version 1.61 | | version 1.62 |
---|
| | |
/* | | /* |
* static char *rcsid_main_c = | | * static char *rcsid_main_c = |
* "$Id: main.c,v 1.61 2002/06/15 07:47:36 mwedel Exp $"; | | * "$Id: main.c,v 1.62 2002/06/19 04:33:25 mwedel Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
} | | } |
} | | } |
| | |
char *crypt_string(char *str, char *salt) { | | /* Really, there is no reason to crypt the passwords any system. But easier |
/* Really, there is no reason to use this on any system. But easier to | | * to just leave this enabled for backward compatibility. Put the |
* just leave this enabled for backward compatibility. | | * simple case at top - no encryption - makes it easier to read. |
*/ | | */ |
#if !defined(WIN32) && !defined(__FreeBSD__) | | char *crypt_string(char *str, char *salt) { |
| | #if defined(WIN32) || (defined(__FreeBSD__) && !defined(HAVE_LIBDES)) |
| | return(str); |
| | #else |
static char *c= | | static char *c= |
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./"; | | "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./"; |
char s[2]; | | char s[2]; |
| | |
if(salt==NULL) | | if(salt==NULL) |
s[0]= c[RANDOM() % (int)strlen(c)], | | s[0]= c[RANDOM() % (int)strlen(c)], |
s[1]= c[RANDOM() % (int)strlen(c)]; | | s[1]= c[RANDOM() % (int)strlen(c)]; |
else | | else |
s[0]= salt[0], | | s[0]= salt[0], |
s[1]= salt[1]; | | s[1]= salt[1]; |
| | |
#ifdef HAVE_LIBDES | | #ifdef HAVE_LIBDES |
return (char*)des_crypt(str,s); | | return (char*)des_crypt(str,s); |
#else | | |
return (char*)crypt(str,s); | | |
#endif | | #endif |
#endif /* win32 */ | | #endif |
return(str); | | /* Default case - just use crypt */ |
| | return (char*)crypt(str,s); |
} | | } |
| | |
int check_password(char *typed,char *crypted) { | | int check_password(char *typed,char *crypted) { |