* src/chage.c: Add the arguments' names in the functions

prototypes.
	* src/chage.c: The ID argument of audit_logger is an unsigned
	int. Use AUDIT_NO_ID instead of -1.
	* src/chage.c: print_date() received a time_t.
	* src/chage.c: Use SHADOW_SP_FLAG_UNSET for the initial
	value of spwent.sp_flag.
This commit is contained in:
nekral-guest 2008-06-13 21:23:09 +00:00
parent 42a4604461
commit fe753e24a3
2 changed files with 36 additions and 24 deletions

View File

@ -1,3 +1,13 @@
2008-06-13 Nicolas François <nicolas.francois@centraliens.net>
* src/chage.c: Add the arguments' names in the functions
prototypes.
* src/chage.c: The ID argument of audit_logger is an unsigned
int. Use AUDIT_NO_ID instead of -1.
* src/chage.c: print_date() received a time_t.
* src/chage.c: Use SHADOW_SP_FLAG_UNSET for the initial
value of spwent.sp_flag.
2008-06-13 Nicolas François <nicolas.francois@centraliens.net> 2008-06-13 Nicolas François <nicolas.francois@centraliens.net>
* src/groupadd.c: The ID argument of audit_logger is an unsigned * src/groupadd.c: The ID argument of audit_logger is an unsigned

View File

@ -92,9 +92,9 @@ static pam_handle_t *pamh = NULL;
/* local function prototypes */ /* local function prototypes */
static bool isnum (const char *s); static bool isnum (const char *s);
static void usage (void); static void usage (void);
static void date_to_str (char *, size_t, time_t); static void date_to_str (char *buf, size_t maxsize, time_t date);
static int new_fields (void); static int new_fields (void);
static void print_date (time_t); static void print_date (time_t date);
static void list_fields (void); static void list_fields (void);
static void process_flags (int argc, char **argv); static void process_flags (int argc, char **argv);
static void check_flags (int argc, int opt_index); static void check_flags (int argc, int opt_index);
@ -118,8 +118,9 @@ static void fail_exit (int code)
#ifdef WITH_AUDIT #ifdef WITH_AUDIT
if (E_SUCCESS != code) { if (E_SUCCESS != code) {
audit_logger (AUDIT_USER_CHAUTHTOK, Prog, "change age", audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
user_name, user_uid, 0); "change age",
user_name, (unsigned int) user_uid, 0);
} }
#endif #endif
@ -307,7 +308,7 @@ static void list_fields (void)
puts (_("password must be changed")); puts (_("password must be changed"));
} else { } else {
changed = lastday * SCALE; changed = lastday * SCALE;
print_date (changed); print_date ((time_t) changed);
} }
/* /*
@ -320,7 +321,7 @@ static void list_fields (void)
puts (_("never")); puts (_("never"));
} else { } else {
expires = changed + maxdays * SCALE; expires = changed + maxdays * SCALE;
print_date (expires); print_date ((time_t) expires);
} }
/* /*
@ -335,7 +336,7 @@ static void list_fields (void)
puts (_("never")); puts (_("never"));
} else { } else {
expires = changed + (maxdays + inactdays) * SCALE; expires = changed + (maxdays + inactdays) * SCALE;
print_date (expires); print_date ((time_t) expires);
} }
/* /*
@ -347,7 +348,7 @@ static void list_fields (void)
puts (_("never")); puts (_("never"));
} else { } else {
expires = expdays * SCALE; expires = expdays * SCALE;
print_date (expires); print_date ((time_t) expires);
} }
/* /*
@ -631,7 +632,7 @@ static void update_age (const struct spwd *sp, const struct passwd *pw)
memzero (&spwent, sizeof spwent); memzero (&spwent, sizeof spwent);
spwent.sp_namp = xstrdup (pw->pw_name); spwent.sp_namp = xstrdup (pw->pw_name);
spwent.sp_pwdp = xstrdup (pw->pw_passwd); spwent.sp_pwdp = xstrdup (pw->pw_passwd);
spwent.sp_flag = -1; spwent.sp_flag = SHADOW_SP_FLAG_UNSET;
pwent.pw_passwd = SHADOW_PASSWD_STRING; /* XXX warning: const */ pwent.pw_passwd = SHADOW_PASSWD_STRING; /* XXX warning: const */
if (pw_update (&pwent) == 0) { if (pw_update (&pwent) == 0) {
@ -818,8 +819,9 @@ int main (int argc, char **argv)
fail_exit (E_NOPERM); fail_exit (E_NOPERM);
} }
#ifdef WITH_AUDIT #ifdef WITH_AUDIT
audit_logger (AUDIT_USER_CHAUTHTOK, Prog, "display aging info", audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
user_name, user_uid, 1); "display aging info",
user_name, (unsigned int) user_uid, 1);
#endif #endif
list_fields (); list_fields ();
fail_exit (E_SUCCESS); fail_exit (E_SUCCESS);
@ -841,40 +843,40 @@ int main (int argc, char **argv)
else { else {
audit_logger (AUDIT_USER_CHAUTHTOK, Prog, audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
"change all aging information", "change all aging information",
user_name, user_uid, 1); user_name, (unsigned int) user_uid, 1);
} }
#endif #endif
} else { } else {
#ifdef WITH_AUDIT #ifdef WITH_AUDIT
if (Mflg) { if (Mflg) {
audit_logger (AUDIT_USER_CHAUTHTOK, Prog, audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
"change max age", user_name, "change max age",
user_uid, 1); user_name, (unsigned int) user_uid, 1);
} }
if (mflg) { if (mflg) {
audit_logger (AUDIT_USER_CHAUTHTOK, Prog, audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
"change min age", user_name, "change min age",
user_uid, 1); user_name, (unsigned int) user_uid, 1);
} }
if (dflg) { if (dflg) {
audit_logger (AUDIT_USER_CHAUTHTOK, Prog, audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
"change last change date", user_name, "change last change date",
user_uid, 1); user_name, (unsigned int) user_uid, 1);
} }
if (Wflg) { if (Wflg) {
audit_logger (AUDIT_USER_CHAUTHTOK, Prog, audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
"change passwd warning", user_name, "change passwd warning",
user_uid, 1); user_name, (unsigned int) user_uid, 1);
} }
if (Iflg) { if (Iflg) {
audit_logger (AUDIT_USER_CHAUTHTOK, Prog, audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
"change inactive days", user_name, "change inactive days",
user_uid, 1); user_name, (unsigned int) user_uid, 1);
} }
if (Eflg) { if (Eflg) {
audit_logger (AUDIT_USER_CHAUTHTOK, Prog, audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
"change passwd expiration", user_name, "change passwd expiration",
user_uid, 1); user_name, (unsigned int) user_uid, 1);
} }
#endif #endif
} }