From 7f381af05dd9d07af08d39d27a6c200266d38297 Mon Sep 17 00:00:00 2001 From: Nalin Dahyabhai Date: Thu, 26 Jul 2007 19:07:22 +0000 Subject: [PATCH] - test patch for login chdir when $HOME is on root-squashed nfs --- krb5-1.6.2-login_chdir.patch | 38 ++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 krb5-1.6.2-login_chdir.patch diff --git a/krb5-1.6.2-login_chdir.patch b/krb5-1.6.2-login_chdir.patch new file mode 100644 index 0000000..93f7adc --- /dev/null +++ b/krb5-1.6.2-login_chdir.patch @@ -0,0 +1,38 @@ +Change to the user's directory after dropping privileges, in case it is only +accessible to the user (for example, if it's in NFS with root squashing). +Incomplete - we probably need to do the same for rshd and ftpd. + +diff -up krb5/src/appl/bsd/login.c krb5/src/appl/bsd/login.c +--- krb5/src/appl/bsd/login.c 2007-07-11 13:50:34.000000000 -0400 ++++ krb5/src/appl/bsd/login.c 2007-07-11 13:50:36.000000000 -0400 +@@ -1497,13 +1497,8 @@ int main(argc, argv) + } + #endif /* USE_PAM */ + +- if (chdir(pwd->pw_dir) < 0) { +- printf("No directory %s!\n", pwd->pw_dir); +- if (chdir("/")) +- exit(0); +- pwd->pw_dir = "/"; +- printf("Logging in with home = \"/\".\n"); +- } ++ if (chdir("/")) ++ exit(0); + + /* nothing else left to fail -- really log in */ + { +@@ -1710,6 +1705,14 @@ int main(argc, argv) + sleepexit(1); + } + ++ if (chdir(pwd->pw_dir) < 0) { ++ printf("No directory %s!\n", pwd->pw_dir); ++ if (chdir("/")) ++ exit(0); ++ pwd->pw_dir = "/"; ++ printf("Logging in with home = \"/\".\n"); ++ } ++ + /* + * We are the user now. Re-create the destroyed ccache and + * ticket file.