]> granicus.if.org Git - shadow/commitdiff
Recommend editing the shadowed (resp. regular) file if the regular (resp.
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Wed, 26 Dec 2007 23:43:55 +0000 (23:43 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Wed, 26 Dec 2007 23:43:55 +0000 (23:43 +0000)
shadowed) file was edited.

ChangeLog
NEWS
src/vipw.c

index e7c991fe1b45f2b8293b6cfeb6fb10d5053e4751..36e3156f17bf1fdd5b86b97a043048a21cbaec64 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-12-27  Nicolas François  <nicolas.francois@centraliens.net>
+
+       Merge Debian's patch 462_warn_to_edit_shadow
+       * NEW, src/vipw.c: Recommend editing the shadowed (resp. regular) file
+       if the regular (resp. shadowed) file was edited.
+
 2007-12-26  Nicolas François  <nicolas.francois@centraliens.net>
 
        Merge Debian's patch 451_login_PATH
diff --git a/NEWS b/NEWS
index 0a740510c5a58325f37dda232478f5d87d35cde8..f2c6487226379716331503f314b7b2b8840fb2c2 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -25,6 +25,9 @@ shadow-4.1.0 -> shadow-4.1.1                                          UNRELEASED
 - login
   * Use PATH and SUPATH to set the PATH environment variable, even when
     support for PAM is enabled.
+- vipw/vigr
+  * Recommend editing the shadowed (resp. regular) file if the regular (resp.
+    shadowed) file was edited.
 
 shadow-4.0.18.2 -> shadow-4.1.0                                                09-12-2008
 
index b8ff1e4cbb283a9ea7df56a06afc5f65e146a365..630e12260ffd51e070421991b0749c2077db2249 100644 (file)
 #include "pwio.h"
 #include "sgroupio.h"
 #include "shadowio.h"
+
+#define MSG_WARN_EDIT_OTHER_FILE _( \
+       "You have modified %s.\n"\
+       "You may need to modify %s for consistency.\n"\
+       "Please use the command `%s' to do so.\n")
+
 /*
  * Global variables
  */
@@ -285,17 +291,41 @@ int main (int argc, char **argv)
        }
 
        if (do_vipw) {
-               if (editshadow)
+               if (editshadow) {
                        vipwedit (SHADOW_FILE, spw_lock, spw_unlock);
-               else
+                       printf (MSG_WARN_EDIT_OTHER_FILE,
+                               SHADOW_FILE,
+                               PASSWD_FILE,
+                               "vipw");
+               } else {
                        vipwedit (PASSWD_FILE, pw_lock, pw_unlock);
+                       if (spw_file_present ()) {
+                               printf (MSG_WARN_EDIT_OTHER_FILE,
+                                       PASSWD_FILE,
+                                       SHADOW_FILE,
+                                       "vipw -s");
+                       }
+               }
        } else {
 #ifdef SHADOWGRP
-               if (editshadow)
+               if (editshadow) {
                        vipwedit (SGROUP_FILE, sgr_lock, sgr_unlock);
-               else
+                       printf (MSG_WARN_EDIT_OTHER_FILE,
+                               SGROUP_FILE,
+                               GROUP_FILE,
+                               "vigr");
+               } else {
 #endif
                        vipwedit (GROUP_FILE, gr_lock, gr_unlock);
+#ifdef SHADOWGRP
+                       if (sgr_file_present ()) {
+                               printf (MSG_WARN_EDIT_OTHER_FILE,
+                                       GROUP_FILE,
+                                       SGROUP_FILE,
+                                       "vigr -s");
+                       }
+#endif
+               }
        }
 
        nscd_flush_cache ("passwd");