mirror of
https://github.com/osmarks/ngircd.git
synced 2024-12-13 02:10:27 +00:00
conf: fix 'Value of "..." is not a number!' for negative values
Don't use isdigit() function any more, because it only checks the first character of the variable value and because it doesn't know about the minus sign which is required e.g. for "Group = -1".
This commit is contained in:
parent
914d6a26d8
commit
58a4dae56d
@ -162,7 +162,7 @@ AC_CHECK_FUNCS([ \
|
||||
bind gethostbyaddr gethostbyname gethostname inet_ntoa \
|
||||
setsid setsockopt socket strcasecmp waitpid],,AC_MSG_ERROR([required function missing!]))
|
||||
|
||||
AC_CHECK_FUNCS(getaddrinfo getnameinfo inet_aton isdigit sigaction sigprocmask snprintf \
|
||||
AC_CHECK_FUNCS(getaddrinfo getnameinfo inet_aton sigaction sigprocmask snprintf \
|
||||
vsnprintf strdup strlcpy strlcat strtok_r)
|
||||
|
||||
# -- Configuration options --
|
||||
|
@ -1055,11 +1055,9 @@ Handle_GLOBAL( int Line, char *Var, char *Arg )
|
||||
pwd = getpwnam( Arg );
|
||||
if( pwd ) Conf_UID = pwd->pw_uid;
|
||||
else {
|
||||
#ifdef HAVE_ISDIGIT
|
||||
if( ! isdigit( (int)*Arg )) Config_Error_NaN( Line, Var );
|
||||
else
|
||||
#endif
|
||||
Conf_UID = (unsigned int)atoi( Arg );
|
||||
if (!Conf_UID && strcmp(Arg, "0"))
|
||||
Config_Error_NaN(Line, Var);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -1068,11 +1066,9 @@ Handle_GLOBAL( int Line, char *Var, char *Arg )
|
||||
grp = getgrnam( Arg );
|
||||
if( grp ) Conf_GID = grp->gr_gid;
|
||||
else {
|
||||
#ifdef HAVE_ISDIGIT
|
||||
if( ! isdigit( (int)*Arg )) Config_Error_NaN( Line, Var );
|
||||
else
|
||||
#endif
|
||||
Conf_GID = (unsigned int)atoi( Arg );
|
||||
Conf_GID = (unsigned int)atoi(Arg);
|
||||
if (!Conf_GID && strcmp(Arg, "0"))
|
||||
Config_Error_NaN( Line, Var );
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -1153,29 +1149,23 @@ Handle_GLOBAL( int Line, char *Var, char *Arg )
|
||||
}
|
||||
if( strcasecmp( Var, "MaxConnections" ) == 0 ) {
|
||||
/* Maximum number of connections. 0 -> "no limit". */
|
||||
#ifdef HAVE_ISDIGIT
|
||||
if( ! isdigit( (int)*Arg )) Config_Error_NaN( Line, Var);
|
||||
else
|
||||
#endif
|
||||
Conf_MaxConnections = atol( Arg );
|
||||
if (!Conf_MaxConnections && strcmp(Arg, "0"))
|
||||
Config_Error_NaN(Line, Var);
|
||||
return;
|
||||
}
|
||||
if( strcasecmp( Var, "MaxConnectionsIP" ) == 0 ) {
|
||||
/* Maximum number of simultaneous connections from one IP. 0 -> "no limit" */
|
||||
#ifdef HAVE_ISDIGIT
|
||||
if( ! isdigit( (int)*Arg )) Config_Error_NaN( Line, Var );
|
||||
else
|
||||
#endif
|
||||
Conf_MaxConnectionsIP = atoi( Arg );
|
||||
if (!Conf_MaxConnectionsIP && strcmp(Arg, "0"))
|
||||
Config_Error_NaN(Line, Var);
|
||||
return;
|
||||
}
|
||||
if( strcasecmp( Var, "MaxJoins" ) == 0 ) {
|
||||
/* Maximum number of channels a user can join. 0 -> "no limit". */
|
||||
#ifdef HAVE_ISDIGIT
|
||||
if( ! isdigit( (int)*Arg )) Config_Error_NaN( Line, Var );
|
||||
else
|
||||
#endif
|
||||
Conf_MaxJoins = atoi( Arg );
|
||||
if (!Conf_MaxJoins && strcmp(Arg, "0"))
|
||||
Config_Error_NaN(Line, Var);
|
||||
return;
|
||||
}
|
||||
if( strcasecmp( Var, "MaxNickLength" ) == 0 ) {
|
||||
@ -1386,12 +1376,9 @@ Handle_SERVER( int Line, char *Var, char *Arg )
|
||||
#endif
|
||||
if( strcasecmp( Var, "Group" ) == 0 ) {
|
||||
/* Server group */
|
||||
#ifdef HAVE_ISDIGIT
|
||||
if( ! isdigit( (int)*Arg ))
|
||||
Config_Error_NaN( Line, Var );
|
||||
else
|
||||
#endif
|
||||
New_Server.group = atoi( Arg );
|
||||
if (!New_Server.group && strcmp(Arg, "0"))
|
||||
Config_Error_NaN(Line, Var);
|
||||
return;
|
||||
}
|
||||
if( strcasecmp( Var, "Passive" ) == 0 ) {
|
||||
@ -1479,7 +1466,7 @@ Handle_CHANNEL(int Line, char *Var, char *Arg)
|
||||
if( strcasecmp( Var, "MaxUsers" ) == 0 ) {
|
||||
/* maximum user limit, mode l */
|
||||
chan->maxusers = (unsigned long) atol(Arg);
|
||||
if (chan->maxusers == 0)
|
||||
if (!chan->maxusers && strcmp(Arg, "0"))
|
||||
Config_Error_NaN(Line, Var);
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user