[Pkg-shadow-devel] Re: [Pkg-shadow-commits] r814 - trunk/debian/patches

Alexander Gattin xrgtn at yandex.ru
Tue Jan 17 22:17:10 UTC 2006


Hi!

I have prepared 3 patches which I think are useful for
upstream. Here are my explanations:

484_su-p_preserve_PATH

1. this patch is initially for fixing bug #347935
   (http://bugs.debian.org/347935) in "su".

   Problem was in su.c, shell() and environment handling.
   There are "environ" and "newenvp" global variables.
   Code in su.c uses addenv() for modifying "newenvp".
   When -p/-m flag is given to "su", it keeps
   "environ", otherwise switches to "newenvp". Finally,
   it runs command or shell, using shell() function.
   shell() always uses "newenvp" so it ignores -m/-p

   This is classical example of why global variables
   are bad. The patch replaces shell(...) with
   shelle(..., envp) i.e. passes environment explicitly

2. it's better to return error code from shelle() and
   let outer code to decide/exit(), than to call exit()
   from inside of shelle().

3. 127/126 exitcodes are given names of E_CMD_NOTFOUND
   and E_CMD_NOEXEC respectively, resembling names
   given to them in bash header files (EX_NOTFOUND,
   EX_NOEXEC, see bash-3.1/shell.h)

   numerical 127/126 exitcodes are defined in POSIX:
   http://www.opengroup.org/onlinepubs/000095399/utilities/command.html

485_shelle-exitcodes patch is logical extension of 484th
   outside of su.c to other code in shadow.

1. all shell() calls are replaced with shelle()
2. returned code is taken into account and handled
3. almost all 127/126 exitcodes are replaced with
   E_CMD_NOTFOUND/E_CMD_NOEXEC

486_nowarn is just eliminating all warnings that
   prevent shadow to be built with "-Wall -Werror"
   options.
   
-- 
WBR,
xrgtn
-------------- next part --------------
Goal: preserve the environment when -p is used and su starts a shell
Fixes: #347935

When su -p started a shell, some environment variables were not preserved
(e.g. PATH). Problem was caused by shell() function from libmisc/shell.c
using global variable "newenvp" for passing environment, while in other
places global variable "environ" is used/assumed.

Patch replaces shell() calls in su.c with shelle() ones, which explicitly
pass environment as 3rd parameter.

Status wrt upstream: reported, but not yet accepted.

Note: On Linux, shell() doesn't provide anything significant. Just an
execv could be simplier.
shell/shelle() vs. execv() differences:
1. exits/returns EINVAL when 1st argument (name of executable) is NULL
2. when ARGV is NULL, forges argv[0] by prepending "-" to image name
3. prints "Executing shell ..." message when built with DEBUG
4. handles non-Linux ENOEXEC
5. prints "Cannot execute ..." error message when execle() fails

(1) probably isn't possible when calling shell() from su.c -- it's always
being provided with executable filename.

Index: shadow-4.0.14/src/su.c
===================================================================
--- shadow-4.0.14.orig/src/su.c	2006-01-16 02:51:03.000000000 +0200
+++ shadow-4.0.14/src/su.c	2006-01-16 03:23:07.000000000 +0200
@@ -174,7 +174,8 @@
  * have been applied.  Some work was needed to get it integrated into
  * su.c from shadow.
  */
-static void run_shell (const char *shellstr, char *args[], int doshell)
+static void run_shell (const char *shellstr, char *args[], int doshell,
+		char *const envp[])
 {
 	int child;
 	sigset_t ourset;
@@ -186,9 +187,9 @@
 		pam_end (pamh, PAM_SUCCESS);
 
 		if (doshell)
-			shell (shellstr, (char *) args[0]);
+			shelle (shellstr, (char *) args[0], envp);
 		else
-			(void) execv (shellstr, (char **) args);
+			(void) execve (shellstr, (char **) args, envp);
 		{
 			int exit_status = (errno == ENOENT ? 127 : 126);
 
@@ -307,6 +308,7 @@
 	char **envp = environ;
 	char *command = 0, *shellstr = 0;
 	char *tmp_name;
+	int exit_status = 0;
 
 #ifdef USE_PAM
 	int ret;
@@ -904,19 +906,22 @@
 		 */
 		argv[-1] = cp;
 #ifndef USE_PAM
-		(void) execv (shellstr, &argv[-1]);
-#else
-		run_shell (shellstr, &argv[-1], 0);
-#endif
+		(void) execve (shellstr, &argv[-1], environ);
+		exit_status = errno == ENOENT ? 127 : 126;
 		(void) fprintf (stderr, _("No shell\n"));
 		SYSLOG ((LOG_WARN, "Cannot execute %s", shellstr));
 		closelog ();
-		exit (1);
+		exit (exit_status);
+#else
+		run_shell (shellstr, &argv[-1], 0, environ); /* no return */
+#endif
 	}
 #ifndef USE_PAM
-	shell (shellstr, cp);
+	exit_status = shelle (shellstr, cp, environ);
+	exit_status = exit_status == ENOENT ? 127 : 126;
+	exit (exit_status);
 #else
-	run_shell (shellstr, &cp, 1);
+	run_shell (shellstr, &cp, 1, environ);
 #endif
 	/* NOT REACHED */
 	exit (1);
Index: shadow-4.0.14/lib/prototypes.h
===================================================================
--- shadow-4.0.14.orig/lib/prototypes.h	2006-01-16 02:50:22.000000000 +0200
+++ shadow-4.0.14/lib/prototypes.h	2006-01-16 03:22:27.000000000 +0200
@@ -150,6 +150,7 @@
 
 /* shell.c */
 extern void shell (const char *, const char *);
+extern int shelle (const char *, const char *, char *const *);
 
 /* strtoday.c */
 extern long strtoday (const char *);
Index: shadow-4.0.14/libmisc/shell.c
===================================================================
--- shadow-4.0.14.orig/libmisc/shell.c	2006-01-16 02:50:22.000000000 +0200
+++ shadow-4.0.14/libmisc/shell.c	2006-01-16 03:24:12.000000000 +0200
@@ -38,8 +38,15 @@
 extern char **newenvp;
 extern size_t newenvc;
 
+/* shell - left here for compatibility (actually being frontend to shelle) */
+void shell (const char *file, const char *arg) {
+	int err;
+	err = shelle (file, arg, newenvp);
+	if (err) exit (1);
+}
+
 /*
- * shell - execute the named program
+ * shelle - execute the named program
  *
  *	shell begins by trying to figure out what argv[0] is going to
  *	be for the named process.  The user may pass in that argument,
@@ -51,13 +58,15 @@
  *	the file.  If all that fails, give up in disgust ...
  */
 
-void shell (const char *file, const char *arg)
+int shelle (const char *file, const char *arg, char *const envp[])
 {
 	char arg0[1024];
 	int err;
 
-	if (file == (char *) 0)
-		exit (1);
+	if (file == (char *) 0) {
+		errno = EINVAL;
+		return errno;
+	}
 
 	/*
 	 * The argv[0]'th entry is usually the path name, but
@@ -80,7 +89,7 @@
 	 * grief.
 	 */
 
-	execle (file, arg, (char *) 0, newenvp);
+	execle (file, arg, (char *) 0, envp);
 	err = errno;
 
 	/* Linux handles #! in the kernel, and bash doesn't make
@@ -100,7 +109,7 @@
 			if (getc (fp) == '#' && getc (fp) == '!') {
 				fclose (fp);
 				execle ("/bin/sh", "sh",
-					file, (char *) 0, newenvp);
+					file, (char *) 0, envp);
 				err = errno;
 			} else {
 				fclose (fp);
@@ -118,5 +127,5 @@
 	snprintf (arg0, sizeof arg0, _("Cannot execute %s"), file);
 	errno = err;
 	perror (arg0);
-	exit (1);
+	return err;
 }
-------------- next part --------------
Goal: eliminate usage of old shell() and introduce E_CMD_{NOEXEC|NOTFOUND}

Status wrt upstream: discussed, but not explicitly reported or accepted yet.

Index: shadow-4.0.14/src/sulogin.c
===================================================================
--- shadow-4.0.14.orig/src/sulogin.c	2006-01-16 03:17:34.000000000 +0200
+++ shadow-4.0.14/src/sulogin.c	2006-01-16 03:28:35.000000000 +0200
@@ -39,6 +39,7 @@
 #include "getdef.h"
 #include "prototypes.h"
 #include "pwauth.h"
+#include "exitcodes.h"
 /*
  * Global variables
  */
@@ -76,6 +77,7 @@
 	char *cp;
 	char **envp = environ;
 	TERMIO termio;
+	int err = 0;
 
 #ifdef	USE_TERMIO
 	ioctl (0, TCGETA, &termio);
@@ -220,6 +222,8 @@
 #ifdef	USE_SYSLOG
 	closelog ();
 #endif
-	shell (pwent.pw_shell, (char *) 0);	/* exec the shell finally. */
-	 /*NOTREACHED*/ return (0);
+	/* exec the shell finally. */
+	err = shelle (pwent.pw_shell, (char *) 0, environ);
+	exit (err == ENOENT ? E_CMD_NOTFOUND : E_CMD_NOEXEC);
+	/*NOTREACHED*/ return (0);
 }
Index: shadow-4.0.14/lib/exitcodes.h
===================================================================
--- shadow-4.0.14.orig/lib/exitcodes.h	2006-01-16 03:17:34.000000000 +0200
+++ shadow-4.0.14/lib/exitcodes.h	2006-01-16 03:28:12.000000000 +0200
@@ -11,3 +11,5 @@
 #define E_SHADOW_NOTFOUND	15	/* not found shadow password file */
 #define E_GROUP_NOTFOUND	16	/* not found group file */
 #define E_GSHADOW_NOTFOUND	17	/* not found shadow group file */
+#define E_CMD_NOEXEC		126	/* can't run command/shell */
+#define E_CMD_NOTFOUND		127	/* can't find command/shell to run */
Index: shadow-4.0.14/src/login.c
===================================================================
--- shadow-4.0.14.orig/src/login.c	2006-01-16 03:17:34.000000000 +0200
+++ shadow-4.0.14/src/login.c	2006-01-16 03:29:25.000000000 +0200
@@ -47,6 +47,7 @@
 #include "getdef.h"
 #include "prototypes.h"
 #include "pwauth.h"
+#include "exitcodes.h"
 #ifdef USE_PAM
 #include "pam_defs.h"
 
@@ -333,6 +334,7 @@
 	int flag;
 	int subroot = 0;
 	int is_console;
+	int err;
 	const char *cp;
 	char *tmp;
 	char fromhost[512];
@@ -1151,10 +1153,12 @@
 		SYSLOG ((LOG_INFO, "`%s' logged in %s", username, fromhost));
 #endif
 	closelog ();
-	if ((tmp = getdef_str ("FAKE_SHELL")) != NULL) {
-		shell (tmp, pwent.pw_shell);	/* fake shell */
-	}
-	shell (pwent.pw_shell, (char *) 0);	/* exec the shell finally. */
+	if ((tmp = getdef_str ("FAKE_SHELL")) != NULL)
+		err = shelle (tmp, pwent.pw_shell, newenvp); /* fake shell */
+	else
+		/* exec the shell finally */
+		err = shelle (pwent.pw_shell, (char *) 0, newenvp);
+	exit (err == ENOENT ? E_CMD_NOTFOUND : E_CMD_NOEXEC);
 	/* NOT REACHED */
 	return 0;
 }
Index: shadow-4.0.14/src/newgrp.c
===================================================================
--- shadow-4.0.14.orig/src/newgrp.c	2006-01-16 03:17:34.000000000 +0200
+++ shadow-4.0.14/src/newgrp.c	2006-01-16 03:29:52.000000000 +0200
@@ -38,9 +38,11 @@
 #include "defines.h"
 #include "getdef.h"
 #include "prototypes.h"
+#include "exitcodes.h"
 /*
  * Global variables
  */
+extern char **newenvp;
 extern char **environ;
 
 #ifdef HAVE_SETGROUPS
@@ -103,6 +105,7 @@
 	int needspasswd = 0;
 	int i;
 	int cflag = 0;
+	int err = 0;
 	gid_t gid;
 	char *cp;
 	const char *cpasswd, *name, *prog;
@@ -556,13 +559,8 @@
 		audit_logger (AUDIT_USER_START, Prog, "changing",
 			      NULL, getuid (), 0);
 #endif
-		if (errno == ENOENT) {
-			perror ("/bin/sh");
-			exit (127);
-		} else {
-			perror ("/bin/sh");
-			exit (126);
-		}
+		perror ("/bin/sh");
+		exit (errno == ENOENT ? E_CMD_NOTFOUND : E_CMD_NOEXEC);
 	}
 
 	/*
@@ -631,7 +629,8 @@
 	 * Exec the login shell and go away. We are trying to get back to
 	 * the previous environment which should be the user's login shell.
 	 */
