Files
shadow/debian/patches/462_warn_to_edit_shadow
T
nekral-guest 39beb1da3a 105_zn_CN was just applied to upstream repository.
Tag 104_man-sv, 101_ja, and 103_man-de as going to be fixed in 4.0.18.2.
2007-10-27 12:51:13 +00:00

69 lines
1.6 KiB
Plaintext

Goal: Warn about possible need to edit shadow files when editing the
master files with vipw
Fixes: #62821
Status wrt upstream: Forwarded but not applied yet
Index: shadow-4.0.18.1/src/vipw.c
===================================================================
--- shadow-4.0.18.1.orig/src/vipw.c 2006-06-20 22:00:04.000000000 +0200
+++ shadow-4.0.18.1/src/vipw.c 2006-09-17 12:18:03.644082321 +0200
@@ -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,39 @@
}
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");