diff options
author | bweschke <bweschke@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-06-16 12:55:18 +0000 |
---|---|---|
committer | bweschke <bweschke@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-06-16 12:55:18 +0000 |
commit | 9576e0c524d9dcabbc8bb9bf98a15dd21c21c6c9 (patch) | |
tree | 711ac23dc81ad4b7db801c7da9eec470fd8db240 /channels/chan_local.c | |
parent | 4ad17199c6072bbd9aac57de85ff39c5fe07ec24 (diff) |
Quit early and print a LOG_WARNING if we are trying to check devicestate on a Local channel that's been improperly defined.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@34463 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_local.c')
-rw-r--r-- | channels/chan_local.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/channels/chan_local.c b/channels/chan_local.c index a865aa6b4..29f5d8afe 100644 --- a/channels/chan_local.c +++ b/channels/chan_local.c @@ -126,16 +126,23 @@ static int local_devicestate(void *data) int res; exten = ast_strdupa(data); - if ((context = strchr(exten, '@'))) { - *context = '\0'; - context = context + 1; + context = strchr(exten, '@'); + + if (!context) { + ast_log(LOG_WARNING, "Someone used Local/%s somewhere without a @context. This is bad.\n", exten); + return AST_DEVICE_INVALID; } + + *context = '\0'; + context = context + 1; + if (option_debug > 2) ast_log(LOG_DEBUG, "Checking if extension %s@%s exists (devicestate)\n", exten, context); res = ast_exists_extension(NULL, context, exten, 1, NULL); - if (!res) + if (!res) { + return AST_DEVICE_INVALID; - else + } else return AST_DEVICE_UNKNOWN; } |