From owner-svn-src-all@FreeBSD.ORG Thu Jan 9 09:19:59 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B8FD2EA3; Thu, 9 Jan 2014 09:19:59 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A5A1C1E9F; Thu, 9 Jan 2014 09:19:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s099JxLc049050; Thu, 9 Jan 2014 09:19:59 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s099JxdI049049; Thu, 9 Jan 2014 09:19:59 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201401090919.s099JxdI049049@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 9 Jan 2014 09:19:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260471 - head/sbin/casperd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Jan 2014 09:19:59 -0000 Author: pjd Date: Thu Jan 9 09:19:59 2014 New Revision: 260471 URL: http://svnweb.freebsd.org/changeset/base/260471 Log: Always create /var/run/casper with correct permissions and don't depend on the calling process' umask. Submitted by: Mikhail Modified: head/sbin/casperd/casperd.c Modified: head/sbin/casperd/casperd.c ============================================================================== --- head/sbin/casperd/casperd.c Thu Jan 9 09:16:35 2014 (r260470) +++ head/sbin/casperd/casperd.c Thu Jan 9 09:19:59 2014 (r260471) @@ -541,6 +541,7 @@ main_loop(const char *sockpath, struct p struct casper_service *casserv; struct service_connection *sconn, *sconntmp; int lsock, sock, maxfd, ret; + mode_t oldumask; lsock = socket(AF_UNIX, SOCK_STREAM, 0); if (lsock == -1) @@ -554,8 +555,10 @@ main_loop(const char *sockpath, struct p sizeof(sun.sun_path)); sun.sun_len = SUN_LEN(&sun); + oldumask = umask(S_IXUSR | S_IXGRP | S_IXOTH); if (bind(lsock, (struct sockaddr *)&sun, sizeof(sun)) == -1) pjdlog_exit(1, "Unable to bind to %s", sockpath); + (void)umask(oldumask); if (listen(lsock, 8) == -1) pjdlog_exit(1, "Unable to listen on %s", sockpath);