]>
Commit | Line | Data |
---|---|---|
e827e87c TO |
1 | --- cvs-1.11.1p1.org/src/login.c Thu Sep 6 18:18:29 2001 |
2 | +++ cvs-1.11.1p1/src/login.c Wed Dec 11 15:19:42 2002 | |
3 | @@ -7,6 +7,7 @@ | |
4 | * Allow user to log in for an authenticating server. | |
5 | */ | |
6 | ||
7 | +#include <sys/stat.h> | |
8 | #include "cvs.h" | |
9 | #include "getline.h" | |
10 | ||
11 | @@ -30,7 +31,7 @@ | |
ecade4f5 TO |
12 | #endif |
13 | ||
14 | #ifndef CVS_PASSWORD_FILE | |
15 | -#define CVS_PASSWORD_FILE ".cvspass" | |
16 | +#define CVS_PASSWORD_FILE "cvspass" | |
17 | #endif | |
18 | ||
19 | /* If non-NULL, get_cvs_password() will just return this. */ | |
e827e87c TO |
20 | @@ -44,6 +45,8 @@ |
21 | { | |
22 | char *homedir; | |
23 | char *passfile; | |
24 | + char *path; | |
25 | + struct stat st; | |
26 | ||
27 | /* Environment should override file. */ | |
28 | if ((passfile = getenv ("CVS_PASSFILE")) != NULL) | |
29 | @@ -65,8 +68,17 @@ | |
ecade4f5 TO |
30 | return (char *) NULL; |
31 | } | |
32 | ||
e827e87c TO |
33 | + if ( (path=getenv("CONFIG_DIR")) && path[0] ) { |
34 | + path=(char*) malloc(strlen(homedir)+strlen(getenv("CONFIG_DIR"))+2); | |
35 | + sprintf(path, "%s/%s", homedir, getenv("CONFIG_DIR")); | |
36 | + } else path=(char *) NULL; | |
37 | + if ( path && stat(path,&st)!=-1 && S_ISDIR(st.st_mode) ) { | |
38 | + passfile = (char *) xmalloc (strlen (path) + strlen (CVS_PASSWORD_FILE) + 3); | |
39 | + sprintf (passfile, "%s/%s", path, CVS_PASSWORD_FILE); | |
ecade4f5 TO |
40 | + } |
41 | + else { | |
42 | passfile = | |
43 | - (char *) xmalloc (strlen (homedir) + strlen (CVS_PASSWORD_FILE) + 3); | |
44 | + (char *) xmalloc (strlen (homedir) + strlen (CVS_PASSWORD_FILE) + 4); | |
45 | strcpy (passfile, homedir); | |
46 | #ifndef NO_SLASH_AFTER_HOME | |
47 | /* NO_SLASH_AFTER_HOME is defined for VMS, where foo:[bar]/.cvspass is not | |
e827e87c | 48 | @@ -75,7 +87,11 @@ |
ecade4f5 TO |
49 | kind of thing.... */ |
50 | strcat (passfile, "/"); | |
51 | #endif | |
52 | + strcat (passfile, "."); | |
53 | strcat (passfile, CVS_PASSWORD_FILE); | |
e827e87c TO |
54 | + } /* else */ |
55 | + if (path) | |
56 | + free(path); | |
ecade4f5 TO |
57 | |
58 | /* Safety first and last, Scouts. */ | |
59 | if (isfile (passfile)) |