opensips/opensips.patch

changeset 377
67e813202d53
parent 376
8f552d1cd671
child 382
b972dc20871f
     1.1 --- a/opensips/opensips.patch	Wed Sep 21 14:02:13 2011 +0200
     1.2 +++ b/opensips/opensips.patch	Wed Sep 21 14:04:16 2011 +0200
     1.3 @@ -1,29 +1,96 @@
     1.4 +Index: main.c
     1.5 +diff -Nau main.c.orig main.c
     1.6 +--- main.c.orig	2009-12-10 14:11:03.590141302 +0100
     1.7 ++++ main.c	2009-12-10 14:11:07.246237908 +0100
     1.8 +@@ -1038,6 +1038,10 @@
     1.9 + 	ret=-1;
    1.10 + 	my_argc=argc; my_argv=argv;
    1.11 + 
    1.12 ++	/* if (!log_stderr), that's not usable yet! '/
    1.13 ++	/* ...so unconditionally log to syslog for now */
    1.14 ++	openlog(argv[0], LOG_PID|LOG_CONS, log_facility);
    1.15 ++
    1.16 + 	/*init pkg mallocs (before parsing cfg or cmd line !)*/
    1.17 + 	if (init_pkg_mallocs()==-1)
    1.18 + 		goto error00;
    1.19 +@@ -1370,6 +1374,11 @@
    1.20 + 
    1.21 + 	/* init_daemon? */
    1.22 + 	if (!dont_fork){
    1.23 ++		/* shortly after main() we called openlog(3) to log */
    1.24 ++		/* the initialization, but since daemonize() has its */
    1.25 ++		/* own syslog(3) handling, we need to close the log first */
    1.26 ++		closelog(); /* close the initialization logging logic */
    1.27 ++
    1.28 + 		if ( daemonize((log_name==0)?argv[0]:log_name, &own_pgid) <0 )
    1.29 + 			goto error;
    1.30 + 	}
    1.31  Index: Makefile.defs
    1.32 ---- Makefile.defs.orig	2009-03-23 19:32:01 +0100
    1.33 -+++ Makefile.defs	2009-03-24 19:10:36 +0100
    1.34 -@@ -1161,6 +1161,8 @@
    1.35 +diff -Nau Makefile.defs.orig Makefile.defs
    1.36 +--- Makefile.defs.orig	2007-12-13 14:39:06.000000000 +0100
    1.37 ++++ Makefile.defs	2008-01-14 16:48:02.811615000 +0100
    1.38 +@@ -220,7 +220,7 @@
    1.39 + else
    1.40 + 	doc-dir = doc/$(MAIN_NAME)/
    1.41 + 	man-dir = man/
    1.42 +-	data-dir = $(MAIN_NAME)/
    1.43 ++	data-dir = share/$(MAIN_NAME)/
    1.44 + 	LOCALBASE ?= $(SYSBASE)/local
    1.45 + endif
    1.46 + endif
    1.47 +@@ -1432,6 +1432,10 @@
    1.48 + LIBS+= -lsctp
    1.49 + endif
    1.50   
    1.51 - endif #mode=release
    1.52 - 
    1.53 ++#conditionally add libfsl
    1.54  +LDFLAGS += -L$(prefix)/lib
    1.55  +LIBS    += -lfsl
    1.56 ++
    1.57 + ifneq ($(found_lock_method), yes)
    1.58 + $(warning	No locking method found so far, trying SYS V sems)
    1.59 + 		DEFS+= -DUSE_SYSV_SEM  # try sys v sems
    1.60 +Index: scripts/opensipsctl.8
    1.61 +diff -Nau scripts/opensipsctl.8.orig scripts/opensipsctl.8
    1.62 +--- scripts/opensipsctl.8.orig	2009-03-25 00:22:16.771365571 +0100
    1.63 ++++ scripts/opensipsctl.8	2009-03-25 00:22:34.295365555 +0100
    1.64 +@@ -20,8 +20,6 @@
    1.65   
    1.66 - #*FLAGS used for compiling the modules
    1.67 - ifeq	($(CC_NAME), gcc)
    1.68 -@@ -1397,8 +1399,8 @@
    1.69 + .SH FILES
    1.70 + .PD 0
    1.71 +-.I /etc/opensips/.opensipsctlrc
    1.72 +-.br
    1.73 + .I /usr/local/etc/opensips/.opensipsctlrc
    1.74 + .br
    1.75 + .I ~/.opensipsctlrc
    1.76 +Index: scripts/osipsconsole
    1.77 +diff -Nau scripts/osipsconsole.orig scripts/osipsconsole
    1.78 +--- scripts/osipsconsole.orig	2009-12-08 03:31:32.633224883 +0100
    1.79 ++++ scripts/osipsconsole	2009-12-08 03:31:51.119960848 +0100
    1.80 +@@ -30,7 +30,6 @@
    1.81 + use Term::ReadLine;
    1.82 + use DBI;
    1.83 + use POSIX;
    1.84 +-use Frontier::RPC2;
    1.85 + use IO::Socket;
    1.86 + use Socket;
    1.87 + #use Net::IP;
    1.88 +@@ -378,6 +377,12 @@
    1.89 + 			}		
    1.90 + 		}
    1.91   
    1.92 - #add libssl if needed
    1.93 - ifneq ($(TLS),)
    1.94 --DEFS+= -I$(LOCALBASE)/ssl/include -I$(LOCALBASE)/include -I$(SYSBASE)/include/openssl
    1.95 --LIBS+= -L$(LOCALBASE)/lib -L$(LOCALBASE)/ssl/lib -lssl  -lcrypto
    1.96 -+DEFS+= -I$(prefix)/include
    1.97 -+LIBS+= -L$(prefix)/lib -lssl -lcrypto
    1.98 - endif
    1.99 - 
   1.100 - #add libsctp if needed
   1.101 ++		if ( $MD5 eq "" ) {
   1.102 ++			if ( $arr[0] =~ /^\s*MD5/ ) {
   1.103 ++			 	$MD5 = $arr[1]; 
   1.104 ++			}		
   1.105 ++		}
   1.106 ++
   1.107 + 		if ( $AWK eq "" ) {
   1.108 + 			if ( $arr[0] =~ /^\s*AWK/ ) {
   1.109 + 			 	$AWK = $arr[1]; 
   1.110  Index: modules/permissions/parse_config.c
   1.111 ---- modules/permissions/parse_config.c.orig	2009-03-23 19:31:32 +0100
   1.112 -+++ modules/permissions/parse_config.c	2009-03-24 19:10:36 +0100
   1.113 +diff -Nau modules/permissions/parse_config.c.orig modules/permissions/parse_config.c
   1.114 +--- modules/permissions/parse_config.c.orig	2008-08-03 15:54:01 +0200
   1.115 ++++ modules/permissions/parse_config.c	2008-08-09 11:58:55 +0200
   1.116  @@ -114,8 +114,11 @@
   1.117   	except = strstr(str, " EXCEPT ");
   1.118   	if (except) {
   1.119 @@ -48,18 +115,82 @@
   1.120   		*e_exceptions = NULL;
   1.121   	}
   1.122   
   1.123 -Index: rtpproxy-1.2.1/main.c
   1.124 ---- rtpproxy-1.2.1/main.c.orig	2009-03-24 05:46:13 +0100
   1.125 -+++ rtpproxy-1.2.1/main.c	2009-03-24 19:10:36 +0100
   1.126 -@@ -88,7 +88,11 @@
   1.127 - 	bindhost = NULL;
   1.128 - 
   1.129 -     if ((n = resolve(ia, pf, bindhost, servname, AI_PASSIVE)) != 0)
   1.130 -+#if defined(__sun__)
   1.131 -+	errx(1, "setbindhost");
   1.132 -+#else
   1.133 - 	errx(1, "setbindhost: %s", gai_strerror(n));
   1.134 -+#endif
   1.135 +Index: modules/nathelper/nathelper.c
   1.136 +diff -Nau modules/nathelper/nathelper.c.orig modules/nathelper/nathelper.c
   1.137 +--- modules/nathelper/nathelper.c.orig	2010-12-20 14:33:50.000000000 +0100
   1.138 ++++ modules/nathelper/nathelper.c	2011-01-26 17:48:40.685941382 +0100
   1.139 +@@ -288,6 +288,9 @@
   1.140 + 	return 0;
   1.141   }
   1.142   
   1.143 - static void
   1.144 ++/* MSvB macros */
   1.145 ++#define OPENSIPS_NOOP ((void)0)
   1.146 ++
   1.147 + 
   1.148 + 
   1.149 + 
   1.150 +@@ -805,6 +808,7 @@
   1.151 + #define	FIX_MEDIP	0x02
   1.152 + #define	ADD_ANORTPPROXY	0x04
   1.153 + #define	FIX_ORGIP	0x08
   1.154 ++#define	FIX_RTCPIP	0x10
   1.155 + 
   1.156 + #define	ADIRECTION	"a=direction:active"
   1.157 + #define	ADIRECTION_LEN	(sizeof(ADIRECTION) - 1)
   1.158 +@@ -821,7 +825,9 @@
   1.159 + {
   1.160 + 	char *buf;
   1.161 + 	int offset;
   1.162 ++	int binlump;
   1.163 + 	struct lump* anchor;
   1.164 ++	struct lump* templump;
   1.165 + 	str omip, nip, oip;
   1.166 + 
   1.167 + 	/* check that updating mediaip is really necessary */
   1.168 +@@ -852,7 +858,19 @@
   1.169 + 		memcpy(buf, CRLF, CRLF_LEN);
   1.170 + 		memcpy(buf + CRLF_LEN, omip.s, omip.len);
   1.171 + 		memcpy(buf + CRLF_LEN + omip.len, oldip->s, oldip->len);
   1.172 +-		if (insert_new_lump_after(anchor, buf,
   1.173 ++
   1.174 ++		/* if the oldmediaip string is already */
   1.175 ++		/* in the body then don't add it again */
   1.176 ++		binlump = 0;
   1.177 ++		for (templump = msg->body_lumps; templump; templump = templump->next)
   1.178 ++			if (templump->op == LUMP_ADD && strstr(templump->u.value, buf))
   1.179 ++				binlump = 1;
   1.180 ++		for (templump = msg->add_rm; templump; templump = templump->next)
   1.181 ++			if (templump->op == LUMP_ADD && strstr(templump->u.value, buf))
   1.182 ++				binlump = 1;
   1.183 ++		if (strstr(body->s, buf) || binlump)
   1.184 ++			pkg_free(buf);
   1.185 ++		else if (insert_new_lump_after(anchor, buf,
   1.186 + 		    omip.len + oldip->len + CRLF_LEN, 0) == NULL) {
   1.187 + 			LM_ERR("insert_new_lump_after failed\n");
   1.188 + 			pkg_free(buf);
   1.189 +@@ -1038,6 +1056,12 @@
   1.190 + 		p= p->next;
   1.191 + 	}
   1.192 + 
   1.193 ++	if (level & FIX_RTCPIP) {
   1.194 ++		/* Iterate all a=rtcp: and replace ips in them. */
   1.195 ++		if (replace_sdp_ip(msg, &body, "a=rtcp:", str2?&ip:0)==-1)
   1.196 ++			return -1;
   1.197 ++	}
   1.198 ++
   1.199 + 	return 1;
   1.200 + }
   1.201 + 
   1.202 +Index: parser/sdp/sdp_helpr_funcs.c
   1.203 +diff -Nau parser/sdp/sdp_helpr_funcs.c.orig parser/sdp/sdp_helpr_funcs.c
   1.204 +--- parser/sdp/sdp_helpr_funcs.c.orig	2010-12-08 15:14:06.000000000 +0100
   1.205 ++++ parser/sdp/sdp_helpr_funcs.c	2011-01-27 00:39:50.128212053 +0100
   1.206 +@@ -392,7 +392,7 @@
   1.207 + 
   1.208 + 	cp1 = NULL;
   1.209 + 	for (cp = body->s; (len = body->s + body->len - cp) > 0;) {
   1.210 +-		cp1 = (char*)ser_memmem(cp, line, len, 2);
   1.211 ++		cp1 = (char*)ser_memmem(cp, line, len, strlen(line));
   1.212 + 		if (cp1 == NULL || cp1[-1] == '\n' || cp1[-1] == '\r')
   1.213 + 			break;
   1.214 + 		cp = cp1 + 2;

mercurial