From: nekral-guest Date: Sat, 19 Nov 2011 14:27:48 +0000 (+0000) Subject: * src/gpasswd.c: Change of group password enforces gshadow X-Git-Tag: 4.1.5~43 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=653d22c3e97b39eba8696c56b1f8decb05e29db9;p=thirdparty%2Fshadow.git * src/gpasswd.c: Change of group password enforces gshadow password. Set /etc/group password to "x". --- diff --git a/ChangeLog b/ChangeLog index 5c30001a7..168308af0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-11-16 Nicolas François + + * src/gpasswd.c: Change of group password enforces gshadow + password. Set /etc/group password to "x". + 2011-11-16 Peter Vrabec * NEWS, src/userdel.c, man/userdel.8.xml: Add option -Z/--selinux-user. diff --git a/src/gpasswd.c b/src/gpasswd.c index 1b830346e..0015dc41f 100644 --- a/src/gpasswd.c +++ b/src/gpasswd.c @@ -941,6 +941,7 @@ static void change_passwd (struct group *gr) memzero (pass, sizeof pass); #ifdef SHADOWGRP if (is_shadowgrp) { + gr->gr_passwd = SHADOW_PASSWD_STRING; sg->sg_passwd = cp; } else #endif @@ -1041,20 +1042,30 @@ int main (int argc, char **argv) * field to a "". */ if (rflg) { - grent.gr_passwd = ""; /* XXX warning: const */ #ifdef SHADOWGRP - sgent.sg_passwd = ""; /* XXX warning: const */ -#endif + if (is_shadowgrp) { + grent.gr_passwd = SHADOW_PASSWD_STRING; /* XXX warning: const */ + sgent.sg_passwd = ""; /* XXX warning: const */ + } else +#endif /* SHADOWGRP */ + { + grent.gr_passwd = ""; /* XXX warning: const */ + } goto output; } else if (Rflg) { /* * Same thing for restricting the group. Set the password * field to "!". */ - grent.gr_passwd = "!"; /* XXX warning: const */ #ifdef SHADOWGRP - sgent.sg_passwd = "!"; /* XXX warning: const */ -#endif + if (is_shadowgrp) { + grent.gr_passwd = SHADOW_PASSWD_STRING; /* XXX warning: const */ + sgent.sg_passwd = "!"; /* XXX warning: const */ + } else +#endif /* SHADOWGRP */ + { + grent.gr_passwd = "!"; /* XXX warning: const */ + } goto output; }