Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37423960
en ru br
Репозитории ALT
S:1.11.23-alt9
5.1: 1.11.23-alt3.M50P.1
4.1: 1.11.22-alt3
4.0: 1.11.22-alt2
+updates:1.11.22-alt2
3.0: 1.11.20-alt1
www.altlinux.org/Changes

Группа :: Разработка/Прочее
Пакет: cvs

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: cvs-1.11.21-deb-alt-homedir.patch
Скачать


diff -upk.orig cvs-1.11.21.orig/src/filesubr.c cvs-1.11.21/src/filesubr.c
--- cvs-1.11.21.orig/src/filesubr.c	2005-09-30 15:46:58 +0000
+++ cvs-1.11.21/src/filesubr.c	2005-09-30 15:48:02 +0000
@@ -981,6 +981,11 @@ last_component (path)
    The workaround is to put -f in inetd.conf which means that
    get_homedir won't get called until after the switch in user ID.
 
+   NOTE: the above paragraph is not sufficient if the HOME environment
+   variable is set, it overrides the uid based password lookup, hence
+   the change_uid logic path that blocks the HOME environment variable
+   when the uid gets changed.
+
    The whole concept of a "home directory" on the server is pretty
    iffy, although I suppose some people probably are relying on it for
    .cvsrc and such, in the cases where it works.  */
@@ -988,15 +993,24 @@ char *
 get_homedir ()
 {
     static char *home = NULL;
+    static uid_t home_uid = -1;
+    static int changed_uid = 0;
+    uid_t uid = getuid();
     char *env;
     struct passwd *pw;
 
+    if (home && home_uid != -1 && home_uid != uid) {
+	home = 0;
+	changed_uid = 1;
+    }
+    home_uid = uid;
+
     if (home != NULL)
 	return home;
 
-    if (!server_active && (env = getenv ("HOME")) != NULL)
+    if (!server_active && !changed_uid && (env = getenv ("HOME")) != NULL)
 	home = env;
-    else if ((pw = (struct passwd *) getpwuid (getuid ()))
+    else if ((pw = (struct passwd *) getpwuid (uid))
 	     && pw->pw_dir)
 	home = xstrdup (pw->pw_dir);
     else
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin