<p>Joshua Colp <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/18475">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Joshua Colp: Looks good to me, but someone else must approve; Approved for Submit
Benjamin Keith Ford: Looks good to me, approved
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">asterisk.c: Warn of incompatibilities with remote console.<br><br>Some command line options to Asterisk only apply when Asterisk<br>is started and cannot be used with remote console mode. If a<br>user tries to use any of these, they are currently simply<br>silently ignored.<br><br>This prints out a warning if incompatible options are used,<br>informing users that an option used cannot be used with remote<br>console mode. Additionally, some clarifications are added to<br>the help text and man page.<br><br>ASTERISK-22246<br>ASTERISK-26582<br><br>Change-Id: I980a5380ef2c19e8ea348596396d5382893c4337<br>---<br>M doc/asterisk.8<br>M main/asterisk.c<br>2 files changed, 54 insertions(+), 3 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/doc/asterisk.8 b/doc/asterisk.8</span><br><span>index e5991d9..50ad8f6 100644</span><br><span>--- a/doc/asterisk.8</span><br><span>+++ b/doc/asterisk.8</span><br><span>@@ -158,6 +158,7 @@</span><br><span> .TP</span><br><span> \-n</span><br><span> Disable ANSI colors even on terminals capable of displaying them.</span><br><span style="color: hsl(120, 100%, 40%);">+This option can be used only at startup (e.g. not with remote console).</span><br><span> .TP</span><br><span> \-p</span><br><span> If supported by the operating system (and executing as root),</span><br><span>@@ -195,7 +196,8 @@</span><br><span> .TP</span><br><span> \-T</span><br><span> Add timestamp to all non-command related output going to the console</span><br><span style="color: hsl(0, 100%, 40%);">-when running with verbose and/or logging to the console.</span><br><span style="color: hsl(120, 100%, 40%);">+when running with verbose and/or logging to the console. Can only be</span><br><span style="color: hsl(120, 100%, 40%);">+used at startup (e.g. not with remote console mode).</span><br><span> .TP</span><br><span> \-U \fIuser\fR</span><br><span> Run as user \fIuser\fR instead of the</span><br><span>diff --git a/main/asterisk.c b/main/asterisk.c</span><br><span>index de520a0..b965a4d 100644</span><br><span>--- a/main/asterisk.c</span><br><span>+++ b/main/asterisk.c</span><br><span>@@ -3351,7 +3351,7 @@</span><br><span> printf(" -L <load> Limit the maximum load average before rejecting new calls\n");</span><br><span> printf(" -M <value> Limit the maximum number of calls to the specified value\n");</span><br><span> printf(" -m Mute debugging and console output on the console\n");</span><br><span style="color: hsl(0, 100%, 40%);">- printf(" -n Disable console colorization\n");</span><br><span style="color: hsl(120, 100%, 40%);">+ printf(" -n Disable console colorization. Can be used only at startup.\n");</span><br><span> printf(" -p Run as pseudo-realtime thread\n");</span><br><span> printf(" -q Quiet mode (suppress output)\n");</span><br><span> printf(" -r Connect to Asterisk on this machine\n");</span><br><span>@@ -3360,7 +3360,7 @@</span><br><span> printf(" -t Record soundfiles in /var/tmp and move them where they\n");</span><br><span> printf(" belong after they are done\n");</span><br><span> printf(" -T Display the time in [Mmm dd hh:mm:ss] format for each line\n");</span><br><span style="color: hsl(0, 100%, 40%);">- printf(" of output to the CLI\n");</span><br><span style="color: hsl(120, 100%, 40%);">+ printf(" of output to the CLI. Cannot be used with remote console mode.\n\n");</span><br><span> printf(" -v Increase verbosity (multiple v's = more verbose)\n");</span><br><span> printf(" -x <cmd> Execute command <cmd> (implies -r)\n");</span><br><span> printf(" -X Enable use of #exec in asterisk.conf\n");</span><br><span>@@ -3716,6 +3716,55 @@</span><br><span> }</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ if (ast_opt_remote) {</span><br><span style="color: hsl(120, 100%, 40%);">+ int didwarn = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+ optind = 1;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Not all options can be used with remote console. Warn if they're used. */</span><br><span style="color: hsl(120, 100%, 40%);">+ while ((c = getopt(argc, argv, getopt_settings)) != -1) {</span><br><span style="color: hsl(120, 100%, 40%);">+ switch (c) {</span><br><span style="color: hsl(120, 100%, 40%);">+ /* okay to run with remote console */</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'B': /* force black background */</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'd': /* debug */</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'h': /* help */</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'I': /* obsolete timing option: warning already thrown if used */</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'L': /* max load */</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'M': /* max calls */</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'R': /* reconnect */</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'r': /* remote */</span><br><span style="color: hsl(120, 100%, 40%);">+ case 's': /* set socket path */</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'V': /* version */</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'v': /* verbose */</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'W': /* white background */</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'x': /* remote execute */</span><br><span style="color: hsl(120, 100%, 40%);">+ case '?': /* ? */</span><br><span style="color: hsl(120, 100%, 40%);">+ break;</span><br><span style="color: hsl(120, 100%, 40%);">+ /* can only be run when Asterisk is starting */</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'X': /* enables #exec for asterisk.conf only. */</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'C': /* set config path */</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'c': /* foreground console */</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'e': /* minimum memory free */</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'F': /* always fork */</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'f': /* no fork */</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'G': /* run group */</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'g': /* dump core */</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'i': /* init keys */</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'm': /* mute */</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'n': /* no color */</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'p': /* high priority */</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'q': /* quiet */</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'T': /* timestamp */</span><br><span style="color: hsl(120, 100%, 40%);">+ case 't': /* cache record files */</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'U': /* run user */</span><br><span style="color: hsl(120, 100%, 40%);">+ fprintf(stderr, "'%c' option is not compatible with remote console mode and has no effect.\n", c);</span><br><span style="color: hsl(120, 100%, 40%);">+ didwarn = 1;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ if (didwarn) {</span><br><span style="color: hsl(120, 100%, 40%);">+ fprintf(stderr, "\n"); /* if any warnings print out, make them stand out */</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /* For remote connections, change the name of the remote connection.</span><br><span> * We do this for the benefit of init scripts (which need to know if/when</span><br><span> * the main asterisk process has died yet). */</span><br><span></span><br></pre><div style="white-space:pre-wrap"></div><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/18475">change 18475</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/18475"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 19 </div>
<div style="display:none"> Gerrit-Change-Id: I980a5380ef2c19e8ea348596396d5382893c4337 </div>
<div style="display:none"> Gerrit-Change-Number: 18475 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: N A <mail@interlinked.x10host.com> </div>
<div style="display:none"> Gerrit-Reviewer: Benjamin Keith Ford <bford@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>