annotate dgl/rlgwebd-compat.patch @ 44:7c789e87ee5d

Rearrange the statistics pages. Move each game's charts onto individual pages. Put links to these pages on /scoring/index.html, instead of dumping all the charts there.
author John "Elwin" Edwards
date Thu, 16 Jan 2014 11:04:45 -0800
parents ce26225f7d9d
children c2127bc98694
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
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
2 index fbf6ef5..b52b545 100644
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);
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
46 @@ -2053,6 +2076,8 @@ passwordgood (char *cpw)
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
47 {
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
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
50 + if (!strncmp (crypt (cpw, me->password), me->password, DGL_PASSWDLEN))
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
51 + return 1;
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
52 if (!strncmp (crypt (cpw, cpw), me->password, DGL_PASSWDLEN))
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
53 return 1;
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
54 if (!strncmp (cpw, me->password, DGL_PASSWDLEN))
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
55 diff --git a/dgamelaunch.h b/dgamelaunch.h
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
56 index b9ce41c..ca5e11b 100644
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
57 --- a/dgamelaunch.h
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
58 +++ b/dgamelaunch.h
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
59 @@ -20,7 +20,7 @@
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
60 #define dglsign(x) (x < 0 ? -1 : (x > 0 ? 1 : 0))
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
61
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
62 #define DGL_PLAYERNAMELEN 30 /* max. length of player name */
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
63 -#define DGL_PASSWDLEN 20 /* max. length of passwords */
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
64 +#define DGL_PASSWDLEN 108 /* max. length of passwords */
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
65 #define DGL_MAILMSGLEN 80 /* max. length of mail message */
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
66
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
67 #define DGL_MAXWATCHCOLS 10
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
68 diff --git a/dgl-common.c b/dgl-common.c
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
69 index e5c80bc..fbc4eea 100644
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
70 --- a/dgl-common.c
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
71 +++ b/dgl-common.c
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
72 @@ -593,7 +593,7 @@ game_read_extra_info(struct dg_game *game, const char *extra_info_file)
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
73 struct dg_game **
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
74 populate_games (int xgame, int *l, struct dg_user *me)
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
75 {
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
76 - int fd, len, n, pid;
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
77 + int fd, len, n, pid, is_node;
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
78 DIR *pdir;
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
79 struct dirent *pdirent;
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
80 struct stat pstat;
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
81 @@ -631,13 +631,15 @@ populate_games (int xgame, int *l, struct dg_user *me)
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
82
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
83 if (!inprog) continue;
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
84
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
85 + 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
86 +
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
87 snprintf (fullname, 130, "%s%s", inprog, pdirent->d_name);
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 fd = 0;
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
90 /* O_RDWR here should be O_RDONLY, but we need to test for
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
91 * an exclusive lock */
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
92 fd = open (fullname, O_RDWR);
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents:
diff changeset
93 - if (fd >= 0 && (fcntl (fd, F_SETLK, &fl) == -1))
ce26225f7d9d Switch to the Git version of dgamelaunch.
John "Elwin" Edwards
parents: