Mercurial > hg > rlgallery-misc
annotate dgl/rlgwebd-compat.patch @ 88:08c6e8c87caa
Certificate post-hook script: add option to restart lighttpd.
author | John "Elwin" Edwards |
---|---|
date | Fri, 14 Dec 2018 16:24:37 -0500 |
parents | 1bddd1839831 |
children |
rev | line source |
---|---|
24 | 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 | 3 --- a/dgamelaunch.c |
4 +++ b/dgamelaunch.c | |
5 @@ -1489,7 +1489,10 @@ int | |
6 changepw (int dowrite) | |
7 { | |
8 char buf[DGL_PASSWDLEN+1]; | |
9 + char salt[21]; | |
10 int error = 2; | |
11 + int i; | |
12 + FILE *urandom; | |
13 | |
14 /* A precondition is that struct `me' exists because we can be not-yet-logged-in. */ | |
15 if (!me) { | |
16 @@ -1553,8 +1556,28 @@ changepw (int dowrite) | |
17 error = 1; | |
18 } | |
19 | |
20 + salt[0] = salt[2] = salt[19] = '$'; | |
21 + salt[1] = '6'; | |
22 + salt[20] = '\0'; | |
23 + urandom = fopen("/dev/urandom", "r"); | |
24 + for (i = 3; i < 19; i++) { | |
25 + /* This does waste four random bytes. */ | |
26 + fread(salt + i, 1, 1, urandom); | |
27 + salt[i] &= 0x3f; | |
28 + if (salt[i] < 26) | |
29 + salt[i] += 'a'; | |
30 + else if (salt[i] < 52) | |
31 + salt[i] = 'A' + salt[i] - 26; | |
32 + else if (salt[i] < 62) | |
33 + salt[i] = '0' + salt[i] - 52; | |
34 + else if (salt[i] == 62) | |
35 + salt[i] = '.'; | |
36 + else | |
37 + salt[i] = '/'; | |
38 + } | |
39 + fclose(urandom); | |
40 free(me->password); | |
41 - me->password = strdup (crypt (buf, buf)); | |
42 + me->password = strdup (crypt (buf, salt)); | |
43 | |
44 if (dowrite) | |
45 writefile (0); | |
69
c2127bc98694
Update the dgamelaunch compatibility patch.
John "Elwin" Edwards
parents:
24
diff
changeset
|
46 @@ -2054,6 +2077,12 @@ passwordgood (char *cpw) |
c2127bc98694
Update the dgamelaunch compatibility patch.
John "Elwin" Edwards
parents:
24
diff
changeset
|
47 char *crypted; |
24 | 48 assert (me != NULL); |
49 | |
69
c2127bc98694
Update the dgamelaunch compatibility patch.
John "Elwin" Edwards
parents:
24
diff
changeset
|
50 + crypted = crypt (cpw, me->password); |
c2127bc98694
Update the dgamelaunch compatibility patch.
John "Elwin" Edwards
parents:
24
diff
changeset
|
51 + if (crypted == NULL) |
c2127bc98694
Update the dgamelaunch compatibility patch.
John "Elwin" Edwards
parents:
24
diff
changeset
|
52 + return 0; |
c2127bc98694
Update the dgamelaunch compatibility patch.
John "Elwin" Edwards
parents:
24
diff
changeset
|
53 + if (!strncmp (crypted, me->password, DGL_PASSWDLEN)) |
24 | 54 + return 1; |
69
c2127bc98694
Update the dgamelaunch compatibility patch.
John "Elwin" Edwards
parents:
24
diff
changeset
|
55 + |
c2127bc98694
Update the dgamelaunch compatibility patch.
John "Elwin" Edwards
parents:
24
diff
changeset
|
56 crypted = crypt (cpw, cpw); |
c2127bc98694
Update the dgamelaunch compatibility patch.
John "Elwin" Edwards
parents:
24
diff
changeset
|
57 if (crypted == NULL) |
c2127bc98694
Update the dgamelaunch compatibility patch.
John "Elwin" Edwards
parents:
24
diff
changeset
|
58 return 0; |
87
1bddd1839831
Update the dgamelaunch patch to work with the most recent changes.
John "Elwin" Edwards
parents:
69
diff
changeset
|
59 @@ -2870,6 +2899,8 @@ main (int argc, char** argv) |
1bddd1839831
Update the dgamelaunch patch to work with the most recent changes.
John "Elwin" Edwards
parents:
69
diff
changeset
|
60 } |
1bddd1839831
Update the dgamelaunch patch to work with the most recent changes.
John "Elwin" Edwards
parents:
69
diff
changeset
|
61 } |
1bddd1839831
Update the dgamelaunch patch to work with the most recent changes.
John "Elwin" Edwards
parents:
69
diff
changeset
|
62 |
1bddd1839831
Update the dgamelaunch patch to work with the most recent changes.
John "Elwin" Edwards
parents:
69
diff
changeset
|
63 + umask(0002); |
1bddd1839831
Update the dgamelaunch patch to work with the most recent changes.
John "Elwin" Edwards
parents:
69
diff
changeset
|
64 + |
1bddd1839831
Update the dgamelaunch patch to work with the most recent changes.
John "Elwin" Edwards
parents:
69
diff
changeset
|
65 if (globalconfig.locale) { |
1bddd1839831
Update the dgamelaunch patch to work with the most recent changes.
John "Elwin" Edwards
parents:
69
diff
changeset
|
66 setlocale(LC_CTYPE, globalconfig.locale); |
1bddd1839831
Update the dgamelaunch patch to work with the most recent changes.
John "Elwin" Edwards
parents:
69
diff
changeset
|
67 } |
24 | 68 diff --git a/dgamelaunch.h b/dgamelaunch.h |
69
c2127bc98694
Update the dgamelaunch compatibility patch.
John "Elwin" Edwards
parents:
24
diff
changeset
|
69 index e298adf..411c7c3 100644 |
24 | 70 --- a/dgamelaunch.h |
71 +++ b/dgamelaunch.h | |
72 @@ -20,7 +20,7 @@ | |
73 #define dglsign(x) (x < 0 ? -1 : (x > 0 ? 1 : 0)) | |
74 | |
75 #define DGL_PLAYERNAMELEN 30 /* max. length of player name */ | |
76 -#define DGL_PASSWDLEN 20 /* max. length of passwords */ | |
77 +#define DGL_PASSWDLEN 108 /* max. length of passwords */ | |
78 #define DGL_MAILMSGLEN 80 /* max. length of mail message */ | |
79 | |
80 #define DGL_MAXWATCHCOLS 10 | |
81 diff --git a/dgl-common.c b/dgl-common.c | |
69
c2127bc98694
Update the dgamelaunch compatibility patch.
John "Elwin" Edwards
parents:
24
diff
changeset
|
82 index 80560b5..94f7b69 100644 |
24 | 83 --- a/dgl-common.c |
84 +++ b/dgl-common.c | |
69
c2127bc98694
Update the dgamelaunch compatibility patch.
John "Elwin" Edwards
parents:
24
diff
changeset
|
85 @@ -608,7 +608,7 @@ game_read_extra_info(struct dg_game *game, const char *extra_info_file) |
24 | 86 struct dg_game ** |
87 populate_games (int xgame, int *l, struct dg_user *me) | |
88 { | |
89 - int fd, len, n, pid; | |