[Pkg-voip-commits] r6021 - in /ser/trunk/debian/patches: initgroups series

marcusb-guest at alioth.debian.org marcusb-guest at alioth.debian.org
Thu Aug 7 13:25:12 UTC 2008


Author: marcusb-guest
Date: Thu Aug  7 13:25:12 2008
New Revision: 6021

URL: http://svn.debian.org/wsvn/pkg-voip/?sc=1&rev=6021
Log:
Initialise supplementary groups when setting uid.

Added:
    ser/trunk/debian/patches/initgroups
Modified:
    ser/trunk/debian/patches/series

Added: ser/trunk/debian/patches/initgroups
URL: http://svn.debian.org/wsvn/pkg-voip/ser/trunk/debian/patches/initgroups?rev=6021&op=file
==============================================================================
--- ser/trunk/debian/patches/initgroups (added)
+++ ser/trunk/debian/patches/initgroups Thu Aug  7 13:25:12 2008
@@ -1,0 +1,30 @@
+Initialise supplementary groups also when setting uid. This is needed when the ser user belongs to the rtpproxy group to get access to the rtpproxy control socket. The patch has been accepted upstream for the 2.1 branch.
+
+--- a/daemonize.c
++++ b/daemonize.c
+@@ -55,6 +55,8 @@
+ #include <sys/time.h>    
+ #include <sys/resource.h> /* setrlimit */
+ #include <unistd.h>
++#include <pwd.h>
++#include <grp.h>
+ 
+ #include "daemonize.h"
+ #include "globals.h"
+@@ -219,6 +221,16 @@ int do_suid()
+ 	}
+ 	
+ 	if(uid){
++		struct passwd *pw;
++
++		if (!(pw = getpwuid(uid))){
++			LOG(L_CRIT, "user lookup failed: %s\n", strerror(errno));
++			goto error;
++		}
++		if(initgroups(pw->pw_name, pw->pw_gid)<0){
++			LOG(L_CRIT, "cannot set supplementary groups: %s\n", strerror(errno));
++			goto error;
++		}
+ 		if(setuid(uid)<0){
+ 			LOG(L_CRIT, "cannot change uid to %d: %s\n", uid, strerror(errno));
+ 			goto error;

Modified: ser/trunk/debian/patches/series
URL: http://svn.debian.org/wsvn/pkg-voip/ser/trunk/debian/patches/series?rev=6021&op=diff
==============================================================================
--- ser/trunk/debian/patches/series (original)
+++ ser/trunk/debian/patches/series Thu Aug  7 13:25:12 2008
@@ -1,3 +1,4 @@
 dont-link-extra-system-libs
 stop-build-on-error
 fix-osptk-lib-path
+initgroups




More information about the Pkg-voip-commits mailing list