Merge branch 'master' of git.freeswitch.org:freeswitch
This commit is contained in:
commit
d09f96d44f
|
@ -199,15 +199,28 @@
|
|||
<X-PRE-PROCESS cmd="set" data="default_areacode=918"/>
|
||||
<X-PRE-PROCESS cmd="set" data="default_country=US"/>
|
||||
|
||||
<X-PRE-PROCESS cmd="set" data="uk-ring=%(400,200,400,450);%(400,2200,400,450)"/>
|
||||
<X-PRE-PROCESS cmd="set" data="us-ring=%(2000,4000,440.0,480.0)"/>
|
||||
<X-PRE-PROCESS cmd="set" data="fr-ring=%(1500,3500,440.0,0.0)"/>
|
||||
<X-PRE-PROCESS cmd="set" data="rs-ring=%(1000,4000,425.0,0.0)"/>
|
||||
<X-PRE-PROCESS cmd="set" data="ru-ring=%(800,3200,425,0)"/>
|
||||
<X-PRE-PROCESS cmd="set" data="be-ring=%(1000,3000,425,0)"/>
|
||||
<X-PRE-PROCESS cmd="set" data="ca-ring=%(2000,4000,440,480)"/>
|
||||
<X-PRE-PROCESS cmd="set" data="cn-ring=%(1000,4000,450,0)"/>
|
||||
<X-PRE-PROCESS cmd="set" data="cy-ring=%(1500,3000,425,0)"/>
|
||||
<X-PRE-PROCESS cmd="set" data="cz-ring=%(1000,4000,425,0)"/>
|
||||
<X-PRE-PROCESS cmd="set" data="de-ring=%(1000,4000,425,0)"/>
|
||||
<X-PRE-PROCESS cmd="set" data="dz-ring=%(1500,3500,425.0,0.0)"/>
|
||||
<X-PRE-PROCESS cmd="set" data="dk-ring=%(1000,4000,425,0)"/>
|
||||
<X-PRE-PROCESS cmd="set" data="dz-ring=%(1500,3500,425,0)"/>
|
||||
<X-PRE-PROCESS cmd="set" data="fi-ring=%(1000,4000,425,0)"/>
|
||||
<X-PRE-PROCESS cmd="set" data="fr-ring=%(1500,3500,440,0)"/>
|
||||
<X-PRE-PROCESS cmd="set" data="hk-ring=%(400,200,440,480);%(400,3000,440,480)"/>
|
||||
<X-PRE-PROCESS cmd="set" data="hu-ring=%(1250,3750,425,0)"/>
|
||||
<X-PRE-PROCESS cmd="set" data="il-ring=%(1000,3000,400,0)"/>
|
||||
<X-PRE-PROCESS cmd="set" data="ko-ring=%(1000,2000,440,480)"/>
|
||||
<X-PRE-PROCESS cmd="set" data="pk-ring=%(1000,2000,400,0)"/>
|
||||
<X-PRE-PROCESS cmd="set" data="pl-ring=%(1000,4000,425,0)"/>
|
||||
<X-PRE-PROCESS cmd="set" data="il-ring=%(1000,2000,425.0,0)"/>
|
||||
<X-PRE-PROCESS cmd="set" data="rs-ring=%(1000,4000,425,0)"/>
|
||||
<X-PRE-PROCESS cmd="set" data="ru-ring=%(800,3200,425,0)"/>
|
||||
<X-PRE-PROCESS cmd="set" data="sa-ring=%(1200,4600,425,0)"/>
|
||||
<X-PRE-PROCESS cmd="set" data="tr-ring=%(2000,4000,450,0)"/>
|
||||
<X-PRE-PROCESS cmd="set" data="uk-ring=%(400,200,400,450);%(400,2000,400,450)"/>
|
||||
<X-PRE-PROCESS cmd="set" data="us-ring=%(2000,4000,440,480)"/>
|
||||
<X-PRE-PROCESS cmd="set" data="bong-ring=v=-7;%(100,0,941.0,1477.0);v=-7;>=2;+=.1;%(1400,0,350,440)"/>
|
||||
<X-PRE-PROCESS cmd="set" data="sit=%(274,0,913.8);%(274,0,1370.6);%(380,0,1776.7)"/>
|
||||
<!--
|
||||
|
|
|
@ -22,6 +22,8 @@ include $(BASE)/build/modmake.rules
|
|||
|
||||
$(LDNS_DIR)/Makefile.in:
|
||||
$(GETLIB) $(LDNS).tar.gz
|
||||
cp ldns.diff $(LDNS_BUILDDIR)
|
||||
cd $(LDNS_BUILDDIR) && patch -p1 -i ldns.diff
|
||||
|
||||
$(LDNS_BUILDDIR)/Makefile: $(LDNS_DIR)/Makefile.in
|
||||
mkdir -p $(LDNS_BUILDDIR)
|
||||
|
|
|
@ -0,0 +1,323 @@
|
|||
diff -ru b/ldns/ldns.h a/ldns/ldns.h
|
||||
--- b/ldns/ldns.h 2011-03-24 20:32:30.000000000 -0500
|
||||
+++ a/ldns/ldns.h 2011-03-24 20:29:03.000000000 -0500
|
||||
@@ -148,6 +148,16 @@
|
||||
/** EDNS flags */
|
||||
extern ldns_lookup_table ldns_edns_flags[];
|
||||
|
||||
+
|
||||
+#ifdef USE_WINSOCK
|
||||
+#define SOCK_INVALID INVALID_SOCKET
|
||||
+#define close_socket(_s) if (_s > SOCK_INVALID) {closesocket(_s); _s = SOCK_INVALID;}
|
||||
+#else
|
||||
+#define SOCK_INVALID -1
|
||||
+#define close_socket(_s) if (_s > SOCK_INVALID) {close(_s); _s = SOCK_INVALID;}
|
||||
+#endif
|
||||
+
|
||||
+
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
diff -ru b/net.c a/net.c
|
||||
--- b/net.c 2011-02-11 10:50:46.000000000 -0600
|
||||
+++ a/net.c 2011-03-24 20:28:15.000000000 -0500
|
||||
@@ -261,12 +261,18 @@
|
||||
#endif
|
||||
}
|
||||
|
||||
+#ifndef WIN32
|
||||
+#include <poll.h>
|
||||
+#endif
|
||||
+
|
||||
/** wait for a socket to become ready */
|
||||
static int
|
||||
ldns_sock_wait(int sockfd, struct timeval timeout, int write)
|
||||
{
|
||||
- fd_set fds;
|
||||
int ret;
|
||||
+
|
||||
+#ifdef WIN32
|
||||
+ fd_set fds;
|
||||
#ifndef S_SPLINT_S
|
||||
FD_ZERO(&fds);
|
||||
FD_SET(FD_SET_T sockfd, &fds);
|
||||
@@ -275,6 +281,26 @@
|
||||
ret = select(sockfd+1, NULL, &fds, NULL, &timeout);
|
||||
else
|
||||
ret = select(sockfd+1, &fds, NULL, NULL, &timeout);
|
||||
+#else
|
||||
+
|
||||
+ struct pollfd pfds[2];
|
||||
+ int x = 0;
|
||||
+
|
||||
+ memset(&pfds[0], 0, sizeof(pfds[0]) * 2);
|
||||
+
|
||||
+ pfds[0].fd = sockfd;
|
||||
+ pfds[0].events = POLLIN|POLLERR;
|
||||
+
|
||||
+ if (write) {
|
||||
+ pfds[0].events |= POLLOUT;
|
||||
+ }
|
||||
+
|
||||
+ ret = poll(pfds, 1, timeout.tv_sec * 1000 + timeout.tv_usec / 1000);
|
||||
+
|
||||
+#endif
|
||||
+
|
||||
+
|
||||
+
|
||||
if(ret == 0)
|
||||
/* timeout expired */
|
||||
return 0;
|
||||
@@ -299,11 +325,7 @@
|
||||
|
||||
/* wait for an response*/
|
||||
if(!ldns_sock_wait(sockfd, timeout, 0)) {
|
||||
-#ifndef USE_WINSOCK
|
||||
- close(sockfd);
|
||||
-#else
|
||||
- closesocket(sockfd);
|
||||
-#endif
|
||||
+ close_socket(sockfd);
|
||||
return LDNS_STATUS_NETWORK_ERR;
|
||||
}
|
||||
|
||||
@@ -313,11 +335,7 @@
|
||||
ldns_sock_nonblock(sockfd);
|
||||
|
||||
answer = ldns_udp_read_wire(sockfd, answer_size, NULL, NULL);
|
||||
-#ifndef USE_WINSOCK
|
||||
- close(sockfd);
|
||||
-#else
|
||||
- closesocket(sockfd);
|
||||
-#endif
|
||||
+ close_socket(sockfd);
|
||||
|
||||
if (*answer_size == 0) {
|
||||
/* oops */
|
||||
@@ -353,9 +371,10 @@
|
||||
|
||||
if ((sockfd = socket((int)((struct sockaddr*)to)->sa_family, SOCK_DGRAM,
|
||||
IPPROTO_UDP))
|
||||
- == -1) {
|
||||
+ == SOCK_INVALID) {
|
||||
return 0;
|
||||
}
|
||||
+
|
||||
return sockfd;
|
||||
}
|
||||
|
||||
@@ -366,20 +385,20 @@
|
||||
int sockfd;
|
||||
|
||||
if ((sockfd = socket((int)((struct sockaddr*)to)->sa_family, SOCK_STREAM,
|
||||
- IPPROTO_TCP)) == -1) {
|
||||
+ IPPROTO_TCP)) == SOCK_INVALID) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* perform nonblocking connect, to be able to wait with select() */
|
||||
ldns_sock_nonblock(sockfd);
|
||||
- if (connect(sockfd, (struct sockaddr*)to, tolen) == -1) {
|
||||
+ if (connect(sockfd, (struct sockaddr*)to, tolen) == SOCK_INVALID) {
|
||||
#ifndef USE_WINSOCK
|
||||
#ifdef EINPROGRESS
|
||||
if(errno != EINPROGRESS) {
|
||||
#else
|
||||
if(1) {
|
||||
#endif
|
||||
- close(sockfd);
|
||||
+ close_socket(sockfd);
|
||||
return 0;
|
||||
}
|
||||
#else /* USE_WINSOCK */
|
||||
@@ -398,11 +417,7 @@
|
||||
socklen_t len = (socklen_t)sizeof(error);
|
||||
|
||||
if(!ldns_sock_wait(sockfd, timeout, 1)) {
|
||||
-#ifndef USE_WINSOCK
|
||||
- close(sockfd);
|
||||
-#else
|
||||
- closesocket(sockfd);
|
||||
-#endif
|
||||
+ close_socket(sockfd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -421,7 +436,7 @@
|
||||
continue; /* try again */
|
||||
#endif
|
||||
else if(error != 0) {
|
||||
- close(sockfd);
|
||||
+ close_socket(sockfd);
|
||||
/* error in errno for our user */
|
||||
errno = error;
|
||||
return 0;
|
||||
@@ -645,11 +660,7 @@
|
||||
}
|
||||
|
||||
answer = ldns_tcp_read_wire_timeout(sockfd, answer_size, timeout);
|
||||
-#ifndef USE_WINSOCK
|
||||
- close(sockfd);
|
||||
-#else
|
||||
- closesocket(sockfd);
|
||||
-#endif
|
||||
+ close_socket(sockfd);
|
||||
|
||||
if (*answer_size == 0) {
|
||||
/* oops */
|
||||
@@ -782,7 +793,7 @@
|
||||
* @hostname is used */
|
||||
for (ns_i = 0;
|
||||
ns_i < ldns_resolver_nameserver_count(resolver) &&
|
||||
- resolver->_socket == 0;
|
||||
+ resolver->_socket == SOCK_INVALID;
|
||||
ns_i++) {
|
||||
ns = ldns_rdf2native_sockaddr_storage(
|
||||
resolver->_nameservers[ns_i],
|
||||
@@ -792,7 +803,7 @@
|
||||
ldns_resolver_timeout(resolver));
|
||||
}
|
||||
|
||||
- if (resolver->_socket == 0) {
|
||||
+ if (resolver->_socket == SOCK_INVALID) {
|
||||
ldns_pkt_free(query);
|
||||
LDNS_FREE(ns);
|
||||
return LDNS_STATUS_NETWORK_ERR;
|
||||
@@ -807,13 +818,7 @@
|
||||
if (status != LDNS_STATUS_OK) {
|
||||
/* RoRi: to prevent problems on subsequent calls to ldns_axfr_start
|
||||
we have to close the socket here! */
|
||||
-#ifndef USE_WINSOCK
|
||||
- close(resolver->_socket);
|
||||
-#else
|
||||
- closesocket(resolver->_socket);
|
||||
-#endif
|
||||
- resolver->_socket = 0;
|
||||
-
|
||||
+ close_socket(resolver->_socket);
|
||||
return LDNS_STATUS_CRYPTO_TSIG_ERR;
|
||||
}
|
||||
}
|
||||
@@ -826,12 +831,8 @@
|
||||
if(!query_wire) {
|
||||
ldns_pkt_free(query);
|
||||
LDNS_FREE(ns);
|
||||
-#ifndef USE_WINSOCK
|
||||
- close(resolver->_socket);
|
||||
-#else
|
||||
- closesocket(resolver->_socket);
|
||||
-#endif
|
||||
- resolver->_socket = 0;
|
||||
+
|
||||
+ close_socket(resolver->_socket);
|
||||
|
||||
return LDNS_STATUS_MEM_ERR;
|
||||
}
|
||||
@@ -843,12 +844,8 @@
|
||||
|
||||
/* RoRi: to prevent problems on subsequent calls to ldns_axfr_start
|
||||
we have to close the socket here! */
|
||||
-#ifndef USE_WINSOCK
|
||||
- close(resolver->_socket);
|
||||
-#else
|
||||
- closesocket(resolver->_socket);
|
||||
-#endif
|
||||
- resolver->_socket = 0;
|
||||
+
|
||||
+ close_socket(resolver->_socket);
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -862,12 +859,8 @@
|
||||
/* RoRi: to prevent problems on subsequent calls to ldns_axfr_start
|
||||
we have to close the socket here! */
|
||||
|
||||
-#ifndef USE_WINSOCK
|
||||
- close(resolver->_socket);
|
||||
-#else
|
||||
- closesocket(resolver->_socket);
|
||||
-#endif
|
||||
- resolver->_socket = 0;
|
||||
+
|
||||
+ close_socket(resolver->_socket);
|
||||
|
||||
return LDNS_STATUS_NETWORK_ERR;
|
||||
}
|
||||
diff -ru b/resolver.c a/resolver.c
|
||||
--- b/resolver.c 2010-12-14 08:41:38.000000000 -0600
|
||||
+++ a/resolver.c 2011-03-24 20:07:17.000000000 -0500
|
||||
@@ -627,9 +627,7 @@
|
||||
r->_timeout.tv_sec = LDNS_DEFAULT_TIMEOUT_SEC;
|
||||
r->_timeout.tv_usec = LDNS_DEFAULT_TIMEOUT_USEC;
|
||||
|
||||
- /* TODO: fd=0 is actually a valid socket (stdin),
|
||||
- replace with -1 */
|
||||
- r->_socket = 0;
|
||||
+ r->_socket = -1;
|
||||
r->_axfr_soa_count = 0;
|
||||
r->_axfr_i = 0;
|
||||
r->_cur_axfr_pkt = NULL;
|
||||
@@ -903,6 +901,8 @@
|
||||
size_t i;
|
||||
|
||||
if (res) {
|
||||
+ close_socket(res->_socket);
|
||||
+
|
||||
if (res->_searchlist) {
|
||||
for (i = 0; i < ldns_resolver_searchlist_count(res); i++) {
|
||||
ldns_rdf_deep_free(res->_searchlist[i]);
|
||||
@@ -1198,7 +1198,7 @@
|
||||
ldns_status status;
|
||||
|
||||
/* check if start() has been called */
|
||||
- if (!resolver || resolver->_socket == 0) {
|
||||
+ if (!resolver || resolver->_socket == -1) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1215,12 +1215,9 @@
|
||||
if (ldns_rr_get_type(cur_rr) == LDNS_RR_TYPE_SOA) {
|
||||
resolver->_axfr_soa_count++;
|
||||
if (resolver->_axfr_soa_count >= 2) {
|
||||
-#ifndef USE_WINSOCK
|
||||
- close(resolver->_socket);
|
||||
-#else
|
||||
- closesocket(resolver->_socket);
|
||||
-#endif
|
||||
- resolver->_socket = 0;
|
||||
+
|
||||
+ close_socket(resolver->_socket);
|
||||
+
|
||||
ldns_pkt_free(resolver->_cur_axfr_pkt);
|
||||
resolver->_cur_axfr_pkt = NULL;
|
||||
}
|
||||
@@ -1243,12 +1240,8 @@
|
||||
/* RoRi: we must now also close the socket, otherwise subsequent uses of the
|
||||
same resolver structure will fail because the link is still open or
|
||||
in an undefined state */
|
||||
-#ifndef USE_WINSOCK
|
||||
- close(resolver->_socket);
|
||||
-#else
|
||||
- closesocket(resolver->_socket);
|
||||
-#endif
|
||||
- resolver->_socket = 0;
|
||||
+
|
||||
+ close_socket(resolver->_socket);
|
||||
|
||||
return NULL;
|
||||
} else if (ldns_pkt_get_rcode(resolver->_cur_axfr_pkt) != 0) {
|
||||
@@ -1258,12 +1251,8 @@
|
||||
/* RoRi: we must now also close the socket, otherwise subsequent uses of the
|
||||
same resolver structure will fail because the link is still open or
|
||||
in an undefined state */
|
||||
-#ifndef USE_WINSOCK
|
||||
- close(resolver->_socket);
|
||||
-#else
|
||||
- closesocket(resolver->_socket);
|
||||
-#endif
|
||||
- resolver->_socket = 0;
|
||||
+
|
||||
+ close_socket(resolver->_socket);
|
||||
|
||||
return NULL;
|
||||
} else {
|
|
@ -380,9 +380,7 @@ switch_status_t ldns_lookup(const char *number, const char *root, const char *se
|
|||
goto end;
|
||||
}
|
||||
|
||||
domain = ldns_dname_new_frm_str(name);
|
||||
|
||||
if (!domain) {
|
||||
if (!(domain = ldns_dname_new_frm_str(name))) {
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
@ -403,12 +401,6 @@ switch_status_t ldns_lookup(const char *number, const char *root, const char *se
|
|||
goto end;
|
||||
}
|
||||
|
||||
/* use the resolver to send a query for the naptr
|
||||
* records of the domain given on the command line
|
||||
*/
|
||||
|
||||
|
||||
|
||||
if ((p = ldns_resolver_query(res,
|
||||
domain,
|
||||
LDNS_RR_TYPE_NAPTR,
|
||||
|
@ -472,11 +464,10 @@ static switch_status_t enum_lookup(char *root, char *in, enum_record_t **results
|
|||
root = globals.root;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
if (!(server = switch_core_get_variable("enum-server"))) {
|
||||
server = globals.server;
|
||||
}
|
||||
#endif
|
||||
|
||||
ldns_lookup(mnum, root, server, results);
|
||||
|
||||
|
|
|
@ -3497,12 +3497,12 @@ static void select_from_profile(sofia_profile_t *profile,
|
|||
|
||||
if (exclude_contact) {
|
||||
sql = switch_mprintf("select contact, profile_name, '%q' "
|
||||
"from sip_registrations where sip_user='%q' and (sip_host='%q' or presence_hosts like '%%%q%%') "
|
||||
"and contact not like '%%%s%%'", (concat != NULL) ? concat : "", user, domain, domain, exclude_contact);
|
||||
"from sip_registrations where (sip_user='%q' or sip_username='%q') and (sip_host='%q' or presence_hosts like '%%%q%%') "
|
||||
"and contact not like '%%%s%%'", (concat != NULL) ? concat : "", user, user, domain, domain, exclude_contact);
|
||||
} else {
|
||||
sql = switch_mprintf("select contact, profile_name, '%q' "
|
||||
"from sip_registrations where sip_user='%q' and (sip_host='%q' or presence_hosts like '%%%q%%')",
|
||||
(concat != NULL) ? concat : "", user, domain, domain);
|
||||
"from sip_registrations where (sip_user='%q' or sip_username='%q') and (sip_host='%q' or presence_hosts like '%%%q%%')",
|
||||
(concat != NULL) ? concat : "", user, user, domain, domain);
|
||||
}
|
||||
|
||||
switch_assert(sql);
|
||||
|
|
Loading…
Reference in New Issue