summaryrefslogtreecommitdiff
path: root/res/res_pjsip
diff options
context:
space:
mode:
authorGeorge Joseph <gjoseph@digium.com>2016-08-11 11:18:15 -0600
committerGeorge Joseph <gjoseph@digium.com>2016-08-11 12:33:14 -0500
commitaeb859dba9a0fc62e6d46088a0d5c162909541a9 (patch)
treeca20ff7ae5253596c0040199613ec74c2d6ddd16 /res/res_pjsip
parente845ef6762bdfd404f1f3f2b5c22c66e49eaec68 (diff)
res_pjsip: Fail global load if debug or default_from_user are empty
If debug was specified in the global configuration but left blank, the logger would treat it as a wildcard and log all hosts. If default_from_user was empty, a crash would result. The global apply handler now checks for empty strings. ASTERISK-26239 #close ASTERISK-26238 #close Change-Id: Ie75727f5cd5808845d92cc81f5713842fb203336
Diffstat (limited to 'res/res_pjsip')
-rw-r--r--res/res_pjsip/config_global.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/res/res_pjsip/config_global.c b/res/res_pjsip/config_global.c
index 8a1b0d449..975c5eefe 100644
--- a/res/res_pjsip/config_global.c
+++ b/res/res_pjsip/config_global.c
@@ -118,6 +118,18 @@ static int global_apply(const struct ast_sorcery *sorcery, void *obj)
struct global_config *cfg = obj;
char max_forwards[10];
+ if (ast_strlen_zero(cfg->debug)) {
+ ast_log(LOG_ERROR,
+ "Global option 'debug' can't be empty. Set it to a valid value or remove the entry to accept 'no' as the default\n");
+ return -1;
+ }
+
+ if (ast_strlen_zero(cfg->default_from_user)) {
+ ast_log(LOG_ERROR,
+ "Global option 'default_from_user' can't be empty. Set it to a valid value or remove the entry to accept 'asterisk' as the default\n");
+ return -1;
+ }
+
snprintf(max_forwards, sizeof(max_forwards), "%u", cfg->max_forwards);
ast_sip_add_global_request_header("Max-Forwards", max_forwards, 1);