neozeed ircu2.9.32-linux-hacks.diff
This commit is contained in:
@@ -3,9 +3,14 @@
|
||||
* You can use this code as long as my name stays with it.
|
||||
*/
|
||||
|
||||
#define _XOPEN_SOURCE 500
|
||||
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
extern char *getpass();
|
||||
|
||||
@@ -16,6 +21,7 @@ char *argv[];
|
||||
static char saltChars[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./";
|
||||
char salt[3];
|
||||
char * plaintext;
|
||||
char *key;
|
||||
int i;
|
||||
|
||||
if (argc < 2) {
|
||||
@@ -28,13 +34,20 @@ char *argv[];
|
||||
salt[0] = argv[1][0];
|
||||
salt[1] = argv[1][1];
|
||||
salt[2] = '\0';
|
||||
if ((strchr(saltChars, salt[0]) == NULL) || (strchr(saltChars, salt[1]) == NULL))
|
||||
if ((strchr(saltChars, salt[0]) == NULL) || (strchr(saltChars, salt[1]) == NULL)) {
|
||||
fprintf(stderr, "illegal salt %s\n", salt), exit(1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
plaintext = getpass("plaintext: ");
|
||||
|
||||
printf("%s\n", crypt(plaintext, salt));
|
||||
key = crypt(plaintext, salt);
|
||||
if (key == NULL) {
|
||||
fprintf(stderr, "unable to crypt: %s\n", strerror(errno));
|
||||
return 1;
|
||||
}
|
||||
printf("%s\n", key);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user