]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_monitor.c: Don't emit a warning about 'X' being unrecognized.
authorSean Bright <sean@seanbright.com>
Thu, 7 Mar 2024 17:27:12 +0000 (12:27 -0500)
committerasterisk-org-access-app[bot] <120671045+asterisk-org-access-app[bot]@users.noreply.github.com>
Mon, 11 Mar 2024 17:53:30 +0000 (17:53 +0000)
Code was added in 030f7d41 to warn if an unrecognized option was
passed to an application, but code in Monitor was taking advantage of
the fact that the application would silently accept an invalid option.

We now recognize the invalid option but we don't do anything if it's
set.

Fixes #639

res/res_monitor.c

index aba4bbe6e3580870015479f2f2c7c30b7e564f6d..5af5d4178e4e1b7eef448e26ed134f485290ef8b 100644 (file)
@@ -671,6 +671,19 @@ enum {
        MON_FLAG_DROP_IN =  (1 << 2),
        MON_FLAG_DROP_OUT = (1 << 3),
        MON_FLAG_BEEP =     (1 << 4),
+
+       /*!
+        * \brief Dummy option to silence WARNINGs.
+        *
+        * Application argument processing was updated to emit a WARNING when an
+        * unrecognized option was encountered. Previously, unrecognized options
+        * were silently ignored which was taken advantage of by code in this module
+        * to "stamp out" problematic application arguments and replace them with 'X.'
+        *
+        * So to silence the warning we add 'X' as a valid option and just don't do
+        * anything if it's set.
+        */
+       MON_FLAG_DUMMY =    (1 << 5),
 };
 
 enum {
@@ -684,6 +697,7 @@ AST_APP_OPTIONS(monitor_opts, {
        AST_APP_OPTION('i', MON_FLAG_DROP_IN),
        AST_APP_OPTION('o', MON_FLAG_DROP_OUT),
        AST_APP_OPTION_ARG('B', MON_FLAG_BEEP, OPT_ARG_BEEP_INTERVAL),
+       AST_APP_OPTION('X', MON_FLAG_DUMMY),
 });
 
 /*!