]> granicus.if.org Git - shadow/commitdiff
* src/gpasswd.c: Change of group password enforces gshadow
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sat, 19 Nov 2011 14:27:48 +0000 (14:27 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sat, 19 Nov 2011 14:27:48 +0000 (14:27 +0000)
password. Set /etc/group password to "x".

ChangeLog
src/gpasswd.c

index 5c30001a796d57af4d0e4c1f93b631e537d5a19a..168308af03218a6723fe590272f73512505c4976 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-11-16  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * src/gpasswd.c: Change of group password enforces gshadow
+       password. Set /etc/group password to "x".
+
 2011-11-16  Peter Vrabec  <pvrabec@redhat.com>
 
        * NEWS, src/userdel.c, man/userdel.8.xml: Add option -Z/--selinux-user.
index 1b830346e958f309f48ef98a096ba6a54f85019f..0015dc41f72c72bc48f43cb18a029cdba75ef802 100644 (file)
@@ -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;
        }