Commit Graph

118 Commits

Author SHA1 Message Date
Mark Michelson 3162a8e558 Enable IPv6 for the built-in HTTP server.
Review: https://reviewboard.asterisk.org/r/986



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@293273 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-10-29 20:46:06 +00:00
Paul Belanger da2a5e5aa9 Merged revisions 279726 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r279726 | pabelanger | 2010-07-26 21:53:38 -0400 (Mon, 26 Jul 2010) | 9 lines
  
  Use ast_sockaddr_setnull() when http is not enabled.
  
  Otherwise, ast_tcptls_server_start() will still start http. 
  
  (closes issue #17708)
  Reported by: pabelanger
  Patches:
        http.patch uploaded by pabelanger (license 224)
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@279727 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-27 01:56:30 +00:00
Mark Michelson cd4ebd336f Add IPv6 to Asterisk.
This adds a generic API for accommodating IPv6 and IPv4 addresses
within Asterisk. While many files have been updated to make use of the
API, chan_sip and the RTP code are the files which actually support
IPv6 addresses at the time of this commit. The way has been paved for
easier upgrading for other files in the near future, though.

Big thanks go to Simon Perrault, Marc Blanchet, and Jean-Philippe Dionne
for their hard work on this.

(closes issue #17565)
Reported by: russell
Patches: 
      asteriskv6-test-report.pdf uploaded by russell (license 2)

Review: https://reviewboard.asterisk.org/r/743



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@274783 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-08 22:08:07 +00:00
Terry Wilson de18661bee Don't continue sending the file when there has been an error
If there is a problem with a firmware file, Polycom phones will close the
connection. We were continuing to send the file anyway. There should be no
reason to continue sending a file if there is an error writing it.

(closes issue #16682)
Reported by: lmadsen


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@270692 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-15 21:42:33 +00:00
Terry Wilson 66053b8a58 Don't act like an http write failed when it didn't
fwrite returns the number of items written, not the number of bytes


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@253958 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-23 16:52:53 +00:00
Olle Johansson 8d64231c62 Adding external reference for doxygen
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@226970 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-11-02 20:43:52 +00:00
Tilghman Lesher 0f6b01f914 Fix a trunk compilation warning.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@215070 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-08-31 22:02:24 +00:00
Tilghman Lesher 642bec4d6f AST-2009-005
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@211539 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-08-10 19:20:57 +00:00
Kevin P. Fleming 82fb56886e More 'static' qualifiers on module global variables.
The 'pglobal' tool is quite handy indeed :-)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@200620 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-15 17:34:30 +00:00
David Vossel ca138fc807 Consistent SSL/TLS options across conf files
ast_tls_read_conf() is a new api call for handling SSL/TLS options across all conf files.  Before this change, SSL/TLS options were not consistent.  http.conf and manager.conf required the 'ssl' prefix while sip.conf used options with the 'tls' prefix.  While the options had different names in different conf files, they all did the exact same thing.  Now, instead of mixing 'ssl' or 'tls' prefixes to do the same thing depending on what conf file you're in, all SSL/TLS options use the 'tls' prefix.  For example.  'sslenable' in http.conf and manager.conf is now 'tlsenable' which matches what already existed in sip.conf. Since this has the potential to break backwards compatibility, previous options containing the 'ssl' prefix still work, but they are no longer documented in the sample.conf files.  The change is noted in the CHANGES file though.

Review: http://reviewboard.digium.com/r/237/



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@191028 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-29 14:39:48 +00:00
David Vossel 8f0b88c8c8 TLS/SSL private key option
Adds option to specify a private key .pem file when configuring TLS or SSL in AMI, HTTP, and SIP.  Before this, the certificate file was used for both the public and private key.  It is possible for this file to hold both, but most configurations allow for a separate private key file to be specified.  Clarified in .conf files how these options are to be used.  The current conf files do not explain how the private key is handled at all, so without knowledge of Asterisk's TLS implementation, it would be hard to know for sure what was going on or how to set it up.

Review: http://reviewboard.digium.com/r/234/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@190545 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-24 21:22:31 +00:00
Tilghman Lesher ce6ebaef97 Support HTTP digest authentication for the http manager interface.
(closes issue #10961)
 Reported by: ys
 Patches: 
       digest_auth_r148468_v5.diff uploaded by ys (license 281)
       SVN branch http://svn.digium.com/svn/asterisk/team/group/manager_http_auth
 Tested by: ys, twilson, tilghman
 Review: http://reviewboard.digium.com/r/223/
 Reviewed by: tilghman,russellb,mmichelson


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@190349 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-23 20:36:35 +00:00
Tilghman Lesher 1030a25ac9 Modify headers and macros, according to Russell's suggestions on the -dev list
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@187599 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-10 03:55:27 +00:00
Tilghman Lesher 1745773f30 Allow browsers to cache images and other static content.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@183865 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-23 23:28:20 +00:00
Terry Wilson e0b40036e1 Fix qualify for TCP peer
(closes issue #14192)
Reported by: pabelanger
Patches: 
      asterisk-bug14192.diff.txt uploaded by jamesgolovich (license 176)
Tested by: jamesgolovich


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@169080 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-17 01:56:36 +00:00
Tilghman Lesher c8223fc957 Merge ast_str_opaque branch (discontinue usage of ast_str internals)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@163991 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-13 08:36:35 +00:00
Eliel C. Sardanons 1e8e12efcf Janitor, use ARRAY_LEN() when possible.
(closes issue #13990)
Reported by: eliel
Patches:
      array_len.diff uploaded by eliel (license 64)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@161218 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-05 10:31:25 +00:00
Kevin P. Fleming bd4eb070f3 bring over all the fixes for the warnings found by gcc 4.3.x from the 1.4 branch, and add the ones needed for all the new code here too
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@153616 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-02 18:52:13 +00:00
Kevin P. Fleming 1ddc834b39 cleaup of the TCP/TLS socket API:
1) rename 'struct server_args' to 'struct ast_tcptls_session_args', to follow coding guidelines

2) make ast_make_file_from_fd() static and rename it to something that indicates what it really is for (again coding guidelines)

3) rename address variables inside 'struct ast_tcptls_session_args' to be more descriptive (dare i say it... coding guidelines)

4) change ast_tcptls_client_start() to use the new 'remote_address' field of the session args for the destination of the connection, and use the 'local_address' field to bind() the socket to the proper source address, if one is supplied

5) in chan_sip, ensure that we pass in the PP address we are bound to when creating outbound (client) connections, so that our connections will appear from the correct address



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@151101 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-10-19 19:11:28 +00:00
Tilghman Lesher 08af5bb312 Create a new config file status, CONFIG_STATUS_FILEINVALID for differentiating
when a file is invalid from when a file is missing.  This is most important when
we have two configuration files.  Consider the following example:

