comparison dgl/rlgwebd-compat.patch @ 69:c2127bc98694

Update the dgamelaunch compatibility patch. The patch is now to be applied to dgamelaunch revision 6753fd6e. Maybe I should maintain my own Git branch. But this project already uses autotools and npm. I don't need any more software that's amazing in theory but painful to actually work with.
author John "Elwin" Edwards
date Sat, 23 Jan 2016 19:04:17 -0500
parents ce26225f7d9d
children 1bddd1839831
comparison
equal deleted inserted replaced
68:67bcca6e3cb1 69:c2127bc98694
1 diff --git a/dgamelaunch.c b/dgamelaunch.c 1 diff --git a/dgamelaunch.c b/dgamelaunch.c
2 index fbf6ef5..b52b545 100644 2 index a52812d..6107851 100644
3 --- a/dgamelaunch.c 3 --- a/dgamelaunch.c
4 +++ b/dgamelaunch.c 4 +++ b/dgamelaunch.c
5 @@ -1489,7 +1489,10 @@ int 5 @@ -1489,7 +1489,10 @@ int
6 changepw (int dowrite) 6 changepw (int dowrite)
7 { 7 {
41 - me->password = strdup (crypt (buf, buf)); 41 - me->password = strdup (crypt (buf, buf));
42 + me->password = strdup (crypt (buf, salt)); 42 + me->password = strdup (crypt (buf, salt));
43 43
44 if (dowrite) 44 if (dowrite)
45 writefile (0); 45 writefile (0);
46 @@ -2053,6 +2076,8 @@ passwordgood (char *cpw) 46 @@ -2054,6 +2077,12 @@ passwordgood (char *cpw)
47 { 47 char *crypted;
48 assert (me != NULL); 48 assert (me != NULL);
49 49
50 + if (!strncmp (crypt (cpw, me->password), me->password, DGL_PASSWDLEN)) 50 + crypted = crypt (cpw, me->password);
51 + if (crypted == NULL)
52 + return 0;
53 + if (!strncmp (crypted, me->password, DGL_PASSWDLEN))
51 + return 1; 54 + return 1;
52 if (!strncmp (crypt (cpw, cpw), me->password, DGL_PASSWDLEN)) 55 +
53 return 1; 56 crypted = crypt (cpw, cpw);
54 if (!strncmp (cpw, me->password, DGL_PASSWDLEN)) 57 if (crypted == NULL)
58 return 0;
55 diff --git a/dgamelaunch.h b/dgamelaunch.h 59 diff --git a/dgamelaunch.h b/dgamelaunch.h
56 index b9ce41c..ca5e11b 100644 60 index e298adf..411c7c3 100644
57 --- a/dgamelaunch.h 61 --- a/dgamelaunch.h
58 +++ b/dgamelaunch.h 62 +++ b/dgamelaunch.h
59 @@ -20,7 +20,7 @@ 63 @@ -20,7 +20,7 @@
60 #define dglsign(x) (x < 0 ? -1 : (x > 0 ? 1 : 0)) 64 #define dglsign(x) (x < 0 ? -1 : (x > 0 ? 1 : 0))
61 65
64 +#define DGL_PASSWDLEN 108 /* max. length of passwords */ 68 +#define DGL_PASSWDLEN 108 /* max. length of passwords */
65 #define DGL_MAILMSGLEN 80 /* max. length of mail message */ 69 #define DGL_MAILMSGLEN 80 /* max. length of mail message */
66 70
67 #define DGL_MAXWATCHCOLS 10 71 #define DGL_MAXWATCHCOLS 10
68 diff --git a/dgl-common.c b/dgl-common.c 72 diff --git a/dgl-common.c b/dgl-common.c
69 index e5c80bc..fbc4eea 100644 73 index 80560b5..94f7b69 100644
70 --- a/dgl-common.c 74 --- a/dgl-common.c
71 +++ b/dgl-common.c 75 +++ b/dgl-common.c
72 @@ -593,7 +593,7 @@ game_read_extra_info(struct dg_game *game, const char *extra_info_file) 76 @@ -608,7 +608,7 @@ game_read_extra_info(struct dg_game *game, const char *extra_info_file)
73 struct dg_game ** 77 struct dg_game **
74 populate_games (int xgame, int *l, struct dg_user *me) 78 populate_games (int xgame, int *l, struct dg_user *me)
75 { 79 {
76 - int fd, len, n, pid; 80 - int fd, len, n, pid;
77 + int fd, len, n, pid, is_node; 81 + int fd, len, n, pid, is_node;
78 DIR *pdir; 82 DIR *pdir;
79 struct dirent *pdirent; 83 struct dirent *pdirent;
80 struct stat pstat; 84 struct stat pstat;
81 @@ -631,13 +631,15 @@ populate_games (int xgame, int *l, struct dg_user *me) 85 @@ -646,13 +646,15 @@ populate_games (int xgame, int *l, struct dg_user *me)
82 86
83 if (!inprog) continue; 87 if (!inprog) continue;
84 88
85 + is_node = strchr(pdirent->d_name, ':') && !strncmp(strchr(pdirent->d_name, ':'), ":node:", 6); 89 + is_node = strchr(pdirent->d_name, ':') && !strncmp(strchr(pdirent->d_name, ':'), ":node:", 6);
86 + 90 +
93 - if (fd >= 0 && (fcntl (fd, F_SETLK, &fl) == -1)) 97 - if (fd >= 0 && (fcntl (fd, F_SETLK, &fl) == -1))
94 + if (fd >= 0 && (is_node || (fcntl (fd, F_SETLK, &fl) == -1))) 98 + if (fd >= 0 && (is_node || (fcntl (fd, F_SETLK, &fl) == -1)))
95 { 99 {
96 char *ttrecdir = NULL; 100 char *ttrecdir = NULL;
97 strncpy(playername, pdirent->d_name, DGL_PLAYERNAMELEN); 101 strncpy(playername, pdirent->d_name, DGL_PLAYERNAMELEN);
98 @@ -651,6 +653,9 @@ populate_games (int xgame, int *l, struct dg_user *me) 102 @@ -666,6 +668,9 @@ populate_games (int xgame, int *l, struct dg_user *me)
99 graceful_exit(145); 103 graceful_exit(145);
100 } 104 }
101 replacestr++; 105 replacestr++;
102 + if (is_node) { 106 + if (is_node) {
103 + replacestr += 5; 107 + replacestr += 5;
104 + } 108 + }
105 109
106 ttrecdir = dgl_format_str(game, me, myconfig[game]->ttyrecdir, playername); 110 ttrecdir = dgl_format_str(game, me, myconfig[game]->ttyrecdir, playername);
107 if (!ttrecdir) continue; 111 if (!ttrecdir) continue;
108 @@ -673,6 +678,8 @@ populate_games (int xgame, int *l, struct dg_user *me) 112 @@ -688,6 +693,8 @@ populate_games (int xgame, int *l, struct dg_user *me)
109 strlcpy (games[len]->name, pdirent->d_name, 113 strlcpy (games[len]->name, pdirent->d_name,
110 strlen (pdirent->d_name) + 1); 114 strlen (pdirent->d_name) + 1);
111 115
112 + if (is_node) 116 + if (is_node)
113 + replacestr += 5; 117 + replacestr += 5;