aboutsummaryrefslogtreecommitdiffstats
path: root/main/sems/sems-0011-Avoid-using-private-Glibc-functions.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/sems/sems-0011-Avoid-using-private-Glibc-functions.patch')
-rw-r--r--main/sems/sems-0011-Avoid-using-private-Glibc-functions.patch67
1 files changed, 67 insertions, 0 deletions
diff --git a/main/sems/sems-0011-Avoid-using-private-Glibc-functions.patch b/main/sems/sems-0011-Avoid-using-private-Glibc-functions.patch
new file mode 100644
index 0000000000..048a0a9ba4
--- /dev/null
+++ b/main/sems/sems-0011-Avoid-using-private-Glibc-functions.patch
@@ -0,0 +1,67 @@
+From fb437ef493d6023e936bd55088df7e6d99452cfb Mon Sep 17 00:00:00 2001
+From: Peter Lemenkov <lemenkov@gmail.com>
+Date: Tue, 4 Jan 2011 22:34:03 +0300
+Subject: [PATCH 11/11] Avoid using private Glibc functions
+
+Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
+---
+ core/sip/resolver.cpp | 33 +++++++++++++++++++++++++++------
+ 1 files changed, 27 insertions(+), 6 deletions(-)
+
+diff --git a/core/sip/resolver.cpp b/core/sip/resolver.cpp
+index e3443c7..3b3e4a6 100644
+--- a/core/sip/resolver.cpp
++++ b/core/sip/resolver.cpp
+@@ -54,6 +54,27 @@ using std::list;
+ // (the limit is the # bits in dns_handle::srv_used)
+ #define MAX_SRV_RR (sizeof(unsigned int)*8)
+
++/* The SEMS_GET16 macro and the sems_get16 function were copied from glibc 2.7
++ * (include/arpa/nameser.h (NS_GET16) and resolv/ns_netint.c (ns_get16)) to
++ * avoid using private glibc functions.
++ */
++
++# define SEMS_GET16(s, cp) \
++ do { \
++ uint16_t *t_cp = (uint16_t *) (cp); \
++ (s) = ntohs (*t_cp); \
++ (cp) += NS_INT16SZ; \
++} while (0)
++
++u_int
++sems_get16(const u_char *src)
++{
++ u_int dst;
++
++ SEMS_GET16(dst, src);
++ return (dst);
++}
++
+ struct ip_entry
+ : public dns_base_entry
+ {
+@@ -399,15 +420,15 @@ dns_base_entry* dns_srv_entry::get_rr(dns_record* rr, u_char* begin, u_char* end
+ DBG("SRV:\tTTL=%i\t%s\tP=<%i> W=<%i> P=<%i> T=<%s>\n",
+ ns_rr_ttl(*rr),
+ ns_rr_name(*rr),
+- ns_get16(rdata),
+- ns_get16(rdata+2),
+- ns_get16(rdata+4),
++ sems_get16(rdata),
++ sems_get16(rdata+2),
++ sems_get16(rdata+4),
+ name_buf);
+
+ srv_entry* srv_r = new srv_entry();
+- srv_r->p = ns_get16(rdata);
+- srv_r->w = ns_get16(rdata+2);
+- srv_r->port = ns_get16(rdata+4);
++ srv_r->p = sems_get16(rdata);
++ srv_r->w = sems_get16(rdata+2);
++ srv_r->port = sems_get16(rdata+4);
+ srv_r->target = (const char*)name_buf;
+
+ return srv_r;
+--
+1.7.3.4
+