110-change_user.patch 817 B

1234567891011121314151617181920
  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) {
  8. - if ((setgid(ses.authstate.pw_gid) < 0) ||
  9. + if ((ses.authstate.pw_gid != 0) && ((setgid(ses.authstate.pw_gid) < 0) ||
  10. (initgroups(ses.authstate.pw_name,
  11. - ses.authstate.pw_gid) < 0)) {
  12. + ses.authstate.pw_gid) < 0))) {
  13. dropbear_exit("error changing user group");
  14. }
  15. - if (setuid(ses.authstate.pw_uid) < 0) {
  16. + if ((ses.authstate.pw_uid != 0) && (setuid(ses.authstate.pw_uid) < 0)) {
  17. dropbear_exit("error changing user");
  18. }
  19. } else {