]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fixed reference to incorrect variable if unknown host configured crash.
authorRichard Mudgett <rmudgett@digium.com>
Tue, 8 Nov 2011 17:58:21 +0000 (17:58 +0000)
committerRichard Mudgett <rmudgett@digium.com>
Tue, 8 Nov 2011 17:58:21 +0000 (17:58 +0000)
* Fixed a LOG_ERROR message referencing the config variable list v that
had previously been processed and became NULL.

* Added error return value set that was missing in an ast_append_ha()
error return path.

(closes issue ASTERISK-18743)
Reported by: Michele
Patches:
      issueA18743-fix_dynamic_exclude_static_bad_host_log.patch (license #5674) patch uploaded by Walter Doekes
Tested by: Michele

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@343851 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c
main/acl.c

index de963f3a630551cb5b756f122e5bf37c0adba409..33638bf541a444f6a4c39405724418c363bf145b 100644 (file)
@@ -27360,11 +27360,11 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
                ast_string_field_set(peer, tohost, srvlookup);
 
                if (global_dynamic_exclude_static) {
-                       int err = 0;
+                       int ha_error = 0;
                        sip_cfg.contact_ha = ast_append_ha("deny", ast_sockaddr_stringify_addr(&peer->addr), 
-                                                       sip_cfg.contact_ha, &err);
-                       if (err) {
-                               ast_log(LOG_ERROR, "Bad ACL entry in configuration line %d : %s\n", v->lineno, v->value);
+                                                       sip_cfg.contact_ha, &ha_error);
+                       if (ha_error) {
+                               ast_log(LOG_ERROR, "Bad or unresolved host/IP entry in configuration for peer %s, cannot add to contact ACL\n", peer->name);
                        }
                }
        } else if (peer->dnsmgr && !peer->host_dynamic) {
index a7b283ed971cf69d95130e6f5d90400504d051d0..961b50136879b8e10dff3ebd02b652a976ca2526 100644 (file)
@@ -408,6 +408,9 @@ struct ast_ha *ast_append_ha(const char *sense, const char *stuff, struct ast_ha
        }
 
        if (!(ha = ast_calloc(1, sizeof(*ha)))) {
+               if (error) {
+                       *error = 1;
+               }
                return ret;
        }