summaryrefslogtreecommitdiff
path: root/networking/inetd.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-03-20 15:12:58 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-03-20 15:12:58 +0000
commit9230582315a15dd7b95de9f03c48024858ec935d (patch)
tree5495a94e29baa12c71e33fa8d049131fe572f881 /networking/inetd.c
parentc52248e41ce50bd3fa684d19b2bce4320267dc44 (diff)
downloadbusybox-w32-9230582315a15dd7b95de9f03c48024858ec935d.tar.gz
busybox-w32-9230582315a15dd7b95de9f03c48024858ec935d.tar.bz2
busybox-w32-9230582315a15dd7b95de9f03c48024858ec935d.zip
inetd: use change_identity().
libbb: shrink our internal initgroups(). httpd: remove stray 'else' and 'index_page = "index.html"' function old new delta httpd_main 750 743 -7 inetd_main 2033 2011 -22 bb_internal_initgroups 251 228 -23 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-52) Total: -52 bytes
Diffstat (limited to 'networking/inetd.c')
-rw-r--r--networking/inetd.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/networking/inetd.c b/networking/inetd.c
index b931aa1e0..5cdfe0a22 100644
--- a/networking/inetd.c
+++ b/networking/inetd.c
@@ -142,15 +142,15 @@
142/* Here's the scoop concerning the user[:group] feature: 142/* Here's the scoop concerning the user[:group] feature:
143 * 1) group is not specified: 143 * 1) group is not specified:
144 * a) user = root: NO setuid() or setgid() is done 144 * a) user = root: NO setuid() or setgid() is done
145 * b) other: setgid(primary group as found in passwd) 145 * b) other: initgroups(name, primary group)
146 * initgroups(name, primary group) 146 * setgid(primary group as found in passwd)
147 * setuid() 147 * setuid()
148 * 2) group is specified: 148 * 2) group is specified:
149 * a) user = root: setgid(specified group) 149 * a) user = root: setgid(specified group)
150 * NO initgroups() 150 * NO initgroups()
151 * NO setuid() 151 * NO setuid()
152 * b) other: setgid(specified group) 152 * b) other: initgroups(name, specified group)
153 * initgroups(name, specified group) 153 * setgid(specified group)
154 * setuid() 154 * setuid()
155 */ 155 */
156 156
@@ -1383,9 +1383,8 @@ int inetd_main(int argc ATTRIBUTE_UNUSED, char **argv)
1383 if (pwd->pw_uid) { 1383 if (pwd->pw_uid) {
1384 if (sep->se_group) 1384 if (sep->se_group)
1385 pwd->pw_gid = grp->gr_gid; 1385 pwd->pw_gid = grp->gr_gid;
1386 xsetgid(pwd->pw_gid); 1386 /* initgroups, setgid, setuid: */
1387 initgroups(pwd->pw_name, pwd->pw_gid); 1387 change_identity(pwd);
1388 xsetuid(pwd->pw_uid);
1389 } else if (sep->se_group) { 1388 } else if (sep->se_group) {
1390 xsetgid(grp->gr_gid); 1389 xsetgid(grp->gr_gid);
1391 setgroups(1, &grp->gr_gid); 1390 setgroups(1, &grp->gr_gid);