aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2023-12-23 15:52:53 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2023-12-23 15:52:53 +0100
commit597588f4b362ca65b96a103350530cfeeb52cf66 (patch)
treeac2f519403ae2e2a237fd5889b6b36f3780669a1
parent44b6779d2520514a97ef363672d67374d8b96e3a (diff)
Fixed salt
-rw-r--r--FICS/comproc.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/FICS/comproc.c b/FICS/comproc.c
index c27b787..f4b8eab 100644
--- a/FICS/comproc.c
+++ b/FICS/comproc.c
@@ -537,7 +537,7 @@ com_password(int p, param_list param)
{
char *oldpassword = param[0].val.word;
char *newpassword = param[1].val.word;
- char salt[3];
+ char salt[6];
if (!parray[p].registered) {
pprintf(p, "Setting a password is only for registered players."
@@ -546,9 +546,12 @@ com_password(int p, param_list param)
}
if (parray[p].passwd) {
- salt[0] = parray[p].passwd[0];
- salt[1] = parray[p].passwd[1];
- salt[2] = '\0';
+ salt[0] = '$';
+ salt[1] = '1';
+ salt[2] = '$';
+ salt[3] = parray[p].passwd[0];
+ salt[4] = parray[p].passwd[1];
+ salt[5] = '\0';
if (strcmp(crypt(oldpassword, salt), parray[p].passwd)) {
pprintf(p, "Incorrect password, password not changed!"
@@ -560,9 +563,12 @@ com_password(int p, param_list param)
parray[p].passwd = NULL;
}
- salt[0] = ('a' + rand() % 26);
- salt[1] = ('a' + rand() % 26);
- salt[2] = '\0';
+ salt[0] = '$';
+ salt[1] = '1';
+ salt[2] = '$';
+ salt[3] = ('a' + rand() % 26);
+ salt[4] = ('a' + rand() % 26);
+ salt[5] = '\0';
parray[p].passwd = xstrdup(crypt(newpassword, salt));
pprintf(p, "Password changed to \"%s\".\n", newpassword);