rpms/rsh/devel netkit-rsh-0.17-arg_max.patch, NONE, 1.1 rsh.spec, 1.44, 1.45

Adam Tkac (atkac) fedora-extras-commits at redhat.com
Mon Apr 14 11:49:04 UTC 2008


Author: atkac

Update of /cvs/pkgs/rpms/rsh/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv25512

Modified Files:
	rsh.spec 
Added Files:
	netkit-rsh-0.17-arg_max.patch 
Log Message:
- use sysconf for ARG_MAX value (#440867)


netkit-rsh-0.17-arg_max.patch:

--- NEW FILE netkit-rsh-0.17-arg_max.patch ---
diff -up netkit-rsh-0.17/rexecd/rexecd.c.arg_max netkit-rsh-0.17/rexecd/rexecd.c
--- netkit-rsh-0.17/rexecd/rexecd.c.arg_max	2008-04-14 13:19:29.000000000 +0200
+++ netkit-rsh-0.17/rexecd/rexecd.c	2008-04-14 13:33:35.000000000 +0200
@@ -235,7 +235,8 @@ static struct pam_conv PAM_conversation 
 static void
 doit(struct sockaddr_in *fromp)
 {
-	char cmdbuf[ARG_MAX+1];
+	char *cmdbuf;
+	long cmdbuflen;
 	char user[17], pass[17];
 	struct passwd *pwd;
 	int s = -1;
@@ -254,6 +255,18 @@ doit(struct sockaddr_in *fromp)
 #endif
 #endif /* USE_PAM */
 
+	cmdbuflen = sysconf (_SC_ARG_MAX);
+	if (!(cmdbuflen > 0)) {
+		syslog (LOG_ERR, "sysconf (_SC_ARG_MAX) failed");
+		fatal ("sysconf (_SC_ARG_MAX) failed\n");
+	}
+
+	cmdbuf = malloc (++cmdbuflen);
+	if (cmdbuf == NULL) {
+		syslog (LOG_ERR, "Could not allocate space for cmdbuf");
+		fatal ("Could not allocate space for cmdbuf\n");
+	}
+
 	signal(SIGINT, SIG_DFL);
 	signal(SIGQUIT, SIG_DFL);
 	signal(SIGTERM, SIG_DFL);
@@ -303,7 +316,7 @@ doit(struct sockaddr_in *fromp)
 
 	getstr(user, sizeof(user), "username too long\n");
 	getstr(pass, sizeof(pass), "password too long\n");
-	getstr(cmdbuf, sizeof(cmdbuf), "command too long\n");
+	getstr(cmdbuf, cmdbuflen, "command too long\n");
 #ifdef USE_PAM
        #define PAM_BAIL if (pam_error != PAM_SUCCESS) { \
 	       pam_end(pamh, pam_error); exit(1); \
diff -up netkit-rsh-0.17/rshd/rshd.c.arg_max netkit-rsh-0.17/rshd/rshd.c
--- netkit-rsh-0.17/rshd/rshd.c.arg_max	2008-04-14 13:33:58.000000000 +0200
+++ netkit-rsh-0.17/rshd/rshd.c	2008-04-14 13:35:17.000000000 +0200
@@ -402,7 +402,8 @@ static int log_audit(const char *usernam
 static void
 doit(struct sockaddr_storage *fromp, socklen_t fromlen)
 {
-	char cmdbuf[ARG_MAX+1];
+	char *cmdbuf;
+	long cmdbuflen;
 	const char *theshell, *shellname;
 	char locuser[16], remuser[16];
 	struct passwd *pwd;
@@ -415,6 +416,18 @@ doit(struct sockaddr_storage *fromp, soc
         int i;
 #endif
 
+	cmdbuflen = sysconf (_SC_ARG_MAX);
+	if (!(cmdbuflen > 0)) {
+		syslog (LOG_ERR, "sysconf (_SC_ARG_MAX) failed");
+		exit (1);
+	}
+
+	cmdbuf = malloc (++cmdbuflen);
+	if (cmdbuf == NULL) {
+		syslog (LOG_ERR, "Could not allocate space for cmdbuf");
+		exit (1);
+	}
+
 	signal(SIGINT, SIG_DFL);
 	signal(SIGQUIT, SIG_DFL);
 	signal(SIGTERM, SIG_DFL);


Index: rsh.spec
===================================================================
RCS file: /cvs/pkgs/rpms/rsh/devel/rsh.spec,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- rsh.spec	27 Mar 2008 16:07:20 -0000	1.44
+++ rsh.spec	14 Apr 2008 11:48:26 -0000	1.45
@@ -1,7 +1,7 @@
 Summary: Clients for remote access commands (rsh, rlogin, rcp).
 Name: rsh
 Version: 0.17
-Release: 48%{?dist}
+Release: 49%{?dist}
 License: BSD
 Group: Applications/Internet
 
@@ -55,6 +55,7 @@
 Patch34: netkit-rsh-0.17-nohostcheck-compat.patch
 Patch35: netkit-rsh-0.17-audit.patch
 Patch36: netkit-rsh-0.17-longname.patch
+Patch37: netkit-rsh-0.17-arg_max.patch
 
 %description
 The rsh package contains a set of programs which allow users to run
@@ -120,6 +121,7 @@
 %patch34 -p1 -b .compat
 %patch35 -p1 -b .audit
 %patch36 -p1 -b .longname
+%patch37 -p1 -b .arg_max
 
 # No, I don't know what this is doing in the tarball.
 rm -f rexec/rexec
@@ -188,6 +190,9 @@
 %{_mandir}/man8/*.8*
 
 %changelog
+* Mon Apr 14 2008 Adam Tkac <atkac redhat com> 0.17-49
+- use sysconf for ARG_MAX value (#440867)
+
 * Thu Mar 27 2008 Adam Tkac <atkac redhat com> 0.17-48
 - in.rexecd username limit was 14 characters, not 16
 




More information about the scm-commits mailing list