rpms/openssh/devel openssh-5.2p1-sesftp.patch, 1.5, 1.6 openssh.spec, 1.158, 1.159
Jan F. Chadima
jfch2222 at fedoraproject.org
Fri Aug 28 22:43:53 UTC 2009
Author: jfch2222
Update of /cvs/pkgs/rpms/openssh/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv27577
Modified Files:
openssh-5.2p1-sesftp.patch openssh.spec
Log Message:
rearange sesftp patch acording to upstream request
openssh-5.2p1-sesftp.patch:
session.c | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
Index: openssh-5.2p1-sesftp.patch
===================================================================
RCS file: /cvs/pkgs/rpms/openssh/devel/openssh-5.2p1-sesftp.patch,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -p -r1.5 -r1.6
--- openssh-5.2p1-sesftp.patch 26 Aug 2009 10:44:57 -0000 1.5
+++ openssh-5.2p1-sesftp.patch 28 Aug 2009 22:43:53 -0000 1.6
@@ -1,49 +1,66 @@
diff -up openssh-5.2p1/session.c.sesftp openssh-5.2p1/session.c
---- openssh-5.2p1/session.c.sesftp 2009-07-22 15:18:17.156499945 +0200
-+++ openssh-5.2p1/session.c 2009-07-22 15:20:09.950319644 +0200
-@@ -58,6 +58,7 @@
+--- openssh-5.2p1/session.c.sesftp 2009-08-09 10:21:11.586827446 +0200
++++ openssh-5.2p1/session.c 2009-08-09 10:39:30.475622699 +0200
+@@ -58,6 +58,9 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
++#ifdef WITH_SELINUX
+#include <selinux/selinux.h>
++#endif
#include "openbsd-compat/sys-queue.h"
#include "xmalloc.h"
-@@ -1805,8 +1806,8 @@ do_child(Session *s, const char *command
+@@ -101,6 +104,9 @@
+ c[sizeof(INTERNAL_SFTP_NAME) - 1] == ' ' || \
+ c[sizeof(INTERNAL_SFTP_NAME) - 1] == '\t'))
- if (s->is_subsystem == SUBSYSTEM_INT_SFTP) {
++#ifdef WITH_SELINUX
++#define SFTPD_T "sftpd_t"
++#endif
+ /* func */
+
+ Session *session_new(void);
+@@ -1789,6 +1795,10 @@ do_child(Session *s, const char *command
extern int optind, optreset;
-- int i;
-- char *p, *args;
-+ int i, l;
-+ char *p, *args, *c1, *c2, *cx;
+ int i;
+ char *p, *args;
++#ifdef WITH_SELINUX
++ int L1, L2;
++ char *c1, *c2, *cx;
++#endif
setproctitle("%s at internal-sftp-server", s->pw->pw_name);
args = xstrdup(command ? command : "sftp-server");
-@@ -1816,6 +1817,27 @@ do_child(Session *s, const char *command
+@@ -1798,6 +1808,32 @@ do_child(Session *s, const char *command
argv[i] = NULL;
optind = optreset = 1;
__progname = argv[0];
-+ if (getcon (&c1) < 0) {
-+ logit("do_child: getcon failed witch %s", strerror (errno));
++#ifdef WITH_SELINUX
++ if (getcon ((security_context_t *) &c1) < 0) {
++ logit("do_child: getcon failed with %s", strerror (errno));
+ } else {
-+ c2 = xmalloc (strlen (c1) + 8);
++ L1 = strlen (c1) + sizeof (SFTPD_T);
++ c2 = xmalloc (L1);
+ if (!(cx = index (c1, ':')))
+ goto badcontext;
+ if (!(cx = index (cx + 1, ':'))) {
+badcontext:
+ logit ("do_child: unparseable context %s", c1);
+ } else {
-+ l = cx - c1 + 1;
-+ memcpy (c2, c1, l);
-+ strcpy (c2 + l, "sftpd_t");
++ L2 = cx - c1 + 1;
++ memcpy (c2, c1, L2);
++ strlcpy (c2 + L2, SFTPD_T, L1);
+ if ((cx = index (cx + 1, ':')))
-+ strcat (c2, cx);
++ strlcat (c2, cx, L1);
+ if (setcon (c2) < 0)
-+ logit("do_child: setcon failed witch %s", strerror (errno));
++ logit("do_child: setcon failed with %s", strerror (errno));
+
+ }
++ xfree (c1);
++ xfree (c2);
+ }
++#endif
+
exit(sftp_server_main(i, argv, s->pw));
}
Index: openssh.spec
===================================================================
RCS file: /cvs/pkgs/rpms/openssh/devel/openssh.spec,v
retrieving revision 1.158
retrieving revision 1.159
diff -u -p -r1.158 -r1.159
--- openssh.spec 28 Aug 2009 21:46:27 -0000 1.158
+++ openssh.spec 28 Aug 2009 22:43:53 -0000 1.159
@@ -473,6 +473,7 @@ fi
- merged gssapi-role to selinux patch
- merged cve-2007_3102 to audit patch
- sesftp patch only with WITH_SELINUX flag
+- rearange sesftp patch according to upstream request
* Wed Aug 26 2009 Jan F. Chadima <jchadima at redhat.com> - 5.2p1-19
- minor change in sesftp patch
More information about the scm-commits
mailing list