mirror of
https://gitea.psi.ch/ELOG/elog.git
synced 2026-09-12 19:33:03 +00:00
Applied patch from Emiliano Gabrielli to use chkext()
SVN revision: 1221
This commit is contained in:
parent
6f899d48d8
commit
435215ec1c
33
src/elogd.c
33
src/elogd.c
@ -6,6 +6,9 @@
|
|||||||
Contents: Web server program for Electronic Logbook ELOG
|
Contents: Web server program for Electronic Logbook ELOG
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.569 2005/02/22 08:15:19 ritt
|
||||||
|
Applied patch from Emiliano Gabrielli to use chkext()
|
||||||
|
|
||||||
Revision 1.568 2005/02/22 07:19:41 ritt
|
Revision 1.568 2005/02/22 07:19:41 ritt
|
||||||
Fixed bug in parse_config_file()
|
Fixed bug in parse_config_file()
|
||||||
|
|
||||||
@ -18262,7 +18265,7 @@ void show_elog_entry(LOGBOOK * lbs, char *dec_path, char *command)
|
|||||||
/* anchor for references */
|
/* anchor for references */
|
||||||
rsprintf("<a name=\"att%d\"></a>\n", index + 1);
|
rsprintf("<a name=\"att%d\"></a>\n", index + 1);
|
||||||
|
|
||||||
if (!strstr(att, ".HTML"))
|
if (!chkext(att, ".HTML"))
|
||||||
rsprintf("<pre class=\"messagepre\">");
|
rsprintf("<pre class=\"messagepre\">");
|
||||||
|
|
||||||
f = fopen(file_name, "rt");
|
f = fopen(file_name, "rt");
|
||||||
@ -18273,7 +18276,7 @@ void show_elog_entry(LOGBOOK * lbs, char *dec_path, char *command)
|
|||||||
fgets(str, sizeof(str), f);
|
fgets(str, sizeof(str), f);
|
||||||
|
|
||||||
if (n_lines < 1000) {
|
if (n_lines < 1000) {
|
||||||
if (!strstr(att, ".HTML"))
|
if (!chkext(att, ".HTML"))
|
||||||
rsputs2(str);
|
rsputs2(str);
|
||||||
else
|
else
|
||||||
rsputs(str);
|
rsputs(str);
|
||||||
@ -18283,7 +18286,7 @@ void show_elog_entry(LOGBOOK * lbs, char *dec_path, char *command)
|
|||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strstr(att, ".HTML"))
|
if (!chkext(att, ".HTML"))
|
||||||
rsprintf("</pre>");
|
rsprintf("</pre>");
|
||||||
rsprintf("\n");
|
rsprintf("\n");
|
||||||
if (n_lines > 1000)
|
if (n_lines > 1000)
|
||||||
@ -19640,7 +19643,7 @@ void interprete(char *lbook, char *path)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strncmp(path, "last", 4) == 0 && strstr(path, ".png") == NULL &&
|
if (strncmp(path, "last", 4) == 0 && !chkext(path, ".png")&&
|
||||||
(!isparam("cmd") || strieq(getparam("cmd"), loc("Select")))
|
(!isparam("cmd") || strieq(getparam("cmd"), loc("Select")))
|
||||||
&& !isparam("newpwd")) {
|
&& !isparam("newpwd")) {
|
||||||
show_elog_list(lbs, 0, atoi(path + 4), 0, NULL);
|
show_elog_list(lbs, 0, atoi(path + 4), 0, NULL);
|
||||||
@ -19676,10 +19679,10 @@ void interprete(char *lbook, char *path)
|
|||||||
|
|
||||||
if ((strlen(pfile) > 13 && pfile[6] == '_' && pfile[13] == '_')
|
if ((strlen(pfile) > 13 && pfile[6] == '_' && pfile[13] == '_')
|
||||||
|| (strlen(pfile) > 13 && pfile[6] == '_' && pfile[13] == '/')
|
|| (strlen(pfile) > 13 && pfile[6] == '_' && pfile[13] == '/')
|
||||||
|| strstr(pfile, ".gif") || strstr(pfile, ".ico")
|
|| chkext(pfile, ".gif") || chkext(pfile, ".ico")
|
||||||
|| strstr(pfile, ".jpg") || strstr(pfile, ".jpeg")
|
|| chkext(pfile, ".jpg") || chkext(pfile, ".jpeg")
|
||||||
|| strstr(pfile, ".png") || strstr(pfile, ".css")
|
|| chkext(pfile, ".png") || chkext(pfile, ".css")
|
||||||
|| strstr(pfile, ".js") || strstr(pfile, ".html")) {
|
|| chkext(pfile, ".js") || chkext(pfile, ".html")) {
|
||||||
if ((strlen(pfile) > 13 && pfile[6] == '_'
|
if ((strlen(pfile) > 13 && pfile[6] == '_'
|
||||||
&& pfile[13] == '_') || (strlen(pfile) > 13 && pfile[6] == '_' && pfile[13] == '/')) {
|
&& pfile[13] == '_') || (strlen(pfile) > 13 && pfile[6] == '_' && pfile[13] == '/')) {
|
||||||
if (pfile[13] == '/')
|
if (pfile[13] == '/')
|
||||||
@ -21009,9 +21012,9 @@ void server_loop(void)
|
|||||||
/* check for trailing '/' after logbook */
|
/* check for trailing '/' after logbook */
|
||||||
if (strstr(net_buffer, "POST") == NULL) { // fix for konqueror
|
if (strstr(net_buffer, "POST") == NULL) { // fix for konqueror
|
||||||
if (logbook[0] && *p == ' ') {
|
if (logbook[0] && *p == ' ') {
|
||||||
if (!strstr(logbook, ".css") && !strstr(logbook, ".htm")
|
if (!chkext(logbook, ".css") && !chkext(logbook, ".htm")
|
||||||
&& !strstr(logbook, ".gif") && !strstr(logbook, ".jpg")
|
&& !chkext(logbook, ".gif") && !chkext(logbook, ".jpg")
|
||||||
&& !strstr(logbook, ".png") && !strstr(logbook, ".ico")) {
|
&& !chkext(logbook, ".png") && !chkext(logbook, ".ico")) {
|
||||||
sprintf(str, "%s/", logbook_enc);
|
sprintf(str, "%s/", logbook_enc);
|
||||||
redirect(NULL, str);
|
redirect(NULL, str);
|
||||||
goto redir;
|
goto redir;
|
||||||
@ -21059,10 +21062,10 @@ void server_loop(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strstr(logbook, ".gif") || strstr(logbook, ".jpg") ||
|
if (chkext(logbook, ".gif") || chkext(logbook, ".jpg") ||
|
||||||
strstr(logbook, ".jpg") || strstr(logbook, ".png") ||
|
chkext(logbook, ".jpg") || chkext(logbook, ".png") ||
|
||||||
strstr(logbook, ".ico") || strstr(logbook, ".htm")
|
chkext(logbook, ".ico") || chkext(logbook, ".htm")
|
||||||
|| strstr(logbook, ".css")) {
|
|| chkext(logbook, ".css")) {
|
||||||
/* check if file in resource directory */
|
/* check if file in resource directory */
|
||||||
strlcpy(str, resource_dir, sizeof(str));
|
strlcpy(str, resource_dir, sizeof(str));
|
||||||
strlcat(str, logbook, sizeof(str));
|
strlcat(str, logbook, sizeof(str));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user