From 5804a068f4f9e0af4e1bdd8d92d3e41266d902a1 Mon Sep 17 00:00:00 2001 From: Tomek Orzechowski Date: Wed, 11 Dec 2002 15:14:50 +0000 Subject: [PATCH] - new version Changed files: cvs-home_etc.patch -> 1.2 --- cvs-home_etc.patch | 42 ++++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/cvs-home_etc.patch b/cvs-home_etc.patch index 8071ff1..5d55f0c 100644 --- a/cvs-home_etc.patch +++ b/cvs-home_etc.patch @@ -1,7 +1,14 @@ -diff -ruN cvs-1.11.2.org/src/login.c cvs-1.11.2/src/login.c ---- cvs-1.11.2.org/src/login.c Sat Jun 1 23:47:43 2002 -+++ cvs-1.11.2/src/login.c Sat Jun 1 23:49:12 2002 -@@ -30,7 +30,7 @@ +--- cvs-1.11.1p1.org/src/login.c Thu Sep 6 18:18:29 2001 ++++ cvs-1.11.1p1/src/login.c Wed Dec 11 15:19:42 2002 +@@ -7,6 +7,7 @@ + * Allow user to log in for an authenticating server. + */ + ++#include + #include "cvs.h" + #include "getline.h" + +@@ -30,7 +31,7 @@ #endif #ifndef CVS_PASSWORD_FILE @@ -10,13 +17,26 @@ diff -ruN cvs-1.11.2.org/src/login.c cvs-1.11.2/src/login.c #endif /* If non-NULL, get_cvs_password() will just return this. */ -@@ -65,8 +65,13 @@ +@@ -44,6 +45,8 @@ + { + char *homedir; + char *passfile; ++ char *path; ++ struct stat st; + + /* Environment should override file. */ + if ((passfile = getenv ("CVS_PASSFILE")) != NULL) +@@ -65,8 +68,17 @@ return (char *) NULL; } -+ if (getenv("CONFIG_DIR")) { -+ passfile = (char *) xmalloc (strlen (homedir) + strlen (getenv("CONFIG_DIR")) + strlen (CVS_PASSWORD_FILE) + 4); -+ sprintf (passfile, "%s/%s/%s", homedir, getenv("CONFIG_DIR"), CVS_PASSWORD_FILE); ++ if ( (path=getenv("CONFIG_DIR")) && path[0] ) { ++ path=(char*) malloc(strlen(homedir)+strlen(getenv("CONFIG_DIR"))+2); ++ sprintf(path, "%s/%s", homedir, getenv("CONFIG_DIR")); ++ } else path=(char *) NULL; ++ if ( path && stat(path,&st)!=-1 && S_ISDIR(st.st_mode) ) { ++ passfile = (char *) xmalloc (strlen (path) + strlen (CVS_PASSWORD_FILE) + 3); ++ sprintf (passfile, "%s/%s", path, CVS_PASSWORD_FILE); + } + else { passfile = @@ -25,13 +45,15 @@ diff -ruN cvs-1.11.2.org/src/login.c cvs-1.11.2/src/login.c strcpy (passfile, homedir); #ifndef NO_SLASH_AFTER_HOME /* NO_SLASH_AFTER_HOME is defined for VMS, where foo:[bar]/.cvspass is not -@@ -75,7 +80,9 @@ +@@ -75,7 +87,11 @@ kind of thing.... */ strcat (passfile, "/"); #endif + strcat (passfile, "."); strcat (passfile, CVS_PASSWORD_FILE); -+ } ++ } /* else */ ++ if (path) ++ free(path); /* Safety first and last, Scouts. */ if (isfile (passfile)) -- 2.44.0