Bugzilla – Attachment 1681 Details for
Bug 1637
Change the context when starting internal-sftp
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch solving the problem
sesftp.patch (text/plain), 1.43 KB, created by
jchadima
on 2009-08-28 15:39:49 AEST
(
hide
)
Description:
Patch solving the problem
Filename:
MIME Type:
Creator:
jchadima
Created:
2009-08-28 15:39:49 AEST
Size:
1.43 KB
patch
obsolete
>diff -up openssh-5.2p1/session.c.sesftp openssh-5.2p1/session.c >--- openssh-5.2p1/session.c.sesftp 2009-01-28 06:29:49.000000000 +0100 >+++ openssh-5.2p1/session.c 2009-08-08 13:13:54.670122454 +0200 >@@ -58,6 +58,7 @@ > #include <stdlib.h> > #include <string.h> > #include <unistd.h> >+#include <selinux/selinux.h> > > #include "openbsd-compat/sys-queue.h" > #include "xmalloc.h" >@@ -1791,8 +1792,8 @@ do_child(Session *s, const char *command > > if (s->is_subsystem == SUBSYSTEM_INT_SFTP) { > extern int optind, optreset; >- int i; >- char *p, *args; >+ int i, l; >+ char *p, *args, *c1, *c2, *cx; > > setproctitle("%s@internal-sftp-server", s->pw->pw_name); > args = xstrdup(command ? command : "sftp-server"); >@@ -1802,6 +1803,27 @@ 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)); >+ } else { >+ c2 = xmalloc (strlen (c1) + 8); >+ 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"); >+ if ((cx = index (cx + 1, ':'))) >+ strcat (c2, cx); >+ if (setcon (c2) < 0) >+ logit("do_child: setcon failed witch %s", strerror (errno)); >+ >+ } >+ } >+ > exit(sftp_server_main(i, argv, s->pw)); > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1637
:
1681
|
1683
|
1687