Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Mar 2013 09:41:55 +0000 (UTC)
From:      Dag-Erling Smørgrav <des@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r248231 - head/crypto/openssh
Message-ID:  <201303130941.r2D9ftfp065313@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: des
Date: Wed Mar 13 09:41:55 2013
New Revision: 248231
URL: http://svnweb.freebsd.org/changeset/base/248231

Log:
  Unlike OpenBSD's, our setusercontext() will intentionally ignore the user's
  own umask setting (from ~/.login.conf) unless running with the user's UID.
  Therefore, we need to call it again with LOGIN_SETUMASK after changing UID.
  
  PR:		bin/176740
  Submitted by:	John Marshall <john.marshall@riverwillow.com.au>
  MFC after:	1 week

Modified:
  head/crypto/openssh/session.c

Modified: head/crypto/openssh/session.c
==============================================================================
--- head/crypto/openssh/session.c	Wed Mar 13 06:42:01 2013	(r248230)
+++ head/crypto/openssh/session.c	Wed Mar 13 09:41:55 2013	(r248231)
@@ -1533,6 +1533,12 @@ do_setusercontext(struct passwd *pw)
 			perror("unable to set user context (setuser)");
 			exit(1);
 		}
+
+		/*
+		 * FreeBSD's setusercontext() will not apply the user's
+		 * own umask setting unless running with the user's UID.
+		 */
+		setusercontext(lc, pw, pw->pw_uid, LOGIN_SETUMASK);
 #else
 		/* Permanently switch to the desired uid. */
 		permanently_set_uid(pw);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201303130941.r2D9ftfp065313>