]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
rtp_engine: Ignore empty filenames in DTLS configuration. 33/1833/1
authorJoshua Colp <jcolp@digium.com>
Thu, 17 Dec 2015 16:25:47 +0000 (12:25 -0400)
committerJoshua Colp <jcolp@digium.com>
Thu, 17 Dec 2015 16:25:47 +0000 (12:25 -0400)
When applying an empty DTLS configuration the filenames in the
configuration will be empty. This is actually valid to do and
each filename should simply be ignored.

Change-Id: Ib761dc235638a3fb701df337952f831fc3e69539

main/rtp_engine.c

index beda8cd745651d0ae67531ca5935446853973211..7c5ef311ad57c5ee40e80a45849cb718d203396e 100644 (file)
@@ -1634,14 +1634,14 @@ int ast_rtp_dtls_cfg_parse(struct ast_rtp_dtls_cfg *dtls_cfg, const char *name,
                }
        } else if (!strcasecmp(name, "dtlscertfile")) {
                ast_free(dtls_cfg->certfile);
-               if (!ast_file_is_readable(value)) {
+               if (!ast_strlen_zero(value) && !ast_file_is_readable(value)) {
                        ast_log(LOG_ERROR, "%s file %s does not exist or is not readable\n", name, value);
                        return -1;
                }
                dtls_cfg->certfile = ast_strdup(value);
        } else if (!strcasecmp(name, "dtlsprivatekey")) {
                ast_free(dtls_cfg->pvtfile);
-               if (!ast_file_is_readable(value)) {
+               if (!ast_strlen_zero(value) && !ast_file_is_readable(value)) {
                        ast_log(LOG_ERROR, "%s file %s does not exist or is not readable\n", name, value);
                        return -1;
                }
@@ -1651,14 +1651,14 @@ int ast_rtp_dtls_cfg_parse(struct ast_rtp_dtls_cfg *dtls_cfg, const char *name,
                dtls_cfg->cipher = ast_strdup(value);
        } else if (!strcasecmp(name, "dtlscafile")) {
                ast_free(dtls_cfg->cafile);
-               if (!ast_file_is_readable(value)) {
+               if (!ast_strlen_zero(value) && !ast_file_is_readable(value)) {
                        ast_log(LOG_ERROR, "%s file %s does not exist or is not readable\n", name, value);
                        return -1;
                }
                dtls_cfg->cafile = ast_strdup(value);
        } else if (!strcasecmp(name, "dtlscapath") || !strcasecmp(name, "dtlscadir")) {
                ast_free(dtls_cfg->capath);
-               if (!ast_file_is_readable(value)) {
+               if (!ast_strlen_zero(value) && !ast_file_is_readable(value)) {
                        ast_log(LOG_ERROR, "%s file %s does not exist or is not readable\n", name, value);
                        return -1;
                }