* src/usermod.c: Re-indent.
* src/usermod.c: Specifying a inactivity value < -1 is not valid.
This commit is contained in:
parent
f481938cc5
commit
c3f109556a
@ -1,3 +1,8 @@
|
||||
2009-04-06 Nicolas François <nicolas.francois@centraliens.net>
|
||||
|
||||
* src/usermod.c: Re-indent.
|
||||
* src/usermod.c: Specifying a inactivity value < -1 is not valid.
|
||||
|
||||
2009-04-06 Nicolas François <nicolas.francois@centraliens.net>
|
||||
|
||||
* configure.in: Prepare the next 4.1.3 release.
|
||||
|
@ -410,7 +410,8 @@ static void new_pwent (struct passwd *pwent)
|
||||
"changing name",
|
||||
user_newname, (unsigned int) user_newid, 1);
|
||||
#endif
|
||||
SYSLOG ((LOG_INFO, "change user name '%s' to '%s'",
|
||||
SYSLOG ((LOG_INFO,
|
||||
"change user name '%s' to '%s'",
|
||||
pwent->pw_name, user_newname));
|
||||
pwent->pw_name = xstrdup (user_newname);
|
||||
}
|
||||
@ -466,7 +467,8 @@ static void new_pwent (struct passwd *pwent)
|
||||
"changing user shell",
|
||||
user_newname, (unsigned int) user_newid, 1);
|
||||
#endif
|
||||
SYSLOG ((LOG_INFO, "change user '%s' shell from '%s' to '%s'",
|
||||
SYSLOG ((LOG_INFO,
|
||||
"change user '%s' shell from '%s' to '%s'",
|
||||
pwent->pw_name, pwent->pw_shell, user_newshell));
|
||||
pwent->pw_shell = user_newshell;
|
||||
}
|
||||
@ -634,7 +636,8 @@ static void update_group (void)
|
||||
"removing group member",
|
||||
user_name, AUDIT_NO_ID, 1);
|
||||
#endif
|
||||
SYSLOG ((LOG_INFO, "delete '%s' from group '%s'",
|
||||
SYSLOG ((LOG_INFO,
|
||||
"delete '%s' from group '%s'",
|
||||
user_name, ngrp->gr_name));
|
||||
} else if (!was_member && Gflg && is_member) {
|
||||
ngrp->gr_mem = add_list (ngrp->gr_mem, user_newname);
|
||||
@ -821,7 +824,8 @@ static void process_flags (int argc, char **argv)
|
||||
/* local, no need for xgetpwnam */
|
||||
pwd = getpwnam (argv[argc - 1]);
|
||||
if (NULL == pwd) {
|
||||
fprintf (stderr, _("%s: user '%s' does not exist\n"),
|
||||
fprintf (stderr,
|
||||
_("%s: user '%s' does not exist\n"),
|
||||
Prog, argv[argc - 1]);
|
||||
exit (E_NOTFOUND);
|
||||
}
|
||||
@ -848,12 +852,14 @@ static void process_flags (int argc, char **argv)
|
||||
char *nis_domain;
|
||||
char *nis_master;
|
||||
|
||||
fprintf (stderr, _("%s: user %s is a NIS user\n"),
|
||||
fprintf (stderr,
|
||||
_("%s: user %s is a NIS user\n"),
|
||||
Prog, user_name);
|
||||
|
||||
if ( !yp_get_default_domain (&nis_domain)
|
||||
&& !yp_master (nis_domain, "passwd.byname", &nis_master)) {
|
||||
fprintf (stderr, _("%s: %s is the NIS master\n"),
|
||||
fprintf (stderr,
|
||||
_("%s: %s is the NIS master\n"),
|
||||
Prog, nis_master);
|
||||
}
|
||||
exit (E_NOTFOUND);
|
||||
@ -895,8 +901,8 @@ static void process_flags (int argc, char **argv)
|
||||
{"unlock", no_argument, NULL, 'U'},
|
||||
{NULL, 0, NULL, '\0'}
|
||||
};
|
||||
while ((c =
|
||||
getopt_long (argc, argv, "ac:d:e:f:g:G:hl:Lmop:s:u:U",
|
||||
while ((c = getopt_long (argc, argv,
|
||||
"ac:d:e:f:g:G:hl:Lmop:s:u:U",
|
||||
long_options, NULL)) != -1) {
|
||||
switch (c) {
|
||||
case 'a':
|
||||
@ -927,8 +933,7 @@ static void process_flags (int argc, char **argv)
|
||||
user_newexpire = strtoday (optarg);
|
||||
if (user_newexpire == -1) {
|
||||
fprintf (stderr,
|
||||
_
|
||||
("%s: invalid date '%s'\n"),
|
||||
_("%s: invalid date '%s'\n"),
|
||||
Prog, optarg);
|
||||
exit (E_BAD_ARG);
|
||||
}
|
||||
@ -939,7 +944,8 @@ static void process_flags (int argc, char **argv)
|
||||
eflg = true;
|
||||
break;
|
||||
case 'f':
|
||||
if (getlong (optarg, &user_newinactive) == 0) {
|
||||
if ( (getlong (optarg, &user_newinactive) == 0)
|
||||
|| (user_newinactive < -1)) {
|
||||
fprintf (stderr,
|
||||
_("%s: invalid numeric argument '%s'\n"),
|
||||
Prog, optarg);
|
||||
@ -1057,8 +1063,7 @@ static void process_flags (int argc, char **argv)
|
||||
|
||||
if (!is_shadow_pwd && (eflg || fflg)) {
|
||||
fprintf (stderr,
|
||||
_
|
||||
("%s: shadow passwords required for -e and -f\n"),
|
||||
_("%s: shadow passwords required for -e and -f\n"),
|
||||
Prog);
|
||||
exit (E_USAGE);
|
||||
}
|
||||
@ -1101,13 +1106,16 @@ static void process_flags (int argc, char **argv)
|
||||
|
||||
/* local, no need for xgetpwnam */
|
||||
if (lflg && (getpwnam (user_newname) != NULL)) {
|
||||
fprintf (stderr, _("%s: user '%s' already exists\n"), Prog, user_newname);
|
||||
fprintf (stderr,
|
||||
_("%s: user '%s' already exists\n"),
|
||||
Prog, user_newname);
|
||||
exit (E_NAME_IN_USE);
|
||||
}
|
||||
|
||||
/* local, no need for xgetpwuid */
|
||||
if (uflg && !oflg && (getpwuid (user_newid) != NULL)) {
|
||||
fprintf (stderr, _("%s: UID '%lu' already exists\n"),
|
||||
fprintf (stderr,
|
||||
_("%s: UID '%lu' already exists\n"),
|
||||
Prog, (unsigned long) user_newid);
|
||||
exit (E_UID_IN_USE);
|
||||
}
|
||||
@ -1132,7 +1140,9 @@ static void close_files (void)
|
||||
fprintf (stderr,
|
||||
_("%s: failure while writing changes to %s\n"),
|
||||
Prog, spw_dbname ());
|
||||
SYSLOG ((LOG_ERR, "failure while writing changes to %s", spw_dbname ()));
|
||||
SYSLOG ((LOG_ERR,
|
||||
"failure while writing changes to %s",
|
||||
spw_dbname ()));
|
||||
fail_exit (E_PW_UPDATE);
|
||||
}
|
||||
|
||||
@ -1141,7 +1151,9 @@ static void close_files (void)
|
||||
fprintf (stderr,
|
||||
_("%s: failure while writing changes to %s\n"),
|
||||
Prog, gr_dbname ());
|
||||
SYSLOG ((LOG_ERR, "failure while writing changes to %s", gr_dbname ()));
|
||||
SYSLOG ((LOG_ERR,
|
||||
"failure while writing changes to %s",
|
||||
gr_dbname ()));
|
||||
fail_exit (E_GRP_UPDATE);
|
||||
}
|
||||
#ifdef SHADOWGRP
|
||||
@ -1150,32 +1162,48 @@ static void close_files (void)
|
||||
fprintf (stderr,
|
||||
_("%s: failure while writing changes to %s\n"),
|
||||
Prog, sgr_dbname ());
|
||||
SYSLOG ((LOG_ERR, "failure while writing changes to %s", sgr_dbname ()));
|
||||
SYSLOG ((LOG_ERR,
|
||||
"failure while writing changes to %s",
|
||||
sgr_dbname ()));
|
||||
fail_exit (E_GRP_UPDATE);
|
||||
}
|
||||
if (sgr_unlock () == 0) {
|
||||
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ());
|
||||
SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ()));
|
||||
fprintf (stderr,
|
||||
_("%s: failed to unlock %s\n"),
|
||||
Prog, sgr_dbname ());
|
||||
SYSLOG ((LOG_ERR,
|
||||
"failed to unlock %s",
|
||||
sgr_dbname ()));
|
||||
/* continue */
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (gr_unlock () == 0) {
|
||||
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ());
|
||||
SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ()));
|
||||
fprintf (stderr,
|
||||
_("%s: failed to unlock %s\n"),
|
||||
Prog, gr_dbname ());
|
||||
SYSLOG ((LOG_ERR,
|
||||
"failed to unlock %s",
|
||||
gr_dbname ()));
|
||||
/* continue */
|
||||
}
|
||||
}
|
||||
|
||||
if (is_shadow_pwd) {
|
||||
if (spw_unlock () == 0) {
|
||||
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ());
|
||||
SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
|
||||
fprintf (stderr,
|
||||
_("%s: failed to unlock %s\n"),
|
||||
Prog, spw_dbname ());
|
||||
SYSLOG ((LOG_ERR,
|
||||
"failed to unlock %s",
|
||||
spw_dbname ()));
|
||||
/* continue */
|
||||
}
|
||||
}
|
||||
if (pw_unlock () == 0) {
|
||||
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ());
|
||||
fprintf (stderr,
|
||||
_("%s: failed to unlock %s\n"),
|
||||
Prog, pw_dbname ());
|
||||
SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ()));
|
||||
/* continue */
|
||||
}
|
||||
@ -1214,7 +1242,8 @@ static void open_files (void)
|
||||
pw_locked = true;
|
||||
if (pw_open (O_RDWR) == 0) {
|
||||
fprintf (stderr,
|
||||
_("%s: cannot open %s\n"), Prog, pw_dbname ());
|
||||
_("%s: cannot open %s\n"),
|
||||
Prog, pw_dbname ());
|
||||
fail_exit (E_PW_UPDATE);
|
||||
}
|
||||
if (is_shadow_pwd && (spw_lock () == 0)) {
|
||||
@ -1226,7 +1255,8 @@ static void open_files (void)
|
||||
spw_locked = true;
|
||||
if (is_shadow_pwd && (spw_open (O_RDWR) == 0)) {
|
||||
fprintf (stderr,
|
||||
_("%s: cannot open %s\n"), Prog, spw_dbname ());
|
||||
_("%s: cannot open %s\n"),
|
||||
Prog, spw_dbname ());
|
||||
fail_exit (E_PW_UPDATE);
|
||||
}
|
||||
|
||||
@ -1244,7 +1274,8 @@ static void open_files (void)
|
||||
gr_locked = true;
|
||||
if (gr_open (O_RDWR) == 0) {
|
||||
fprintf (stderr,
|
||||
_("%s: cannot open %s\n"), Prog, gr_dbname ());
|
||||
_("%s: cannot open %s\n"),
|
||||
Prog, gr_dbname ());
|
||||
fail_exit (E_GRP_UPDATE);
|
||||
}
|
||||
#ifdef SHADOWGRP
|
||||
@ -1257,7 +1288,8 @@ static void open_files (void)
|
||||
sgr_locked = true;
|
||||
if (is_shadow_grp && (sgr_open (O_RDWR) == 0)) {
|
||||
fprintf (stderr,
|
||||
_("%s: cannot open %s\n"), Prog, sgr_dbname ());
|
||||
_("%s: cannot open %s\n"),
|
||||
Prog, sgr_dbname ());
|
||||
fail_exit (E_GRP_UPDATE);
|
||||
}
|
||||
#endif
|
||||
@ -1283,7 +1315,8 @@ static void usr_update (void)
|
||||
*/
|
||||
pwd = pw_locate (user_name);
|
||||
if (NULL == pwd) {
|
||||
fprintf (stderr, _("%s: user '%s' does not exist in %s\n"),
|
||||
fprintf (stderr,
|
||||
_("%s: user '%s' does not exist in %s\n"),
|
||||
Prog, user_name, pw_dbname ());
|
||||
fail_exit (E_NOTFOUND);
|
||||
}
|
||||
@ -1351,7 +1384,8 @@ static void move_home (void)
|
||||
}
|
||||
|
||||
if (access (user_newhome, F_OK) == 0) {
|
||||
fprintf (stderr, _("%s: directory %s exists\n"),
|
||||
fprintf (stderr,
|
||||
_("%s: directory %s exists\n"),
|
||||
Prog, user_newhome);
|
||||
fail_exit (E_HOMEDIR);
|
||||
} else if (rename (user_home, user_newhome) != 0) {
|
||||
@ -1373,8 +1407,7 @@ static void move_home (void)
|
||||
gflg ? (long int)user_newgid : -1) == 0) {
|
||||
if (remove_tree (user_home) != 0) {
|
||||
fprintf (stderr,
|
||||
_
|
||||
("%s: warning: failed to completely remove old home directory %s"),
|
||||
_("%s: warning: failed to completely remove old home directory %s"),
|
||||
Prog, user_home);
|
||||
}
|
||||
#ifdef WITH_AUDIT
|
||||
|
Loading…
x
Reference in New Issue
Block a user