mirror of
https://gitea.psi.ch/ELOG/elog.git
synced 2026-09-12 19:33:03 +00:00
Applied patch from Recai
SVN revision: 1642
This commit is contained in:
parent
df8681fb54
commit
9c1bdf0718
16
src/elogd.c
16
src/elogd.c
@ -23205,7 +23205,7 @@ void server_loop(void)
|
|||||||
{
|
{
|
||||||
int status, i, n, n_error, authorized, min, i_min, i_conn, length;
|
int status, i, n, n_error, authorized, min, i_min, i_conn, length;
|
||||||
struct sockaddr_in serv_addr, acc_addr;
|
struct sockaddr_in serv_addr, acc_addr;
|
||||||
char pwd[256], str[1000], url[256], cl_pwd[256], *p, *pd;
|
char pwd[256], str[1000], url[256], cl_pwd[256], *p;
|
||||||
char cookie[256], boundary[256], list[1000], theme[256],
|
char cookie[256], boundary[256], list[1000], theme[256],
|
||||||
host_list[MAX_N_LIST][NAME_LENGTH], logbook[256], logbook_enc[256], global_cmd[256];
|
host_list[MAX_N_LIST][NAME_LENGTH], logbook[256], logbook_enc[256], global_cmd[256];
|
||||||
int lsock, len, flag, content_length, header_length;
|
int lsock, len, flag, content_length, header_length;
|
||||||
@ -23756,7 +23756,7 @@ void server_loop(void)
|
|||||||
p = strchr(net_buffer, '/') + 1;
|
p = strchr(net_buffer, '/') + 1;
|
||||||
|
|
||||||
/* check for ../.. to avoid serving of files on top of the elog directory */
|
/* check for ../.. to avoid serving of files on top of the elog directory */
|
||||||
for (i = 0; p[i] && p[i] != ' ' && p[i] != '?'; i++)
|
for (i = 0; p[i] && p[i] != ' ' && p[i] != '?' && i < (int) sizeof(url); i++)
|
||||||
url[i] = p[i];
|
url[i] = p[i];
|
||||||
url[i] = 0;
|
url[i] = 0;
|
||||||
|
|
||||||
@ -23774,7 +23774,7 @@ void server_loop(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* check if file is in scripts directory or in its subdirs */
|
/* check if file is in scripts directory or in its subdirs */
|
||||||
for (i = 0; p[i] && p[i] != ' ' && p[i] != '?'; i++)
|
for (i = 0; p[i] && p[i] != ' ' && p[i] != '?' && i < (int) sizeof(url); i++)
|
||||||
url[i] = (p[i] == '/') ? DIR_SEPARATOR : p[i];
|
url[i] = (p[i] == '/') ? DIR_SEPARATOR : p[i];
|
||||||
url[i] = 0;
|
url[i] = 0;
|
||||||
if (strchr(url, '.')) {
|
if (strchr(url, '.')) {
|
||||||
@ -23810,7 +23810,7 @@ void server_loop(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
logbook[0] = 0;
|
logbook[0] = 0;
|
||||||
for (i = 0; *p && *p != '/' && *p != '?' && *p != ' '; i++)
|
for (i = 0; *p && *p != '/' && *p != '?' && *p != ' ' && i < (int) sizeof(logbook); i++)
|
||||||
logbook[i] = *p++;
|
logbook[i] = *p++;
|
||||||
logbook[i] = 0;
|
logbook[i] = 0;
|
||||||
strcpy(logbook_enc, logbook);
|
strcpy(logbook_enc, logbook);
|
||||||
@ -23831,10 +23831,9 @@ void server_loop(void)
|
|||||||
/* check for trailing '/' after logbook/ID */
|
/* check for trailing '/' after logbook/ID */
|
||||||
if (logbook[0] && *p == '/' && *(p + 1) != ' ') {
|
if (logbook[0] && *p == '/' && *(p + 1) != ' ') {
|
||||||
sprintf(url, "%s", logbook_enc);
|
sprintf(url, "%s", logbook_enc);
|
||||||
pd = url + strlen(url);
|
for (i = strlen(url); *p && *p != ' ' && i < (int) sizeof(url); i++)
|
||||||
while (*p && *p != ' ')
|
url[i] = *p++;
|
||||||
*pd++ = *p++;
|
url[i] = 0;
|
||||||
*pd = 0;
|
|
||||||
if (*(p - 1) == '/') {
|
if (*(p - 1) == '/') {
|
||||||
sprintf(str, "Invalid URL: %s", url);
|
sprintf(str, "Invalid URL: %s", url);
|
||||||
show_error(str);
|
show_error(str);
|
||||||
@ -24109,6 +24108,7 @@ void server_loop(void)
|
|||||||
goto redir;
|
goto redir;
|
||||||
} else if (strncmp(net_buffer, "GET", 3) == 0) {
|
} else if (strncmp(net_buffer, "GET", 3) == 0) {
|
||||||
/* extract path and commands */
|
/* extract path and commands */
|
||||||
|
if (strchr(net_buffer, '\r'))
|
||||||
*strchr(net_buffer, '\r') = 0;
|
*strchr(net_buffer, '\r') = 0;
|
||||||
if (!strstr(net_buffer, "HTTP/1"))
|
if (!strstr(net_buffer, "HTTP/1"))
|
||||||
goto finished;
|
goto finished;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user