From owner-svn-src-head@FreeBSD.ORG Thu Feb 3 10:44:40 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9D6821065673; Thu, 3 Feb 2011 10:44:40 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8BCF78FC1B; Thu, 3 Feb 2011 10:44:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p13AieNi042804; Thu, 3 Feb 2011 10:44:40 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p13Aieaw042802; Thu, 3 Feb 2011 10:44:40 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201102031044.p13Aieaw042802@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 3 Feb 2011 10:44:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r218215 - head/sbin/hastctl X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Feb 2011 10:44:41 -0000 Author: pjd Date: Thu Feb 3 10:44:40 2011 New Revision: 218215 URL: http://svn.freebsd.org/changeset/base/218215 Log: Drop privileges after connecting to hastd, but before sending or receiving anything. MFC after: 1 week Modified: head/sbin/hastctl/hastctl.c Modified: head/sbin/hastctl/hastctl.c ============================================================================== --- head/sbin/hastctl/hastctl.c Thu Feb 3 10:37:44 2011 (r218214) +++ head/sbin/hastctl/hastctl.c Thu Feb 3 10:44:40 2011 (r218215) @@ -491,6 +491,11 @@ main(int argc, char *argv[]) pjdlog_exit(EX_OSERR, "Unable to connect to hastd via %s", cfg->hc_controladdr); } + + if (drop_privs() != 0) + exit(EX_CONFIG); + pjdlog_debug(1, "Privileges successfully dropped."); + /* Send the command to the server... */ if (hast_proto_send(NULL, controlconn, nv, NULL, 0) < 0) { pjdlog_exit(EX_UNAVAILABLE,