mirror of https://github.com/sipwise/kamailio.git
parent
3b29201634
commit
05ce704fcf
@ -1,33 +0,0 @@
|
||||
From 620d9309a1bfe5e6f3ea0e93f40f267cd3f5f1bf Mon Sep 17 00:00:00 2001
|
||||
From: Daniel-Constantin Mierla <miconda@gmail.com>
|
||||
Date: Thu, 9 Jan 2014 19:19:31 +0100
|
||||
Subject: [PATCH] snmpstats: use $(share_prefix) for deploying MIBS
|
||||
|
||||
(cherry picked from commit 5dde71f7fb9715a18dabfe0beeb152b0821c6fb0)
|
||||
|
||||
Conflicts:
|
||||
modules/snmpstats/Makefile
|
||||
---
|
||||
modules/snmpstats/Makefile | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/modules/snmpstats/Makefile b/modules/snmpstats/Makefile
|
||||
index 0778be1..a26c93e 100644
|
||||
--- a/modules/snmpstats/Makefile
|
||||
+++ b/modules/snmpstats/Makefile
|
||||
@@ -14,10 +14,10 @@ ifeq ($(BUILDER),)
|
||||
DEFS +=-I$(LOCALBASE)/include
|
||||
BUILDAGENTLIBS =-L$(LOCALBASE)/lib -lnetsnmpmibs -lnetsnmpagent \
|
||||
-lnetsnmphelpers -lnetsnmp
|
||||
- INSTALLMIBDIR = $(cfg-prefix)/share/snmp/mibs
|
||||
+ INSTALLMIBDIR = $(share_prefix)/share/snmp/mibs
|
||||
else
|
||||
BUILDAGENTLIBS = $(shell net-snmp-config --netsnmp-agent-libs)
|
||||
- INSTALLMIBDIR = $(cfg-prefix)$(shell net-snmp-config --prefix)/share/snmp/mibs
|
||||
+ INSTALLMIBDIR = $(share_prefix)$(shell net-snmp-config --prefix)/share/snmp/mibs
|
||||
endif
|
||||
|
||||
ifeq ($(EMBEDDED_PERL),1)
|
||||
--
|
||||
1.8.5.2
|
||||
|
||||
@ -1,100 +0,0 @@
|
||||
From 67c12f48926c88b265db1501e1d211309bebdc7e Mon Sep 17 00:00:00 2001
|
||||
From: Carsten Bock <carsten@ng-voice.com>
|
||||
Date: Sat, 11 Jan 2014 01:39:21 +0100
|
||||
Subject: [PATCH] ims_auth: Fix for SIP Digest (Segmentation fault) - Fix by
|
||||
Marek Bazler (marek.bazler@acision.com)
|
||||
|
||||
---
|
||||
modules/ims_auth/authorize.c | 36 +++++++++++++++++++++++++++---------
|
||||
1 file changed, 27 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/modules/ims_auth/authorize.c b/modules/ims_auth/authorize.c
|
||||
index 026e3b5..6b9bb13 100644
|
||||
--- a/modules/ims_auth/authorize.c
|
||||
+++ b/modules/ims_auth/authorize.c
|
||||
@@ -89,8 +89,7 @@ extern int ignore_failed_auth;
|
||||
extern int av_check_only_impu;
|
||||
|
||||
auth_hash_slot_t *auth_data; /**< Authentication vector hash table */
|
||||
-extern int auth_data_hash_size; /**< authentication vector hash table size */
|
||||
-
|
||||
+static int act_auth_data_hash_size = 0; /**< authentication vector hash table size */
|
||||
|
||||
static str empty_s = {0, 0};
|
||||
|
||||
@@ -192,7 +191,7 @@ void reg_await_timer(unsigned int ticks, void* param) {
|
||||
int i;
|
||||
|
||||
LM_DBG("Looking for expired/useless at %d\n", ticks);
|
||||
- for (i = 0; i < auth_data_hash_size; i++) {
|
||||
+ for (i = 0; i < act_auth_data_hash_size; i++) {
|
||||
auth_data_lock(i);
|
||||
aud = auth_data[i].head;
|
||||
while (aud) {
|
||||
@@ -704,8 +703,27 @@ int authenticate(struct sip_msg* msg, char* _realm, char* str2, int is_proxy_aut
|
||||
&qop_str,
|
||||
qop == QOP_AUTHINT,
|
||||
&msg->first_line.u.request.method, &uri, hbody, expected);
|
||||
- LM_INFO("UE said: %.*s and we expect %.*s ha1 %.*s (%.*s)\n",
|
||||
- response16.len, response16.s, /*av->authorization.len,av->authorization.s,*/32, expected, 32, ha1, msg->first_line.u.request.method.len, msg->first_line.u.request.method.s);
|
||||
+ LM_INFO("UE said: %.*s and we expect %.*s ha1 %.*s (%.*s)\n",
|
||||
+ response16.len, response16.s,
|
||||
+ /*av->authorization.len,av->authorization.s,*/32, expected,
|
||||
+ 32, ha1,
|
||||
+ msg->first_line.u.request.method.len, msg->first_line.u.request.method.s);
|
||||
+ break;
|
||||
+ case AUTH_SIP_DIGEST:
|
||||
+ case AUTH_DIGEST:
|
||||
+ // memcpy of received HA1
|
||||
+ memcpy(ha1, av->authorization.s, HASHHEXLEN);
|
||||
+ calc_response(ha1, &(av->authenticate),
|
||||
+ &nc,
|
||||
+ &cnonce,
|
||||
+ &qop_str,
|
||||
+ qop == QOP_AUTHINT,
|
||||
+ &msg->first_line.u.request.method, &uri, hbody, expected);
|
||||
+ LM_INFO("UE said: %.*s and we expect %.*s ha1 %.*s (%.*s)\n",
|
||||
+ response16.len, response16.s,
|
||||
+ 32,expected,
|
||||
+ 32,ha1,
|
||||
+ msg->first_line.u.request.method.len, msg->first_line.u.request.method.s);
|
||||
break;
|
||||
default:
|
||||
LM_ERR("algorithm %.*s is not handled.\n",
|
||||
@@ -902,11 +920,11 @@ int auth_data_init(int size) {
|
||||
return 0;
|
||||
}
|
||||
memset(auth_data, 0, sizeof (auth_hash_slot_t) * size);
|
||||
- auth_data_hash_size = size;
|
||||
for (i = 0; i < size; i++) {
|
||||
auth_data[i].lock = lock_alloc();
|
||||
lock_init(auth_data[i].lock);
|
||||
}
|
||||
+ act_auth_data_hash_size = size;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -915,7 +933,7 @@ int auth_data_init(int size) {
|
||||
void auth_data_destroy() {
|
||||
int i;
|
||||
auth_userdata *aud, *next;
|
||||
- for (i = 0; i < auth_data_hash_size; i++) {
|
||||
+ for (i = 0; i < act_auth_data_hash_size; i++) {
|
||||
auth_data_lock(i);
|
||||
lock_destroy(auth_data[i].lock);
|
||||
lock_dealloc(auth_data[i].lock);
|
||||
@@ -1181,9 +1199,9 @@ void free_auth_userdata(auth_userdata * aud) {
|
||||
*/
|
||||
inline unsigned int get_hash_auth(str private_identity, str public_identity) {
|
||||
if (av_check_only_impu)
|
||||
- return core_hash(&public_identity, 0, auth_data_hash_size);
|
||||
+ return core_hash(&public_identity, 0, act_auth_data_hash_size);
|
||||
else
|
||||
- return core_hash(&public_identity, 0, auth_data_hash_size);
|
||||
+ return core_hash(&public_identity, 0, act_auth_data_hash_size);
|
||||
/*
|
||||
|
||||
|
||||
--
|
||||
1.8.5.2
|
||||
|
||||
@ -1,127 +0,0 @@
|
||||
From fc0bad2c005048d73926cbf8637cd8ba10287bd8 Mon Sep 17 00:00:00 2001
|
||||
From: Carsten Bock <carsten@ng-voice.com>
|
||||
Date: Mon, 13 Jan 2014 12:04:13 +0100
|
||||
Subject: [PATCH] ims_registrar_scscf: Fix memory corruption in build_contacts,
|
||||
in case no contacts available
|
||||
|
||||
---
|
||||
modules/ims_registrar_scscf/reply.c | 91 +++++++++++++++++++------------------
|
||||
1 file changed, 48 insertions(+), 43 deletions(-)
|
||||
|
||||
diff --git a/modules/ims_registrar_scscf/reply.c b/modules/ims_registrar_scscf/reply.c
|
||||
index 64b31c3..cfefd5c 100644
|
||||
--- a/modules/ims_registrar_scscf/reply.c
|
||||
+++ b/modules/ims_registrar_scscf/reply.c
|
||||
@@ -412,61 +412,66 @@ int build_contact(ucontact_t* c, contact_for_header_t** contact_header) {
|
||||
tmp_contact_header->data_len = calc_buf_len(c);
|
||||
tmp_contact_header->buf = (char*)shm_malloc(tmp_contact_header->data_len);
|
||||
|
||||
- p = tmp_contact_header->buf;
|
||||
+ if (tmp_contact_header->data_len) {
|
||||
+ p = tmp_contact_header->buf;
|
||||
|
||||
- memcpy(p, CONTACT_BEGIN, CONTACT_BEGIN_LEN);
|
||||
- p += CONTACT_BEGIN_LEN;
|
||||
+ memcpy(p, CONTACT_BEGIN, CONTACT_BEGIN_LEN);
|
||||
+ p += CONTACT_BEGIN_LEN;
|
||||
|
||||
- fl = 0;
|
||||
- while (c) {
|
||||
- if (VALID_CONTACT(c, act_time)) {
|
||||
- if (fl) {
|
||||
- memcpy(p, CONTACT_SEP, CONTACT_SEP_LEN);
|
||||
- p += CONTACT_SEP_LEN;
|
||||
- } else {
|
||||
- fl = 1;
|
||||
- }
|
||||
+ fl = 0;
|
||||
+ while (c) {
|
||||
+ if (VALID_CONTACT(c, act_time)) {
|
||||
+ if (fl) {
|
||||
+ memcpy(p, CONTACT_SEP, CONTACT_SEP_LEN);
|
||||
+ p += CONTACT_SEP_LEN;
|
||||
+ } else {
|
||||
+ fl = 1;
|
||||
+ }
|
||||
|
||||
- *p++ = '<';
|
||||
- memcpy(p, c->c.s, c->c.len);
|
||||
- p += c->c.len;
|
||||
- *p++ = '>';
|
||||
+ *p++ = '<';
|
||||
+ memcpy(p, c->c.s, c->c.len);
|
||||
+ p += c->c.len;
|
||||
+ *p++ = '>';
|
||||
+
|
||||
+ len = len_q(c->q);
|
||||
+ if (len) {
|
||||
+ memcpy(p, Q_PARAM, Q_PARAM_LEN);
|
||||
+ p += Q_PARAM_LEN;
|
||||
+ memcpy(p, q2str(c->q, 0), len);
|
||||
+ p += len;
|
||||
+ }
|
||||
|
||||
- len = len_q(c->q);
|
||||
- if (len) {
|
||||
- memcpy(p, Q_PARAM, Q_PARAM_LEN);
|
||||
- p += Q_PARAM_LEN;
|
||||
- memcpy(p, q2str(c->q, 0), len);
|
||||
+ memcpy(p, EXPIRES_PARAM, EXPIRES_PARAM_LEN);
|
||||
+ p += EXPIRES_PARAM_LEN;
|
||||
+ cp = int2str((int) (c->expires - act_time), &len);
|
||||
+ memcpy(p, cp, len);
|
||||
p += len;
|
||||
+
|
||||
+ if (c->received.s) {
|
||||
+ *p++ = ';';
|
||||
+ memcpy(p, rcv_param.s, rcv_param.len);
|
||||
+ p += rcv_param.len;
|
||||
+ *p++ = '=';
|
||||
+ *p++ = '\"';
|
||||
+ memcpy(p, c->received.s, c->received.len);
|
||||
+ p += c->received.len;
|
||||
+ *p++ = '\"';
|
||||
+ }
|
||||
}
|
||||
|
||||
- memcpy(p, EXPIRES_PARAM, EXPIRES_PARAM_LEN);
|
||||
- p += EXPIRES_PARAM_LEN;
|
||||
- cp = int2str((int) (c->expires - act_time), &len);
|
||||
- memcpy(p, cp, len);
|
||||
- p += len;
|
||||
-
|
||||
- if (c->received.s) {
|
||||
- *p++ = ';';
|
||||
- memcpy(p, rcv_param.s, rcv_param.len);
|
||||
- p += rcv_param.len;
|
||||
- *p++ = '=';
|
||||
- *p++ = '\"';
|
||||
- memcpy(p, c->received.s, c->received.len);
|
||||
- p += c->received.len;
|
||||
- *p++ = '\"';
|
||||
- }
|
||||
+ c = c->next;
|
||||
}
|
||||
|
||||
- c = c->next;
|
||||
- }
|
||||
+ memcpy(p, CRLF, CRLF_LEN);
|
||||
+ p += CRLF_LEN;
|
||||
|
||||
- memcpy(p, CRLF, CRLF_LEN);
|
||||
- p += CRLF_LEN;
|
||||
+ tmp_contact_header->data_len = p - tmp_contact_header->buf;
|
||||
+
|
||||
+ LM_DBG("created Contact HF: %.*s\n", tmp_contact_header->data_len, tmp_contact_header->buf);
|
||||
+ } else
|
||||
+ LM_DBG("No Contact HF created, no contacts.\n");
|
||||
|
||||
- tmp_contact_header->data_len = p - tmp_contact_header->buf;
|
||||
|
||||
- LM_DBG("created Contact HF: %.*s\n", tmp_contact_header->data_len, tmp_contact_header->buf);
|
||||
*contact_header = tmp_contact_header;
|
||||
return 0;
|
||||
}
|
||||
--
|
||||
1.8.5.2
|
||||
|
||||
@ -1,27 +0,0 @@
|
||||
From ac1f9f9b601f3a6f3e53d55c5a061f35df6524e2 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel-Constantin Mierla <miconda@gmail.com>
|
||||
Date: Tue, 14 Jan 2014 08:59:17 +0100
|
||||
Subject: [PATCH] snmpstats: fixed path for deploying mibs when net-snmp-config
|
||||
is used
|
||||
|
||||
(cherry picked from commit 777548d79f17a6eb81d241e18b22329e9654e951)
|
||||
---
|
||||
modules/snmpstats/Makefile | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/modules/snmpstats/Makefile b/modules/snmpstats/Makefile
|
||||
index a26c93e..ea986ac 100644
|
||||
--- a/modules/snmpstats/Makefile
|
||||
+++ b/modules/snmpstats/Makefile
|
||||
@@ -17,7 +17,7 @@ ifeq ($(BUILDER),)
|
||||
INSTALLMIBDIR = $(share_prefix)/share/snmp/mibs
|
||||
else
|
||||
BUILDAGENTLIBS = $(shell net-snmp-config --netsnmp-agent-libs)
|
||||
- INSTALLMIBDIR = $(share_prefix)$(shell net-snmp-config --prefix)/share/snmp/mibs
|
||||
+ INSTALLMIBDIR = $(basedir)$(shell net-snmp-config --prefix)/share/snmp/mibs
|
||||
endif
|
||||
|
||||
ifeq ($(EMBEDDED_PERL),1)
|
||||
--
|
||||
1.8.5.2
|
||||
|
||||
@ -1,131 +0,0 @@
|
||||
From 4fb71c24a119f53d75500c9bf69275634ea05a60 Mon Sep 17 00:00:00 2001
|
||||
From: Jason Penton <jason.penton@gmail.com>
|
||||
Date: Thu, 16 Jan 2014 13:08:29 +0200
|
||||
Subject: [PATCH] =?UTF-8?q?modules/tm:=20fixed=20bug=20where=20AVPs=20are?=
|
||||
=?UTF-8?q?=20not=20restored=20correctly=20if=20async=20used=20within=20fa?=
|
||||
=?UTF-8?q?ilure=20route=20=09-=20related=20to=20mail=20by=20Jos=C3=A9=20S?=
|
||||
=?UTF-8?q?eabra=20on=20Jan=2010=202014=20entitiled=20-=20kamailio-4.1.1?=
|
||||
=?UTF-8?q?=20avp=20issue=20within=20failure=20routes?=
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
(cherry picked from commit f3f2f09beda60e1f7f4e6dfc0359f788991aeef6)
|
||||
---
|
||||
modules/tm/t_reply.c | 93 +++++++++++++++++++++++++---------------------------
|
||||
1 file changed, 44 insertions(+), 49 deletions(-)
|
||||
|
||||
diff --git a/modules/tm/t_reply.c b/modules/tm/t_reply.c
|
||||
index 4d9901d..f6fc568 100644
|
||||
--- a/modules/tm/t_reply.c
|
||||
+++ b/modules/tm/t_reply.c
|
||||
@@ -856,62 +856,57 @@ void faked_env(struct cell *t, struct sip_msg *msg, int is_async_env) {
|
||||
* otherwise the actions would attempt to look the transaction
|
||||
* up (unnecessary overhead, refcounting)
|
||||
*/
|
||||
- if (!is_async_env) {
|
||||
- /* backup */
|
||||
- backup_t = get_t();
|
||||
- backup_branch = get_t_branch();
|
||||
- backup_msgid = global_msg_id;
|
||||
- /* fake transaction and message id */
|
||||
- global_msg_id = msg->id;
|
||||
+
|
||||
+ /* backup */
|
||||
+ backup_t = get_t();
|
||||
+ backup_branch = get_t_branch();
|
||||
+ backup_msgid = global_msg_id;
|
||||
+ /* fake transaction and message id */
|
||||
+ global_msg_id = msg->id;
|
||||
+
|
||||
+ if (is_async_env) {
|
||||
+ set_t(t, t->async_backup.backup_branch);
|
||||
+ } else {
|
||||
set_t(t, T_BR_UNDEFINED);
|
||||
+ }
|
||||
|
||||
- /* make available the avp list from transaction */
|
||||
- backup_uri_from = set_avp_list(AVP_TRACK_FROM | AVP_CLASS_URI, &t->uri_avps_from);
|
||||
- backup_uri_to = set_avp_list(AVP_TRACK_TO | AVP_CLASS_URI, &t->uri_avps_to);
|
||||
- backup_user_from = set_avp_list(AVP_TRACK_FROM | AVP_CLASS_USER, &t->user_avps_from);
|
||||
- backup_user_to = set_avp_list(AVP_TRACK_TO | AVP_CLASS_USER, &t->user_avps_to);
|
||||
- backup_domain_from = set_avp_list(AVP_TRACK_FROM | AVP_CLASS_DOMAIN, &t->domain_avps_from);
|
||||
- backup_domain_to = set_avp_list(AVP_TRACK_TO | AVP_CLASS_DOMAIN, &t->domain_avps_to);
|
||||
+ /* make available the avp list from transaction */
|
||||
+ backup_uri_from = set_avp_list(AVP_TRACK_FROM | AVP_CLASS_URI, &t->uri_avps_from);
|
||||
+ backup_uri_to = set_avp_list(AVP_TRACK_TO | AVP_CLASS_URI, &t->uri_avps_to);
|
||||
+ backup_user_from = set_avp_list(AVP_TRACK_FROM | AVP_CLASS_USER, &t->user_avps_from);
|
||||
+ backup_user_to = set_avp_list(AVP_TRACK_TO | AVP_CLASS_USER, &t->user_avps_to);
|
||||
+ backup_domain_from = set_avp_list(AVP_TRACK_FROM | AVP_CLASS_DOMAIN, &t->domain_avps_from);
|
||||
+ backup_domain_to = set_avp_list(AVP_TRACK_TO | AVP_CLASS_DOMAIN, &t->domain_avps_to);
|
||||
#ifdef WITH_XAVP
|
||||
- backup_xavps = xavp_set_list(&t->xavps_list);
|
||||
+ backup_xavps = xavp_set_list(&t->xavps_list);
|
||||
#endif
|
||||
- /* set default send address to the saved value */
|
||||
- backup_si = bind_address;
|
||||
- bind_address = t->uac[0].request.dst.send_sock;
|
||||
- /* backup lump lists */
|
||||
- backup_add_rm = t->uas.request->add_rm;
|
||||
- backup_body_lumps = t->uas.request->body_lumps;
|
||||
- backup_reply_lump = t->uas.request->reply_lump;
|
||||
- } else {
|
||||
- global_msg_id = msg->id;
|
||||
- set_t(t, t->async_backup.backup_branch);
|
||||
- }
|
||||
+ /* set default send address to the saved value */
|
||||
+ backup_si = bind_address;
|
||||
+ bind_address = t->uac[0].request.dst.send_sock;
|
||||
+ /* backup lump lists */
|
||||
+ backup_add_rm = t->uas.request->add_rm;
|
||||
+ backup_body_lumps = t->uas.request->body_lumps;
|
||||
+ backup_reply_lump = t->uas.request->reply_lump;
|
||||
} else {
|
||||
- if (!is_async_env) {
|
||||
- /* restore original environment */
|
||||
- set_t(backup_t, backup_branch);
|
||||
- global_msg_id = backup_msgid;
|
||||
- set_route_type(backup_route_type);
|
||||
- /* restore original avp list */
|
||||
- set_avp_list(AVP_TRACK_FROM | AVP_CLASS_USER, backup_user_from);
|
||||
- set_avp_list(AVP_TRACK_TO | AVP_CLASS_USER, backup_user_to);
|
||||
- set_avp_list(AVP_TRACK_FROM | AVP_CLASS_DOMAIN, backup_domain_from);
|
||||
- set_avp_list(AVP_TRACK_TO | AVP_CLASS_DOMAIN, backup_domain_to);
|
||||
- set_avp_list(AVP_TRACK_FROM | AVP_CLASS_URI, backup_uri_from);
|
||||
- set_avp_list(AVP_TRACK_TO | AVP_CLASS_URI, backup_uri_to);
|
||||
+ /* restore original environment */
|
||||
+ set_t(backup_t, backup_branch);
|
||||
+ global_msg_id = backup_msgid;
|
||||
+ set_route_type(backup_route_type);
|
||||
+ /* restore original avp list */
|
||||
+ set_avp_list(AVP_TRACK_FROM | AVP_CLASS_USER, backup_user_from);
|
||||
+ set_avp_list(AVP_TRACK_TO | AVP_CLASS_USER, backup_user_to);
|
||||
+ set_avp_list(AVP_TRACK_FROM | AVP_CLASS_DOMAIN, backup_domain_from);
|
||||
+ set_avp_list(AVP_TRACK_TO | AVP_CLASS_DOMAIN, backup_domain_to);
|
||||
+ set_avp_list(AVP_TRACK_FROM | AVP_CLASS_URI, backup_uri_from);
|
||||
+ set_avp_list(AVP_TRACK_TO | AVP_CLASS_URI, backup_uri_to);
|
||||
#ifdef WITH_XAVP
|
||||
- xavp_set_list(backup_xavps);
|
||||
+ xavp_set_list(backup_xavps);
|
||||
#endif
|
||||
- bind_address = backup_si;
|
||||
- /* restore lump lists */
|
||||
- t->uas.request->add_rm = backup_add_rm;
|
||||
- t->uas.request->body_lumps = backup_body_lumps;
|
||||
- t->uas.request->reply_lump = backup_reply_lump;
|
||||
- } else {
|
||||
- /*we don't need to restore anything as there was no "environment" prior
|
||||
- to continuing (we are in a different process)*/
|
||||
- LOG(L_DBG, "nothing to restore in async continue, useless call\n");
|
||||
- }
|
||||
+ bind_address = backup_si;
|
||||
+ /* restore lump lists */
|
||||
+ t->uas.request->add_rm = backup_add_rm;
|
||||
+ t->uas.request->body_lumps = backup_body_lumps;
|
||||
+ t->uas.request->reply_lump = backup_reply_lump;
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
1.8.5.3
|
||||
|
||||
@ -1,44 +0,0 @@
|
||||
From ab7f961dd22af7ce3cb451f30b116cc9a76bd4b5 Mon Sep 17 00:00:00 2001
|
||||
From: Ovidiu Sas <osas@voipembedded.com>
|
||||
Date: Thu, 16 Jan 2014 18:02:31 -0500
|
||||
Subject: [PATCH] xhttp_rpc: fix arg parsing (cherry picked from commit
|
||||
3615f3c26405f1c1bcd3721674e9d87e4b589146)
|
||||
|
||||
---
|
||||
modules/xhttp_rpc/xhttp_rpc_fnc.c | 13 ++++++++++---
|
||||
1 file changed, 10 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/modules/xhttp_rpc/xhttp_rpc_fnc.c b/modules/xhttp_rpc/xhttp_rpc_fnc.c
|
||||
index b25405e..5218c2f 100644
|
||||
--- a/modules/xhttp_rpc/xhttp_rpc_fnc.c
|
||||
+++ b/modules/xhttp_rpc/xhttp_rpc_fnc.c
|
||||
@@ -310,7 +310,16 @@ void xhttp_rpc_get_next_arg(rpc_ctx_t* ctx, str *arg)
|
||||
int i;
|
||||
|
||||
trim_leading(&ctx->arg2scan);
|
||||
- if (ctx->arg2scan.len) {
|
||||
+
|
||||
+ if (ctx->arg2scan.len<=0) {
|
||||
+ *arg = XHTTP_RPC_NULL_ARG;
|
||||
+ return;
|
||||
+ }
|
||||
+ if (ctx->arg2scan.len==1 && ctx->arg2scan.s[0]=='\0') {
|
||||
+ *arg = XHTTP_RPC_NULL_ARG;
|
||||
+ return;
|
||||
+ }
|
||||
+ else {
|
||||
*arg = ctx->arg2scan;
|
||||
for(i=1; i<arg->len-1; i++) {
|
||||
if(arg->s[i]==' '||arg->s[i]=='\t'||
|
||||
@@ -322,8 +331,6 @@ void xhttp_rpc_get_next_arg(rpc_ctx_t* ctx, str *arg)
|
||||
i++;
|
||||
ctx->arg2scan.s += i;
|
||||
ctx->arg2scan.len -= i;
|
||||
- } else {
|
||||
- *arg = XHTTP_RPC_NULL_ARG;
|
||||
}
|
||||
return;
|
||||
}
|
||||
--
|
||||
1.8.5.3
|
||||
|
||||
Loading…
Reference in new issue