annotate dgl/rlgwebd-compat.patch @ 82:14850d283b54

Update information about ttyrec terminal size.
author John "Elwin" Edwards
date Wed, 07 Feb 2018 20:54:48 -0500
parents c2127bc98694
children 1bddd1839831
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
69
c2127bc98694 Update the dgamelaunch compatibility patch.
John "Elwin" Edwards
parents: 24
diff changeset
2 index a52812d..6107851 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;
24
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
59 diff --git a/dgamelaunch.h b/dgamelaunch.h
69
c2127bc98694 Update the dgamelaunch compatibility patch.
John "Elwin" Edwards
parents: 24
diff changeset
60 index e298adf..411c7c3 100644
24
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
61 --- a/dgamelaunch.h
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
62 +++ b/dgamelaunch.h
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
63 @@ -20,7 +20,7 @@
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
64 #define dglsign(x) (x < 0 ? -1 : (x > 0 ? 1 : 0))
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
65
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
66 #define DGL_PLAYERNAMELEN 30 /* max. length of player name */
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
67 -#define DGL_PASSWDLEN 20 /* max. length of passwords */
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
68 +#define DGL_PASSWDLEN 108 /* max. length of passwords */
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
69 #define DGL_MAILMSGLEN 80 /* max. length of mail message */
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
70
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
71 #define DGL_MAXWATCHCOLS 10
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
72 diff --git a/dgl-common.c b/dgl-common.c
69
c2127bc98694 Update the dgamelaunch compatibility patch.
John "Elwin" Edwards
parents: 24
diff changeset
73 index 80560b5..94f7b69 100644
24
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
74 --- a/dgl-common.c
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
75 +++ b/dgl-common.c
69
c2127bc98694 Update the dgamelaunch compatibility patch.
John "Elwin" Edwards
parents: 24
diff changeset
76 @@ -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
77 struct dg_game **
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
78 populate_games (int xgame, int *l, struct dg_user *me)
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 - int fd, len, n, pid;
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
81 + int fd, len, n, pid, is_node;
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
82 DIR *pdir;
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
83 struct dirent *pdirent;
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
84 struct stat pstat;
69
c2127bc98694 Update the dgamelaunch compatibility patch.
John "Elwin" Edwards
parents: 24
diff changeset
85 @@ -646,13 +646,15 @@ populate_games (int xgame, int *l, struct dg_user *me)
24
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
86
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
87 if (!inprog) continue;
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 + is_node = strchr(pdirent->d_name, ':') && !strncmp(strchr(pdirent->d_name, ':'), ":node:", 6);
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
90 +