*/
if (__isgrNIS ()) {
fprintf (stderr,
- _("%s: group '%s' is a NIS group.\n"),
- Prog, grp->gr_name);
+ _("%s: group '%s' is a NIS group.\n"),
+ Prog, grp->gr_name);
continue;
}
#endif
if (pw_pass[1] == '\0') {
fprintf (stderr,
- _("%s: unlocking the user's password would result in a passwordless account.\n"
- "You should set a password with usermod -p to unlock this user's password.\n"),
- Prog);
+ _("%s: unlocking the user's password would result in a passwordless account.\n"
+ "You should set a password with usermod -p to unlock this user's password.\n"),
+ Prog);
return pw_pass;
}
"changing name",
user_newname, (unsigned int) user_newid, 1);
#endif
- SYSLOG ((LOG_INFO, "change user name '%s' to '%s'",
- pwent->pw_name, user_newname));
+ SYSLOG ((LOG_INFO,
+ "change user name '%s' to '%s'",
+ pwent->pw_name, user_newname));
pwent->pw_name = xstrdup (user_newname);
}
if (!is_shadow_pwd) {
user_newname, (unsigned int) user_newid, 1);
#endif
SYSLOG ((LOG_INFO,
- "change user '%s' UID from '%d' to '%d'",
- pwent->pw_name, pwent->pw_uid, user_newid));
+ "change user '%s' UID from '%d' to '%d'",
+ pwent->pw_name, pwent->pw_uid, user_newid));
pwent->pw_uid = user_newid;
}
if (gflg) {
user_newname, (unsigned int) user_newid, 1);
#endif
SYSLOG ((LOG_INFO,
- "change user '%s' GID from '%d' to '%d'",
- pwent->pw_name, pwent->pw_gid, user_newgid));
+ "change user '%s' GID from '%d' to '%d'",
+ pwent->pw_name, pwent->pw_gid, user_newgid));
pwent->pw_gid = user_newgid;
}
if (cflg) {
user_newname, (unsigned int) user_newid, 1);
#endif
SYSLOG ((LOG_INFO,
- "change user '%s' home from '%s' to '%s'",
- pwent->pw_name, pwent->pw_dir, user_newhome));
+ "change user '%s' home from '%s' to '%s'",
+ pwent->pw_name, pwent->pw_dir, user_newhome));
pwent->pw_dir = user_newhome;
}
if (sflg) {
"changing user shell",
user_newname, (unsigned int) user_newid, 1);
#endif
- SYSLOG ((LOG_INFO, "change user '%s' shell from '%s' to '%s'",
- pwent->pw_name, pwent->pw_shell, user_newshell));
+ SYSLOG ((LOG_INFO,
+ "change user '%s' shell from '%s' to '%s'",
+ pwent->pw_name, pwent->pw_shell, user_newshell));
pwent->pw_shell = user_newshell;
}
}
user_newname, (unsigned int) user_newid, 1);
#endif
SYSLOG ((LOG_INFO,
- "change user '%s' inactive from '%ld' to '%ld'",
- spent->sp_namp, spent->sp_inact, user_newinactive));
+ "change user '%s' inactive from '%ld' to '%ld'",
+ spent->sp_namp, spent->sp_inact, user_newinactive));
spent->sp_inact = user_newinactive;
}
if (eflg) {
user_newname, (unsigned int) user_newid, 1);
#endif
SYSLOG ((LOG_INFO,
- "change user '%s' expiration from '%s' to '%s'",
- spent->sp_namp, old_exp, new_exp));
+ "change user '%s' expiration from '%s' to '%s'",
+ spent->sp_namp, old_exp, new_exp));
spent->sp_expire = user_newexpire;
}
spent->sp_pwdp = new_pw_passwd (spent->sp_pwdp);
if (was_member && (!Gflg || is_member)) {
if (lflg) {
ngrp->gr_mem = del_list (ngrp->gr_mem,
- user_name);
+ user_name);
ngrp->gr_mem = add_list (ngrp->gr_mem,
- user_newname);
+ user_newname);
changed = true;
#ifdef WITH_AUDIT
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
user_newname, AUDIT_NO_ID, 1);
#endif
SYSLOG ((LOG_INFO,
- "change '%s' to '%s' in group '%s'",
- user_name, user_newname,
- ngrp->gr_name));
+ "change '%s' to '%s' in group '%s'",
+ user_name, user_newname,
+ ngrp->gr_name));
}
} else if (was_member && !aflg && Gflg && !is_member) {
ngrp->gr_mem = del_list (ngrp->gr_mem, user_name);
"removing group member",
user_name, AUDIT_NO_ID, 1);
#endif
- SYSLOG ((LOG_INFO, "delete '%s' from group '%s'",
- user_name, ngrp->gr_name));
+ 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);
changed = true;
user_name, AUDIT_NO_ID, 1);
#endif
SYSLOG ((LOG_INFO,
- "change admin '%s' to '%s' in shadow group '%s'",
- user_name, user_newname, nsgrp->sg_name));
+ "change admin '%s' to '%s' in shadow group '%s'",
+ user_name, user_newname, nsgrp->sg_name));
}
if (was_member && (!Gflg || is_member)) {
if (lflg) {
nsgrp->sg_mem = del_list (nsgrp->sg_mem,
- user_name);
+ user_name);
nsgrp->sg_mem = add_list (nsgrp->sg_mem,
- user_newname);
+ user_newname);
changed = true;
#ifdef WITH_AUDIT
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
user_name, AUDIT_NO_ID, 1);
#endif
SYSLOG ((LOG_INFO,
- "change '%s' to '%s' in shadow group '%s'",
- user_name, user_newname,
- nsgrp->sg_name));
+ "change '%s' to '%s' in shadow group '%s'",
+ user_name, user_newname,
+ nsgrp->sg_name));
}
} else if (was_member && !aflg && Gflg && !is_member) {
nsgrp->sg_mem = del_list (nsgrp->sg_mem, user_name);
user_name, AUDIT_NO_ID, 1);
#endif
SYSLOG ((LOG_INFO,
- "delete '%s' from shadow group '%s'",
- user_name, nsgrp->sg_name));
+ "delete '%s' from shadow group '%s'",
+ user_name, nsgrp->sg_name));
} else if (!was_member && Gflg && is_member) {
nsgrp->sg_mem = add_list (nsgrp->sg_mem, user_newname);
changed = true;
/* local, no need for xgetpwnam */
pwd = getpwnam (argv[argc - 1]);
if (NULL == pwd) {
- fprintf (stderr, _("%s: user '%s' does not exist\n"),
- Prog, argv[argc - 1]);
+ fprintf (stderr,
+ _("%s: user '%s' does not exist\n"),
+ Prog, argv[argc - 1]);
exit (E_NOTFOUND);
}
char *nis_domain;
char *nis_master;
- fprintf (stderr, _("%s: user %s is a NIS user\n"),
- Prog, user_name);
+ 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"),
- Prog, nis_master);
+ fprintf (stderr,
+ _("%s: %s is the NIS master\n"),
+ Prog, nis_master);
}
exit (E_NOTFOUND);
}
{"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",
- long_options, NULL)) != -1) {
+ 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':
aflg = true;
case 'c':
if (!VALID (optarg)) {
fprintf (stderr,
- _("%s: invalid field '%s'\n"),
- Prog, optarg);
+ _("%s: invalid field '%s'\n"),
+ Prog, optarg);
exit (E_BAD_ARG);
}
user_newcomment = optarg;
case 'd':
if (!VALID (optarg)) {
fprintf (stderr,
- _("%s: invalid field '%s'\n"),
- Prog, optarg);
+ _("%s: invalid field '%s'\n"),
+ Prog, optarg);
exit (E_BAD_ARG);
}
dflg = true;
user_newexpire = strtoday (optarg);
if (user_newexpire == -1) {
fprintf (stderr,
- _
- ("%s: invalid date '%s'\n"),
- Prog, optarg);
+ _("%s: invalid date '%s'\n"),
+ Prog, optarg);
exit (E_BAD_ARG);
}
user_newexpire *= DAY / SCALE;
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);
grp = getgr_nam_gid (optarg);
if (NULL == grp) {
fprintf (stderr,
- _("%s: group '%s' does not exist\n"),
- Prog, optarg);
+ _("%s: group '%s' does not exist\n"),
+ Prog, optarg);
exit (E_NOTFOUND);
}
user_newgid = grp->gr_gid;
case 'l':
if (!is_valid_user_name (optarg)) {
fprintf (stderr,
- _("%s: invalid field '%s'\n"),
- Prog, optarg);
+ _("%s: invalid field '%s'\n"),
+ Prog, optarg);
exit (E_BAD_ARG);
}
lflg = true;
case 's':
if (!VALID (optarg)) {
fprintf (stderr,
- _("%s: invalid field '%s'\n"),
- Prog, optarg);
+ _("%s: invalid field '%s'\n"),
+ Prog, optarg);
exit (E_BAD_ARG);
}
user_newshell = optarg;
if (!is_shadow_pwd && (eflg || fflg)) {
fprintf (stderr,
- _
- ("%s: shadow passwords required for -e and -f\n"),
- Prog);
+ _("%s: shadow passwords required for -e and -f\n"),
+ Prog);
exit (E_USAGE);
}
if (aflg && (!Gflg)) {
fprintf (stderr,
- _("%s: %s flag is only allowed with the %s flag\n"),
- Prog, "-a", "-G");
+ _("%s: %s flag is only allowed with the %s flag\n"),
+ Prog, "-a", "-G");
usage ();
exit (E_USAGE);
}
if ((Lflg && (pflg || Uflg)) || (pflg && Uflg)) {
fprintf (stderr,
- _("%s: the -L, -p, and -U flags are exclusive\n"),
- Prog);
+ _("%s: the -L, -p, and -U flags are exclusive\n"),
+ Prog);
usage ();
exit (E_USAGE);
}
if (oflg && !uflg) {
fprintf (stderr,
- _("%s: %s flag is only allowed with the %s flag\n"),
- Prog, "-o", "-u");
+ _("%s: %s flag is only allowed with the %s flag\n"),
+ Prog, "-o", "-u");
usage ();
exit (E_USAGE);
}
if (mflg && !dflg) {
fprintf (stderr,
- _("%s: %s flag is only allowed with the %s flag\n"),
- Prog, "-m", "-d");
+ _("%s: %s flag is only allowed with the %s flag\n"),
+ Prog, "-m", "-d");
usage ();
exit (E_USAGE);
}
/* 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"),
- Prog, (unsigned long) user_newid);
+ fprintf (stderr,
+ _("%s: UID '%lu' already exists\n"),
+ Prog, (unsigned long) user_newid);
exit (E_UID_IN_USE);
}
}
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);
}
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
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 */
}
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)) {
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);
}
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
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
*/
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);
}
}
if (access (user_newhome, F_OK) == 0) {
- fprintf (stderr, _("%s: directory %s exists\n"),
- Prog, user_newhome);
+ fprintf (stderr,
+ _("%s: directory %s exists\n"),
+ Prog, user_newhome);
fail_exit (E_HOMEDIR);
} else if (rename (user_home, user_newhome) != 0) {
if (errno == EXDEV) {
}
if (chown (user_newhome, sb.st_uid, sb.st_gid) != 0) {
fprintf (stderr,
- _("%s: can't chown %s\n"),
- Prog, user_newhome);
+ _("%s: can't chown %s\n"),
+ Prog, user_newhome);
rmdir (user_newhome);
fail_exit (E_HOMEDIR);
}
if (copy_tree (user_home, user_newhome,
- uflg ? (long int)user_newid : -1,
- gflg ? (long int)user_newgid : -1) == 0) {
+ uflg ? (long int)user_newid : -1,
+ 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"),
- Prog, user_home);
+ _("%s: warning: failed to completely remove old home directory %s"),
+ Prog, user_home);
}
#ifdef WITH_AUDIT
audit_logger (AUDIT_USER_CHAUTHTOK,
if (st.st_uid != user_id) {
/* better leave it alone */
fprintf (stderr, _("%s: warning: %s not owned by %s\n"),
- Prog, mailfile, user_name);
+ Prog, mailfile, user_name);
close (fd);
return;
}
if (lflg) {
snprintf (newmailfile, sizeof newmailfile, "%s/%s",
- maildir, user_newname);
+ maildir, user_newname);
if ( (link (mailfile, newmailfile) != 0)
|| (unlink (mailfile) != 0)) {
perror (_("failed to rename mailbox"));