* src/useradd.c: Get rid of strtol.
* src/useradd.c: Provide better warning in case a default GROUP or INACTIVE value is not valid in /etc/default/useradd.
This commit is contained in:
@@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
* src/useradd.c: Re-indent.
|
* src/useradd.c: Re-indent.
|
||||||
* src/useradd.c: Use getlong instead of get_number.
|
* src/useradd.c: Use getlong instead of get_number.
|
||||||
|
* src/useradd.c: Get rid of strtol.
|
||||||
|
* src/useradd.c: Provide better warning in case a default GROUP or
|
||||||
|
INACTIVE value is not valid in /etc/default/useradd.
|
||||||
|
|
||||||
2009-04-06 Nicolas François <nicolas.francois@centraliens.net>
|
2009-04-06 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
|
@@ -330,6 +330,9 @@ static void get_defaults (void)
|
|||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("%s: group '%s' does not exist\n"),
|
_("%s: group '%s' does not exist\n"),
|
||||||
Prog, cp);
|
Prog, cp);
|
||||||
|
fprintf (stderr,
|
||||||
|
_("%s: the %s configuration in %s will be ignored\n"),
|
||||||
|
Prog, DGROUP, def_file);
|
||||||
} else {
|
} else {
|
||||||
def_group = grp->gr_gid;
|
def_group = grp->gr_gid;
|
||||||
def_gname = xstrdup (grp->gr_name);
|
def_gname = xstrdup (grp->gr_name);
|
||||||
@@ -354,14 +357,14 @@ static void get_defaults (void)
|
|||||||
* Default Password Inactive value
|
* Default Password Inactive value
|
||||||
*/
|
*/
|
||||||
else if (MATCH (buf, INACT)) {
|
else if (MATCH (buf, INACT)) {
|
||||||
long val = strtol (cp, &ep, 10);
|
if ( (getlong (cp, &def_inactive) == 0)
|
||||||
|
|| (def_inactive < -1)) {
|
||||||
if ( ('\0' != *cp)
|
fprintf (stderr,
|
||||||
&& ('\0' == *ep)
|
_("%s: invalid numeric argument '%s'\n"),
|
||||||
&& (ERANGE != errno)
|
Prog, optarg);
|
||||||
&& (val >= 0)) {
|
fprintf (stderr,
|
||||||
def_inactive = val;
|
_("%s: the %s configuration in %s will be ignored\n"),
|
||||||
} else {
|
Prog, INACT, def_file);
|
||||||
def_inactive = -1;
|
def_inactive = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -971,9 +974,9 @@ static void process_flags (int argc, char **argv)
|
|||||||
{"user-group", no_argument, NULL, 'U'},
|
{"user-group", no_argument, NULL, 'U'},
|
||||||
{NULL, 0, NULL, '\0'}
|
{NULL, 0, NULL, '\0'}
|
||||||
};
|
};
|
||||||
while ((c =
|
while ((c = getopt_long (argc, argv,
|
||||||
getopt_long (argc, argv, "b:c:d:De:f:g:G:k:K:lmMNop:rs:u:U",
|
"b:c:d:De:f:g:G:k:K:lmMNop:rs:u:U",
|
||||||
long_options, NULL)) != -1) {
|
long_options, NULL)) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'b':
|
case 'b':
|
||||||
if ( ( !VALID (optarg) )
|
if ( ( !VALID (optarg) )
|
||||||
@@ -1247,7 +1250,7 @@ static void process_flags (int argc, char **argv)
|
|||||||
char *uh;
|
char *uh;
|
||||||
|
|
||||||
uh = xmalloc (strlen (def_home) +
|
uh = xmalloc (strlen (def_home) +
|
||||||
strlen (user_name) + 2);
|
strlen (user_name) + 2);
|
||||||
sprintf (uh, "%s/%s", def_home, user_name);
|
sprintf (uh, "%s/%s", def_home, user_name);
|
||||||
user_home = uh;
|
user_home = uh;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user