Old system:
sip.conf     users.conf     Old result               New result
========     ==========     ==========               ==========
Missing      Missing        SIP doesn't load         SIP doesn't load
Missing      OK             SIP doesn't load         SIP doesn't load
Missing      Invalid        SIP doesn't load         SIP doesn't load
OK           Missing        SIP loads                SIP loads
OK           OK             SIP loads                SIP loads
OK           Invalid        SIP loads incompletely   SIP doesn't load
Invalid      Missing        SIP doesn't load         SIP doesn't load
Invalid      OK             SIP doesn't load         SIP doesn't load
Invalid      Invalid        SIP doesn't load         SIP doesn't load

So in the case when users.conf doesn't load because there's a typo that
disrupts the syntax, we may only partially load users, instead of failing with
an error, which may cause some calls not to get processed.  Worse yet, the old
system would do this with no indication that anything was even wrong.

(closes issue #10690)
 Reported by: dtyoo
 Patches: 
       20080716__bug10690.diff.txt uploaded by Corydon76 (license 14)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@142992 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-09-12 23:30:03 +00:00
Sean Bright b69c8e6ab5 Another big chunk of changes from the RSW branch. Bunch of stuff from main/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@137082 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-08-10 19:35:50 +00:00
Tilghman Lesher aca394bf0c HTTP module memory leaks
(closes issue #13230)
 Reported by: eliel
 Patches: 
       res_http_post_leak.patch uploaded by eliel (license 64)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@135476 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-08-04 16:34:04 +00:00
Terry Wilson 671627028c Fix mime parsing by re-adding support for passing headers to callback functions
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@135235 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-08-01 21:56:07 +00:00
Kevin P. Fleming 54b0143463 Merged revisions 134983 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r134983 | kpfleming | 2008-07-31 17:18:11 -0500 (Thu, 31 Jul 2008) | 3 lines

accomodate users who seem to lack a sense of humor :-)


........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@135016 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-07-31 22:28:42 +00:00
Brett Bryant e03f7ce05a Fix deadlock when unloading res_http_post because the uris lock was still locked.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@134253 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-07-29 21:23:43 +00:00
Brandon Kruse dff6f08784 Committing a fix that was introduced a long time
ago (does not affect 1.4), where you would pass
a pointer to the end of a character array, and
ast_uri_decode would do no good.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@133651 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-07-25 17:21:46 +00:00
Terry Wilson a32369fcd5 Expose the prefix variable so that it can be used by modules depending on http support
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@127545 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-07-02 20:28:17 +00:00
Brett Bryant 2aae0ba13d Updates all usages of ast_tcptls_session_instance to be managed by reference counts so that they only get destroyed when all threads are done using
them, and memory does not get free'd causing strange issues with SIP. 

This code was originally written by russellb in the team/group/issue_11972/ branch.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@123546 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-17 21:46:57 +00:00
Brett Bryant d32c2d6fd9 Add new functionality to http server that requires manager authentication for any path that includes a directory named 'private'. This patch also
requires manager authentication for any POST's being sent to the server as well to help secure uploads.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@118161 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-05-23 21:19:42 +00:00
Luigi Rizzo c7a4899ac4 Document the possible presence of multiple variables with the
same name in http queries, which might confuse the manager.

Replace calls to ast_uri_decode() with a local function that also
replaces '+' with ' ', as this is the normal encoding for
spaces in http requests.
This allows passing cli commands to the manager through the
http interface.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@117295 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-05-20 17:48:43 +00:00
Luigi Rizzo d56a42cb1a Reverse the check for Cookie: and remove leftover code implementing
the same thing.
Add an ast_debug() call to help debugging the url matching.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@117266 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-05-20 16:39:39 +00:00
Russell Bryant 76917df5cb Merged revisions 114600 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r114600 | russell | 2008-04-23 17:18:12 -0500 (Wed, 23 Apr 2008) | 6 lines

Improve some broken cookie parsing code.  Previously, manager login over HTTP
would only work if the mansession_id cookie was first.  Now, the code builds
a list of all of the cookies in the Cookie header.  This fixes a problem
observed by users of the Asterisk GUI.
(closes AST-20)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114601 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-23 22:53:20 +00:00
Terry Wilson 1eb31edde2 Re-add HTTP post support by moving to res_http_post.c
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@112426 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-02 15:25:48 +00:00
Terry Wilson f02c11d88b Yeah, simplify that logic a bit...
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@112035 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-31 21:01:59 +00:00
Terry Wilson aa720d402b Handle blank prefix= in http.conf
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@112033 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-31 20:45:05 +00:00
Terry Wilson 2848068017 Fix another little http problem. In making it match coding guidelines, a comparison was dropped
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@111500 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-27 22:10:25 +00:00
Terry Wilson 4c2531989a Stupid strcasecmp function :-)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@111213 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-26 21:23:29 +00:00
Tilghman Lesher ef4eff9a9b Add the "config reload <conffile>" command, which allows you to tell Asterisk
to reload any file that references a given configuration file.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@111012 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-26 18:39:06 +00:00
Kevin P. Fleming 75cb5032e6 actually implement HTTP request dispatching based on both URI and method; reduce duplication of data when generating responses using ast_http_error()
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@109912 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-19 16:18:29 +00:00
Kevin P. Fleming 84b133bd81 clean up code to conform to coding guidelines
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@109909 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-19 15:41:54 +00:00
Russell Bryant f1d2a11aad Minor change to use Asterisk macros
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@109841 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-19 04:09:55 +00:00
Kevin P. Fleming e191b51a08 start the process of changing HTTP request dispatching to do it based on *both* URI and method, so that POST support can move into a module; move http.c's private function prototypes into _private.h
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@109762 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-18 22:32:26 +00:00
Terry Wilson e727d15d34 Replace minimime with superior GMime library so that the entire contents of an http post are not read into memory.
This does introduce a dependency on the GMime library for handling HTTP POSTs, but it is available in most distros.

