Kludge to detect 'maxusers = 0' and handle f_num > myconfig->max more smoothly
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@205 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
parent
8721002b54
commit
b34e8a4af3
5
config.y
5
config.y
|
@ -156,7 +156,11 @@ KeyPair: KeyType '=' TYPE_VALUE {
|
|||
}
|
||||
| KeyType '=' TYPE_NUMBER {
|
||||
if (!myconfig)
|
||||
{
|
||||
myconfig = calloc(1, sizeof(struct dg_config));
|
||||
myconfig->shed_uid = (uid_t)-1;
|
||||
myconfig->shed_gid = (gid_t)-1;
|
||||
}
|
||||
|
||||
switch ($1)
|
||||
{
|
||||
|
@ -184,6 +188,7 @@ KeyPair: KeyType '=' TYPE_VALUE {
|
|||
break;
|
||||
|
||||
case TYPE_MAX:
|
||||
set_max = 1; /* XXX XXX */
|
||||
myconfig->max = $3;
|
||||
break;
|
||||
|
||||
|
|
|
@ -109,6 +109,7 @@ struct dg_config defconfig = {
|
|||
/* max = */ 64000
|
||||
};
|
||||
|
||||
int set_max = 0; /* XXX */
|
||||
int loggedin = 0;
|
||||
char rcfilename[80];
|
||||
char *chosen_name;
|
||||
|
@ -181,7 +182,7 @@ create_config ()
|
|||
myconfig->shed_gid = defconfig.shed_gid;
|
||||
}
|
||||
|
||||
if (myconfig->max == -1) myconfig->max = defconfig.max;
|
||||
if (myconfig->max == 0 && !set_max) myconfig->max = defconfig.max;
|
||||
if (!myconfig->banner) myconfig->banner = defconfig.banner;
|
||||
if (!myconfig->chroot) myconfig->chroot = defconfig.chroot;
|
||||
if (!myconfig->nethack) myconfig->nethack = defconfig.nethack;
|
||||
|
@ -1093,7 +1094,10 @@ readfile (int nolock)
|
|||
f_num++;
|
||||
/* prevent a buffer overrun here */
|
||||
if (f_num > myconfig->max)
|
||||
{
|
||||
fprintf(stderr,"ERROR: number of users in database exceeds maximum. Exiting.\n");
|
||||
graceful_exit (109);
|
||||
}
|
||||
}
|
||||
|
||||
if (!nolock)
|
||||
|
|
|
@ -60,6 +60,7 @@ extern struct dg_config *myconfig;
|
|||
extern char *chosen_name;
|
||||
extern int loggedin;
|
||||
extern int silent;
|
||||
extern int set_max;
|
||||
|
||||
/* dgamelaunch.c */
|
||||
extern void create_config(void);
|
||||
|
|
Loading…
Reference in New Issue