Module: sip-router
Branch: master
Commit: b6bd830ea93024324354dc3fb5eceaddbd8d20a3
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=b6bd830…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Thu Aug 14 11:14:10 2014 +0200
lib/srutils: new files with wrappers around sha256 and other hashing functions
---
lib/srutils/shautils.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++
lib/srutils/shautils.h | 36 +++++++++++++++++++++++++++
2 files changed, 99 insertions(+), 0 deletions(-)
diff --git a/lib/srutils/shautils.c b/lib/srutils/shautils.c
new file mode 100644
index 0000000..25f9e38
--- /dev/null
+++ b/lib/srutils/shautils.c
@@ -0,0 +1,63 @@
+/*
+ * sha and other hashing utilities
+ *
+ * Copyright (C) 2014 1&1 Germany
+ *
+ * This file is part of Kamailio, a free SIP server.
+ *
+ * Kamailio 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
+ *
+ * Kamailio 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "../../md5.h"
+#include "../../ut.h"
+#include "shautils.h"
+
+/*! \brief Compute MD5 checksum */
+void compute_md5(char *dst, char *src, int src_len)
+{
+ MD5_CTX context;
+ unsigned char digest[16];
+ MD5Init (&context);
+ MD5Update (&context, src, src_len);
+ U_MD5Final (digest, &context);
+ string2hex(digest, 16, dst);
+}
+
+/*! \brief Compute SHA256 checksum */
+void compute_sha256(char *dst, u_int8_t *src, int src_len)
+{
+ SHA256_CTX ctx256;
+ SHA256_Init(&ctx256);
+ SHA256_Update(&ctx256, src, src_len);
+ SHA256_End(&ctx256, dst);
+}
+
+/*! \brief Compute SHA384 checksum */
+void compute_sha384(char *dst, u_int8_t *src, int src_len)
+{
+ SHA384_CTX ctx384;
+ SHA384_Init(&ctx384);
+ SHA384_Update(&ctx384, src, src_len);
+ SHA384_End(&ctx384, dst);
+}
+
+/*! \brief Compute SHA512 checksum */
+void compute_sha512(char *dst, u_int8_t *src, int src_len)
+{
+ SHA512_CTX ctx512;
+ SHA512_Init(&ctx512);
+ SHA512_Update(&ctx512, src, src_len);
+ SHA512_End(&ctx512, dst);
+}
diff --git a/lib/srutils/shautils.h b/lib/srutils/shautils.h
new file mode 100644
index 0000000..1d7b0e4
--- /dev/null
+++ b/lib/srutils/shautils.h
@@ -0,0 +1,36 @@
+/*
+ * sha and other hashing utilities
+ *
+ * Copyright (C) 2014 1&1 Germany
+ *
+ * This file is part of Kamailio, a free SIP server.
+ *
+ * Kamailio 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
+ *
+ * Kamailio 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef _SHAUTILS_H_
+#define _SHAUTILS_H_
+
+#include "sha256.h"
+
+void compute_md5(char *dst, char *src, int src_len);
+
+void compute_sha256(char *dst, u_int8_t *src, int src_len);
+
+void compute_sha384(char *dst, u_int8_t *src, int src_len);
+
+void compute_sha512(char *dst, u_int8_t *src, int src_len);
+
+#endif
Module: sip-router
Branch: master
Commit: b4e8f3f4c09b57ce6f60f542963a80b79fc0205b
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=b4e8f3f…
Author: Richard Good <richard.good(a)smilecoms.com>
Committer: Richard Good <richard.good(a)smilecoms.com>
Date: Thu Aug 14 10:48:16 2014 +0200
modules/ims_qos: Do not add MCD AVP to AAR if src or dst ports are 0
Check if src or dst ports in SDP are 0 and if so do not add an MCD AVP for this
---
modules/ims_qos/rx_aar.c | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/modules/ims_qos/rx_aar.c b/modules/ims_qos/rx_aar.c
index 5196d99..463845a 100644
--- a/modules/ims_qos/rx_aar.c
+++ b/modules/ims_qos/rx_aar.c
@@ -380,12 +380,17 @@ int add_media_components(AAAMessage* aar, struct sip_msg *req,
//is this a stream to add to AAR.
if (req_sdp_stream->is_rtp) {
- rx_add_media_component_description_avp(aar, sdp_stream_num + 1,
- &req_sdp_stream->media, &req_sdp_session->ip_addr,
- &req_sdp_stream->port, &rpl_sdp_session->ip_addr,
- &rpl_sdp_stream->port, &rpl_sdp_stream->transport,
- &req_sdp_stream->raw_stream,
- &rpl_sdp_stream->raw_stream, direction);
+ //check if the src or dst port is 0 and if so then don't add to rx
+ int intportA = atoi(req_sdp_stream->port.s);
+ int intportB = atoi(rpl_sdp_stream->port.s);
+ if(intportA != 0 && intportB != 0){
+ rx_add_media_component_description_avp(aar, sdp_stream_num + 1,
+ &req_sdp_stream->media, &req_sdp_session->ip_addr,
+ &req_sdp_stream->port, &rpl_sdp_session->ip_addr,
+ &rpl_sdp_stream->port, &rpl_sdp_stream->transport,
+ &req_sdp_stream->raw_stream,
+ &rpl_sdp_stream->raw_stream, direction);
+ }
}
sdp_stream_num++;
}
Module: sip-router
Branch: master
Commit: f44dad86621685cf7fde45e4ad36f0f0bbcfb15a
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=f44dad8…
Author: Richard Good <richard.good(a)smilecoms.com>
Committer: Richard Good <richard.good(a)smilecoms.com>
Date: Thu Aug 14 10:46:59 2014 +0200
modules/ims_qos: Support Rx_AAR on AAR update
Previously if Rx_AAR was called for an AAR update the function returned true
Now this function gets the previous Rx session and sends an AAR update
---
modules/ims_qos/mod.c | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/modules/ims_qos/mod.c b/modules/ims_qos/mod.c
index c3d8d81..e87af76 100644
--- a/modules/ims_qos/mod.c
+++ b/modules/ims_qos/mod.c
@@ -552,10 +552,7 @@ static int w_rx_aar(struct sip_msg *msg, char *route, char* str1, char* bar) {
LM_DBG("Attached CDP auth session [%.*s] for Rx to dialog in %s mode\n", auth_session->id.len, auth_session->id.s, direction);
} else {
LM_DBG("Update AAR session for this dialog in mode %s\n", direction);
- if (saved_t_data)
- free_saved_transaction_global_data(saved_t_data); //only free global data if no AARs were sent. if one was sent we have to rely on the callback (CDP) to free
- create_return_code(CSCF_RETURN_TRUE);
- return CSCF_RETURN_TRUE;
+ auth_session = cdpb.AAAGetAuthSession(*rx_session_id);
}
LM_DBG("Suspending SIP TM transaction\n");
Hi,
I have noticed that in some instances if you update a row in mysql via the
mysql_db module and the actual row data does not change - affected_rows
will return 0. This is the default behaviour for the mysql API as per -
http://dev.mysql.com/doc/refman/5.0/en/mysql-real-connect.html
There is a flag (CLIENT_FOUND_ROWS) that can be used in the
mysql_real_connect function that will cause affected_rows to return the
number of rows that were "matched" - ie in the WHERE clause, as opposed to
whether or not any data was changed.
If we don't it could be a problem for modules like usrloc where an update
is done and if no row are "affected" and new row is added which would cause
a duplicate.
I understand that updating a row with zero changes is not ideal and prob.
not a typical use case but this IMO is irrelevant. I understand affected
rows to mean the number of rows that were matched and not the number of
rows that had data changed... - seems like a case of MySQL being too clever
here ;)
Thoughts?
Cheers
Jason