If the library is present, then the compile flag for ENABLE_UPLOADS is enabled by default in menuselect.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@109229 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-17 22:10:06 +00:00
Russell Bryant c3c56990df Make the default prefix empty, like it was in Asterisk 1.4.
(closes issue #12198, reported by bkruse, patched by me)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@108346 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-12 22:49:26 +00:00
Russell Bryant 8bbef5f996 Rename ast_tcptls_server_instance to session_instance, since this pertains to
server and client usage.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@108295 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-12 22:13:18 +00:00
Russell Bryant 96e04792bd add a destroy API call for a server instance
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@105804 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-04 22:28:03 +00:00
Russell Bryant cc55483858 More public API name changes to use an appropriate ast_ prefix
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@105785 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-04 22:23:21 +00:00
Russell Bryant efb1e30a38 Rename public object server_instance to ast_tcptls_server_instance
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@105773 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-04 22:15:18 +00:00
Russell Bryant 0036cde5f3 Rename version.h to ast_version.h. Next, I will be re-adding version.h as an
automatically generated file like it used to be.  This still needs to be there
for modules that have to check it to compile against multiple asterisk versions.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@104244 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-26 20:02:14 +00:00
Russell Bryant b995c78c31 Merge changes from team/group/sip-tcptls
This set of changes introduces TCP and TLS support for chan_sip.  There are various
new options in configs/sip.conf.sample that are used to enable these features.  Also,
there is a document, doc/siptls.txt that describes some things in more detail.

This code was implemented by Brett Bryant and James Golovich.  It was reviewed
by Joshua Colp and myself.  A number of other people participated in the testing
of this code, but since it was done outside of the bug tracker, I do not have their
names.  If you were one of them, thanks a lot for the help!

(closes issue #4903, but with completely different code that what exists there.)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@99085 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-18 22:04:33 +00:00