]> git.pld-linux.org Git - packages/cvs-nserver.git/blob - cvs-nserver-home_etc.patch
- unified rc-inetd usage (via %service), adapterized
[packages/cvs-nserver.git] / cvs-nserver-home_etc.patch
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 @@
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. */
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 @@
30         return (char *) NULL;
31      }
32  
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);
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
48 @@ -75,7 +87,11 @@
49         kind of thing....  */
50      strcat (passfile, "/");
51  #endif
52 +    strcat (passfile, ".");
53      strcat (passfile, CVS_PASSWORD_FILE);
54 +    } /* else */
55 +    if (path)
56 +           free(path);
57  
58      /* Safety first and last, Scouts. */
59      if (isfile (passfile))
60 --- cvs-1.11.1p1.org/src/cvsrc.c        Sun Dec 22 14:18:41 2002
61 +++ cvs-1.11.1p1/src/cvsrc.c    Sun Dec 22 14:30:43 2002
62 @@ -9,13 +9,14 @@
63   */
64  
65  
66 +#include <sys/stat.h>
67  #include "cvs.h"
68  #include "getline.h"
69  
70  /* this file is to be found in the user's home directory */
71  
72  #ifndef        CVSRC_FILENAME
73 -#define        CVSRC_FILENAME  ".cvsrc"
74 +#define        CVSRC_FILENAME  "cvsrc"
75  #endif
76  char cvsrc[] = CVSRC_FILENAME;
77  
78 @@ -36,6 +37,9 @@
79      char *homeinit;
80      FILE *cvsrcfile;
81  
82 +    char *path;
83 +    struct stat st;
84 +    
85      char *line;
86      int line_length;
87      size_t line_chars_allocated;
88 @@ -73,10 +77,22 @@
89      if (!homedir)
90         return;
91  
92 +    if ( (path=getenv("CONFIG_DIR")) && path[0] ) {
93 +       path=(char*) malloc(strlen(homedir)+strlen(getenv("CONFIG_DIR"))+2);
94 +       sprintf(path, "%s/%s", homedir, getenv("CONFIG_DIR"));
95 +    } else path=(char *) NULL;
96 +    if ( path && stat(path,&st)!=-1 && S_ISDIR(st.st_mode) ) {
97 +       homeinit = (char *) xmalloc (strlen (path) + strlen (cvsrc) + 3);
98 +       sprintf (homeinit, "%s/%s", path, cvsrc);
99 +    }
100 +    else {
101      homeinit = (char *) xmalloc (strlen (homedir) + strlen (cvsrc) + 10);
102      strcpy (homeinit, homedir);
103      strcat (homeinit, "/");
104      strcat (homeinit, cvsrc);
105 +    } /* else */
106 +    if (path)
107 +       free(path);
108  
109      /* if it can't be read, there's no point to continuing */
110  
This page took 0.078918 seconds and 3 git commands to generate.