[MINI2440] Updated defconfig to add (optional) packages
[openwrt/mini2440.git] / package / dropbear / patches / 110-change_user.patch
blob4a0cdc5e7559b489e3bbaf4b11751eec082e3873
1 Index: dropbear-0.51/svr-chansession.c
2 ===================================================================
3 --- dropbear-0.51.orig/svr-chansession.c 2008-04-22 17:29:49.000000000 -0700
4 +++ dropbear-0.51/svr-chansession.c 2008-04-22 17:29:49.000000000 -0700
5 @@ -912,12 +912,12 @@
6 /* We can only change uid/gid as root ... */
7 if (getuid() == 0) {
9 - if ((setgid(ses.authstate.pw_gid) < 0) ||
10 + if ((ses.authstate.pw_gid != 0) && ((setgid(ses.authstate.pw_gid) < 0) ||
11 (initgroups(ses.authstate.pw_name,
12 - ses.authstate.pw_gid) < 0)) {
13 + ses.authstate.pw_gid) < 0))) {
14 dropbear_exit("error changing user group");
16 - if (setuid(ses.authstate.pw_uid) < 0) {
17 + if ((ses.authstate.pw_uid != 0) && (setuid(ses.authstate.pw_uid) < 0)) {
18 dropbear_exit("error changing user");
20 } else {