From 17deaa39f5b5ed08b1ace6133e94d92562109418 Mon Sep 17 00:00:00 2001 From: nekral-guest Date: Fri, 18 May 2012 18:56:24 +0000 Subject: [PATCH] * NEWS, src/userdel.c: Fix segfault when userdel removes the user's group. --- ChangeLog | 5 +++++ NEWS | 2 ++ src/userdel.c | 12 ++++++------ 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index feb9dc65..f9eba533 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012-05-18 Nicolas François + + * NEWS, src/userdel.c: Fix segfault when userdel removes the + user's group. + 2012-05-17 Nicolas François * NEWS, src/login.c: Log in utmp / utmpx / wtmp also when PAM is diff --git a/NEWS b/NEWS index 68c2302b..4501df95 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,8 @@ shadow-4.1.5 -> shadow-4.1.5.1 UNRELEASED - login * Log into utmp(x) when PAM is enabled, but do not log into wtmp. This complete pam_lastlog which logs into wtmp and in into utmp(x). +- userdel + * Fix segfault when userdel removes the user's group. shadow-4.1.4.3 -> shadow-4.1.5 2012-02-12 diff --git a/src/userdel.c b/src/userdel.c index 63c107bf..8f731a59 100644 --- a/src/userdel.c +++ b/src/userdel.c @@ -333,22 +333,22 @@ static void remove_usergroup (void) * We can remove this group, it is not the primary * group of any remaining user. */ - if (gr_remove (grp->gr_name) == 0) { + if (gr_remove (user_name) == 0) { fprintf (stderr, _("%s: cannot remove entry '%s' from %s\n"), - Prog, grp->gr_name, gr_dbname ()); + Prog, user_name, gr_dbname ()); fail_exit (E_GRP_UPDATE); } #ifdef WITH_AUDIT audit_logger (AUDIT_DEL_GROUP, Prog, "deleting group", - grp->gr_name, AUDIT_NO_ID, + user_name, AUDIT_NO_ID, SHADOW_AUDIT_SUCCESS); #endif /* WITH_AUDIT */ SYSLOG ((LOG_INFO, "removed group '%s' owned by '%s'\n", - grp->gr_name, user_name)); + user_name, user_name)); #ifdef SHADOWGRP if (sgr_locate (user_name) != NULL) { @@ -361,12 +361,12 @@ static void remove_usergroup (void) #ifdef WITH_AUDIT audit_logger (AUDIT_DEL_GROUP, Prog, "deleting shadow group", - grp->gr_name, AUDIT_NO_ID, + user_name, AUDIT_NO_ID, SHADOW_AUDIT_SUCCESS); #endif /* WITH_AUDIT */ SYSLOG ((LOG_INFO, "removed shadow group '%s' owned by '%s'\n", - grp->gr_name, user_name)); + user_name, user_name)); } #endif /* SHADOWGRP */