* src/usermod.c: date_to_str() is always called with negativ set

to "never", remove this argument.
	* src/usermod.c: Added missing cast for gr_free argument.
This commit is contained in:
nekral-guest 2011-09-18 17:34:21 +00:00
parent 4ce849a5ed
commit 603d949ed5
2 changed files with 15 additions and 9 deletions

View File

@ -1,3 +1,9 @@
2011-09-18 Nicolas François <nicolas.francois@centraliens.net>
* src/usermod.c: date_to_str() is always called with negativ set
to "never", remove this argument.
* src/usermod.c: Added missing cast for gr_free argument.
2011-09-18 Nicolas François <nicolas.francois@centraliens.net> 2011-09-18 Nicolas François <nicolas.francois@centraliens.net>
* src/pwconv.c: Fail if not called correctly. * src/pwconv.c: Fail if not called correctly.

View File

@ -150,7 +150,7 @@ static bool sgr_locked = false;
/* local function prototypes */ /* local function prototypes */
static void date_to_str (/*@unique@*//*@out@*/char *buf, size_t maxsize, static void date_to_str (/*@unique@*//*@out@*/char *buf, size_t maxsize,
long int date, const char *negativ); long int date);
static int get_groups (char *); static int get_groups (char *);
static /*@noreturn@*/void usage (int status); static /*@noreturn@*/void usage (int status);
static void new_pwent (struct passwd *); static void new_pwent (struct passwd *);
@ -180,12 +180,12 @@ static void move_mailbox (void);
#endif #endif
static void date_to_str (/*@unique@*//*@out@*/char *buf, size_t maxsize, static void date_to_str (/*@unique@*//*@out@*/char *buf, size_t maxsize,
long int date, const char *negativ) long int date)
{ {
struct tm *tp; struct tm *tp;
if ((negativ != NULL) && (date < 0)) { if (date < 0) {
strncpy (buf, negativ, maxsize); strncpy (buf, "never", maxsize);
} else { } else {
time_t t = (time_t) date; time_t t = (time_t) date;
tp = gmtime (&t); tp = gmtime (&t);
@ -273,7 +273,7 @@ static int get_groups (char *list)
fprintf (stderr, fprintf (stderr,
_("%s: group '%s' is a NIS group.\n"), _("%s: group '%s' is a NIS group.\n"),
Prog, grp->gr_name); Prog, grp->gr_name);
gr_free (grp); gr_free ((struct group *)grp);
continue; continue;
} }
#endif #endif
@ -282,7 +282,7 @@ static int get_groups (char *list)
fprintf (stderr, fprintf (stderr,
_("%s: too many groups specified (max %d).\n"), _("%s: too many groups specified (max %d).\n"),
Prog, ngroups); Prog, ngroups);
gr_free (grp); gr_free ((struct group *)grp);
break; break;
} }
@ -290,7 +290,7 @@ static int get_groups (char *list)
* Add the group name to the user's list of groups. * Add the group name to the user's list of groups.
*/ */
user_groups[ngroups++] = xstrdup (grp->gr_name); user_groups[ngroups++] = xstrdup (grp->gr_name);
gr_free (grp); gr_free ((struct group *)grp);
} while (NULL != list); } while (NULL != list);
user_groups[ngroups] = (char *) 0; user_groups[ngroups] = (char *) 0;
@ -524,9 +524,9 @@ static void new_spent (struct spwd *spent)
/* log dates rather than numbers of days. */ /* log dates rather than numbers of days. */
char new_exp[16], old_exp[16]; char new_exp[16], old_exp[16];
date_to_str (new_exp, sizeof(new_exp), date_to_str (new_exp, sizeof(new_exp),
user_newexpire * DAY, "never"); user_newexpire * DAY);
date_to_str (old_exp, sizeof(old_exp), date_to_str (old_exp, sizeof(old_exp),
user_expire * DAY, "never"); user_expire * DAY);
#ifdef WITH_AUDIT #ifdef WITH_AUDIT
audit_logger (AUDIT_USER_CHAUTHTOK, Prog, audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
"changing expiration date", "changing expiration date",