[asterisk-commits] mnicholson: branch 1.4 r271123 - in /branches/1.4/main: acl.c dnsmgr.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jun 17 10:11:34 CDT 2010


Author: mnicholson
Date: Thu Jun 17 10:11:27 2010
New Revision: 271123

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=271123
Log:
Set sin_family in ast_get_ip_or_srv() and removed the 'last' member of the ast_dnsmgr_entry struct.

(closes issue #15827)
Reported by: DennisD
Patches:
      (modified) dnsmgr_15827.patch uploaded by chappell (license 8)

Modified:
    branches/1.4/main/acl.c
    branches/1.4/main/dnsmgr.c

Modified: branches/1.4/main/acl.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.4/main/acl.c?view=diff&rev=271123&r1=271122&r2=271123
==============================================================================
--- branches/1.4/main/acl.c (original)
+++ branches/1.4/main/acl.c Thu Jun 17 10:11:27 2010
@@ -395,6 +395,7 @@
 	}
 	hp = ast_gethostbyname(value, &ahp);
 	if (hp) {
+		sin->sin_family = hp->h_addrtype;
 		memcpy(&sin->sin_addr, hp->h_addr, sizeof(sin->sin_addr));
 	} else {
 		ast_log(LOG_WARNING, "Unable to lookup '%s'\n", value);

Modified: branches/1.4/main/dnsmgr.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.4/main/dnsmgr.c?view=diff&rev=271123&r1=271122&r2=271123
==============================================================================
--- branches/1.4/main/dnsmgr.c (original)
+++ branches/1.4/main/dnsmgr.c Thu Jun 17 10:11:27 2010
@@ -55,8 +55,6 @@
 struct ast_dnsmgr_entry {
 	/*! where we will store the resulting address */
 	struct in_addr *result;
-	/*! the last result, used to check if address has changed */
-	struct in_addr last;
 	/*! Set to 1 if the entry changes */
 	int changed:1;
 	ast_mutex_t lock;
@@ -96,7 +94,6 @@
 	entry->result = result;
 	ast_mutex_init(&entry->lock);
 	strcpy(entry->name, name);
-	memcpy(&entry->last, result, sizeof(entry->last));
 
 	AST_LIST_LOCK(&entry_list);
 	AST_LIST_INSERT_HEAD(&entry_list, entry, list);
@@ -172,13 +169,12 @@
 	if ((hp = ast_gethostbyname(entry->name, &ahp))) {
 		/* check to see if it has changed, do callback if requested (where de callback is defined ????) */
 		memcpy(&tmp, hp->h_addr, sizeof(tmp));
-		if (tmp.s_addr != entry->last.s_addr) {
-			ast_copy_string(iabuf, ast_inet_ntoa(entry->last), sizeof(iabuf));
+		if (tmp.s_addr != entry->result->s_addr) {
+			ast_copy_string(iabuf, ast_inet_ntoa(*entry->result), sizeof(iabuf));
 			ast_copy_string(iabuf2, ast_inet_ntoa(tmp), sizeof(iabuf2));
 			ast_log(LOG_NOTICE, "host '%s' changed from %s to %s\n", 
 				entry->name, iabuf, iabuf2);
 			memcpy(entry->result, hp->h_addr, sizeof(entry->result));
-			memcpy(&entry->last, hp->h_addr, sizeof(entry->last));
 			changed = entry->changed = 1;
 		} 
 		




More information about the asterisk-commits mailing list