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
This commit is contained in:
Dag-Erling Smørgrav 2013-03-13 09:41:55 +00:00
parent ca9feb490c
commit 2ec88e9d1b

View File

@ -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);