-	shell (prog, initflag ? (char *) 0 : cp);
+	err = shelle (prog, initflag ? (char *) 0 : cp, newenvp);
+	exit (err == ENOENT ? E_CMD_NOTFOUND : E_CMD_NOEXEC);
 	/* NOTREACHED */
       failure:
 
Index: shadow-4.0.14/src/su.c
===================================================================
--- shadow-4.0.14.orig/src/su.c	2006-01-16 03:23:07.000000000 +0200
+++ shadow-4.0.14/src/su.c	2006-01-16 03:30:33.000000000 +0200
@@ -187,14 +187,10 @@
 		pam_end (pamh, PAM_SUCCESS);
 
 		if (doshell)
-			shelle (shellstr, (char *) args[0], envp);
+			(void) shelle (shellstr, (char *) args[0], envp);
 		else
 			(void) execve (shellstr, (char **) args, envp);
-		{
-			int exit_status = (errno == ENOENT ? 127 : 126);
-
-			exit (exit_status);
-		}
+		exit (errno == ENOENT ? E_CMD_NOTFOUND : E_CMD_NOEXEC);
 	} else if (child == -1) {
 		(void) fprintf (stderr, "%s: Cannot fork user shell\n", Prog);
 		SYSLOG ((LOG_WARN, "Cannot execute %s", shellstr));
@@ -308,7 +304,7 @@
 	char **envp = environ;
 	char *command = 0, *shellstr = 0;
 	char *tmp_name;
-	int exit_status = 0;
+	int err = 0;
 
 #ifdef USE_PAM
 	int ret;
@@ -907,19 +903,19 @@
 		argv[-1] = cp;
 #ifndef USE_PAM
 		(void) execve (shellstr, &argv[-1], environ);
-		exit_status = errno == ENOENT ? 127 : 126;
+		err = errno;
 		(void) fprintf (stderr, _("No shell\n"));
 		SYSLOG ((LOG_WARN, "Cannot execute %s", shellstr));
 		closelog ();
-		exit (exit_status);
+		exit (err == ENOENT ? E_CMD_NOTFOUND : E_CMD_NOEXEC);
 #else
-		run_shell (shellstr, &argv[-1], 0, environ); /* no return */
+		run_shell (shellstr, &argv[-1], 0, environ);
+		/* no return */
 #endif
 	}
 #ifndef USE_PAM
