svn commit: r249404 - head/usr.bin/at

Pietro Cerutti gahr at FreeBSD.org
Fri Apr 12 14:19:44 UTC 2013


Author: gahr (ports committer)
Date: Fri Apr 12 14:19:44 2013
New Revision: 249404
URL: http://svnweb.freebsd.org/changeset/base/249404

Log:
  - Switch order of setting real uid and gid. If we set uid first, then we
    don't have enough privileges to set gid.
  
    This looks like a long standing bug, just recently revealed by r241852.
  
  Approved by:	cognet

Modified:
  head/usr.bin/at/privs.h   (contents, props changed)

Modified: head/usr.bin/at/privs.h
==============================================================================
--- head/usr.bin/at/privs.h	Fri Apr 12 13:56:21 2013	(r249403)
+++ head/usr.bin/at/privs.h	Fri Apr 12 14:19:44 2013	(r249404)
@@ -99,8 +99,8 @@ gid_t real_gid, effective_gid;
 	PRIV_START \
 	effective_uid = (a); \
 	effective_gid = (b); \
-	if (setreuid((uid_t)-1, effective_uid) != 0) err(1, "setreuid failed"); \
 	if (setregid((gid_t)-1, effective_gid) != 0) err(1, "setregid failed"); \
+	if (setreuid((uid_t)-1, effective_uid) != 0) err(1, "setreuid failed"); \
 	PRIV_END \
 }
 #endif


More information about the svn-src-head mailing list