gnats-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Changes to gnats/gnats/gnats-pwconv.c


From: Milan Zamazal
Subject: Changes to gnats/gnats/gnats-pwconv.c
Date: Mon, 10 Dec 2001 16:56:20 -0500

Index: gnats/gnats/gnats-pwconv.c
diff -c gnats/gnats/gnats-pwconv.c:1.1 gnats/gnats/gnats-pwconv.c:1.2
*** gnats/gnats/gnats-pwconv.c:1.1      Thu Dec  6 17:26:41 2001
--- gnats/gnats/gnats-pwconv.c  Mon Dec 10 16:56:20 2001
***************
*** 118,123 ****
--- 118,125 ----
  static int
  encrypt_ (char *clearpwstring, Crypt_Type crypttype, char **newpwentry)
  {
+   int result;
+ #ifdef HAVE_LIBCRYPT
    unsigned long seed = random();
    char salt[12];
    char rawsalt[9];
***************
*** 125,131 ****
      "./0123456789ABCDEFGHIJKLMNOPQRST"
      "UVWXYZabcdefghijklmnopqrstuvwxyz";
    const int SEEDCHARS_LEN = strlen (SEEDCHARS);
-   int result;
    int i;
    
    for (i = 0; i < 8; i++)
--- 127,132 ----
***************
*** 133,139 ****
        rawsalt[i] = SEEDCHARS[(seed/(i+1)) % SEEDCHARS_LEN];
      }
    rawsalt[i] = '\0';
! 
    switch (crypttype)
      {
      case PLAIN:
--- 134,141 ----
        rawsalt[i] = SEEDCHARS[(seed/(i+1)) % SEEDCHARS_LEN];
      }
    rawsalt[i] = '\0';
! #endif
!   
    switch (crypttype)
      {
      case PLAIN:
***************
*** 160,165 ****
--- 162,173 ----
        exit (1);
      }
  
+   if (result < 0)
+     {
+       fprintf (stderr, "Memory allocation error\n");
+       exit (1);
+     }
+   
    /* Are we on a system that supports MD5? */
    return (crypttype == MD5 && strncmp ("$1$", *newpwentry, 3)) ? 1 : 0;
  }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]