-	exit_status = shelle (shellstr, cp, environ);
-	exit_status = exit_status == ENOENT ? 127 : 126;
-	exit (exit_status);
+	err = shelle (shellstr, cp, environ);
+	exit (err == ENOENT ? E_CMD_NOTFOUND : E_CMD_NOEXEC);
 #else
 	run_shell (shellstr, &cp, 1, environ);
 #endif
Index: shadow-4.0.14/libmisc/age.c
===================================================================
--- shadow-4.0.14.orig/libmisc/age.c	2006-01-16 03:17:34.000000000 +0200
+++ shadow-4.0.14/libmisc/age.c	2006-01-16 03:28:12.000000000 +0200
@@ -35,6 +35,7 @@
 #include <errno.h>
 #include "prototypes.h"
 #include "defines.h"
+#include "exitcodes.h"
 #include <pwd.h>
 #include <grp.h>
 
@@ -125,7 +126,7 @@
 		execl (PASSWD_PROGRAM, PASSWD_PROGRAM, pw->pw_name, (char *) 0);
 		err = errno;
 		perror ("Can't execute " PASSWD_PROGRAM);
-		_exit ((err == ENOENT) ? 127 : 126);
+		_exit (err == ENOENT ? E_CMD_NOTFOUND : E_CMD_NOEXEC);
 	} else if (pid == -1) {
 		perror ("fork");
 		exit (1);
Index: shadow-4.0.14/src/userdel.c
===================================================================
--- shadow-4.0.14.orig/src/userdel.c	2006-01-16 03:17:34.000000000 +0200
+++ shadow-4.0.14/src/userdel.c	2006-01-16 03:28:12.000000000 +0200
@@ -51,6 +51,7 @@
 #include "pwauth.h"
 #include "pwio.h"
 #include "shadowio.h"
+#include "exitcodes.h"
 #ifdef	SHADOWGRP
 #include "sgroupio.h"
 #endif
@@ -512,13 +513,8 @@
 	pid = fork ();
 	if (pid == 0) {
 		execl (cmd, cmd, user, (char *) 0);
-		if (errno == ENOENT) {
-			perror (cmd);
-			_exit (127);
-		} else {
-			perror (cmd);
-			_exit (126);
-		}
+		perror (cmd);
+		_exit (errno == ENOENT ? E_CMD_NOTFOUND : E_CMD_NOEXEC);
 	} else if (pid == -1) {
 		perror ("fork");
 		return;
-------------- next part --------------
Goal: make possible compilation of shadow with -Wall -Werror

Eliminates several reasons for warnings:
* unused variables
* non-declared static functions
* missing extern declarations like nscd_flush_cache ("nscd.h")
* ambiguaos "else"
* ??? (what else I forgot)

Index: shadow-4.0.14/libmisc/setupenv.c
===================================================================
--- shadow-4.0.14.orig/libmisc/setupenv.c	2006-01-16 18:12:10.862077290 +0200
+++ shadow-4.0.14/libmisc/setupenv.c	2006-01-16 18:18:17.185919272 +0200
@@ -43,6 +43,8 @@
 #include "defines.h"
 #include <pwd.h>
 #include "getdef.h"
+
+#ifndef USE_PAM
 static void
 addenv_path (const char *varname, const char *dirname, const char *filename)
 {
@@ -54,8 +56,6 @@
 	free (buf);
 }
 
-
-#ifndef USE_PAM
 static void read_env_file (const char *filename)
 {
 	FILE *fp;
Index: shadow-4.0.14/src/login.c
===================================================================
--- shadow-4.0.14.orig/src/login.c	2006-01-16 18:12:11.252045186 +0200
+++ shadow-4.0.14/src/login.c	2006-01-16 18:19:31.372811754 +0200
@@ -261,7 +261,10 @@
 
 static void init_env (void)
 {
-	char *cp, *tmp;
+#ifndef USE_PAM
+	char *cp
+#endif
+	char *tmp;
 
 	if ((tmp = getenv ("LANG"))) {
 		addenv ("LANG", tmp);
Index: shadow-4.0.14/src/chage.c
===================================================================
--- shadow-4.0.14.orig/src/chage.c	2006-01-16 18:12:10.735087745 +0200
+++ shadow-4.0.14/src/chage.c	2006-01-16 18:21:42.643004789 +0200
@@ -338,7 +338,6 @@
 
 int main (int argc, char **argv)
 {
-	int flag;
 	const struct spwd *sp;
 	struct spwd spwd;
 	uid_t ruid;
Index: shadow-4.0.14/src/chsh.c
===================================================================
--- shadow-4.0.14.orig/src/chsh.c	2006-01-16 18:12:11.025063872 +0200
+++ shadow-4.0.14/src/chsh.c	2006-01-16 18:23:17.887163708 +0200
@@ -68,6 +68,7 @@
 /* local function prototypes */
 static void usage (void);
 static void new_fields (void);
+static int check_shell (const char *);
 static int restricted_shell (const char *);
 
 /*
@@ -117,7 +118,7 @@
  * If getusershell() is available (Linux, *BSD, possibly others), use it
  * instead of re-implementing it.
  */
-int check_shell (const char *sh)
+static int check_shell (const char *sh)
 {
 	char *cp;
 	int found = 0;
Index: shadow-4.0.14/src/gpasswd.c
===================================================================
--- shadow-4.0.14.orig/src/gpasswd.c	2005-12-06 23:24:59.000000000 +0200
+++ shadow-4.0.14/src/gpasswd.c	2006-01-16 18:24:46.917834159 +0200
@@ -45,6 +45,7 @@
 #ifdef	SHADOWGRP
 #include "sgroupio.h"
 #endif
+#include "nscd.h"
 /*
  * Global variables
  */
Index: shadow-4.0.14/src/newgrp.c
===================================================================
--- shadow-4.0.14.orig/src/newgrp.c	2006-01-16 18:12:11.253045104 +0200
+++ shadow-4.0.14/src/newgrp.c	2006-01-16 18:25:52.712417546 +0200
@@ -485,8 +485,8 @@
 					/* wake child when resumed */
 					kill (child, SIGCONT);
 				}
-			} while (pid == child && WIFSTOPPED (cst) ||
-				 pid != child && errno == EINTR);
+			} while ((pid == child && WIFSTOPPED (cst)) ||
+				 (pid != child && errno == EINTR));
 			SYSLOG ((LOG_INFO,
 				 "user `%s' (login `%s' on %s) returned to group `%s'",
 				 name, loginname, tty,
Index: shadow-4.0.14/src/passwd.c
===================================================================
--- shadow-4.0.14.orig/src/passwd.c	2005-12-06 23:25:00.000000000 +0200
+++ shadow-4.0.14/src/passwd.c	2006-01-16 18:26:49.170769550 +0200
@@ -603,7 +603,6 @@
  */
 int main (int argc, char **argv)
 {
-	int flag;		/* Current option to process     */
 	const struct passwd *pw;	/* Password file entry for user      */
 
 #ifndef USE_PAM
@@ -898,11 +897,12 @@
 
 	SYSLOG ((LOG_INFO, "password for `%s' changed by `%s'", name, myname));
 	closelog ();
-	if (!qflg)
+	if (!qflg) {
 		if (!eflg)
 			printf (_("Password changed.\n"));
 		else
 			printf (_("Password set to expire.\n"));
+	}
 	exit (E_SUCCESS);
 	/* NOT REACHED */
 }
Index: shadow-4.0.14/src/groupadd.c
===================================================================
--- shadow-4.0.14.orig/src/groupadd.c	2006-01-16 18:12:10.736087663 +0200
+++ shadow-4.0.14/src/groupadd.c	2006-01-16 18:27:32.077237227 +0200
@@ -86,7 +86,6 @@
 static void grp_update (void);
 static void find_new_gid (void);
 static void check_new_name (void);
-static void process_flags (int, char **);
 static void close_files (void);
 static void open_files (void);
 static void fail_exit (int);
Index: shadow-4.0.14/src/groupdel.c
===================================================================
--- shadow-4.0.14.orig/src/groupdel.c	2006-01-16 18:12:10.736087663 +0200
+++ shadow-4.0.14/src/groupdel.c	2006-01-16 18:28:08.534235864 +0200
@@ -346,4 +346,5 @@
 #endif
 	exit (errors == 0 ? E_SUCCESS : E_GRP_UPDATE);
 	/* NOT REACHED */
+	return 0;
 }
Index: shadow-4.0.14/src/grpck.c
===================================================================
--- shadow-4.0.14.orig/src/grpck.c	2006-01-16 18:12:11.004065601 +0200
+++ shadow-4.0.14/src/grpck.c	2006-01-16 18:29:36.566988470 +0200
@@ -40,6 +40,7 @@
 #include "defines.h"
 #include "groupio.h"
 #include "prototypes.h"
+#include "nscd.h"
 extern void __gr_del_entry (const struct commonio_entry *);
 extern struct commonio_entry *__gr_get_head (void);
 
Index: shadow-4.0.14/src/grpconv.c
===================================================================
--- shadow-4.0.14.orig/src/grpconv.c	2005-12-06 23:25:00.000000000 +0200
+++ shadow-4.0.14/src/grpconv.c	2006-01-16 18:30:05.539603267 +0200
@@ -20,6 +20,7 @@
 #include <time.h>
 #include <unistd.h>
 #include "prototypes.h"
+#include "nscd.h"
 #ifdef SHADOWGRP
 #include "groupio.h"
 #include "sgroupio.h"
Index: shadow-4.0.14/src/grpunconv.c
===================================================================
--- shadow-4.0.14.orig/src/grpunconv.c	2005-12-06 23:25:00.000000000 +0200
+++ shadow-4.0.14/src/grpunconv.c	2006-01-16 18:30:19.012494096 +0200
@@ -20,6 +20,7 @@
 #include <unistd.h>
 #include <grp.h>
 #include "prototypes.h"
+#include "nscd.h"
 #ifdef SHADOWGRP
 #include "groupio.h"
 #include "sgroupio.h"
Index: shadow-4.0.14/src/newusers.c
===================================================================
--- shadow-4.0.14.orig/src/newusers.c	2006-01-16 18:12:10.738087498 +0200
+++ shadow-4.0.14/src/newusers.c	2006-01-16 18:30:47.998107823 +0200
@@ -53,6 +53,7 @@
 #include "pwio.h"
 #include "groupio.h"
 #include "shadowio.h"
+#include "nscd.h"
 /*
  * Global variables
  */
Index: shadow-4.0.14/src/pwck.c
===================================================================
--- shadow-4.0.14.orig/src/pwck.c	2006-01-16 18:12:11.004065601 +0200
+++ shadow-4.0.14/src/pwck.c	2006-01-16 18:31:19.454518139 +0200
@@ -42,6 +42,7 @@
 #include "pwio.h"
 #include "shadowio.h"
 #include "getdef.h"
+#include "nscd.h"
 extern void __pw_del_entry (const struct commonio_entry *);
 extern struct commonio_entry *__pw_get_head (void);
 
Index: shadow-4.0.14/src/pwconv.c
===================================================================
--- shadow-4.0.14.orig/src/pwconv.c	2005-12-06 23:25:00.000000000 +0200
+++ shadow-4.0.14/src/pwconv.c	2006-01-16 18:31:41.501703080 +0200
@@ -43,6 +43,7 @@
 #include "prototypes.h"
 #include "pwio.h"
 #include "shadowio.h"
+#include "nscd.h"
 /*
  * exit status values
  */
Index: shadow-4.0.14/src/usermod.c
===================================================================
--- shadow-4.0.14.orig/src/usermod.c	2006-01-16 18:12:10.741087251 +0200
+++ shadow-4.0.14/src/usermod.c	2006-01-16 18:34:40.291983971 +0200
@@ -88,19 +88,21 @@
 static gid_t user_gid;
 static gid_t user_newgid;
 static char *user_comment;
-static char *user_newcomment;	/* Audit */
 static char *user_home;
 static char *user_newhome;
 static char *user_shell;
-static char *user_newshell;	/* Audit */
-
 static long user_expire;
-static long user_newexpire;	/* Audit */
 static long user_inactive;
-static long user_newinactive;	/* Audit */
 static long sys_ngroups;
 static char **user_groups;	/* NULL-terminated list */
 
+#ifdef WITH_AUDIT
+static char *user_newcomment;	/* Audit */
+static char *user_newshell;	/* Audit */
+static long user_newexpire;	/* Audit */
+static long user_newinactive;	/* Audit */
+#endif
+
 static char *Prog;
 
 static int
@@ -841,7 +843,6 @@
 
 	const struct spwd *spwd = NULL;
 	int anyflag = 0;
-	int arg;
 
 	if (argc == 1 || argv[argc - 1][0] == '-')
 		usage ();
Index: shadow-4.0.14/src/vipw.c
===================================================================
--- shadow-4.0.14.orig/src/vipw.c	2006-01-16 18:12:10.982067412 +0200
+++ shadow-4.0.14/src/vipw.c	2006-01-16 18:34:58.995444188 +0200
@@ -241,7 +241,6 @@
 
 int main (int argc, char **argv)
 {
-	int flag;
 	int editshadow = 0;
 	char *a;
 	int do_vipw;


More information about the Pkg-shadow-devel mailing list