diff --git a/ChangeLog b/ChangeLog index e7c991fe..36e3156f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-12-27 Nicolas François + + 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 Merge Debian's patch 451_login_PATH diff --git a/NEWS b/NEWS index 0a740510..f2c64872 100644 --- 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 diff --git a/src/vipw.c b/src/vipw.c index b8ff1e4c..630e1226 100644 --- a/src/vipw.c +++ b/src/vipw.c @@ -41,6 +41,12 @@ #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");