[packages] srelay: Update to v0.4.8b3 (#8150)

git-svn-id: svn://svn.openwrt.org/openwrt/packages@23816 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
acinonyx 2010-11-03 09:29:25 +00:00
parent 3605dbe144
commit 2311b2e976
6 changed files with 3 additions and 211 deletions

View File

@ -8,12 +8,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=srelay
PKG_VERSION:=0.4.6
PKG_RELEASE:=3
PKG_VERSION:=0.4.8b3
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@SF/socks-relay
PKG_MD5SUM:=4a9f3298b38d8588f0ffde31b946a47f
PKG_MD5SUM:=a6d9521594172710ffa308d6b5dbece4
include $(INCLUDE_DIR)/package.mk

View File

@ -1,15 +0,0 @@
Index: srelay-0.4.6/configure
===================================================================
--- srelay-0.4.6.orig/configure 2008-02-28 13:21:29.000000000 +0100
+++ srelay-0.4.6/configure 2008-02-28 13:21:30.000000000 +0100
@@ -1394,8 +1394,8 @@
;;
linux*)
- case "$build_cpu" in
- i*86)
+ case "$host_cpu" in
+ i*86|mips*|powerpc*|sparc*)
OS=LINUX
cat >>confdefs.h <<\_ACEOF
#define LINUX 1

View File

@ -1,23 +0,0 @@
Index: srelay-0.4.6/get-bind.c
===================================================================
--- srelay-0.4.6.orig/get-bind.c 2008-02-28 13:21:29.000000000 +0100
+++ srelay-0.4.6/get-bind.c 2008-02-28 13:21:30.000000000 +0100
@@ -50,6 +50,18 @@
#include <asm/types.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
+#include <linux/version.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
+# include <linux/if_addr.h>
+#endif
+#ifndef IFA_RTA
+# define IFA_RTA(r) ((struct rtattr *) ((char *)(r) + NLMSG_ALIGN (sizeof (struct ifaddrmsg))))
+# define IFA_PAYLOAD(n) NLMSG_PAYLOAD (n, sizeof (struct ifaddrmsg))
+#endif
+#ifndef IFLA_RTA
+# define IFLA_RTA(r) ((struct rtattr *) ((char *)(r) + NLMSG_ALIGN (sizeof (struct ifinfomsg))))
+# define IFLA_PAYLOAD(n) NLMSG_PAYLOAD (n, sizeof (struct ifinfomsg))
+#endif
static int get_ifconf(int, struct addrinfo *);
#endif /* defined(LINUX) */

View File

