Bugzilla – Attachment 1315 Details for
Bug 1223
tun/tap capability requires root privileges
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
upgrade to latest version
openssh-4.6p1-tunuid.patch (text/plain), 3.37 KB, created by
Jason
on 2007-07-04 10:19:29 AEST
(
hide
)
Description:
upgrade to latest version
Filename:
MIME Type:
Creator:
Jason
Created:
2007-07-04 10:19:29 AEST
Size:
3.37 KB
patch
obsolete
>diff -Nurd openssh-4.6p1.orig/misc.c openssh-4.6p1/misc.c >--- openssh-4.6p1.orig/misc.c 2007-01-05 00:24:48.000000000 -0500 >+++ openssh-4.6p1/misc.c 2007-07-03 20:10:33.000000000 -0400 >@@ -633,10 +633,10 @@ > } > > int >-tun_open(int tun, int mode) >+tun_open(int tun, int mode, uid_t uid) > { > #if defined(CUSTOM_SYS_TUN_OPEN) >- return (sys_tun_open(tun, mode)); >+ return (sys_tun_open(tun, mode, uid)); > #elif defined(SSH_TUN_OPENBSD) > struct ifreq ifr; > char name[100]; >@@ -681,6 +681,11 @@ > if (ioctl(sock, SIOCSIFFLAGS, &ifr) == -1) > goto failed; > >+ /* Set interface owner */ >+ /* XXX: This is most definitely wrong and is considered a stub :) */ >+ if (ioctl(fd, TUNSETOWNER, uid) == -1) >+ goto failed; >+ > /* Bring interface up */ > ifr.ifr_flags |= IFF_UP; > if (ioctl(sock, SIOCSIFFLAGS, &ifr) == -1) >diff -Nurd openssh-4.6p1.orig/misc.h openssh-4.6p1/misc.h >--- openssh-4.6p1.orig/misc.h 2006-08-18 10:33:06.000000000 -0400 >+++ openssh-4.6p1/misc.h 2007-07-03 20:10:34.000000000 -0400 >@@ -48,7 +48,7 @@ > __attribute__((format(printf, 3, 4))); > void freeargs(arglist *); > >-int tun_open(int, int); >+int tun_open(int, int, uid_t); > > /* Common definitions for ssh tunnel device forwarding */ > #define SSH_TUNMODE_NO 0x00 >diff -Nurd openssh-4.6p1.orig/openbsd-compat/port-tun.c openssh-4.6p1/openbsd-compat/port-tun.c >--- openssh-4.6p1.orig/openbsd-compat/port-tun.c 2006-09-02 01:32:40.000000000 -0400 >+++ openssh-4.6p1/openbsd-compat/port-tun.c 2007-07-03 20:10:34.000000000 -0400 >@@ -54,7 +54,7 @@ > #include <linux/if_tun.h> > > int >-sys_tun_open(int tun, int mode) >+sys_tun_open(int tun, int mode, uid_t uid) > { > struct ifreq ifr; > int fd = -1; >@@ -92,6 +92,12 @@ > goto failed; > } > >+ if (ioctl(fd, TUNSETOWNER, uid) == -1) { >+ debug("%s: failed to set tunnel owner (uid %d): %s", __func__, >+ uid, strerror(errno)); >+ goto failed; >+ } >+ > if (tun == SSH_TUNID_ANY) > debug("%s: tunnel mode %d fd %d", __func__, mode, fd); > else >diff -Nurd openssh-4.6p1.orig/openbsd-compat/port-tun.h openssh-4.6p1/openbsd-compat/port-tun.h >--- openssh-4.6p1.orig/openbsd-compat/port-tun.h 2006-08-05 00:07:21.000000000 -0400 >+++ openssh-4.6p1/openbsd-compat/port-tun.h 2007-07-03 20:10:34.000000000 -0400 >@@ -21,7 +21,7 @@ > > #if defined(SSH_TUN_LINUX) || defined(SSH_TUN_FREEBSD) > # define CUSTOM_SYS_TUN_OPEN >-int sys_tun_open(int, int); >+int sys_tun_open(int, int, uid_t); > #endif > > #if defined(SSH_TUN_COMPAT_AF) || defined(SSH_TUN_PREPEND_AF) >diff -Nurd openssh-4.6p1.orig/serverloop.c openssh-4.6p1/serverloop.c >--- openssh-4.6p1.orig/serverloop.c 2007-01-28 18:16:28.000000000 -0500 >+++ openssh-4.6p1/serverloop.c 2007-07-03 20:10:34.000000000 -0400 >@@ -991,7 +991,7 @@ > goto done; > tun = forced_tun_device; > } >- sock = tun_open(tun, mode); >+ sock = tun_open(tun, mode, the_authctxt->pw->pw_uid); > if (sock < 0) > goto done; > c = channel_new("tun", SSH_CHANNEL_OPEN, sock, sock, -1, >diff -Nurd openssh-4.6p1.orig/ssh.c openssh-4.6p1/ssh.c >--- openssh-4.6p1.orig/ssh.c 2007-01-05 00:30:17.000000000 -0500 >+++ openssh-4.6p1/ssh.c 2007-07-03 20:10:34.000000000 -0400 >@@ -1121,7 +1121,7 @@ > > debug("Requesting tun."); > if ((fd = tun_open(options.tun_local, >- options.tun_open)) >= 0) { >+ options.tun_open, original_real_uid)) >= 0) { > c = channel_new("tun", SSH_CHANNEL_OPENING, fd, fd, -1, > CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, > 0, "tun", 1);
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 1223
:
1179
|
1199
| 1315