[svn-commits] russell: branch group/security_events r270691 - in /team/group/security_event...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Tue Jun 15 16:28:59 CDT 2010
Author: russell
Date: Tue Jun 15 16:28:55 2010
New Revision: 270691
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=270691
Log:
resolve, reset
Modified:
team/group/security_events/ (props changed)
team/group/security_events/channels/chan_sip.c
team/group/security_events/res/res_phoneprov.c
Propchange: team/group/security_events/
------------------------------------------------------------------------------
automerge = *
Propchange: team/group/security_events/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Jun 15 16:28:55 2010
@@ -1,1 +1,1 @@
-/trunk:1-270595
+/trunk:1-270690
Modified: team/group/security_events/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/security_events/channels/chan_sip.c?view=diff&rev=270691&r1=270690&r2=270691
==============================================================================
--- team/group/security_events/channels/chan_sip.c (original)
+++ team/group/security_events/channels/chan_sip.c Tue Jun 15 16:28:55 2010
@@ -12701,39 +12701,36 @@
ao2_t_unlink(peers_by_ip, peer, "ao2_unlink of peer from peers_by_ip table");
}
- /* Check that they're allowed to register at this IP */
- /* XXX This could block for a long time XXX */
- /*! \todo Check NAPTR/SRV if we have not got a port in the URI */
- hp = ast_gethostbyname(host, &ahp);
- if (!hp) {
- ast_log(LOG_WARNING, "Invalid host '%s'\n", host);
- ast_string_field_set(peer, fullcontact, "");
- ast_string_field_set(pvt, our_contact, "");
- return PARSE_REGISTER_FAILED;
- }
- memcpy(&testsin.sin_addr, hp->h_addr, sizeof(testsin.sin_addr));
- if (ast_apply_ha(sip_cfg.contact_ha, &testsin) != AST_SENSE_ALLOW ||
- ast_apply_ha(peer->contactha, &testsin) != AST_SENSE_ALLOW) {
- report_failed_acl(peer, pvt, &testsin, "ContactACL");
-
- ast_log(LOG_WARNING, "Host '%s' disallowed by contact ACL (violating IP %s)\n", host, ast_inet_ntoa(testsin.sin_addr));
-
- ast_string_field_set(peer, fullcontact, "");
- ast_string_field_set(pvt, our_contact, "");
-
- return PARSE_REGISTER_DENIED;
- }
-
- /*! \todo This could come before the checking of DNS earlier on, to avoid
- DNS lookups where we don't need it... */
if (!ast_test_flag(&peer->flags[0], SIP_NAT_FORCE_RPORT) && !ast_test_flag(&peer->flags[0], SIP_NAT_RPORT_PRESENT)) {
+ /* use the data provided in the Contact header for call routing */
+ ast_debug(1, "Store REGISTER's Contact header for call routing.\n");
+ /* XXX This could block for a long time XXX */
+ /*! \todo Check NAPTR/SRV if we have not got a port in the URI */
+ hp = ast_gethostbyname(host, &ahp);
+ if (!hp) {
+ ast_log(LOG_WARNING, "Invalid host '%s'\n", host);
+ ast_string_field_set(peer, fullcontact, "");
+ ast_string_field_set(pvt, our_contact, "");
+ return PARSE_REGISTER_FAILED;
+ }
peer->addr.sin_family = AF_INET;
memcpy(&peer->addr.sin_addr, hp->h_addr, sizeof(peer->addr.sin_addr));
peer->addr.sin_port = htons(port);
} else {
/* Don't trust the contact field. Just use what they came to us
with */
+ ast_debug(1, "Store REGISTER's src-IP:port for call routing.\n");
peer->addr = pvt->recv;
+ }
+
+ /* Check that they're allowed to register at this IP */
+ memcpy(&testsin.sin_addr, &peer->addr.sin_addr, sizeof(testsin.sin_addr));
+ if (ast_apply_ha(sip_cfg.contact_ha, &testsin) != AST_SENSE_ALLOW ||
+ ast_apply_ha(peer->contactha, &testsin) != AST_SENSE_ALLOW) {
+ ast_log(LOG_WARNING, "Host '%s' disallowed by contact ACL (violating IP %s)\n", host, ast_inet_ntoa(testsin.sin_addr));
+ ast_string_field_set(peer, fullcontact, "");
+ ast_string_field_set(pvt, our_contact, "");
+ return PARSE_REGISTER_DENIED;
}
/* if the Contact header information copied into peer->addr matches the
Modified: team/group/security_events/res/res_phoneprov.c
URL: http://svnview.digium.com/svn/asterisk/team/group/security_events/res/res_phoneprov.c?view=diff&rev=270691&r1=270690&r2=270691
==============================================================================
--- team/group/security_events/res/res_phoneprov.c (original)
+++ team/group/security_events/res/res_phoneprov.c Tue Jun 15 16:28:55 2010
@@ -411,7 +411,6 @@
char *file = NULL;
int len;
int fd;
- char buf[256];
struct ast_str *http_header;
if (method != AST_HTTP_GET && method != AST_HTTP_HEAD) {
@@ -441,21 +440,11 @@
}
http_header = ast_str_create(80);
- ast_str_set(&http_header, 0, "Content-type: %s\r\n",
+ ast_str_set(&http_header, 0, "Content-type: %s",
route->file->mime_type);
- while ((len = read(fd, buf, sizeof(buf))) > 0) {
- if (fwrite(buf, 1, len, ser->f) != len) {
- if (errno != EPIPE) {
- ast_log(LOG_WARNING, "fwrite() failed: %s\n", strerror(errno));
- } else {
- ast_debug(3, "Requester closed the connection while downloading '%s'\n", path);
- }
- break;
- }
- }
-
ast_http_send(ser, method, 200, NULL, http_header, NULL, fd, 0);
+
close(fd);
route = unref_route(route);
return 0;
@@ -515,7 +504,7 @@
}
http_header = ast_str_create(80);
- ast_str_set(&http_header, 0, "Content-type: %s\r\n",
+ ast_str_set(&http_header, 0, "Content-type: %s",
route->file->mime_type);
if (!(result = ast_str_create(512))) {
More information about the svn-commits
mailing list