[svn-commits] rmudgett: branch 1.8 r346239 - in /branches/1.8: channels/ include/asterisk/ ...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Nov 23 16:53:03 CST 2011


Author: rmudgett
Date: Wed Nov 23 16:52:59 2011
New Revision: 346239

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=346239
Log:
Fix calls to ast_get_ip() not initializing the address family.

Modified:
    branches/1.8/channels/chan_h323.c
    branches/1.8/channels/chan_iax2.c
    branches/1.8/channels/chan_skinny.c
    branches/1.8/include/asterisk/acl.h
    branches/1.8/main/acl.c

Modified: branches/1.8/channels/chan_h323.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/channels/chan_h323.c?view=diff&rev=346239&r1=346238&r2=346239
==============================================================================
--- branches/1.8/channels/chan_h323.c (original)
+++ branches/1.8/channels/chan_h323.c Wed Nov 23 16:52:59 2011
@@ -1431,6 +1431,7 @@
 			} else {
 				struct ast_sockaddr tmp;
 
+				tmp.ss.ss_family = AF_INET;
 				if (ast_get_ip(&tmp, v->value)) {
 					ASTOBJ_UNREF(user, oh323_destroy_user);
 					return NULL;

Modified: branches/1.8/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/channels/chan_iax2.c?view=diff&rev=346239&r1=346238&r2=346239
==============================================================================
--- branches/1.8/channels/chan_iax2.c (original)
+++ branches/1.8/channels/chan_iax2.c Wed Nov 23 16:52:59 2011
@@ -12258,7 +12258,8 @@
 		if (port < 1)
 			port = IAX_DEFAULT_PORTNO;
 	}
-	
+
+	sin_tmp.ss.ss_family = AF_INET;
 	if (!ast_get_ip(&sin_tmp, addr)) {
 		struct ast_netsock *sock;
 		int res;
@@ -12475,6 +12476,7 @@
 			} else if (!strcasecmp(v->name, "defaultip")) {
 				struct ast_sockaddr peer_defaddr_tmp;
 
+				peer_defaddr_tmp.ss.ss_family = AF_INET;
 				if (ast_get_ip(&peer_defaddr_tmp, v->value)) {
 					return peer_unref(peer);
 				}

Modified: branches/1.8/channels/chan_skinny.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/channels/chan_skinny.c?view=diff&rev=346239&r1=346238&r2=346239
==============================================================================
--- branches/1.8/channels/chan_skinny.c (original)
+++ branches/1.8/channels/chan_skinny.c Wed Nov 23 16:52:59 2011
@@ -6926,6 +6926,7 @@
  			if (type & (TYPE_DEVICE)) {
 				struct ast_sockaddr CDEV_addr_tmp;
 
+				CDEV_addr_tmp.ss.ss_family = AF_INET;
 				if (ast_get_ip(&CDEV_addr_tmp, v->value)) {
  					ast_log(LOG_WARNING, "Bad IP '%s' at line %d.\n", v->value, v->lineno);
  				}

Modified: branches/1.8/include/asterisk/acl.h
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/include/asterisk/acl.h?view=diff&rev=346239&r1=346238&r2=346239
==============================================================================
--- branches/1.8/include/asterisk/acl.h (original)
+++ branches/1.8/include/asterisk/acl.h Wed Nov 23 16:52:59 2011
@@ -123,36 +123,39 @@
  * \details
  * Similar in nature to ast_gethostbyname, except that instead
  * of getting an entire hostent structure, you instead are given
- * only the IP address inserted into a sockaddr_in structure.
- *
- * \param[out] addr The IP address is written into sin->sin_addr
- * \param value The hostname to look up
- * \retval 0 Success
- * \retval -1 Failure
- */
-int ast_get_ip(struct ast_sockaddr *addr, const char *value);
+ * only the IP address inserted into a ast_sockaddr structure.
+ *
+ * \param addr The IP address found.  The address family is used
+ * as an input parameter to filter the returned addresses.  If
+ * it is 0, both IPv4 and IPv6 addresses can be returned.
+ * \param hostname The hostname to look up
+ *
+ * \retval 0 Success
+ * \retval -1 Failure
+ */
+int ast_get_ip(struct ast_sockaddr *addr, const char *hostname);
 
 /*!
  * \brief Get the IP address given a hostname and optional service
  *
  * \details
  * If the service parameter is non-NULL, then an SRV lookup will be made by
- * prepending the service to the value parameter, separated by a '.'
- * For example, if value is "example.com" and service is "_sip._udp" then
+ * prepending the service to the hostname parameter, separated by a '.'
+ * For example, if hostname is "example.com" and service is "_sip._udp" then
  * an SRV lookup will be done for "_sip._udp.example.com". If service is NULL,
  * then this function acts exactly like a call to ast_get_ip.
  *
- * \param addr The IP address found.  The address family is used as an input parameter to
- * filter the returned addresses. if it is 0, both IPv4 and IPv6 addresses
- * can be returned.
- *
- * \param value The hostname to look up
+ * \param addr The IP address found.  The address family is used
+ * as an input parameter to filter the returned addresses.  If
+ * it is 0, both IPv4 and IPv6 addresses can be returned.
+ *
+ * \param hostname The hostname to look up
  * \param service A specific service provided by the host. A NULL service results
  * in an A-record lookup instead of an SRV lookup
  * \retval 0 Success
  * \retval -1 Failure
  */
-int ast_get_ip_or_srv(struct ast_sockaddr *addr, const char *value, const char *service);
+int ast_get_ip_or_srv(struct ast_sockaddr *addr, const char *hostname, const char *service);
 
 /*!
  * \brief Get our local IP address when contacting a remote host

Modified: branches/1.8/main/acl.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/acl.c?view=diff&rev=346239&r1=346238&r2=346239
==============================================================================
--- branches/1.8/main/acl.c (original)
+++ branches/1.8/main/acl.c Wed Nov 23 16:52:59 2011
@@ -586,7 +586,7 @@
 	return 0;
 }
 
-int ast_get_ip_or_srv(struct ast_sockaddr *addr, const char *value, const char *service)
+int ast_get_ip_or_srv(struct ast_sockaddr *addr, const char *hostname, const char *service)
 {
 	char srv[256];
 	char host[256];
@@ -594,13 +594,13 @@
 	int tportno;
 
 	if (service) {
-		snprintf(srv, sizeof(srv), "%s.%s", service, value);
+		snprintf(srv, sizeof(srv), "%s.%s", service, hostname);
 		if ((srv_ret = ast_get_srv(NULL, host, sizeof(host), &tportno, srv)) > 0) {
-			value = host;
-		}
-	}
-
-	if (resolve_first(addr, value, PARSE_PORT_FORBID, addr->ss.ss_family) != 0) {
+			hostname = host;
+		}
+	}
+
+	if (resolve_first(addr, hostname, PARSE_PORT_FORBID, addr->ss.ss_family) != 0) {
 		return -1;
 	}
 
@@ -689,9 +689,9 @@
 	return "unknown";
 }
 
-int ast_get_ip(struct ast_sockaddr *addr, const char *value)
-{
-	return ast_get_ip_or_srv(addr, value, NULL);
+int ast_get_ip(struct ast_sockaddr *addr, const char *hostname)
+{
+	return ast_get_ip_or_srv(addr, hostname, NULL);
 }
 
 int ast_ouraddrfor(const struct ast_sockaddr *them, struct ast_sockaddr *us)




More information about the svn-commits mailing list