[Pkg-shadow-commits] r166 - trunk/debian/patches

Nicolas FRANCOIS pkg-shadow-devel@lists.alioth.debian.org
Sun, 22 May 2005 23:21:09 +0000


Author: nekral-guest
Date: 2005-05-22 23:21:08 +0000 (Sun, 22 May 2005)
New Revision: 166

Added:
   trunk/debian/patches/008_login_opt-f_with_username_after--
Modified:
   trunk/debian/patches/008_src.dpatch
   trunk/debian/patches/series
Log:
Move some bits from 008_src.dpatch to 008_login_opt-f_with_username_after--


Added: trunk/debian/patches/008_login_opt-f_with_username_after--
===================================================================
--- trunk/debian/patches/008_login_opt-f_with_username_after--	2005-05-22 23:15:13 UTC (rev 165)
+++ trunk/debian/patches/008_login_opt-f_with_username_after--	2005-05-22 23:21:08 UTC (rev 166)
@@ -0,0 +1,48 @@
+Goal: Made login's -f option also able to use the username after -- if none
+      was passed as it's optarg
+Fixes: #53702
+
+Status wrt upstream: I'm not sure, but it is probably not in upstream.
+                     It could certainly be submitted to upstream.
+
+Index: shadow-4.0.3/src/login.c
+===================================================================
+--- shadow-4.0.3.orig/src/login.c	2005-05-23 01:17:08.437167000 +0200
++++ shadow-4.0.3/src/login.c	2005-05-23 01:19:05.347167000 +0200
+@@ -473,7 +473,7 @@
+ 
+ 	check_flags (argc, argv);
+ 
+-	while ((flag = getopt (argc, argv, "d:f:h:pr:")) != EOF) {
++	while ((flag = getopt (argc, argv, "d:f::h:pr:")) != EOF) {
+ 		switch (flag) {
+ 		case 'p':
+ 			pflg++;
+@@ -482,11 +482,16 @@
+ 			/*
+ 			 * username must be a separate token
+ 			 * (-f root, *not* -froot).  --marekm
++ 			 *
++ 			 * if -f has an arg, use that, else use the
++ 			 * normal user name passed after all options
++ 			 * --benc
+ 			 */
+-			if (optarg != argv[optind - 1])
++			if (optarg != NULL && optarg != argv[optind - 1])
+ 				usage ();
+ 			fflg++;
+-			STRFCPY (username, optarg);
++			if (optarg)
++			  STRFCPY (username, optarg);
+ 			break;
+ #ifdef	RLOGIN
+ 		case 'r':
+@@ -640,7 +645,7 @@
+ 		init_env ();
+ 
+ 		if (optind < argc) {	/* get the user name */
+-			if (rflg || fflg)
++			if (rflg || (fflg && username[0]))
+ 				usage ();
+ 
+ #ifdef SVR4

Modified: trunk/debian/patches/008_src.dpatch
===================================================================
--- trunk/debian/patches/008_src.dpatch	2005-05-22 23:15:13 UTC (rev 165)
+++ trunk/debian/patches/008_src.dpatch	2005-05-22 23:21:08 UTC (rev 166)
@@ -49,44 +49,7 @@
  	}
  }
  
-@@ -466,7 +473,7 @@
- 
- 	check_flags (argc, argv);
- 
--	while ((flag = getopt (argc, argv, "d:f:h:pr:")) != EOF) {
-+	while ((flag = getopt (argc, argv, "d:f::h:pr:")) != EOF) {
- 		switch (flag) {
- 		case 'p':
- 			pflg++;
-@@ -475,11 +482,16 @@
- 			/*
- 			 * username must be a separate token
- 			 * (-f root, *not* -froot).  --marekm
-+ 			 *
-+ 			 * if -f has an arg, use that, else use the
-+ 			 * normal user name passed after all options
-+ 			 * --benc
- 			 */
--			if (optarg != argv[optind - 1])
-+			if (optarg != NULL && optarg != argv[optind - 1])
- 				usage ();
- 			fflg++;
--			STRFCPY (username, optarg);
-+			if (optarg)
-+			  STRFCPY (username, optarg);
- 			break;
- #ifdef	RLOGIN
- 		case 'r':
-@@ -633,7 +645,7 @@
- 		init_env ();
- 
- 		if (optind < argc) {	/* get the user name */
--			if (rflg || fflg)
-+			if (rflg || (fflg && username[0]))
- 				usage ();
- 
- #ifdef SVR4
-@@ -763,49 +775,98 @@
+@@ -763,49 +770,98 @@
  			 * MAX_LOGIN_TRIES?
  			 */
  
@@ -224,7 +187,7 @@
  			retcode = pam_acct_mgmt (pamh, 0);
  
  			if (retcode == PAM_NEW_AUTHTOK_REQD) {
-@@ -828,11 +889,14 @@
+@@ -828,11 +884,14 @@
  
  		if (!pwd || setup_groups (pwd))
  			exit (1);
@@ -240,7 +203,7 @@
  		PAM_FAIL_CHECK;
  
  #else				/* ! USE_PAM */
-@@ -1002,6 +1066,7 @@
+@@ -1002,6 +1061,7 @@
  			failed = 1;
  		}
  #endif
@@ -248,7 +211,7 @@
  		if (pwd && getdef_bool ("FAILLOG_ENAB") &&
  		    !failcheck (pwent.pw_uid, &faillog, failed)) {
  			SYSLOG ((LOG_CRIT, 
-@@ -1009,12 +1074,15 @@
+@@ -1009,12 +1069,15 @@
  				 username, fromhost));
  			failed = 1;
  		}
@@ -264,7 +227,7 @@
  		if (getdef_str ("FTMP_FILE") != NULL) {
  			const char *failent_user;
  
-@@ -1208,6 +1276,40 @@
+@@ -1208,6 +1271,40 @@
  	login_fbtab (tty, pwent.pw_uid, pwent.pw_gid);
  #endif
  
@@ -305,7 +268,7 @@
  	/* We call set_groups() above because this clobbers pam_groups.so */
  #ifndef USE_PAM
  	if (setup_uid_gid (&pwent, is_console))
-@@ -1309,41 +1411,6 @@
+@@ -1309,41 +1406,6 @@
  	signal (SIGTERM, SIG_DFL);	/* default terminate signal */
  	signal (SIGALRM, SIG_DFL);	/* default alarm signal */
  	signal (SIGHUP, SIG_DFL);	/* added this.  --marekm */
@@ -347,7 +310,7 @@
  	signal (SIGINT, SIG_DFL);	/* default interrupt signal */
  
  	endpwent ();	/* stop access to password file */
-@@ -1357,7 +1424,11 @@
+@@ -1357,7 +1419,11 @@
  	if (pwent.pw_uid == 0)
  		SYSLOG ((LOG_NOTICE, "ROOT LOGIN %s", fromhost));
  	else if (getdef_bool ("LOG_OK_LOGINS"))

Modified: trunk/debian/patches/series
===================================================================
--- trunk/debian/patches/series	2005-05-22 23:15:13 UTC (rev 165)
+++ trunk/debian/patches/series	2005-05-22 23:21:08 UTC (rev 166)
@@ -6,6 +6,7 @@
 006_libmisc.dpatch
 008_src.dpatch
 008_grpck_add_prune_option
+008_login_opt-f_with_username_after--
 009_etc.dpatch
 010_chpasswd-md5.dpatch
 100_LINGUAS.dpatch