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 \
|
bind gethostbyaddr gethostbyname gethostname inet_ntoa \
|
||||||
setsid setsockopt socket strcasecmp waitpid],,AC_MSG_ERROR([required function missing!]))
|
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)
|
vsnprintf strdup strlcpy strlcat strtok_r)
|
||||||
|
|
||||||
# -- Configuration options --
|
# -- Configuration options --
|
||||||
|
|
|
@ -1055,11 +1055,9 @@ Handle_GLOBAL( int Line, char *Var, char *Arg )
|
||||||
pwd = getpwnam( Arg );
|
pwd = getpwnam( Arg );
|
||||||
if( pwd ) Conf_UID = pwd->pw_uid;
|
if( pwd ) Conf_UID = pwd->pw_uid;
|
||||||
else {
|
else {
|
||||||
#ifdef HAVE_ISDIGIT
|
|
||||||
if( ! isdigit( (int)*Arg )) Config_Error_NaN( Line, Var );
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
Conf_UID = (unsigned int)atoi( Arg );
|
Conf_UID = (unsigned int)atoi( Arg );
|
||||||
|
if (!Conf_UID && strcmp(Arg, "0"))
|
||||||
|
Config_Error_NaN(Line, Var);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1068,11 +1066,9 @@ Handle_GLOBAL( int Line, char *Var, char *Arg )
|
||||||
grp = getgrnam( Arg );
|
grp = getgrnam( Arg );
|
||||||
if( grp ) Conf_GID = grp->gr_gid;
|
if( grp ) Conf_GID = grp->gr_gid;
|
||||||
else {
|
else {
|
||||||
#ifdef HAVE_ISDIGIT
|
Conf_GID = (unsigned int)atoi(Arg);
|
||||||
if( ! isdigit( (int)*Arg )) Config_Error_NaN( Line, Var );
|
if (!Conf_GID && strcmp(Arg, "0"))
|
||||||
else
|
Config_Error_NaN( Line, Var );
|
||||||
#endif
|
|
||||||
Conf_GID = (unsigned int)atoi( Arg );
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1153,29 +1149,23 @@ Handle_GLOBAL( int Line, char *Var, char *Arg )
|
||||||
}
|
}
|
||||||
if( strcasecmp( Var, "MaxConnections" ) == 0 ) {
|
if( strcasecmp( Var, "MaxConnections" ) == 0 ) {
|
||||||
/* Maximum number of connections. 0 -> "no limit". */
|
/* 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 );
|
Conf_MaxConnections = atol( Arg );
|
||||||
|
if (!Conf_MaxConnections && strcmp(Arg, "0"))
|
||||||
|
Config_Error_NaN(Line, Var);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( strcasecmp( Var, "MaxConnectionsIP" ) == 0 ) {
|
if( strcasecmp( Var, "MaxConnectionsIP" ) == 0 ) {
|
||||||
/* Maximum number of simultaneous connections from one IP. 0 -> "no limit" */
|
/* 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 );
|
Conf_MaxConnectionsIP = atoi( Arg );
|
||||||
|
if (!Conf_MaxConnectionsIP && strcmp(Arg, "0"))
|
||||||
|
Config_Error_NaN(Line, Var);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( strcasecmp( Var, "MaxJoins" ) == 0 ) {
|
if( strcasecmp( Var, "MaxJoins" ) == 0 ) {
|
||||||
/* Maximum number of channels a user can join. 0 -> "no limit". */
|
/* 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 );
|
Conf_MaxJoins = atoi( Arg );
|
||||||
|
if (!Conf_MaxJoins && strcmp(Arg, "0"))
|
||||||
|
Config_Error_NaN(Line, Var);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( strcasecmp( Var, "MaxNickLength" ) == 0 ) {
|
if( strcasecmp( Var, "MaxNickLength" ) == 0 ) {
|
||||||
|
@ -1386,12 +1376,9 @@ Handle_SERVER( int Line, char *Var, char *Arg )
|
||||||
#endif
|
#endif
|
||||||
if( strcasecmp( Var, "Group" ) == 0 ) {
|
if( strcasecmp( Var, "Group" ) == 0 ) {
|
||||||
/* Server group */
|
/* Server group */
|
||||||
#ifdef HAVE_ISDIGIT
|
|
||||||
if( ! isdigit( (int)*Arg ))
|
|
||||||
Config_Error_NaN( Line, Var );
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
New_Server.group = atoi( Arg );
|
New_Server.group = atoi( Arg );
|
||||||
|
if (!New_Server.group && strcmp(Arg, "0"))
|
||||||
|
Config_Error_NaN(Line, Var);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( strcasecmp( Var, "Passive" ) == 0 ) {
|
if( strcasecmp( Var, "Passive" ) == 0 ) {
|
||||||
|
@ -1479,7 +1466,7 @@ Handle_CHANNEL(int Line, char *Var, char *Arg)
|
||||||
if( strcasecmp( Var, "MaxUsers" ) == 0 ) {
|
if( strcasecmp( Var, "MaxUsers" ) == 0 ) {
|
||||||
/* maximum user limit, mode l */
|
/* maximum user limit, mode l */
|
||||||
chan->maxusers = (unsigned long) atol(Arg);
|
chan->maxusers = (unsigned long) atol(Arg);
|
||||||
if (chan->maxusers == 0)
|
if (!chan->maxusers && strcmp(Arg, "0"))
|
||||||
Config_Error_NaN(Line, Var);
|
Config_Error_NaN(Line, Var);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue