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
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
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
44 if (dowrite)
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
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
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
48 assert (me != NULL);
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
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
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
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
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
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
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
70 --- a/dgamelaunch.h
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
71 +++ b/dgamelaunch.h
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
72 @@ -20,7 +20,7 @@
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
73 #define dglsign(x) (x < 0 ? -1 : (x > 0 ? 1 : 0))
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
74
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
75 #define DGL_PLAYERNAMELEN 30 /* max. length of player name */
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
76 -#define DGL_PASSWDLEN 20 /* max. length of passwords */
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
77 +#define DGL_PASSWDLEN 108 /* max. length of passwords */
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
78 #define DGL_MAILMSGLEN 80 /* max. length of mail message */
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
79
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
80 #define DGL_MAXWATCHCOLS 10
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
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
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
83 --- a/dgl-common.c
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
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
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
86 struct dg_game **
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
87 populate_games (int xgame, int *l, struct dg_user *me)
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
88 {
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
89 - int fd, len, n, pid;