---- 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.
- */
+--- cvs-1.11.4/src/filesubr.c.orig Tue Sep 24 22:47:09 2002
++++ cvs-1.11.4/src/filesubr.c Fri Jan 17 20:59:20 2003
+@@ -18,6 +18,7 @@
+ file system semantics. */
+ #include <assert.h>
+#include <sys/stat.h>
#include "cvs.h"
- #include "getline.h"
-@@ -30,7 +31,7 @@
- #endif
-
- #ifndef CVS_PASSWORD_FILE
--#define CVS_PASSWORD_FILE ".cvspass"
-+#define CVS_PASSWORD_FILE "cvspass"
- #endif
-
- /* If non-NULL, get_cvs_password() will just return this. */
-@@ -44,6 +45,8 @@
+ static int deep_remove_dir PROTO((const char *path));
+@@ -969,8 +970,24 @@
+ const char *dir;
+ const char *file;
{
- char *homedir;
- char *passfile;
-+ char *path;
+- char *path = xmalloc (strlen (dir) + 1 + strlen(file) + 1);
+- sprintf (path, "%s/%s", dir, file);
++ char *path,*cfgdir;
+ struct stat st;
-
- /* Environment should override file. */
- if ((passfile = getenv ("CVS_PASSFILE")) != NULL)
-@@ -65,8 +68,17 @@
- return (char *) NULL;
- }
-
-+ 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);
++ int isdot = (*file == '.');
++
++ if ( (path = getenv("CONFIG_DIR")) && path[0] ) {
++ cfgdir = xmalloc(strlen(dir) + 1 + strlen(path) + 1);
++ sprintf(cfgdir, "%s/%s", dir, path);
++ } else
++ cfgdir = NULL;
++ if ( cfgdir && (stat(cfgdir, &st) != -1) && S_ISDIR(st.st_mode) ) {
++ path = xmalloc(strlen(cfgdir) + 1 + strlen(file)-isdot + 1);
++ sprintf (path, "%s/%s", cfgdir, file+isdot);
++ } else {
++ path = xmalloc (strlen (dir) + 1 + strlen(file) + 1);
++ sprintf (path, "%s/%s", dir, file);
+ }
-+ else {
- passfile =
-- (char *) xmalloc (strlen (homedir) + strlen (CVS_PASSWORD_FILE) + 3);
-+ (char *) xmalloc (strlen (homedir) + strlen (CVS_PASSWORD_FILE) + 4);
- strcpy (passfile, homedir);
- #ifndef NO_SLASH_AFTER_HOME
- /* NO_SLASH_AFTER_HOME is defined for VMS, where foo:[bar]/.cvspass is not
-@@ -75,7 +87,11 @@
- kind of thing.... */
- strcat (passfile, "/");
- #endif
-+ strcat (passfile, ".");
- strcat (passfile, CVS_PASSWORD_FILE);
-+ } /* else */
-+ if (path)
-+ free(path);
++ if (cfgdir)
++ free(cfgdir);
+ return path;
+ }
- /* Safety first and last, Scouts. */
- if (isfile (passfile))