packages/net: add lldpd link-layer discovery protocol daemon
[openwrt/svn-archive/archive.git] / net / lldpd / patches / 001-no-multiuser.patch
1 diff -urb lldpd-0.3.orig/src/priv.c lldpd-0.3/src/priv.c
2 --- lldpd-0.3.orig/src/priv.c 2008-12-30 07:35:28.000000000 +0100
3 +++ lldpd-0.3/src/priv.c 2008-12-30 07:40:55.000000000 +0100
4 @@ -522,12 +522,14 @@
5 fatal("[priv]: unable to create socket pair for privilege separation");
6
7 /* Get users */
8 + /*
9 if ((user = getpwnam(PRIVSEP_USER)) == NULL)
10 fatal("[priv]: no " PRIVSEP_USER " user for privilege separation");
11 uid = user->pw_uid;
12 if ((group = getgrnam(PRIVSEP_GROUP)) == NULL)
13 fatal("[priv]: no " PRIVSEP_GROUP " group for privilege separation");
14 gid = group->gr_gid;
15 + */
16
17 /* Spawn off monitor */
18 if ((monitored = fork()) < 0)
19 @@ -535,17 +537,17 @@
20 switch (monitored) {
21 case 0:
22 /* We are in the children, drop privileges */
23 - if (chroot(chrootdir) == -1)
24 - fatal("[priv]: unable to chroot");
25 - if (chdir("/") != 0)
26 + /*if (chroot(chrootdir) == -1)
27 + fatal("[priv]: unable to chroot");*/
28 + if (chdir("/tmp") != 0)
29 fatal("[priv]: unable to chdir");
30 gidset[0] = gid;
31 - if (setresgid(gid, gid, gid) == -1)
32 + /*if (setresgid(gid, gid, gid) == -1)
33 fatal("[priv]: setresgid() failed");
34 if (setgroups(1, gidset) == -1)
35 fatal("[priv]: setgroups() failed");
36 if (setresuid(uid, uid, uid) == -1)
37 - fatal("[priv]: setresuid() failed");
38 + fatal("[priv]: setresuid() failed");*/
39 remote = pair[0];
40 close(pair[1]);
41 priv_ping();