#endif
#ifdef WITH_AUDIT
- audit_logger (AUDIT_USER_CHAUTHTOK, Prog, "adding user", user_name, -1,
- 0);
+ audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
+ "adding user",
+ user_name, AUDIT_NO_ID, 0);
#endif
SYSLOG ((LOG_INFO, "failed adding user `%s', data deleted", user_name));
exit (code);
char *errptr;
gid = strtol (grname, &errptr, 10);
- if (*grname != '\0' && *errptr == '\0' && errno != ERANGE && gid >= 0)
- return xgetgrgid (gid);
+ if (*grname != '\0' && *errptr == '\0' && errno != ERANGE && gid >= 0) {
+ return xgetgrgid ((gid_t) gid);
+ }
return xgetgrnam (grname);
}
uidstr);
exit (E_BAD_ARG);
}
- return val;
+ return (uid_t) val;
}
#define MATCH(x,y) (strncmp((x),(y),strlen(y)) == 0)
* Read the file a line at a time. Only the lines that have relevant
* values are used, everything else can be ignored.
*/
- while (fgets (buf, sizeof buf, fp) == buf) {
+ while (fgets (buf, (int) sizeof buf, fp) == buf) {
cp = strrchr (buf, '\n');
if (NULL != cp) {
*cp = '\0';
goto skip;
}
- while (fgets (buf, sizeof buf, ifp) == buf) {
+ while (fgets (buf, (int) sizeof buf, ifp) == buf) {
cp = strrchr (buf, '\n');
if (NULL != cp) {
*cp = '\0';
return -1;
}
#ifdef WITH_AUDIT
- audit_logger (AUDIT_USER_CHAUTHTOK, Prog, "changing user defaults",
- NULL, -1, 1);
+ audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
+ "changing user defaults",
+ NULL, AUDIT_NO_ID, 1);
#endif
SYSLOG ((LOG_INFO,
"useradd defaults: GROUP=%u, HOME=%s, SHELL=%s, INACTIVE=%ld, "
memzero (spent, sizeof *spent);
spent->sp_namp = (char *) user_name;
spent->sp_pwdp = (char *) user_pass;
- spent->sp_lstchg = time ((time_t *) 0) / SCALE;
+ spent->sp_lstchg = (long) time ((time_t *) 0) / SCALE;
if (!rflg) {
spent->sp_min = scale_age (getdef_num ("PASS_MIN_DAYS", -1));
spent->sp_max = scale_age (getdef_num ("PASS_MAX_DAYS", -1));
spent->sp_inact = scale_age (-1);
spent->sp_expire = scale_age (-1);
}
- spent->sp_flag = -1;
+ spent->sp_flag = SHADOW_SP_FLAG_UNSET;
}
/*
}
#ifdef WITH_AUDIT
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
- "adding user to group", user_name, -1, 1);
+ "adding user to group",
+ user_name, AUDIT_NO_ID, 1);
#endif
SYSLOG ((LOG_INFO, "add `%s' to group `%s'",
user_name, ngrp->gr_name));
}
#ifdef WITH_AUDIT
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
- "adding user to shadow group", user_name, -1, 1);
+ "adding user to shadow group",
+ user_name, AUDIT_NO_ID, 1);
#endif
SYSLOG ((LOG_INFO, "add `%s' to shadow group `%s'",
user_name, nsgrp->sg_name));
("%s: invalid user name '%s'\n"),
Prog, user_name);
#ifdef WITH_AUDIT
- audit_logger (AUDIT_USER_CHAUTHTOK, Prog, "adding user",
- user_name, -1, 0);
+ audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
+ "adding user",
+ user_name, AUDIT_NO_ID, 0);
#endif
exit (E_BAD_ARG);
}
fprintf (stderr, _("%s: unable to lock password file\n"), Prog);
#ifdef WITH_AUDIT
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
- "locking password file", user_name, user_id, 0);
+ "locking password file",
+ user_name, (unsigned int) user_id, 0);
#endif
exit (E_PW_UPDATE);
}
fprintf (stderr, _("%s: unable to open password file\n"), Prog);
#ifdef WITH_AUDIT
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
- "opening password file", user_name, user_id, 0);
+ "opening password file",
+ user_name, (unsigned int) user_id, 0);
#endif
fail_exit (E_PW_UPDATE);
}
Prog);
#ifdef WITH_AUDIT
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
- "locking shadow password file", user_name,
- user_id, 0);
+ "locking shadow password file",
+ user_name, (unsigned int) user_id, 0);
#endif
fail_exit (E_PW_UPDATE);
}
Prog);
#ifdef WITH_AUDIT
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
- "opening shadow password file", user_name,
- user_id, 0);
+ "opening shadow password file",
+ user_name, (unsigned int) user_id, 0);
#endif
fail_exit (E_PW_UPDATE);
}
Prog);
#ifdef WITH_AUDIT
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
- "adding shadow password", user_name, user_id, 0);
+ "adding shadow password",
+ user_name, (unsigned int) user_id, 0);
#endif
fail_exit (E_PW_UPDATE);
}
#ifdef WITH_AUDIT
- audit_logger (AUDIT_USER_CHAUTHTOK, Prog, "adding user", user_name,
- user_id, 1);
+ audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
+ "adding user",
+ user_name, (unsigned int) user_id, 1);
#endif
/*
Prog, user_home);
#ifdef WITH_AUDIT
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
- "adding home directory", user_name,
- user_id, 0);
+ "adding home directory",
+ user_name, (unsigned int) user_id, 0);
#endif
fail_exit (E_HOMEDIR);
}
home_added = true;
#ifdef WITH_AUDIT
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
- "adding home directory", user_name, user_id, 1);
+ "adding home directory",
+ user_name, (unsigned int) user_id, 1);
#endif
}
}
if (getpwnam (user_name) != NULL) { /* local, no need for xgetpwnam */
fprintf (stderr, _("%s: user %s exists\n"), Prog, user_name);
#ifdef WITH_AUDIT
- audit_logger (AUDIT_USER_CHAUTHTOK, Prog, "adding user",
- user_name, -1, 0);
+ audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
+ "adding user",
+ user_name, AUDIT_NO_ID, 0);
#endif
fail_exit (E_NAME_IN_USE);
}
Prog, user_name);
#ifdef WITH_AUDIT
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
- "adding group", user_name, -1, 0);
+ "adding group",
+ user_name, AUDIT_NO_ID, 0);
#endif
fail_exit (E_NAME_IN_USE);
}
}
} else {
if (getpwuid (user_id) != NULL) {
- fprintf (stderr, _("%s: UID %u is not unique\n"), Prog, (unsigned int) user_id);
+ fprintf (stderr,
+ _("%s: UID %lu is not unique\n"),
+ Prog, (unsigned long) user_id);
#ifdef WITH_AUDIT
- audit_logger (AUDIT_USER_CHAUTHTOK, Prog, "adding user", user_name, user_id, 0);
+ audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
+ "adding user",
+ user_name, (unsigned int) user_id, 0);
#endif
fail_exit (E_UID_IN_USE);
}