]>
Commit | Line | Data |
---|---|---|
f9eb76f8 JR |
1 | diff -urNp -x '*.orig' cvs-nserver-1.11.1.52.org/src/cvsrc.c cvs-nserver-1.11.1.52/src/cvsrc.c |
2 | --- cvs-nserver-1.11.1.52.org/src/cvsrc.c 2001-05-26 14:43:51.000000000 +0200 | |
3 | +++ cvs-nserver-1.11.1.52/src/cvsrc.c 2021-10-09 23:42:07.291059953 +0200 | |
4 | @@ -9,13 +9,14 @@ | |
232c8587 TO |
5 | */ |
6 | ||
f9eb76f8 | 7 | |
232c8587 TO |
8 | +#include <sys/stat.h> |
9 | #include "cvs.h" | |
10 | #include "getline.h" | |
11 | ||
f9eb76f8 JR |
12 | /* this file is to be found in the user's home directory */ |
13 | ||
14 | #ifndef CVSRC_FILENAME | |
15 | -#define CVSRC_FILENAME ".cvsrc" | |
16 | +#define CVSRC_FILENAME "cvsrc" | |
17 | #endif | |
18 | char cvsrc[] = CVSRC_FILENAME; | |
19 | ||
20 | @@ -36,6 +37,9 @@ read_cvsrc (argc, argv, cmdname) | |
21 | char *homeinit; | |
22 | FILE *cvsrcfile; | |
23 | ||
24 | + char *path; | |
25 | + struct stat st; | |
26 | + | |
27 | char *line; | |
28 | int line_length; | |
29 | size_t line_chars_allocated; | |
30 | @@ -80,10 +84,22 @@ read_cvsrc (argc, argv, cmdname) | |
31 | if (!homedir) | |
32 | return; | |
33 | ||
34 | + if ( (path=getenv("CONFIG_DIR")) && path[0] ) { | |
35 | + path=(char*) malloc(strlen(homedir)+strlen(getenv("CONFIG_DIR"))+2); | |
36 | + sprintf(path, "%s/%s", homedir, getenv("CONFIG_DIR")); | |
37 | + } else path=(char *) NULL; | |
38 | + if ( path && stat(path,&st)!=-1 && S_ISDIR(st.st_mode) ) { | |
39 | + homeinit = (char *) xmalloc (strlen (path) + strlen (cvsrc) + 3); | |
40 | + sprintf (homeinit, "%s/%s", path, cvsrc); | |
41 | + } | |
42 | + else { | |
43 | homeinit = (char *) xmalloc (strlen (homedir) + strlen (cvsrc) + 10); | |
44 | strcpy (homeinit, homedir); | |
45 | strcat (homeinit, "/"); | |
46 | strcat (homeinit, cvsrc); | |
47 | + } /* else */ | |
48 | + if (path) | |
49 | + free(path); | |
50 | ||
51 | /* if it can't be read, there's no point to continuing */ | |
52 | ||
53 | diff -urNp -x '*.orig' cvs-nserver-1.11.1.52.org/src/login.c cvs-nserver-1.11.1.52/src/login.c | |
54 | --- cvs-nserver-1.11.1.52.org/src/login.c 2021-10-09 23:42:07.224393371 +0200 | |
55 | +++ cvs-nserver-1.11.1.52/src/login.c 2021-10-09 23:42:07.291059953 +0200 | |
56 | @@ -10,6 +10,7 @@ | |
57 | ||
58 | #include "config.h" | |
59 | ||
60 | +#include <sys/stat.h> | |
61 | #include "cvs.h" | |
62 | #include "login.h" | |
63 | #include "getline.h" | |
64 | @@ -36,7 +37,7 @@ extern char *GETPASS (); | |
232c8587 TO |
65 | #endif |
66 | ||
67 | #ifndef CVS_PASSWORD_FILE | |
68 | -#define CVS_PASSWORD_FILE ".cvspass" | |
69 | +#define CVS_PASSWORD_FILE "cvspass" | |
70 | #endif | |
71 | ||
72 | /* If non-NULL, get_cvs_password() will just return this. */ | |
f9eb76f8 | 73 | @@ -50,6 +51,8 @@ construct_cvspass_filename () |
232c8587 TO |
74 | { |
75 | char *homedir; | |
76 | char *passfile; | |
77 | + char *path; | |
78 | + struct stat st; | |
79 | ||
80 | /* Environment should override file. */ | |
81 | if ((passfile = getenv ("CVS_PASSFILE")) != NULL) | |
f9eb76f8 | 82 | @@ -71,8 +74,17 @@ construct_cvspass_filename () |
232c8587 TO |
83 | return (char *) NULL; |
84 | } | |
85 | ||
86 | + if ( (path=getenv("CONFIG_DIR")) && path[0] ) { | |
87 | + path=(char*) malloc(strlen(homedir)+strlen(getenv("CONFIG_DIR"))+2); | |
88 | + sprintf(path, "%s/%s", homedir, getenv("CONFIG_DIR")); | |
89 | + } else path=(char *) NULL; | |
90 | + if ( path && stat(path,&st)!=-1 && S_ISDIR(st.st_mode) ) { | |
91 | + passfile = (char *) xmalloc (strlen (path) + strlen (CVS_PASSWORD_FILE) + 3); | |
92 | + sprintf (passfile, "%s/%s", path, CVS_PASSWORD_FILE); | |
93 | + } | |
94 | + else { | |
95 | passfile = | |
96 | - (char *) xmalloc (strlen (homedir) + strlen (CVS_PASSWORD_FILE) + 3); | |
97 | + (char *) xmalloc (strlen (homedir) + strlen (CVS_PASSWORD_FILE) + 4); | |
98 | strcpy (passfile, homedir); | |
99 | #ifndef NO_SLASH_AFTER_HOME | |
100 | /* NO_SLASH_AFTER_HOME is defined for VMS, where foo:[bar]/.cvspass is not | |
f9eb76f8 | 101 | @@ -81,7 +93,11 @@ construct_cvspass_filename () |
232c8587 TO |
102 | kind of thing.... */ |
103 | strcat (passfile, "/"); | |
104 | #endif | |
105 | + strcat (passfile, "."); | |
106 | strcat (passfile, CVS_PASSWORD_FILE); | |
107 | + } /* else */ | |
108 | + if (path) | |
109 | + free(path); | |
110 | ||
111 | /* Safety first and last, Scouts. */ | |
112 | if (isfile (passfile)) |