diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-08-25 02:55:00 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-08-25 02:55:00 +0000 |
commit | edfcc0682ad87dbfc7d8aa3985bdad717121630a (patch) | |
tree | fad1d333368947effc5bf70fc21a1884d561f991 | |
parent | 8b8693b5dab41d8711a221ef7caae45e839f47d3 (diff) |
don't seg fault when using dbsecret
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@41034 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r-- | channels/chan_iax2.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 97e8b6cfa..624e1b914 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -4743,19 +4743,21 @@ static int check_access(int callno, struct sockaddr_in *sin, struct iax_ies *ies /* Keep this check last */ if (!ast_strlen_zero(user->dbsecret)) { char *family, *key=NULL; + char buf[80]; family = ast_strdupa(user->dbsecret); key = strchr(family, '/'); if (key) { *key = '\0'; key++; } - if (!key || ast_db_get(family, key, (char*)iaxs[callno]->secret, sizeof(iaxs[callno]->secret))) { + if (!key || ast_db_get(family, key, buf, sizeof(buf))) { ast_log(LOG_WARNING, "Unable to retrieve database password for family/key '%s'!\n", user->dbsecret); if (ast_test_flag(user, IAX_TEMPONLY)) { destroy_user(user); user = NULL; } - } + } else + ast_string_field_set(iaxs[callno], secret, buf); } else ast_string_field_set(iaxs[callno], secret, user->secret); res = 0; |