100-pubkey_path.patch 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. --- dropbear.old/svr-authpubkey.c.orig 2006-06-03 14:54:43.000000000 +0000
  2. +++ dropbear.dev/svr-authpubkey.c 2006-06-03 15:03:19.000000000 +0000
  3. @@ -176,6 +176,8 @@
  4. goto out;
  5. }
  6. + if (ses.authstate.pw->pw_uid != 0) {
  7. +
  8. /* we don't need to check pw and pw_dir for validity, since
  9. * its been done in checkpubkeyperms. */
  10. len = strlen(ses.authstate.pw->pw_dir);
  11. @@ -187,6 +189,9 @@
  12. /* open the file */
  13. authfile = fopen(filename, "r");
  14. + } else {
  15. + authfile = fopen("/etc/dropbear/authorized_keys","r");
  16. + }
  17. if (authfile == NULL) {
  18. goto out;
  19. }
  20. @@ -274,6 +279,8 @@
  21. goto out;
  22. }
  23. + if (ses.authstate.pw->pw_uid != 0) {
  24. +
  25. /* allocate max required pathname storage,
  26. * = path + "/.ssh/authorized_keys" + '\0' = pathlen + 22 */
  27. filename = m_malloc(len + 22);
  28. @@ -295,6 +302,14 @@
  29. if (checkfileperm(filename) != DROPBEAR_SUCCESS) {
  30. goto out;
  31. }
  32. + } else {
  33. + if (checkfileperm("/etc/dropbear") != DROPBEAR_SUCCESS) {
  34. + goto out;
  35. + }
  36. + if (checkfileperm("/etc/dropbear/authorized_keys") != DROPBEAR_SUCCESS) {
  37. + goto out;
  38. + }
  39. + }
  40. /* file looks ok, return success */
  41. ret = DROPBEAR_SUCCESS;