diff --git a/.gitignore b/.gitignore index 37c2b41..e6f86c4 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ opensips-1.6.3-tls_src.tar.gz /opensips-1.10.1_src.tar.gz /opensips-1.10.3_src.tar.gz /opensips-1.10.4_src.tar.gz +/opensips-1.10.5_src.tar.gz diff --git a/opensips-0003-Removed-all-async-Oracle-operations-they-didn-t-work.patch b/opensips-0003-Removed-all-async-Oracle-operations-they-didn-t-work.patch index a3fa770..b844a22 100644 --- a/opensips-0003-Removed-all-async-Oracle-operations-they-didn-t-work.patch +++ b/opensips-0003-Removed-all-async-Oracle-operations-they-didn-t-work.patch @@ -5,6 +5,350 @@ Subject: [PATCH] Removed all async Oracle operations - they didn't work well anyway +diff --git a/modules/db_oracle/asynch.c b/modules/db_oracle/asynch.c +deleted file mode 100644 +index d1bbe84..0000000 +--- a/modules/db_oracle/asynch.c ++++ /dev/null +@@ -1,270 +0,0 @@ +-/* +- * $Id$ +- * +- * Oracle module interface +- * +- * Copyright (C) 2007,2008 TRUNK MOBILE +- * +- * This file is part of opensips, a free SIP server. +- * +- * opensips is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2 of the License, or +- * (at your option) any later version +- * +- * opensips is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with this program; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +- */ +-/* +- * History: +- * -------- +- */ +- +-#include +-#include +-#include +-#include +-#include "../../dprint.h" +-#include "../../sr_module.h" +-#include "ora_con.h" +-#include "asynch.h" +- +-#define MAX_TIMEOUT_S 10 +-#define MIN_TIMEOUT_MS 100 +- +- +-/* Default is 3.0 second */ +-static struct timeval request_tm = { .tv_sec = 3, .tv_usec = 0 }; +- +-/* Default is 0.2 second */ +-static struct timeval restore_tm = { .tv_sec = 0, .tv_usec = 200*1000 }; +-static const struct timeval defrest_tm = { .tv_sec = 0, .tv_usec = 200*1000 }; +- +-static int synch_mode; +-static int cur_asynch_mode; +-static struct timeval wtm; +- +- +-static __inline__ int is_zero_tm(const struct timeval* tv) +-{ +- return !tv->tv_usec && !tv->tv_sec; +-} +- +- +-/* +- * parse timeout value in syntax: nnn.mmm (sec/ms) +- */ +-static int set_tv(unsigned type, const char* val, struct timeval* tv) +-{ +- char *eptr; +- unsigned long s, ms; +- double dv; +- +- if (type != STR_PARAM) { +- LM_ERR("type of parameter is no STR\n"); +- return -1; +- } +- +- if (!val || !*val) { +- LM_ERR("empty parameter\n"); +- return -1; +- } +- +- errno = 0; +- dv = strtod(val, &eptr); +- +- if (*eptr) { +- LM_ERR("invalid parameter string\n"); +- return -2; +- } +- +- if ( errno +- || dv > (double)MAX_TIMEOUT_S +- || (dv && dv < ((double)MIN_TIMEOUT_MS)/1000)) +- { +- LM_ERR("value must be between 0.%u and %u.0\n", +- MIN_TIMEOUT_MS, MAX_TIMEOUT_S); +- return -3; +- } +- +- s = (unsigned)dv; +- dv -= (double)s; +- ms = (unsigned)(dv * 1000); +- tv->tv_sec = (time_t)s; +- tv->tv_usec = (suseconds_t)ms; +- return 0; +-} +- +- +-/* +- * set operation timeout +- */ +-int set_timeout(unsigned type, const char* val) +-{ +- int rc = set_tv(type, val, &request_tm); +- +- if (!rc) { +- synch_mode = is_zero_tm(&request_tm); +- if (!synch_mode && is_zero_tm(&restore_tm)) +- restore_tm = defrest_tm; +- } +- +- return rc; +-} +- +- +-/* +- * set (re)connect timeout +- */ +-int set_reconnect(unsigned type, const char* val) +-{ +- int rc = set_tv(type, val, &restore_tm); +- +- if (!synch_mode && is_zero_tm(&restore_tm)) { +- LM_WARN("in asyncronus mode reconnect time can't be zero. " +- "Set default value\n"); +- restore_tm = defrest_tm; +- } +- +- return rc; +-} +- +- +-static sword change_mode(ora_con_t* con) +-{ +- return OCIAttrSet(con->svchp, OCI_HTYPE_SVCCTX, NULL, 0, +- OCI_ATTR_NONBLOCKING_MODE, con->errhp); +-} +- +- +-/* +- * start timelimited operation (if work in synch mode return SUCCESS) +- */ +-sword begin_timelimit(ora_con_t* con, int connect) +-{ +- struct timeval* tv; +- sword status; +- +- if (synch_mode) +- return OCI_SUCCESS; +- +- if (connect || cur_asynch_mode) { +- ub1 mode; +- +- status = OCIAttrGet(con->svchp, OCI_HTYPE_SVCCTX, &mode, NULL, +- OCI_ATTR_NONBLOCKING_MODE, con->errhp); +- if (status != OCI_SUCCESS) +- return status; +- +- if (mode) { +- status = change_mode(con); +- if (status != OCI_SUCCESS) +- return status; +- } +- cur_asynch_mode = 0; +- } +- +- status = change_mode(con); +- if (status != OCI_SUCCESS && connect >= 0) +- return status; +- +- cur_asynch_mode = 1; +- +- gettimeofday(&wtm, NULL); +- tv = &request_tm; +- if (connect) +- tv = &restore_tm; +- wtm.tv_sec += tv->tv_sec; +- wtm.tv_usec += tv->tv_usec; +- if (wtm.tv_usec >= 1000000) { +- wtm.tv_usec -= 1000000; +- ++wtm.tv_sec; +- } +- +- return OCI_SUCCESS; +-} +- +- +-static sword remap_status(ora_con_t* con, sword status) +-{ +- sword code; +- +- if ( status == OCI_ERROR +- && OCIErrorGet(con->errhp, 1, NULL, &code, +- NULL, 0, OCI_HTYPE_ERROR) == OCI_SUCCESS +- && (code == 3123 /*|| code == 3127*/)) +- { +- status = OCI_STILL_EXECUTING; +- } +- return status; +-} +- +- +-/* +- * check completion of timelimited operation (if work in synch mode return 0) +- */ +-int wait_timelimit(ora_con_t* con, sword status) +-{ +- struct timeval cur; +- +- if (!cur_asynch_mode) +- return 0; +- +- if (remap_status(con, status) != OCI_STILL_EXECUTING) +- return 0; +- +- gettimeofday(&cur, NULL); +- return ( cur.tv_sec < wtm.tv_sec +- || (cur.tv_sec == wtm.tv_sec && cur.tv_usec < wtm.tv_usec)); +-} +- +- +-/* +- * close current timelimited operation and disconnect if timeout occured +- * return true only if work in asynch mode and timeout detect +- */ +-int done_timelimit(ora_con_t* con, sword status) +-{ +- int ret = 0; +- +- if (!cur_asynch_mode) +- return 0; +- +- if (remap_status(con, status) == OCI_STILL_EXECUTING) { +- sword code; +- +- status = OCIBreak(con->svchp, con->errhp); +- if (status != OCI_SUCCESS) +- LM_ERR("driver: %s\n", +- db_oracle_error(con, status)); +- +- status = OCIReset(con->svchp, con->errhp); +- if ( status == OCI_ERROR +- && OCIErrorGet(con->errhp, 1, NULL, &code, +- NULL, 0, OCI_HTYPE_ERROR) == OCI_SUCCESS +- && code == 1013) +- { +- status = OCI_SUCCESS; +- } +- if (status != OCI_SUCCESS) +- LM_ERR("driver: %s\n", +- db_oracle_error(con, status)); +- db_oracle_disconnect(con); +- ++ret; +- } else { +- status = change_mode(con); +- if (status != OCI_SUCCESS) { +- LM_ERR("driver: %s\n", db_oracle_error(con, status)); +- ++ret; +- } else { +- cur_asynch_mode = 0; +- } +- } +- return ret; +-} +diff --git a/modules/db_oracle/asynch.h b/modules/db_oracle/asynch.h +deleted file mode 100644 +index 9694088..0000000 +--- a/modules/db_oracle/asynch.h ++++ /dev/null +@@ -1,62 +0,0 @@ +-/* +- * $Id$ +- * +- * Oracle module interface +- * +- * Copyright (C) 2007,2008 TRUNK MOBILE +- * +- * This file is part of opensips, a free SIP server. +- * +- * opensips is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2 of the License, or +- * (at your option) any later version +- * +- * opensips is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with this program; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +- * +- * History: +- * -------- +- */ +- +-#ifndef ASYNCH_H +-#define ASYNCH_H +- +-#include +-#include "ora_con.h" +- +- +-/* +- * parse timeout value for operation in syntax: nnn.mmm (sec/ms) +- */ +-int set_timeout(unsigned type, const char* val); +- +-/* +- * parse timeout value for reconnect in syntax: nnn.mmm (sec/ms) +- */ +-int set_reconnect(unsigned type, const char* val); +- +- +-/* +- * start timelimited operation (if work in synch mode return SUCCESS) +- */ +-sword begin_timelimit(ora_con_t* con, int connect); +- +-/* +- * check completion of timelimited operation (if work in synch mode return 0) +- */ +-int wait_timelimit(ora_con_t* con, sword status); +- +-/* +- * close current timelimited operation and disconnect if timeout occured +- * return true only if work in asynch mode and timeout detect +- */ +-int done_timelimit(ora_con_t* con, sword status); +- +-#endif /* ASYNCH_H */ diff --git a/modules/db_oracle/db_oracle.c b/modules/db_oracle/db_oracle.c index 70cfe40..40c7692 100644 --- a/modules/db_oracle/db_oracle.c diff --git a/opensips-0010-Fix-fixing-hdr-names-shorter-than-3-chars.patch b/opensips-0010-Fix-fixing-hdr-names-shorter-than-3-chars.patch new file mode 100644 index 0000000..e4d1a8b --- /dev/null +++ b/opensips-0010-Fix-fixing-hdr-names-shorter-than-3-chars.patch @@ -0,0 +1,53 @@ +From: Bogdan-Andrei Iancu +Date: Thu, 11 Jun 2015 11:09:03 +0300 +Subject: [PATCH] Fix fixing hdr names shorter than 3 chars. + +The fixup function fails to identify header names shorter than 3 (like To or short formats). This affected script functions like is_present_hf() or remove_hf(). +Reported by Nick Altmann + +(cherry picked from commit 1f7bae0915ac93ca231ede55c5540560e5489a7b) + +Conflicts: + modules/sipmsgops/sipmsgops.c + +diff --git a/modules/sipmsgops/sipmsgops.c b/modules/sipmsgops/sipmsgops.c +index 6fc8f5d..4444f89 100644 +--- a/modules/sipmsgops/sipmsgops.c ++++ b/modules/sipmsgops/sipmsgops.c +@@ -780,6 +780,7 @@ static int is_method_f(struct sip_msg *msg, char *meth, char *str2 ) + static int hname_fixup(void** param, int param_no) + { + char *c; ++ int len; + struct hdr_field hdr; + gparam_p gp = NULL; + +@@ -793,21 +794,23 @@ static int hname_fixup(void** param, int param_no) + + if (gp->type == GPARAM_TYPE_STR) + { +- c = pkg_malloc(gp->v.sval.len + 1); ++ /* parse_hname2() accepts a minimum 4 bytes len buffer ++ * for parsing, so whatever is the len of the header name, ++ * fill it up to 4 */ ++ len = (gp->v.sval.len<3) ? (4) : (gp->v.sval.len+1) ; ++ c = pkg_malloc( len ); + if (!c) + return E_OUT_OF_MEM; + + memcpy(c, gp->v.sval.s, gp->v.sval.len); + c[gp->v.sval.len] = ':'; +- gp->v.sval.len++; + +- if (parse_hname2(c, c + gp->v.sval.len, &hdr) == 0) ++ if (parse_hname2(c, c + len, &hdr) == 0) + { + LM_ERR("error parsing header name\n"); + return E_UNSPEC; + } +- +- gp->v.sval.len--; ++ + pkg_free(c); + + if (hdr.type != HDR_OTHER_T && hdr.type != HDR_ERROR_T) diff --git a/opensips.spec b/opensips.spec index 6d14d54..eee9239 100644 --- a/opensips.spec +++ b/opensips.spec @@ -13,7 +13,7 @@ Summary: Open Source SIP Server Name: opensips Version: 1.10.5 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ Group: System Environment/Daemons Source0: https://opensips.org/pub/%{name}/%{version}/%{name}-%{version}_src.tar.gz @@ -27,6 +27,7 @@ Patch6: opensips-0006-Don-t-modify-interim-return-value.patch Patch7: opensips-0007-Return-actual-payload-ID-in-case-of-a-dynamic-payloa.patch Patch8: opensips-0008-Use-additional-auth-field-Sip-Source-IP-Address.patch Patch9: opensips-0009-Don-t-remove-pthread-library-explicitly-from-mi_xmlr.patch +Patch10: opensips-0010-Fix-fixing-hdr-names-shorter-than-3-chars.patch URL: https://opensips.org BuildRequires: expat-devel @@ -649,8 +650,6 @@ clients. %setup -q -n %{name}-%{version}-tls %patch1 -p1 %patch2 -p1 -# Fix for broken behaviour of a git/rpmbuild in EL5 -rm -f modules/db_oracle/asynch.* %patch3 -p1 %patch4 -p1 # Patch no.5 removed @@ -658,6 +657,7 @@ rm -f modules/db_oracle/asynch.* %patch7 -p1 -b .return_actual_payload_id %patch8 -p1 -b .additional_auth_field_src_ip %patch9 -p1 -b .restore_pthread_linkage +%patch10 -p1 -b .short_headers %build LOCALBASE=/usr NICER=0 CFLAGS="%{optflags} -fgnu89-inline" LDFLAGS="%{?__global_ldflags}" %{?_with_oracle:ORAHOME="$ORACLE_HOME"} %{__make} all %{?_smp_mflags} TLS=1 \ @@ -704,6 +704,7 @@ install -p -D -m 755 packaging/fedora/opensips.init %{buildroot}%{_initrddir}/op # install systemd files install -D -m 0644 -p packaging/fedora/%{name}.service %{buildroot}%{_unitdir}/%{name}.service install -D -m 0644 -p packaging/fedora/%{name}.tmpfiles.conf %{buildroot}%{_tmpfilesdir}/%{name}.conf +install -D -m 0755 -p packaging/fedora/%{name}.m4cfg %{buildroot}%{_sbindir}/opensips-m4cfg %endif %if 0%{?el6}%{?el7}%{?fedora} mkdir -p %{buildroot}%{_localstatedir}/run/%{name} @@ -742,6 +743,7 @@ fi %files %{_sbindir}/opensips +%{_sbindir}/opensips-m4cfg %{_sbindir}/opensipsctl %{_sbindir}/opensipsdbctl %{_sbindir}/opensipsunix @@ -1227,6 +1229,9 @@ fi %doc docdir/README.xmpp %changelog +* Fri Jun 12 2015 Peter Lemenkov - 1.10.5-2 +- Install missing script (required for a systemd service). See rhbz #1019014. + * Fri Jun 12 2015 Ján ONDREJ (SAL) - 1.10.5-1 - Update to upstream. - Added -fgnu89-inline parameter to fix builds for inline functions. diff --git a/sources b/sources index 875577d..c7f4c08 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -dcbee30a571a90e3c198488d4f33a566 opensips-1.10.4_src.tar.gz +b260118c1c5ba91c1134141c0a5c6359 opensips-1.10.5_src.tar.gz