]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
main/frame: Don't report empty disallow values as an error
authorMatthew Jordan <mjordan@digium.com>
Sat, 14 Mar 2015 02:27:13 +0000 (02:27 +0000)
committerMatthew Jordan <mjordan@digium.com>
Sat, 14 Mar 2015 02:27:13 +0000 (02:27 +0000)
In realtime, it is normal to have a database with both 'allow' and 'disallow'
columns in the schema. It is perfectly valid to have an 'allow' value of
'!all,g722,ulaw,alaw' and no 'disallow' value. Unlike in static conf files,
you can't *not* provide the disallow value. Thus, the empty disallow value
causes a spurious WARNING message, which is kind of annoying.

This patch makes it so that a 'disallow' value with no ... value ... is
ignored. Granted, you can still screw this up as well, as technically
specifying 'disallow=all,!ulaw' allows only ulaw, and then you would have no
'allow' value in your database. But really, why would you do that? WHY?

ASTERISK-16779 #close
Reported by: Atis Lezdins

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

main/frame.c

index 9c4d744d684494858f971d30b170c2c2548dad35..47b518c37fe453f76d3f6490c5d41395f4dbde32 100644 (file)
@@ -797,6 +797,10 @@ int ast_parse_allow_disallow(struct ast_codec_pref *pref, struct ast_format_cap
        char *parse = NULL, *this = NULL, *psize = NULL;
        struct ast_format format;
 
+       if (!allowing && ast_strlen_zero(list)) {
+               return 0;
+       }
+
        parse = ast_strdupa(list);
        while ((this = strsep(&parse, ","))) {
                iter_allowing = allowing;