[asterisk-commits] twilson: branch group/manager_http_auth r162065 - /team/group/manager_http_au...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Dec 9 11:06:20 CST 2008
Author: twilson
Date: Tue Dec 9 11:06:20 2008
New Revision: 162065
URL: http://svn.digium.com/view/asterisk?view=rev&rev=162065
Log:
Undo just a few of the gratutitous formatting changes
Modified:
team/group/manager_http_auth/main/http.c
Modified: team/group/manager_http_auth/main/http.c
URL: http://svn.digium.com/view/asterisk/team/group/manager_http_auth/main/http.c?view=diff&rev=162065&r1=162064&r2=162065
==============================================================================
--- team/group/manager_http_auth/main/http.c (original)
+++ team/group/manager_http_auth/main/http.c Tue Dec 9 11:06:20 2008
@@ -139,7 +139,7 @@
int x;
if (ftype) {
- for (x = 0;x < ARRAY_LEN(mimetypes); x++) {
+ for (x = 0; x < ARRAY_LEN(mimetypes); x++) {
if (!strcasecmp(ftype, mimetypes[x].ext)) {
return mimetypes[x].mtype;
}
@@ -198,10 +198,12 @@
if (!enablestatic || ast_strlen_zero(uri)) {
goto out403;
}
+
/* Disallow any funny filenames at all */
if ((uri[0] < 33) || strchr("./|~@#$%^&*() \t", uri[0])) {
goto out403;
}
+
if (strstr(uri, "/..")) {
goto out403;
}
@@ -209,6 +211,7 @@
if ((ftype = strrchr(uri, '.'))) {
ftype++;
}
+
mtype = ast_ftype2mtype(ftype);
if (!mtype) {
snprintf(wkspace, sizeof(wkspace), "text/%s", ftype ? ftype : "plain");
@@ -224,9 +227,11 @@
if (stat(path, &st)) {
goto out404;
}
+
if (S_ISDIR(st.st_mode)) {
goto out404;
}
+
fd = open(path, O_RDONLY);
if (fd < 0) {
goto out403;
@@ -502,10 +507,11 @@
}
AST_RWLIST_TRAVERSE(&uris, uri, entry) {
- if ( AST_RWLIST_NEXT(uri, entry)
- && strlen(AST_RWLIST_NEXT(uri, entry)->uri) <= len ) {
+ if (AST_RWLIST_NEXT(uri, entry) &&
+ strlen(AST_RWLIST_NEXT(uri, entry)->uri) <= len) {
AST_RWLIST_INSERT_AFTER(&uris, uri, urih, entry);
AST_RWLIST_UNLOCK(&uris);
+
return 0;
}
}
@@ -622,9 +628,9 @@
char *c;
int res = -1;
char *params = uri;
- struct ast_http_uri *urih=NULL;
+ struct ast_http_uri *urih = NULL;
int l;
- struct ast_variable *get_vars=NULL, *v, *prev = NULL;
+ struct ast_variable *get_vars = NULL, *v, *prev = NULL;
struct http_uri_redirect *redirect;
strsep(¶ms, "?");
@@ -710,6 +716,7 @@
#define HOOK_T ssize_t
#define LEN_T size_t
#endif
+
/*!
* replacement read/write functions for SSL support.
* We use wrappers rather than SSL_read/SSL_write directly so
@@ -833,6 +840,7 @@
if (*uri) { /* terminate at the first blank */
char *c = ast_skip_nonblanks(uri);
+
if (*c) {
*c = '\0';
}
@@ -934,6 +942,7 @@
|| strlen(AST_RWLIST_FIRST(&uri_redirects)->target) <= target_len ) {
AST_RWLIST_INSERT_HEAD(&uri_redirects, redirect, entry);
AST_RWLIST_UNLOCK(&uri_redirects);
+
return;
}
@@ -1040,6 +1049,7 @@
ast_config_destroy(cfg);
}
+
if (!have_sslbindaddr) {
https_desc.local_address.sin_addr = http_desc.local_address.sin_addr;
}
@@ -1054,7 +1064,7 @@
if (ast_ssl_setup(https_desc.tls_cfg)) {
ast_tcptls_server_start(&https_desc);
}
-
+
return 0;
}
More information about the asterisk-commits
mailing list