+2008-08-26 Nicolas François <nicolas.francois@centraliens.net>
+
+ * src/groupmems.c: When removing an user, check if deluser is on
+ the list, not adduser. This fixes a segmentation fault for every
+ call of groupmems -d.
+ * libmisc/list.c: Add assertions to help identifying these issues.
+ * libmisc/list.c: Avoid implicit conversion of pointers to
+ booleans.
+
2008-08-26 Nicolas François <nicolas.francois@centraliens.net>
* NEWS, src/groupmems.c: Use the "groupmems" PAM service name
group.
* Added syslog support.
* Use the groupmems PAM service name instead of groupmod.
+ * Fix segmentation faults when adding or removing users from a group.
- newusers
* Implement the -r, --system option.
- passwd
int i;
char **tmp;
+ assert (NULL != member);
+
/*
* Scan the list for the new name. Return the original list
* pointer if it is present.
int i, j;
char **tmp;
+ assert (NULL != member);
+
/*
* Scan the list for the old name. Return the original list
* pointer if it is not present.
int i;
char **tmp;
- for (i = 0; list[i]; i++);
+ for (i = 0; NULL != list[i]; i++);
tmp = (char **) xmalloc ((i + 1) * sizeof (char *));
i = 0;
- while (*list) {
+ while (NULL != *list) {
tmp[i] = xstrdup (*list);
i++;
list++;
bool is_on_list (char *const *list, const char *member)
{
- while (*list) {
+ assert (NULL != member);
+
+ while (NULL != *list) {
if (strcmp (*list, member) == 0) {
return true;
}
list++;
}
+
return false;
}
int i;
char *cp, *cp2;
+ assert (NULL != comma);
+
/*
* Make a copy since we are going to be modifying the list
*/
fail_exit (13);
}
} else if (NULL != deluser) {
- if (!is_on_list (grp->gr_mem, adduser)) {
+ if (!is_on_list (grp->gr_mem, deluser)) {
fprintf (stderr,
_("%s: user '%s' is not a member of '%s'\n"),
Prog, deluser, grp->gr_name);