annotate dgl/rlgwebd-compat.patch @ 100:44e8aaa20d02 default tip

Fix the format of archive links.
author John "Elwin" Edwards
date Wed, 03 Aug 2022 20:49:38 -0400
parents 1bddd1839831
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
24
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
1 diff --git a/dgamelaunch.c b/dgamelaunch.c
87
1bddd1839831 Update the dgamelaunch patch to work with the most recent changes.
John "Elwin" Edwards
parents: 69
diff changeset
2 index fc831a9..cb03355 100644
24
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
3 --- a/dgamelaunch.c
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
4 +++ b/dgamelaunch.c
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
5 @@ -1489,7 +1489,10 @@ int
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
6 changepw (int dowrite)
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
7 {
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
8 char buf[DGL_PASSWDLEN+1];
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
9 + char salt[21];
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
10 int error = 2;
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
11 + int i;
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
12 + FILE *urandom;
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
13
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
14 /* A precondition is that struct `me' exists because we can be not-yet-logged-in. */
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
15 if (!me) {
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
16 @@ -1553,8 +1556,28 @@ changepw (int dowrite)
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
17 error = 1;
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
18 }
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
19
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
20 + salt[0] = salt[2] = salt[19] = '$';
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
21 + salt[1] = '6';
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
22 + salt[20] = '\0';
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
23 + urandom = fopen("/dev/urandom", "r");
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
24 + for (i = 3; i < 19; i++) {
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
25 + /* This does waste four random bytes. */
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
26 + fread(salt + i, 1, 1, urandom);
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
27 + salt[i] &= 0x3f;
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
28 + if (salt[i] < 26)
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
29 + salt[i] += 'a';
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
30 + else if (salt[i] < 52)
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
31 + salt[i] = 'A' + salt[i] - 26;
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
32 + else if (salt[i] < 62)
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
33 + salt[i] = '0' + salt[i] - 52;
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
34 + else if (salt[i] == 62)
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
35 + salt[i] = '.';
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
36 + else
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
37 + salt[i] = '/';
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
38 + }
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
39 + fclose(urandom);
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
40 free(me->password);
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
41 - me->password = strdup (crypt (buf, buf));
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
42 + me->password = strdup (crypt (buf, salt));
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
43