[asterisk-dev] [Code Review] 4374: Asterisk: For httpd server, need option to define server name for security purposes

rmudgett reviewboard at asterisk.org
Mon Jan 26 17:44:10 CST 2015


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/4374/#review14289
-----------------------------------------------------------



./branches/13/configs/samples/http.conf.sample
<https://reviewboard.asterisk.org/r/4374/#comment24775>

    This statement is not true.  "Asterisk Server" is no longer sent out if servername is not specified.  It is now "Asterisk/<verion>" by default for both locations.



./branches/13/main/http.c
<https://reviewboard.asterisk.org/r/4374/#comment24773>

    This should be a static definition unless you are wanting to make a new public function which would also need a prototype.



./branches/13/main/http.c
<https://reviewboard.asterisk.org/r/4374/#comment24771>

    Why are the allocation sizes passed in?



./branches/13/main/http.c
<https://reviewboard.asterisk.org/r/4374/#comment24774>

    Just "OOM" here.  It was "Auth OOM" and "error OOM" before you made a common function.



./branches/13/main/http.c
<https://reviewboard.asterisk.org/r/4374/#comment24777>

    Yuck on toothbrush formatting.



./branches/13/main/http.c
<https://reviewboard.asterisk.org/r/4374/#comment24770>

    Can you say uninitialized pointer?



./branches/13/main/http.c
<https://reviewboard.asterisk.org/r/4374/#comment24768>

    This sets the entire buffer to null and is not needed since you sprintf() a string into it before it is used.



./branches/13/main/http.c
<https://reviewboard.asterisk.org/r/4374/#comment24769>

    Use snprintf() to avoid buffer overruns.
    
    Only use sprintf() over snprintf() for a very good reason.  There are very few good reasons.



./branches/13/main/http.c
<https://reviewboard.asterisk.org/r/4374/#comment24779>

    -1 is not needed for the sizeof parameter.  The sizeof parameter includes the string nul terminator.



./branches/13/main/http.c
<https://reviewboard.asterisk.org/r/4374/#comment24778>

    Setting a blank string will really mean a blank servername output value:
    Server: 
    
    Is it intended for this to reset to the default "Asterisk/<version>"?
    
    An alternate method is to check the set value at the end of the function for an empty string and set the global value to "Asterisk/<version>".


- rmudgett


On Jan. 26, 2015, 2:03 p.m., Ashley Sanders wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/4374/
> -----------------------------------------------------------
> 
> (Updated Jan. 26, 2015, 2:03 p.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Bugs: ASTERISK-24316
>     https://issues.asterisk.org/jira/browse/ASTERISK-24316
> 
> 
> Repository: Asterisk
> 
> 
> Description
> -------
> 
> Currently, all responses from the Asterisk HTTP server contain a [Server] header that identifies Asterisk and its version (e.g. "Server:Asterisk/<version>", where <version> is the currently running version of Asterisk). The preferred behavior is to allow the user to configure an alternate name to use for the value returned in the [Server] header for HTTP responses (e.g. "Server:SomeSuperAwesomeServerName").
> 
> This patch provides a new configuration property, [servername], in http.conf, that gives users the ability to modify the value that Asterisk uses when identifying itself. 
> 
> By default, the new property is unused, which means that out-of-the-box, the HTTP server behaves just like it did prior to the patch. Requests to the HTTP server will generate responses with the old-style [Server] header (e.g. "Server:Asterisk/<version>", where <version> is the currently running version of Asterisk). To see the new behavior, you must add the configuration property, [servername] with some value (an empty value will work, also) to http.conf.
> 
> Whatever value the HTTP server is holding for the server name can now be seen through the httpstatus web page (http://<bindaddr>:<bindport>/<prefix>/httpstatus) (where [bindaddr], [bindport], and [prefix] are all values configured in http.conf) and the CLI command: http show status.
> 
> ***Note*** This is just the patch to the Asterisk source. You can find the review for the Testsuite at: https://reviewboard.asterisk.org/r/4377/
> 
> 
> Diffs
> -----
> 
>   ./branches/13/main/http.c 431112 
>   ./branches/13/configs/samples/http.conf.sample 431112 
> 
> Diff: https://reviewboard.asterisk.org/r/4374/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Ashley Sanders
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20150126/7aa6f0a2/attachment-0001.html>


More information about the asterisk-dev mailing list