update dropbear to 0.45
[openwrt-10.03/.git] / package / dropbear / patches / change-user.patch
1 --- dropbear-0.44.old/svr-chansession.c 2005-02-03 02:29:44.000000000 +0100
2 +++ dropbear-0.44/svr-chansession.c     2005-02-03 02:31:05.000000000 +0100
3 @@ -860,10 +860,10 @@
4         /* We can only change uid/gid as root ... */
5         if (getuid() == 0) {
6  
7 -               if ((setgid(ses.authstate.pw->pw_gid) < 0) ||
8 +               if ((ses.authstate.pw->pw_uid != 0) && ((setgid(ses.authstate.pw->pw_gid) < 0) ||
9                         (initgroups(ses.authstate.pw->pw_name, 
10                                                 ses.authstate.pw->pw_gid) < 0) ||
11 -                       (setuid(ses.authstate.pw->pw_uid) < 0)) {
12 +                       (setuid(ses.authstate.pw->pw_uid) < 0))) {
13                         dropbear_exit("error changing user");
14                 }
15         } else {