--- shadow-4.0.11.1/src/groupadd.c.vipw 2005-07-19 11:50:45.000000000 +0000 +++ shadow-4.0.11.1/src/groupadd.c 2005-08-04 15:14:58.000000000 +0000 @@ -438,6 +451,7 @@ int main (int argc, char **argv) { + struct stat s; #ifdef USE_PAM pam_handle_t *pamh = NULL; struct passwd *pampw; @@ -492,6 +506,11 @@ OPENLOG ("groupadd"); #endif /* USE_PAM */ + if (stat("/etc/gtmp", &s) == 0) { + fputs("vigr lockfile (/etc/gtmp) is present.\n", stderr); + fail_exit(1); + } + #ifdef SHADOWGRP is_shadow_grp = sgr_file_present (); #endif --- shadow-4.0.11.1/src/userdel.c.vipw 2005-08-04 15:16:06.000000000 +0000 +++ shadow-4.0.11.1/src/userdel.c 2005-08-04 15:18:15.000000000 +0000 @@ -577,6 +577,7 @@ struct group *grp; int arg; int errors = 0; + struct stat s; #ifdef USE_PAM pam_handle_t *pamh = NULL; @@ -637,6 +638,11 @@ OPENLOG ("userdel"); + if (stat("/etc/ptmp", &s) == 0) { + fputs("vipw lockfile (/etc/ptmp) is present.\n", stderr); + fail_exit(1); + } + is_shadow_pwd = spw_file_present (); #ifdef SHADOWGRP is_shadow_grp = sgr_file_present (); --- shadow-4.0.11.1/src/groupmod.c.vipw 2005-08-04 15:20:09.000000000 +0000 +++ shadow-4.0.11.1/src/groupmod.c 2005-08-04 15:21:27.000000000 +0000 @@ -407,6 +407,7 @@ int main (int argc, char **argv) { struct group *grp; + struct stat s; #ifdef USE_PAM pam_handle_t *pamh = NULL; @@ -458,6 +459,11 @@ } #endif /* USE_PAM */ + if (stat("/etc/gtmp", &s) == 0) { + fputs("vigr lockfile (/etc/gtmp) is present.\n", stderr); + exit(1); + } + OPENLOG ("groupmod"); #ifdef SHADOWGRP --- shadow-4.0.11.1/src/groupdel.c.vipw 2005-08-04 15:22:00.000000000 +0000 +++ shadow-4.0.11.1/src/groupdel.c 2005-08-04 15:23:10.000000000 +0000 @@ -222,6 +222,7 @@ int main (int argc, char **argv) { struct group *grp; + struct stat s; #ifdef USE_PAM pam_handle_t *pamh = NULL; @@ -276,6 +277,11 @@ } #endif /* USE_PAM */ + if (stat("/etc/gtmp", &s) == 0) { + fputs("vigr lockfile (/etc/gtmp) is present.\n", stderr); + exit(1); + } + OPENLOG ("groupdel"); #ifdef SHADOWGRP --- shadow-4.0.11.1/src/usermod.c.vipw 2005-08-04 15:23:30.000000000 +0000 +++ shadow-4.0.11.1/src/usermod.c 2005-08-04 15:25:31.000000000 +0000 @@ -1224,6 +1224,7 @@ int main (int argc, char **argv) { int grp_err = 0; + struct stat s; #ifdef USE_PAM pam_handle_t *pamh = NULL; @@ -1245,6 +1246,12 @@ user_groups[0] = (char *) 0; OPENLOG ("usermod"); + + if (stat("/etc/ptmp", &s) == 0) { + fputs("vipw lockfile (/etc/ptmp) is present.\n", stderr); + fail_exit(1); + } + is_shadow_pwd = spw_file_present (); #ifdef SHADOWGRP --- shadow-4.0.11.1/src/useradd.c.vipw 2005-08-04 15:25:54.000000000 +0000 +++ shadow-4.0.11.1/src/useradd.c 2005-08-04 15:28:42.000000000 +0000 @@ -1651,6 +1651,7 @@ int main (int argc, char **argv) { + struct stat s; #ifdef USE_PAM pam_handle_t *pamh = NULL; struct passwd *pampw; @@ -1669,6 +1670,11 @@ OPENLOG ("useradd"); + if (stat("/etc/ptmp", &s) == 0) { + fputs("vipw lockfile (/etc/ptmp) is present.\n", stderr); + fail_exit(1); + } + sys_ngroups = sysconf (_SC_NGROUPS_MAX); user_groups = malloc ((1 + sys_ngroups) * sizeof (char *));