[Pkg-shadow-commits] r816 - in trunk/debian: . patches

Alexander Gattin xrgtn-guest at costa.debian.org
Fri Jan 20 21:25:27 UTC 2006


Author: xrgtn-guest
Date: 2006-01-20 21:25:26 +0000 (Fri, 20 Jan 2006)
New Revision: 816

Added:
   trunk/debian/patches/485_shell-env-exitcodes
Modified:
   trunk/debian/changelog
   trunk/debian/patches/series
Log:
changed 485th patch to be closer to upstream, put 486th to series

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2006-01-18 07:43:55 UTC (rev 815)
+++ trunk/debian/changelog	2006-01-20 21:25:26 UTC (rev 816)
@@ -2,10 +2,10 @@
 
   * The "Cancoillotte" release
   * Upstream bugs or fixes not already fixed in upstream releases or CVS:
-    - 485_shelle_exitcodes:
-      - replace all shell() calls with shelle()
+    - 485_shell-env-exitcodes:
+      - explicitly pass environment to shell() as 3rd argument
+      - return errno from shell()
       - introduce E_CMD_NOTFOUND/E_CMD_NOEXEC exitcodes
-      - minor beautification of code
   * Debconf translation updates:
     - Danish updated. Closes: #348571
 

Copied: trunk/debian/patches/485_shell-env-exitcodes (from rev 815, trunk/debian/patches/485_shelle-exitcodes)
===================================================================
--- trunk/debian/patches/485_shelle-exitcodes	2006-01-18 07:43:55 UTC (rev 815)
+++ trunk/debian/patches/485_shell-env-exitcodes	2006-01-20 21:25:26 UTC (rev 816)
@@ -0,0 +1,285 @@
+Goal: change shell() prototype and introduce E_CMD_{NOEXEC|NOTFOUND}
+
+Status wrt upstream: will be in 4.0.15
+
+Index: shadow-4.0.14/src/sulogin.c
+===================================================================
+--- shadow-4.0.14.orig/src/sulogin.c	2006-01-20 22:34:15.000000000 +0200
++++ shadow-4.0.14/src/sulogin.c	2006-01-20 22:34:53.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 = shell (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-20 22:34:15.000000000 +0200
++++ shadow-4.0.14/lib/exitcodes.h	2006-01-20 22:34:53.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-20 22:34:15.000000000 +0200
++++ shadow-4.0.14/src/login.c	2006-01-20 22:34:53.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 = shell (tmp, pwent.pw_shell, newenvp); /* fake shell */
++	else
++		/* exec the shell finally */
++		err = shell (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-20 22:34:15.000000000 +0200
++++ shadow-4.0.14/src/newgrp.c	2006-01-20 22:34:54.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 = shell (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-20 22:34:30.000000000 +0200
++++ shadow-4.0.14/src/su.c	2006-01-20 22:34:54.000000000 +0200
+@@ -187,14 +187,10 @@
+ 		pam_end (pamh, PAM_SUCCESS);
+ 
+ 		if (doshell)
+-			shelle (shellstr, (char *) args[0], envp);
++			(void) shell (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,11 +304,11 @@
+ 	char **envp = environ;
+ 	char *command = 0, *shellstr = 0;
+ 	char *tmp_name;
+-	int exit_status = 0;
+ 
+ #ifdef USE_PAM
+ 	int ret;
+ #else				/* !USE_PAM */
++	int err = 0;
+ 	RETSIGTYPE (*oldsig) ();
+ 	int is_console = 0;
+ 
+@@ -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 = shell (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-20 22:34:15.000000000 +0200
++++ shadow-4.0.14/libmisc/age.c	2006-01-20 22:34:54.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-20 22:34:15.000000000 +0200
++++ shadow-4.0.14/src/userdel.c	2006-01-20 22:34:54.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;
+Index: shadow-4.0.14/lib/prototypes.h
+===================================================================
+--- shadow-4.0.14.orig/lib/prototypes.h	2006-01-20 22:34:30.000000000 +0200
++++ shadow-4.0.14/lib/prototypes.h	2006-01-20 22:35:15.000000000 +0200
+@@ -149,8 +149,7 @@
+ extern void setup_env (struct passwd *);
+ 
+ /* shell.c */
+-extern void shell (const char *, const char *);
+-extern int shelle (const char *, const char *, char *const *);
++extern int shell (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-20 22:34:30.000000000 +0200
++++ shadow-4.0.14/libmisc/shell.c	2006-01-20 22:35:30.000000000 +0200
+@@ -38,15 +38,8 @@
+ 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);
+-}
+-
+ /*
+- * shelle - execute the named program
++ * shell - 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,
+@@ -58,7 +51,7 @@
+  *	the file.  If all that fails, give up in disgust ...
+  */
+ 
+-int shelle (const char *file, const char *arg, char *const envp[])
++int shell (const char *file, const char *arg, char *const envp[])
+ {
+ 	char arg0[1024];
+ 	int err;

Modified: trunk/debian/patches/series
===================================================================
--- trunk/debian/patches/series	2006-01-18 07:43:55 UTC (rev 815)
+++ trunk/debian/patches/series	2006-01-20 21:25:26 UTC (rev 816)
@@ -48,7 +48,8 @@
 482_libmisc_copydir_check_return_values
 483_su_fakelogin_wrong_arg0
 484_su-p_preserve_PATH
-485_shelle-exitcodes
+485_shell-env-exitcodes
+486_nowarn
 # 999-2 is about using cdbs. It does not patch upstream files
 # so shouldn't be here, but we keep it for the future
 # 999-2_build_using_cdbs




More information about the Pkg-shadow-commits mailing list