aboutsummaryrefslogtreecommitdiff
path: root/net/ser
diff options
context:
space:
mode:
authorMaxim Sobolev <sobomax@FreeBSD.org>2006-04-21 06:30:43 +0000
committerMaxim Sobolev <sobomax@FreeBSD.org>2006-04-21 06:30:43 +0000
commitdfa121d9d966b38ff43f26fb1ce7a474f2e26cb5 (patch)
tree33a992c0c31ed5427e8c08d35b0c007099d52957 /net/ser
parent08d7206941aea6211579aad60e40d3cf98b63ac5 (diff)
downloadports-dfa121d9d966b38ff43f26fb1ce7a474f2e26cb5.tar.gz
ports-dfa121d9d966b38ff43f26fb1ce7a474f2e26cb5.zip
Merge in latest local changes and improvements:
o Allow radius and presence modules to be turned off; o don't override CFLAGS; o don't duplicate error messages to the console; o postgresql backend doesn't set NULL flag on results properly, so that don't use VAL_NULL() macros on them; o reconnect to MySQL db when necessary; o relax transaction matching rules, so that it works with wider range of phones; o add some missed sanity checks in usrloc; o ignore incoming UDP messages that are shorter than certain limin (128 bytes). They cannot be SIP messages anyway.
Notes
Notes: svn path=/head/; revision=160058
Diffstat (limited to 'net/ser')
-rw-r--r--net/ser/Makefile24
-rw-r--r--net/ser/files/patch-Makefile10
-rw-r--r--net/ser/files/patch-Makefile.defs19
-rw-r--r--net/ser/files/patch-daemonize.c14
-rw-r--r--net/ser/files/patch-main.c10
-rw-r--r--net/ser/files/patch-modules::auth_db::authorize.c44
-rw-r--r--net/ser/files/patch-modules::mysql::my_con.c15
-rw-r--r--net/ser/files/patch-modules::tm::t_lookup.c19
-rw-r--r--net/ser/files/patch-modules::usrloc::urecord.c16
-rw-r--r--net/ser/files/patch-parser::msg_parser.h25
-rw-r--r--net/ser/files/patch-udp_server.c16
-rw-r--r--net/ser/pkg-plist8
12 files changed, 198 insertions, 22 deletions
diff --git a/net/ser/Makefile b/net/ser/Makefile
index 66ec1f19c5a2..3c97f2dff50c 100644
--- a/net/ser/Makefile
+++ b/net/ser/Makefile
@@ -7,6 +7,7 @@
PORTNAME= ser
PORTVERSION= 0.9.6
+PORTREVISION= 1
CATEGORIES= net
MASTER_SITES= http://download.berlios.de/ser/ \
http://download2.berlios.de/ser/
@@ -15,9 +16,6 @@ DISTNAME= ${PORTNAME}-${PORTVERSION}_src
MAINTAINER= sobomax@FreeBSD.org
COMMENT= A very fast and configurable SIP proxy
-LIB_DEPENDS= radiusclient-ng.2:${PORTSDIR}/net/radiusclient \
- xml2.5:${PORTSDIR}/textproc/libxml2
-
WRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION}
USE_GMAKE= yes
@@ -28,6 +26,8 @@ MAN8= ser.8
MAN5= ser.cfg.5
MANCOMPRESSED= no
+.include <bsd.port.pre.mk>
+
.if !defined(WITHOUT_MYSQL)
USE_MYSQL= yes
PLIST_SUB+= MYSQL=""
@@ -44,7 +44,23 @@ PLIST_SUB+= POSTGRESQL="@comment "
MAKE_ENV+= POSTGRESQL=postgres
.endif
-.include <bsd.port.pre.mk>
+.if !defined(WITHOUT_PRESENCE)
+USE_PA= yes
+PLIST_SUB+= PA=""
+LIB_DEPENDS+= xml2.5:${PORTSDIR}/textproc/libxml2
+.else
+PLIST_SUB+= PA="@comment "
+MAKE_ENV+= PA=pa
+.endif
+
+.if !defined(WITHOUT_RADIUS)
+USE_RADIUS= yes
+PLIST_SUB+= RADIUS=""
+LIB_DEPENDS+= radiusclient-ng.2:${PORTSDIR}/net/radiusclient
+.else
+PLIST_SUB+= RADIUS="@comment "
+MAKE_ENV+= RADIUS="auth_radius group_radius uri_radius avp_radius"
+.endif
.if ${ARCH} == "sparc64" || ${ARCH} == "ia64"
BROKEN= Does not compile completely on sparc64 or ia64
diff --git a/net/ser/files/patch-Makefile b/net/ser/files/patch-Makefile
index 99b6cc4ba0de..48110d77f7f0 100644
--- a/net/ser/files/patch-Makefile
+++ b/net/ser/files/patch-Makefile
@@ -3,7 +3,7 @@ $FreeBSD$
--- Makefile.orig
+++ Makefile
-@@ -45,13 +45,12 @@
+@@ -46,13 +46,12 @@
skip_modules?=
# if not set on the cmd. line or the env, exclude this modules:
@@ -17,11 +17,11 @@ $FreeBSD$
cpl-c \
- auth_radius group_radius uri_radius avp_radius \
- pa
-+ group_radius uri_radius avp_radius
++ $(RADIUS) $(PA)
# always exclude the CVS dir
override exclude_modules+= CVS $(skip_modules)
-@@ -263,7 +262,7 @@
+@@ -268,7 +267,7 @@
chmod 644 $(cfg-prefix)/$(cfg-dir)ser.cfg.sample
if [ -z "${skip_cfg_install}" -a \
! -f $(cfg-prefix)/$(cfg-dir)ser.cfg ]; then \
@@ -29,8 +29,8 @@ $FreeBSD$
+ cp $(cfg-prefix)/$(cfg-dir)ser.cfg.sample \
$(cfg-prefix)/$(cfg-dir)ser.cfg; \
fi
- # $(INSTALL-CFG) etc/ser.cfg $(cfg-prefix)/$(cfg-dir)
-@@ -272,10 +271,10 @@
+ # radius dictionary
+@@ -280,10 +279,10 @@
$(INSTALL-TOUCH) $(bin-prefix)/$(bin-dir)/ser
$(INSTALL-BIN) ser $(bin-prefix)/$(bin-dir)
$(INSTALL-TOUCH) $(bin-prefix)/$(bin-dir)/sc
diff --git a/net/ser/files/patch-Makefile.defs b/net/ser/files/patch-Makefile.defs
index 90c41afc2616..5a72b5cc5f15 100644
--- a/net/ser/files/patch-Makefile.defs
+++ b/net/ser/files/patch-Makefile.defs
@@ -1,5 +1,8 @@
---- Makefile.defs.orig Wed Jan 11 03:55:58 2006
-+++ Makefile.defs Thu Mar 2 19:08:17 2006
+
+$FreeBSD$
+
+--- Makefile.defs.orig
++++ Makefile.defs
@@ -169,10 +169,11 @@
INSTALL-TOUCH = touch # used to create the file first (good to
# make solaris install work)
@@ -32,7 +35,7 @@
ifeq ($(CC_NAME), gcc)
#common stuff
- CFLAGS=-g -O9 -funroll-loops -Wcast-align $(PROFILE) \
-+ CFLAGS=-funroll-loops -Wcast-align $(PROFILE) \
++ CFLAGS+=-funroll-loops -Wcast-align $(PROFILE) \
-Wall
#if gcc 4.0+
ifeq ($(CC_SHORTVER), 4.x)
@@ -132,7 +135,15 @@
LDFLAGS+=-g $(PROFILE)
MOD_LDFLAGS=-G $(LDFLAGS)
endif
-@@ -1034,7 +1034,7 @@
+@@ -1028,13 +1028,14 @@
+
+ ifeq ($(OS), freebsd)
+ DEFS+=-DHAVE_SOCKADDR_SA_LEN -DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN \
+- -DHAVE_SCHED_YIELD -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_CONNECT_ECONNRESET_BUG
++ -DHAVE_SCHED_YIELD -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_CONNECT_ECONNRESET_BUG \
++ -I$(LOCALBASE)/include
+ ifneq ($(found_lock_method), yes)
+ DEFS+= -DUSE_PTHREAD_MUTEX # try pthread sems
found_lock_method=yes
LIBS= -pthread -lfl #dlopen is in libc
else
diff --git a/net/ser/files/patch-daemonize.c b/net/ser/files/patch-daemonize.c
new file mode 100644
index 000000000000..88cd832a0ecc
--- /dev/null
+++ b/net/ser/files/patch-daemonize.c
@@ -0,0 +1,14 @@
+
+$FreeBSD$
+
+--- daemonize.c
++++ daemonize.c
+@@ -198,7 +198,7 @@
+ }
+
+ if (log_stderr==0)
+- openlog(name, LOG_PID|LOG_CONS, log_facility);
++ openlog(name, LOG_PID, log_facility);
+ /* LOG_CONS, LOG_PERRROR ? */
+
+ return 0;
diff --git a/net/ser/files/patch-main.c b/net/ser/files/patch-main.c
index f490905b8b03..00ef167417fd 100644
--- a/net/ser/files/patch-main.c
+++ b/net/ser/files/patch-main.c
@@ -3,7 +3,7 @@ $FreeBSD$
--- main.c.orig
+++ main.c
-@@ -249,6 +251,10 @@
+@@ -251,6 +251,10 @@
be default yes, good for trouble-shooting
*/
int server_signature=1;
@@ -14,3 +14,11 @@ $FreeBSD$
/* should ser try to locate outbound interface on multihomed
* host? by default not -- too expensive
*/
+@@ -350,6 +354,7 @@
+ void cleanup(show_status)
+ {
+ /*clean-up*/
++ setlogmask(LOG_UPTO(LOG_INFO));
+ if (mem_lock)
+ shm_unlock(); /* hack: force-unlock the shared memory lock in case
+ some process crashed and let it locked; this will
diff --git a/net/ser/files/patch-modules::auth_db::authorize.c b/net/ser/files/patch-modules::auth_db::authorize.c
new file mode 100644
index 000000000000..15fb53b5e220
--- /dev/null
+++ b/net/ser/files/patch-modules::auth_db::authorize.c
@@ -0,0 +1,44 @@
+
+$FreeBSD$
+
+--- modules/auth_db/authorize.c
++++ modules/auth_db/authorize.c
+@@ -101,7 +101,7 @@
+ }
+ pkg_free(col);
+
+- if ((RES_ROW_N(*res) == 0) || VAL_NULL(ROW_VALUES(RES_ROWS(*res)))) {
++ if (RES_ROW_N(*res) == 0) {
+ DBG("get_ha1(): no result for user \'%.*s@%.*s\'\n",
+ _username->user.len, ZSW(_username->user.s), (use_domain ? (_domain->len) : 0), ZSW(_domain->s));
+ return 1;
+@@ -212,9 +212,7 @@
+ rpid.s = NULL;
+ rpid.len = 0;
+ for (i = 0; i < avps_str_n; i++) {
+- if (avps_str[i].len != 4
+- || VAL_NULL(&(result->rows[0].values[1 + avps_int_n + i]))
+- || memcmp(avps_str[i].s, "rpid", 4) != 0)
++ if (avps_str[i].len != 4 || memcmp(avps_str[i].s, "rpid", 4) != 0)
+ continue;
+ rpid.s = (char*)VAL_STRING(&(result->rows[0].values[1 + avps_int_n + i]));
+ if(rpid.s!=NULL)
+@@ -230,8 +228,6 @@
+ return -1;
+ case AUTHORIZED:
+ for (i = 0; i < avps_int_n; i++) {
+- if(VAL_NULL(&(result->rows[0].values[1 + i])))
+- continue;
+ iname.s = &(avps_int[i]);
+ ivalue.n = VAL_INT(&(result->rows[0].values[1 + i]));
+ add_avp(AVP_NAME_STR, iname, ivalue);
+@@ -240,8 +236,7 @@
+ }
+ for (i = 0; i < avps_str_n; i++) {
+ value.s = (char*)VAL_STRING(&(result->rows[0].values[1 + avps_int_n + i]));
+- if(VAL_NULL(&(result->rows[0].values[1 + avps_int_n + i]))
+- || value.s==NULL)
++ if(value.s==NULL)
+ continue;
+ iname.s = &(avps_str[i]);
+ value.len = strlen(value.s);
diff --git a/net/ser/files/patch-modules::mysql::my_con.c b/net/ser/files/patch-modules::mysql::my_con.c
new file mode 100644
index 000000000000..50c1d6070e42
--- /dev/null
+++ b/net/ser/files/patch-modules::mysql::my_con.c
@@ -0,0 +1,15 @@
+
+$FreeBSD$
+
+--- modules/mysql/my_con.c
++++ modules/mysql/my_con.c
+@@ -70,6 +70,9 @@
+ goto err;
+ }
+
++ /* Enable reconnection explictly */
++ ptr->con->reconnect = 1;
++
+ ptr->timestamp = time(0);
+
+ ptr->id = id;
diff --git a/net/ser/files/patch-modules::tm::t_lookup.c b/net/ser/files/patch-modules::tm::t_lookup.c
index e64315689ec4..18a3ddf1abf4 100644
--- a/net/ser/files/patch-modules::tm::t_lookup.c
+++ b/net/ser/files/patch-modules::tm::t_lookup.c
@@ -1,9 +1,9 @@
$FreeBSD$
---- modules/tm/t_lookup.c.orig Fri Jul 16 00:18:34 2004
-+++ modules/tm/t_lookup.c Tue Jul 27 21:01:37 2004
-@@ -97,8 +97,8 @@
+--- modules/tm/t_lookup.c.orig
++++ modules/tm/t_lookup.c
+@@ -103,8 +103,8 @@
#include "t_msgbuilder.h" /* for t_lookup_callid */
#define EQ_VIA_LEN(_via)\
@@ -14,7 +14,7 @@ $FreeBSD$
-@@ -116,7 +116,7 @@
+@@ -122,7 +122,7 @@
#define EQ_VIA_STR(_via)\
( memcmp( t_msg->_via->name.s,\
p_msg->_via->name.s,\
@@ -23,3 +23,14 @@ $FreeBSD$
)==0 )
+@@ -264,8 +264,10 @@
+ if (memcmp(inv_via->host.s, ack_via->host.s,
+ ack_via->host.len)!=0)
+ return 0;
++#if 0
+ if (inv_via->port!=ack_via->port)
+ return 0;
++#endif
+ if (inv_via->transport.len!=ack_via->transport.len)
+ return 0;
+ if (memcmp(inv_via->transport.s, ack_via->transport.s,
diff --git a/net/ser/files/patch-modules::usrloc::urecord.c b/net/ser/files/patch-modules::usrloc::urecord.c
new file mode 100644
index 000000000000..33be6b49cd95
--- /dev/null
+++ b/net/ser/files/patch-modules::usrloc::urecord.c
@@ -0,0 +1,16 @@
+
+$FreeBSD$
+
+--- modules/usrloc/urecord.c
++++ modules/usrloc/urecord.c
+@@ -502,8 +502,8 @@
+
+ ptr = _r->contacts;
+ while(ptr) {
+- if ((_c->len == ptr->c.len) &&
+- !memcmp(_c->s, ptr->c.s, _c->len)) {
++ if (_c == NULL || ((_c->len == ptr->c.len) &&
++ !memcmp(_c->s, ptr->c.s, _c->len))) {
+ *_co = ptr;
+ return 0;
+ }
diff --git a/net/ser/files/patch-parser::msg_parser.h b/net/ser/files/patch-parser::msg_parser.h
new file mode 100644
index 000000000000..aae77f66f6cb
--- /dev/null
+++ b/net/ser/files/patch-parser::msg_parser.h
@@ -0,0 +1,25 @@
+
+$FreeBSD$
+
+--- parser/msg_parser.h.orig
++++ parser/msg_parser.h
+@@ -193,6 +193,7 @@
+ struct hdr_field* accept_disposition;
+ struct hdr_field* diversion;
+ struct hdr_field* rpid;
++ struct hdr_field* server;
+
+ char* eoh; /* pointer to the end of header (if found) or null */
+ char* unparsed; /* here we stopped parsing*/
+@@ -287,7 +288,11 @@
+
+ /* topmost Via is part of transaction key as well ! */
+ src[5]= msg->via1->host;
++#if 0
+ src[6]= msg->via1->port_str;
++#else
++ src[6].len = 0;
++#endif
+ if (msg->via1->branch) {
+ src[7]= msg->via1->branch->value;
+ MDStringArray ( cv, src, 8 );
diff --git a/net/ser/files/patch-udp_server.c b/net/ser/files/patch-udp_server.c
new file mode 100644
index 000000000000..89b155fd5583
--- /dev/null
+++ b/net/ser/files/patch-udp_server.c
@@ -0,0 +1,16 @@
+
+$FreeBSD$
+
+--- udp_server.c
++++ udp_server.c
+@@ -432,6 +432,10 @@
+ continue; /* goto skip;*/
+ else goto error;
+ }
++ if (len < 128) {
++ /* Message is too short, just drop it already */
++ continue;
++ }
+ /* we must 0-term the messages, receive_msg expects it */
+ buf[len]=0; /* no need to save the previous char */
+
diff --git a/net/ser/pkg-plist b/net/ser/pkg-plist
index 920dc8c47c2e..d721e410033e 100644
--- a/net/ser/pkg-plist
+++ b/net/ser/pkg-plist
@@ -9,7 +9,7 @@ lib/ser/modules/acc.so
lib/ser/modules/auth.so
lib/ser/modules/auth_db.so
lib/ser/modules/auth_diameter.so
-lib/ser/modules/auth_radius.so
+%%RADIUS%%lib/ser/modules/auth_radius.so
lib/ser/modules/avp.so
lib/ser/modules/avp_db.so
lib/ser/modules/avpops.so
@@ -31,7 +31,7 @@ lib/ser/modules/msilo.so
lib/ser/modules/mediaproxy.so
lib/ser/modules/nathelper.so
lib/ser/modules/options.so
-lib/ser/modules/pa.so
+%%PA%%lib/ser/modules/pa.so
lib/ser/modules/pdt.so
lib/ser/modules/permissions.so
lib/ser/modules/pike.so
@@ -62,7 +62,7 @@ sbin/serunix
%%DOCSDIR%%/README.auth
%%DOCSDIR%%/README.auth_db
%%DOCSDIR%%/README.auth_diameter
-%%DOCSDIR%%/README.auth_radius
+%%RADIUS%%%%DOCSDIR%%/README.auth_radius
%%DOCSDIR%%/README.avp
%%DOCSDIR%%/README.avp_db
%%DOCSDIR%%/README.avpops
@@ -81,7 +81,7 @@ sbin/serunix
%%DOCSDIR%%/README.msilo
%%DOCSDIR%%/README.nathelper
%%DOCSDIR%%/README.options
-%%DOCSDIR%%/README.pa
+%%PA%%%%DOCSDIR%%/README.pa
%%DOCSDIR%%/README.pdt
%%DOCSDIR%%/README.permissions
%%DOCSDIR%%/README.pike