/[gnats]/gnats/gnats/gnats-pwconv.c
ViewVC logotype

Diff of /gnats/gnats/gnats-pwconv.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by pdm, Thu Dec 6 22:26:41 2001 UTC revision 1.2 by pdm, Mon Dec 10 21:56:20 2001 UTC
# Line 118  parse_entry (char *line, Line 118  parse_entry (char *line,
118  static int  static int
119  encrypt_ (char *clearpwstring, Crypt_Type crypttype, char **newpwentry)  encrypt_ (char *clearpwstring, Crypt_Type crypttype, char **newpwentry)
120  {  {
121      int result;
122    #ifdef HAVE_LIBCRYPT
123    unsigned long seed = random();    unsigned long seed = random();
124    char salt[12];    char salt[12];
125    char rawsalt[9];    char rawsalt[9];
# Line 125  encrypt_ (char *clearpwstring, Crypt_Typ Line 127  encrypt_ (char *clearpwstring, Crypt_Typ
127      "./0123456789ABCDEFGHIJKLMNOPQRST"      "./0123456789ABCDEFGHIJKLMNOPQRST"
128      "UVWXYZabcdefghijklmnopqrstuvwxyz";      "UVWXYZabcdefghijklmnopqrstuvwxyz";
129    const int SEEDCHARS_LEN = strlen (SEEDCHARS);    const int SEEDCHARS_LEN = strlen (SEEDCHARS);
   int result;  
130    int i;    int i;
131        
132    for (i = 0; i < 8; i++)    for (i = 0; i < 8; i++)
# Line 133  encrypt_ (char *clearpwstring, Crypt_Typ Line 134  encrypt_ (char *clearpwstring, Crypt_Typ
134        rawsalt[i] = SEEDCHARS[(seed/(i+1)) % SEEDCHARS_LEN];        rawsalt[i] = SEEDCHARS[(seed/(i+1)) % SEEDCHARS_LEN];
135      }      }
136    rawsalt[i] = '\0';    rawsalt[i] = '\0';
137    #endif
138      
139    switch (crypttype)    switch (crypttype)
140      {      {
141      case PLAIN:      case PLAIN:
# Line 160  encrypt_ (char *clearpwstring, Crypt_Typ Line 162  encrypt_ (char *clearpwstring, Crypt_Typ
162        exit (1);        exit (1);
163      }      }
164    
165      if (result < 0)
166        {
167          fprintf (stderr, "Memory allocation error\n");
168          exit (1);
169        }
170      
171    /* Are we on a system that supports MD5? */    /* Are we on a system that supports MD5? */
172    return (crypttype == MD5 && strncmp ("$1$", *newpwentry, 3)) ? 1 : 0;    return (crypttype == MD5 && strncmp ("$1$", *newpwentry, 3)) ? 1 : 0;
173  }  }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26