lib/getdef.c: Reject negative values in getdef_* except -1
The values are retrieved from login.defs files, which normally do not contain negative values. In fact, negative value -1 is used in many code places as "feature disabled", which is normally achieved by simply commenting out the key from the file. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
This commit is contained in:
committed by
Serge Hallyn
parent
8b8793920e
commit
b80c55946a
@@ -247,7 +247,7 @@ int getdef_num (const char *item, int dflt)
|
||||
|
||||
if ( (getlong (d->value, &val) == 0)
|
||||
|| (val > INT_MAX)
|
||||
|| (val < INT_MIN)) {
|
||||
|| (val < -1)) {
|
||||
fprintf (shadow_logfd,
|
||||
_("configuration error - cannot parse %s value: '%s'"),
|
||||
item, d->value);
|
||||
@@ -315,7 +315,8 @@ long getdef_long (const char *item, long dflt)
|
||||
return dflt;
|
||||
}
|
||||
|
||||
if (getlong (d->value, &val) == 0) {
|
||||
if ( (getlong (d->value, &val) == 0)
|
||||
|| (val < -1)) {
|
||||
fprintf (shadow_logfd,
|
||||
_("configuration error - cannot parse %s value: '%s'"),
|
||||
item, d->value);
|
||||
|
||||
Reference in New Issue
Block a user