@ -1,21 +0,0 @@
Index: srelay-0.4.6/main.c
===================================================================
--- srelay-0.4.6.orig/main.c 2008-02-28 13:21:29.000000000 +0100
+++ srelay-0.4.6/main.c 2008-02-28 13:21:30.000000000 +0100
@@ -33,6 +33,7 @@
*/
#include <sys/stat.h>
+#include <syslog.h>
#include "srelay.h"
/* prototypes */
@@ -125,6 +126,8 @@
uid = getuid();
+ openlog("srelay", LOG_PID, LOG_DAEMON);
+
while((ch = getopt(ac, av, "a:c:i:m:o:p:u:frstbvh?")) != -1)
switch (ch) {
case 'a':

View File

@ -1,132 +0,0 @@
Index: srelay-0.4.6/main.c
===================================================================
--- srelay-0.4.6.orig/main.c 2008-02-28 13:21:30.000000000 +0100
+++ srelay-0.4.6/main.c 2008-02-28 13:21:30.000000000 +0100
@@ -44,6 +44,7 @@
char *ident = "srelay";
char *pidfile = PIDFILE;
char *pwdfile = PWDFILE;
+char *bindtodevice = NULL;
pid_t master_pid;
#if USE_THREAD
@@ -75,6 +76,9 @@
fprintf(stderr, "options:\n"
"\t-c file\tconfig file\n"
"\t-i i/f\tlisten interface IP[:PORT]\n"
+#ifdef SO_BINDTODEVICE
+ "\t-J i/f\toutbound interface name\n"
+#endif
"\t-m num\tmax child/thread\n"
"\t-o min\tidle timeout minutes\n"
"\t-p file\tpid file\n"
@@ -128,7 +132,7 @@
openlog("srelay", LOG_PID, LOG_DAEMON);
- while((ch = getopt(ac, av, "a:c:i:m:o:p:u:frstbvh?")) != -1)
+ while((ch = getopt(ac, av, "a:c:i:J:m:o:p:u:frstbvh?")) != -1)
switch (ch) {
case 'a':
if (optarg != NULL) {
@@ -183,6 +187,14 @@
}
break;
+#ifdef SO_BINDTODEVICE
+ case 'J':
+ if (optarg != NULL) {
+ bindtodevice = strdup(optarg);
+ }
+ break;
+#endif
+
case 'o':
if (optarg != NULL) {
idle_timeout = atol(optarg);
Index: srelay-0.4.6/socks.c
===================================================================
--- srelay-0.4.6.orig/socks.c 2008-02-28 13:21:29.000000000 +0100
+++ srelay-0.4.6/socks.c 2008-02-28 13:21:30.000000000 +0100
@@ -990,6 +990,24 @@
return(-1);
}
+#ifdef SO_BINDTODEVICE
+#include <net/if.h>
+static int do_bindtodevice(int cs, char *dev)
+{
+ int rc;
+ struct ifreq interface;
+
+ strncpy(interface.ifr_name, dev, IFNAMSIZ);
+ setreuid(PROCUID, 0);
+ rc = setsockopt(cs, SOL_SOCKET, SO_BINDTODEVICE,
+ (char *)&interface, sizeof(interface));
+ setreuid(0, PROCUID);
+ if (rc < 0)
+ msg_out(crit, "setsockopt SO_BINDTODEVICE(%s) failed: %d", dev, errno);
+ return(rc);
+}
+#endif
+
int socks_direct_conn(int ver, struct socks_req *req)
{
int cs, acs = 0;
@@ -1037,6 +1055,14 @@
continue;
}
+#ifdef SO_BINDTODEVICE
+ if (bindtodevice && do_bindtodevice(cs, bindtodevice) < 0) {
+ save_errno = errno;
+ close(cs);
+ continue;
+ }
+#endif
+
if (connect(cs, res->ai_addr, res->ai_addrlen) < 0) {
/* connect fail */
save_errno = errno;
@@ -1096,6 +1122,14 @@
return(-1);
}
+#ifdef SO_BINDTODEVICE
+ if (bindtodevice && do_bindtodevice(acs, bindtodevice) < 0) {
+ GEN_ERR_REP(req->s, ver);
+ close(acs);
+ return(-1);
+ }
+#endif
+
if (bind_sock(acs, req, &ba) != 0) {
GEN_ERR_REP(req->s, ver);
return(-1);
@@ -1351,6 +1385,14 @@
continue;
}
+#ifdef SO_BINDTODEVICE
+ if (bindtodevice && do_bindtodevice(cs, bindtodevice) < 0) {
+ save_errno = errno;
+ close(cs);
+ continue;
+ }
+#endif
+
if (connect(cs, res->ai_addr, res->ai_addrlen) < 0) {
/* connect fail */
save_errno = errno;
Index: srelay-0.4.6/srelay.h
===================================================================
--- srelay-0.4.6.orig/srelay.h 2008-02-28 13:21:29.000000000 +0100
+++ srelay-0.4.6/srelay.h 2008-02-28 13:21:30.000000000 +0100
@@ -266,6 +266,7 @@
extern char *ident;
extern char *pidfile;
extern char *pwdfile;
+extern char *bindtodevice;
extern int max_child;
extern int cur_child;
extern char method_tab[];

View File

@ -1,17 +0,0 @@
Without this patch, authentication will accept any password!
--- a/auth-pwd.c
+++ b/auth-pwd.c
@@ -251,12 +251,9 @@ int checkpasswd(char *user, char *pass)
memset(spwd->sp_pwdp, 0, strlen(spwd->sp_pwdp));
#endif
-#if defined(FREEBSD) || defined(SOLARIS)
if (matched) {
return(0);
} else {
return(-1);
}
-#endif
- return(0);
}