]> git.pld-linux.org Git - packages/cvs.git/blame - cvs-debian-homedir.patch
- outdated
[packages/cvs.git] / cvs-debian-homedir.patch
CommitLineData
76652ff6
AM
1--- cvs-1.12.13.orig/debian/patches/93_homedir
2+++ cvs-1.12.13/debian/patches/93_homedir
3@@ -0,0 +1,44 @@
4+# Fix handling of homedirectory for pserver, patch from
5+# Jim Studt <jim@federated.com>. Closes: Bug#51234
6+diff -ruN cvs-1.12.13-old/src/filesubr.c cvs-1.12.13/src/filesubr.c
7+--- cvs-1.12.13-old/src/filesubr.c 2005-09-28 23:25:59.000000000 +0800
8++++ cvs-1.12.13/src/filesubr.c 2006-02-26 22:31:57.000000000 +0800
9+@@ -795,6 +795,11 @@
10+ The workaround is to put -f in inetd.conf which means that
11+ get_homedir won't get called until after the switch in user ID.
12+
13++ NOTE: the above paragraph is not sufficient if the HOME environment
14++ variable is set, it overrides the uid based password lookup, hence
15++ the change_uid logic path that blocks the HOME environment variable
16++ when the uid gets changed.
17++
18+ The whole concept of a "home directory" on the server is pretty
19+ iffy, although I suppose some people probably are relying on it for
20+ .cvsrc and such, in the cases where it works. */
21+@@ -802,15 +807,24 @@
22+ get_homedir (void)
23+ {
24+ static char *home = NULL;
25++ static uid_t home_uid = 0;
26++ static int changed_uid = 0;
27+ char *env;
28++ uid_t uid = getuid();
29+ struct passwd *pw;
30+
31++ if ( home && home_uid != uid) {
32++ home = 0;
33++ home_uid = uid;
34++ changed_uid = 1;
35++ }
36++
37+ if (home != NULL)
38+ return home;
39+
40+- if (!server_active && (env = getenv ("HOME")) != NULL)
41++ if (!server_active && ((env = getenv ("HOME")) != NULL) && !changed_uid)
42+ home = env;
43+- else if ((pw = (struct passwd *) getpwuid (getuid ()))
44++ else if ((pw = (struct passwd *) getpwuid (uid))
45+ && pw->pw_dir)
46+ home = xstrdup (pw->pw_dir);
47+ else
This page took 0.117231 seconds and 4 git commands to generate.