CVE-2006-2607.patch 769 B

123456789101112131415161718192021222324252627282930
  1. diff -uPr do_command.c do_command.c
  2. --- do_command.c 2006-05-25 16:44:26.000000000 +0400
  3. +++ do_command.c 2006-05-25 16:42:25.000000000 +0400
  4. @@ -240,12 +240,23 @@
  5. }
  6. }
  7. #else
  8. - setgid(e->pwd->pw_gid);
  9. +
  10. initgroups(usernm, e->pwd->pw_gid);
  11. #if (defined(BSD)) && (BSD >= 199103)
  12. setlogin(usernm);
  13. #endif /* BSD */
  14. - setuid(e->pwd->pw_uid); /* we aren't root after this... */
  15. + // setuid(e->pwd->pw_uid); /* we aren't root after this... */
  16. +
  17. + if ( setgid(e->pwd->pw_gid) == -1 ) {
  18. + fprintf(stderr,"can't set gid for %s\n", e->pwd->pw_name);
  19. + _exit(1);
  20. + }
  21. +
  22. + if ( setuid(e->pwd->pw_uid) == -1 ) {
  23. + fprintf(stderr,"can't set uid for %s\n", e->pwd->pw_name);
  24. + _exit(1);
  25. + }
  26. +
  27. #endif /* LOGIN_CAP */
  28. chdir(env_get("HOME", e->envp));