Release 2.6.1-1

SVN revision: 1622
This commit is contained in:
Stefan Ritt 2006-01-19 09:10:02 +00:00
parent 6a823fb603
commit a5220a2c49
14 changed files with 202 additions and 118 deletions

View File

@ -1,3 +1,35 @@
Version 2.6.1, released Jan 19th, 2005
======================================
- Major security fix
- Prohibit '..' in URLs
- Use absolute links only for email notification
- Added string substitution for email heading
- Improved error display in sendmail()
- Fixed quick filters with MOptions
- Highlight search results in http link correctly
- Removed (int)'s for 64-bit compatibility
- Removed "nowrap" from MOptions and ROptions attributes in edit form
- Fixed problem with attachments containing "HTTP" in their name
- Fixed bug with ### presets
- Added SVN revision to server version in HTTP header
- Fixed problem with empty bottom and top text
- Fixed bug with sorting attributes
- Show SVN revision on bottom of page
- Fixed wrong </td></tr> when showing attachments in list mode
- Fixed problem with page navigation after "find" command
- Implemented "Fonts = " option
- Fixed HelpELCode page permission with guest menus
- Highlight previous entry in full list mode
- "List" link goes to corresponding listing page
- Fixed problem with missing non-required attribute
- Strip attachments on "duplicate"
- Don't evaluate preset attributes on "duplicate"
- Implemented $shell substitution
- Fixed double entries when using inline images
- Added warning it email notification buffer size exceeded
- Increased mail notification buffer for long attachments
- Fixed bug in self registering
Version 2.6.0, released Dec 14th, 2005 Version 2.6.0, released Dec 14th, 2005
====================================== ======================================

View File

@ -25,7 +25,7 @@
&nbsp;[<a class="nav" href="#links">Links</a>]&nbsp; *&nbsp;</div> &nbsp;[<a class="nav" href="#links">Links</a>]&nbsp; *&nbsp;</div>
<P class="Sub">Home of the <i>Electronic Logbook</i> package by <a href="mailto:Stefan.Ritt&#64;psi.ch"> <P class="Sub">Home of the <i>Electronic Logbook</i> package by <a href="mailto:Stefan.Ritt&#64;psi.ch">
Stefan Ritt</a></P> Stefan Ritt</a></P>
<div class="version">Current version is : 2.6.0</div> <div class="version">Current version is : 2.6.1</div>
<hr> <hr>
<a name="whatis"> <a name="whatis">
<div class="section">&nbsp; What is ELOG ? &nbsp;</div> <div class="section">&nbsp; What is ELOG ? &nbsp;</div>

View File

@ -401,3 +401,7 @@ Enter URL of hyperlink =
astonished = astonished =
Error in regular expression "%s" = Error in regular expression "%s" =
File not found at URL "%s" = File not found at URL "%s" =
Entry size too large for email notification =
Please specify a valid email address =
Cannot send email notification to "%s" =
Error: Command "<b>%s</b>" is not allowed for user "<b>%s</b>" =

View File

@ -403,3 +403,7 @@ Enter URL of hyperlink =
astonished = astonished =
Error in regular expression "%s" = Error in regular expression "%s" =
File not found at URL "%s" = File not found at URL "%s" =
Entry size too large for email notification =
Please specify a valid email address =
Cannot send email notification to "%s" =
Error: Command "<b>%s</b>" is not allowed for user "<b>%s</b>" =

View File

@ -401,3 +401,7 @@ Enter URL of hyperlink =
astonished = astonished =
Error in regular expression "%s" = Error in regular expression "%s" =
File not found at URL "%s" = File not found at URL "%s" =
Entry size too large for email notification =
Please specify a valid email address =
Cannot send email notification to "%s" =
Error: Command "<b>%s</b>" is not allowed for user "<b>%s</b>" =

View File

@ -397,3 +397,14 @@ Enter URL of hyperlink = Geef URL van de hyperlink
astonished = verbaast astonished = verbaast
Error in regular expression "%s" = Fout in reguliere expressie "%s" Error in regular expression "%s" = Fout in reguliere expressie "%s"
File not found at URL "%s" = Kan bestand niet gevonden bij URL "%s" File not found at URL "%s" = Kan bestand niet gevonden bij URL "%s"
#
#---- please translate following items and then remove this comment ----#
#
Entry size too large for email notification =
Please specify a valid email address =
Cannot send email notification to "%s" =
Enable email notifications =
text =
From =
Error: Command "<b>%s</b>" is not allowed for user "<b>%s</b>" =

View File

@ -397,3 +397,11 @@ Enter name of hyperlink = Nom du lien
Enter URL of hyperlink = URL du lien Enter URL of hyperlink = URL du lien
Error in regular expression "%s" = Erreur dans l'expression régulière "%s" Error in regular expression "%s" = Erreur dans l'expression régulière "%s"
File not found at URL "%s" = Fichier non trouvé à l'URL "%s" File not found at URL "%s" = Fichier non trouvé à l'URL "%s"
#
#---- please translate following items and then remove this comment ----#
#
Entry size too large for email notification =
Please specify a valid email address =
Cannot send email notification to "%s" =
Error: Command "<b>%s</b>" is not allowed for user "<b>%s</b>" =

View File

@ -396,4 +396,7 @@ Enter URL of hyperlink = URL von Hyperlink eingeben
astonished = erstaunt astonished = erstaunt
Error in regular expression "%s" = Fehler in regulärem Ausdruck "%s" Error in regular expression "%s" = Fehler in regulärem Ausdruck "%s"
File not found at URL "%s" = Datei bei URL "%s" nicht gefunden File not found at URL "%s" = Datei bei URL "%s" nicht gefunden
Entry size too large for email notification = Eintrag zu groß für Email-Benachrichtigung
Please specify a valid email address = Bitte eine gültige Email-Adresse eingeben
Cannot send email notification to "%s" = Kann Email-Benachrichtigung nicht an "%s" senden
Error: Command "<b>%s</b>" is not allowed for user "<b>%s</b>" = Fehler: Kommando "<b>%s</b>" ist nicht erlaubt für Benutzer "<b>%s</b>"

View File

@ -399,3 +399,7 @@ Enter URL of hyperlink =
astonished = astonished =
Error in regular expression "%s" = Error in regular expression "%s" =
File not found at URL "%s" = File not found at URL "%s" =
Entry size too large for email notification =
Please specify a valid email address =
Cannot send email notification to "%s" =
Error: Command "<b>%s</b>" is not allowed for user "<b>%s</b>" =

View File

@ -399,3 +399,7 @@ Enter URL of hyperlink =
astonished = astonished =
Error in regular expression "%s" = Error in regular expression "%s" =
File not found at URL "%s" = File not found at URL "%s" =
Entry size too large for email notification =
Please specify a valid email address =
Cannot send email notification to "%s" =
Error: Command "<b>%s</b>" is not allowed for user "<b>%s</b>" =

View File

@ -401,3 +401,7 @@ Cannot retrieve file from URL "%s" = No puedo obtener el archivo desde la URL "%
astonished = astonished =
Error in regular expression "%s" = Error in regular expression "%s" =
File not found at URL "%s" = File not found at URL "%s" =
Entry size too large for email notification =
Please specify a valid email address =
Cannot send email notification to "%s" =
Error: Command "<b>%s</b>" is not allowed for user "<b>%s</b>" =

View File

@ -401,3 +401,7 @@ Enter URL of hyperlink =
astonished = astonished =
Error in regular expression "%s" = Error in regular expression "%s" =
File not found at URL "%s" = File not found at URL "%s" =
Entry size too large for email notification =
Please specify a valid email address =
Cannot send email notification to "%s" =
Error: Command "<b>%s</b>" is not allowed for user "<b>%s</b>" =

View File

@ -401,3 +401,7 @@ Enter URL of hyperlink =
astonished = astonished =
Error in regular expression "%s" = Error in regular expression "%s" =
File not found at URL "%s" = File not found at URL "%s" =
Entry size too large for email notification =
Please specify a valid email address =
Cannot send email notification to "%s" =
Error: Command "<b>%s</b>" is not allowed for user "<b>%s</b>" =

View File

@ -10,7 +10,7 @@
\********************************************************************/ \********************************************************************/
/* Version of ELOG */ /* Version of ELOG */
#define VERSION "2.6.0" #define VERSION "2.6.1"
char svn_revision[] = "$Id$"; char svn_revision[] = "$Id$";
/* ELOG identification */ /* ELOG identification */
@ -895,8 +895,7 @@ int subst_shell(char *cmd, char *result, int size)
#ifdef OS_WINNT #ifdef OS_WINNT
HANDLE hChildStdinRd, hChildStdinWr, hChildStdinWrDup, HANDLE hChildStdinRd, hChildStdinWr, hChildStdinWrDup,
hChildStdoutRd, hChildStdoutWr, hChildStdoutRd, hChildStdoutWr, hChildStderrRd, hChildStderrWr, hSaveStdin, hSaveStdout, hSaveStderr;
hChildStderrRd, hChildStderrWr, hSaveStdin, hSaveStdout, hSaveStderr;
SECURITY_ATTRIBUTES saAttr; SECURITY_ATTRIBUTES saAttr;
PROCESS_INFORMATION piProcInfo; PROCESS_INFORMATION piProcInfo;
@ -961,15 +960,15 @@ int subst_shell(char *cmd, char *result, int size)
/* command to execute */ /* command to execute */
sprintf(buffer, "cmd /q /c %s", cmd); sprintf(buffer, "cmd /q /c %s", cmd);
if (!CreateProcess(NULL, buffer, /* command line */ if (!CreateProcess(NULL, buffer, /* command line */
NULL, /* process security attributes */ NULL, /* process security attributes */
NULL, /* primary thread security attributes */ NULL, /* primary thread security attributes */
TRUE, /* handles are inherited */ TRUE, /* handles are inherited */
0, /* creation flags */ 0, /* creation flags */
NULL, /* use parent's environment */ NULL, /* use parent's environment */
NULL, /* use parent's current directory */ NULL, /* use parent's current directory */
&siStartInfo, /* STARTUPINFO pointer */ &siStartInfo, /* STARTUPINFO pointer */
&piProcInfo)) /* receives PROCESS_INFORMATION */ &piProcInfo)) /* receives PROCESS_INFORMATION */
return 0; return 0;
/* After process creation, restore the saved STDIN and STDOUT. */ /* After process creation, restore the saved STDIN and STDOUT. */
@ -1015,8 +1014,8 @@ int subst_shell(char *cmd, char *result, int size)
CloseHandle(hChildStdoutRd); CloseHandle(hChildStdoutRd);
/* strip trailing CR/LF */ /* strip trailing CR/LF */
while (strlen(result) > 0 && (result[strlen(result)-1] == '\r' || result[strlen(result)-1] == '\n')) while (strlen(result) > 0 && (result[strlen(result) - 1] == '\r' || result[strlen(result) - 1] == '\n'))
result[strlen(result)-1] = 0; result[strlen(result) - 1] = 0;
return 1; return 1;
@ -1052,13 +1051,13 @@ int subst_shell(char *cmd, char *result, int size)
buffer[i] = 0; buffer[i] = 0;
strlcat(result, buffer, size); strlcat(result, buffer, size);
} else } else
break; break;
} while (1); } while (1);
/* strip trailing CR/LF */ /* strip trailing CR/LF */
while (strlen(result) > 0 && (result[strlen(result)-1] == '\r' || result[strlen(result)-1] == '\n')) while (strlen(result) > 0 && (result[strlen(result) - 1] == '\r' || result[strlen(result) - 1] == '\n'))
result[strlen(result)-1] = 0; result[strlen(result) - 1] = 0;
} else { } else {
/* child process */ /* child process */
@ -1108,18 +1107,18 @@ void strsubst_list(char *string, int size, char name[][NAME_LENGTH], char value[
if (strrchr(p, '\"')) { if (strrchr(p, '\"')) {
ps += strrchr(p, '\"') - p - 5; ps += strrchr(p, '\"') - p - 5;
if (strchr(ps, ')')) if (strchr(ps, ')'))
ps = strchr(ps, ')')+1; ps = strchr(ps, ')') + 1;
} else { } else {
if (strchr(ps, ')')) if (strchr(ps, ')'))
ps = strchr(ps, ')')+1; ps = strchr(ps, ')') + 1;
} }
if (str[6] == '"') { if (str[6] == '"') {
strcpy(str, p+7); strcpy(str, p + 7);
if (strrchr(str, '\"')) if (strrchr(str, '\"'))
*strrchr(str, '\"') = 0; *strrchr(str, '\"') = 0;
} else { } else {
strcpy(str, p+6); strcpy(str, p + 6);
if (strrchr(str, ')')) if (strrchr(str, ')'))
*strrchr(str, ')') = 0; *strrchr(str, ')') = 0;
} }
@ -1818,7 +1817,7 @@ int recv_string(int sock, char *buffer, int buffer_size, int millisec)
/*-------------------------------------------------------------------*/ /*-------------------------------------------------------------------*/
void compose_email_header(LOGBOOK *lbs, char *subject, char *from, char *to, void compose_email_header(LOGBOOK * lbs, char *subject, char *from, char *to,
char *url, char *mail_text, int size, int mail_encoding, char *url, char *mail_text, int size, int mail_encoding,
int n_attachments, char *multipart_boundary) int n_attachments, char *multipart_boundary)
{ {
@ -2146,7 +2145,7 @@ int sendmail(LOGBOOK * lbs, char *smtp_host, char *from, char *to, char *text, c
strlcat(str, ".\r\n", strsize); strlcat(str, ".\r\n", strsize);
/* check if buffer exceeded */ /* check if buffer exceeded */
if ((int)strlen(str) == strsize-1) { if ((int) strlen(str) == strsize - 1) {
strlcpy(error, loc("Entry size too large for email notification"), error_size); strlcpy(error, loc("Entry size too large for email notification"), error_size);
goto smtp_error; goto smtp_error;
} }
@ -5245,8 +5244,7 @@ void rsputs2(LOGBOOK * lbs, int absolute_link, const char *str)
compose_base_url(lbs, base_url, sizeof(base_url)); compose_base_url(lbs, base_url, sizeof(base_url));
else else
base_url[0] = 0; base_url[0] = 0;
sprintf(return_buffer + j, "<a href=\"%s%s\">elog:%s</a>", base_url, sprintf(return_buffer + j, "<a href=\"%s%s\">elog:%s</a>", base_url, link, link_text);
link, link_text);
} }
} else if (strcmp(key_list[l], "mailto:") == 0) { } else if (strcmp(key_list[l], "mailto:") == 0) {
@ -5846,7 +5844,7 @@ int setparam(char *param, char *value)
if (strlen(value) >= TEXT_SIZE) { if (strlen(value) >= TEXT_SIZE) {
sprintf(str, sprintf(str,
"Error: Entry text too big (%lu bytes). Please increase TEXT_SIZE and recompile elogd\n", "Error: Entry text too big (%lu bytes). Please increase TEXT_SIZE and recompile elogd\n",
(unsigned long)strlen(value)); (unsigned long) strlen(value));
show_error(str); show_error(str);
return 0; return 0;
} }
@ -5859,7 +5857,7 @@ int setparam(char *param, char *value)
if (strlen(value) >= CMD_SIZE) { if (strlen(value) >= CMD_SIZE) {
sprintf(str, sprintf(str,
"Error: Command line too big (%lu bytes). Please increase CMD_SIZE and recompile elogd\n", "Error: Command line too big (%lu bytes). Please increase CMD_SIZE and recompile elogd\n",
(unsigned long)strlen(value)); (unsigned long) strlen(value));
show_error(str); show_error(str);
return 0; return 0;
} }
@ -5875,7 +5873,7 @@ int setparam(char *param, char *value)
if (i < MAX_PARAM) { if (i < MAX_PARAM) {
if (strlen(param) >= NAME_LENGTH) { if (strlen(param) >= NAME_LENGTH) {
sprintf(str, "Error: Parameter name too big (%lu bytes).\n", (unsigned long)strlen(param)); sprintf(str, "Error: Parameter name too big (%lu bytes).\n", (unsigned long) strlen(param));
show_error(str); show_error(str);
return 0; return 0;
} }
@ -5885,7 +5883,7 @@ int setparam(char *param, char *value)
if (strlen(value) >= NAME_LENGTH) { if (strlen(value) >= NAME_LENGTH) {
sprintf(str, sprintf(str,
"Error: Parameter value for parameter <b>%s</b> too big (%lu bytes). Please increase NAME_LENGTH and recompile elogd\n", "Error: Parameter value for parameter <b>%s</b> too big (%lu bytes). Please increase NAME_LENGTH and recompile elogd\n",
param, (unsigned long)strlen(value)); param, (unsigned long) strlen(value));
show_error(str); show_error(str);
return 0; return 0;
} }
@ -6023,7 +6021,7 @@ void extract_host(char *str)
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
void compose_base_url(LOGBOOK *lbs, char *base_url, int size) void compose_base_url(LOGBOOK * lbs, char *base_url, int size)
/* return URL for elogd with optional logbook subdirectory */ /* return URL for elogd with optional logbook subdirectory */
{ {
if (!getcfg("global", "URL", base_url, size)) { if (!getcfg("global", "URL", base_url, size)) {
@ -6034,7 +6032,7 @@ void compose_base_url(LOGBOOK *lbs, char *base_url, int size)
if (strchr(base_url, '?')) if (strchr(base_url, '?'))
*strchr(base_url, '?') = 0; *strchr(base_url, '?') = 0;
if (strrchr(base_url, '/')) if (strrchr(base_url, '/'))
*(strrchr(base_url, '/')+1) = 0; *(strrchr(base_url, '/') + 1) = 0;
} else { } else {
strcpy(base_url, "http://"); strcpy(base_url, "http://");
@ -6073,8 +6071,7 @@ void set_location(LOGBOOK * lbs, char *rel_path)
rsputs(rel_path); rsputs(rel_path);
} else { } else {
if (getcfg(lbs->name, "redirection", str, sizeof(str)) && if (getcfg(lbs->name, "redirection", str, sizeof(str)) && atoi(str) == 1) {
atoi(str) == 1) {
/* use relative redirection */ /* use relative redirection */
if (lbs) if (lbs)
@ -6086,7 +6083,7 @@ void set_location(LOGBOOK * lbs, char *rel_path)
/* assemble absolute path from host name and port */ /* assemble absolute path from host name and port */
sprintf(str, "http://%s", host_name); sprintf(str, "http://%s", host_name);
if (elog_tcp_port != 80) if (elog_tcp_port != 80)
sprintf(str+strlen(str), ":%d", elog_tcp_port); sprintf(str + strlen(str), ":%d", elog_tcp_port);
strcat(str, "/"); strcat(str, "/");
} }
@ -6122,7 +6119,7 @@ void set_location(LOGBOOK * lbs, char *rel_path)
} else { } else {
/* use absolute redirection */ /* use absolute redirection */
if (lbs) if (lbs)
getcfg(lbs->name, "URL", str, sizeof(str)); getcfg(lbs->name, "URL", str, sizeof(str));
else else
@ -6267,7 +6264,7 @@ void redirect(LOGBOOK * lbs, char *rel_path)
{ {
/* redirect */ /* redirect */
rsprintf("HTTP/1.1 302 Found\r\n"); rsprintf("HTTP/1.1 302 Found\r\n");
rsprintf("Server: ELOG HTTP %s-%d\r\n", VERSION, atoi(svn_revision+13)); rsprintf("Server: ELOG HTTP %s-%d\r\n", VERSION, atoi(svn_revision + 13));
if (use_keepalive) { if (use_keepalive) {
rsprintf("Connection: Keep-Alive\r\n"); rsprintf("Connection: Keep-Alive\r\n");
rsprintf("Keep-Alive: timeout=60, max=10\r\n"); rsprintf("Keep-Alive: timeout=60, max=10\r\n");
@ -6472,7 +6469,7 @@ void show_http_header(LOGBOOK * lbs, BOOL expires, char *cookie)
char str[256]; char str[256];
rsprintf("HTTP/1.1 200 Document follows\r\n"); rsprintf("HTTP/1.1 200 Document follows\r\n");
rsprintf("Server: ELOG HTTP %s-%d\r\n", VERSION, atoi(svn_revision+13)); rsprintf("Server: ELOG HTTP %s-%d\r\n", VERSION, atoi(svn_revision + 13));
if (getcfg("global", "charset", str, sizeof(str))) if (getcfg("global", "charset", str, sizeof(str)))
rsprintf("Content-Type: text/html;charset=%s\r\n", str); rsprintf("Content-Type: text/html;charset=%s\r\n", str);
@ -6512,7 +6509,7 @@ void show_plain_header(int size, char *file_name)
{ {
/* header */ /* header */
rsprintf("HTTP/1.1 200 Document follows\r\n"); rsprintf("HTTP/1.1 200 Document follows\r\n");
rsprintf("Server: ELOG HTTP %s-%d\r\n", VERSION, atoi(svn_revision+13)); rsprintf("Server: ELOG HTTP %s-%d\r\n", VERSION, atoi(svn_revision + 13));
rsprintf("Accept-Ranges: bytes\r\n"); rsprintf("Accept-Ranges: bytes\r\n");
if (use_keepalive) { if (use_keepalive) {
@ -7114,7 +7111,7 @@ void show_bottom_text(LOGBOOK * lbs)
/* add little logo */ /* add little logo */
rsprintf rsprintf
("<center><a class=\"bottomlink\" title=\"%s\" href=\"http://midas.psi.ch/elog/\">ELOG V%s-%d</a></center>", ("<center><a class=\"bottomlink\" title=\"%s\" href=\"http://midas.psi.ch/elog/\">ELOG V%s-%d</a></center>",
loc("Goto ELOG home page"), VERSION, atoi(svn_revision+13)); loc("Goto ELOG home page"), VERSION, atoi(svn_revision + 13));
} }
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
@ -7157,7 +7154,7 @@ void set_login_cookies(LOGBOOK * lbs, char *user, char *enc_pwd)
int i; int i;
rsprintf("HTTP/1.1 302 Found\r\n"); rsprintf("HTTP/1.1 302 Found\r\n");
rsprintf("Server: ELOG HTTP %s-%d\r\n", VERSION, atoi(svn_revision+13)); rsprintf("Server: ELOG HTTP %s-%d\r\n", VERSION, atoi(svn_revision + 13));
if (use_keepalive) { if (use_keepalive) {
rsprintf("Connection: Keep-Alive\r\n"); rsprintf("Connection: Keep-Alive\r\n");
rsprintf("Keep-Alive: timeout=60, max=10\r\n"); rsprintf("Keep-Alive: timeout=60, max=10\r\n");
@ -7209,7 +7206,7 @@ void remove_all_login_cookies(LOGBOOK * lbs)
int i; int i;
rsprintf("HTTP/1.1 302 Found\r\n"); rsprintf("HTTP/1.1 302 Found\r\n");
rsprintf("Server: ELOG HTTP %s-%d\r\n", VERSION, atoi(svn_revision+13)); rsprintf("Server: ELOG HTTP %s-%d\r\n", VERSION, atoi(svn_revision + 13));
if (use_keepalive) { if (use_keepalive) {
rsprintf("Connection: Keep-Alive\r\n"); rsprintf("Connection: Keep-Alive\r\n");
rsprintf("Keep-Alive: timeout=60, max=10\r\n"); rsprintf("Keep-Alive: timeout=60, max=10\r\n");
@ -7257,7 +7254,7 @@ void send_file_direct(char *file_name)
lseek(fh, 0, SEEK_SET); lseek(fh, 0, SEEK_SET);
rsprintf("HTTP/1.1 200 Document follows\r\n"); rsprintf("HTTP/1.1 200 Document follows\r\n");
rsprintf("Server: ELOG HTTP %s-%d\r\n", VERSION, atoi(svn_revision+13)); rsprintf("Server: ELOG HTTP %s-%d\r\n", VERSION, atoi(svn_revision + 13));
rsprintf("Accept-Ranges: bytes\r\n"); rsprintf("Accept-Ranges: bytes\r\n");
/* set expiration time to one day */ /* set expiration time to one day */
@ -8178,7 +8175,7 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
sprintf(str, "Preset %s", attr_list[index]); sprintf(str, "Preset %s", attr_list[index]);
if ((i = getcfg(lbs->name, str, preset, sizeof(preset))) > 0) { if ((i = getcfg(lbs->name, str, preset, sizeof(preset))) > 0) {
if ((!bedit && !breply && !bduplicate) || /* don't subst on edit or reply */ if ((!bedit && !breply && !bduplicate) || /* don't subst on edit or reply */
(breedit && i == 2)) { /* subst on reedit only if preset is under condition */ (breedit && i == 2)) { /* subst on reedit only if preset is under condition */
/* do not format date for date attributes */ /* do not format date for date attributes */
@ -8244,7 +8241,7 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
sprintf(str, "Preset %s", attr_list[index]); sprintf(str, "Preset %s", attr_list[index]);
if ((i = getcfg(lbs->name, str, preset, sizeof(preset))) > 0) { if ((i = getcfg(lbs->name, str, preset, sizeof(preset))) > 0) {
if ((!bedit && !breply && !bduplicate) || /* don't subst on edit or reply */ if ((!bedit && !breply && !bduplicate) || /* don't subst on edit or reply */
(breedit && i == 2)) { /* subst on reedit only if preset is under condition */ (breedit && i == 2)) { /* subst on reedit only if preset is under condition */
/* do not format date for date attributes */ /* do not format date for date attributes */
@ -9212,7 +9209,7 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
strcpy(str, "Arial, Comic Sans MS, Courier New, Tahoma, Times New Roman, Verdana"); strcpy(str, "Arial, Comic Sans MS, Courier New, Tahoma, Times New Roman, Verdana");
n = strbreak(str, list, MAX_N_ATTR, ","); n = strbreak(str, list, MAX_N_ATTR, ",");
for (i=0 ; i<n ; i++) for (i = 0; i < n; i++)
rsprintf("<option value=\"%s\">%s</option>\n", list[i], list[i]); rsprintf("<option value=\"%s\">%s</option>\n", list[i], list[i]);
rsprintf("</select>\n"); rsprintf("</select>\n");
@ -10882,7 +10879,9 @@ int save_user_config(LOGBOOK * lbs, char *user, BOOL new_user, BOOL activate)
sprintf(url + strlen(url), "?cmd=Login&unm=%s", getparam("new_user_name")); sprintf(url + strlen(url), "?cmd=Login&unm=%s", getparam("new_user_name"));
sprintf(mail_text + strlen(mail_text), "%s %s\r\n", loc("You can access it at"), url); sprintf(mail_text + strlen(mail_text), "%s %s\r\n", loc("You can access it at"), url);
if (sendmail(lbs, smtp_host, mail_from, getparam("new_user_email"), mail_text, error, sizeof(error)) == -1) { if (sendmail
(lbs, smtp_host, mail_from, getparam("new_user_email"), mail_text, error,
sizeof(error)) == -1) {
sprintf(str, loc("Cannot send email notification to \"%s\""), getparam("new_user_email")); sprintf(str, loc("Cannot send email notification to \"%s\""), getparam("new_user_email"));
strlcat(str, " : ", sizeof(str)); strlcat(str, " : ", sizeof(str));
strlcat(str, error, sizeof(str)); strlcat(str, error, sizeof(str));
@ -10908,10 +10907,10 @@ int save_user_config(LOGBOOK * lbs, char *user, BOOL new_user, BOOL activate)
if (isparam("new_user_name")) { if (isparam("new_user_name")) {
if (lbs) if (lbs)
sprintf(subject, loc("User \"%s\" registered on logbook \"%s\""), sprintf(subject, loc("User \"%s\" registered on logbook \"%s\""),
getparam("new_user_name"), lbs->name); getparam("new_user_name"), lbs->name);
else else
sprintf(subject, loc("User \"%s\" registered on host \"%s\""), sprintf(subject, loc("User \"%s\" registered on host \"%s\""),
getparam("new_user_name"), host_name); getparam("new_user_name"), host_name);
} }
sprintf(str, loc("A new ELOG user has been registered on %s"), host_name); sprintf(str, loc("A new ELOG user has been registered on %s"), host_name);
@ -10931,13 +10930,13 @@ int save_user_config(LOGBOOK * lbs, char *user, BOOL new_user, BOOL activate)
if (isparam("new_user_name")) if (isparam("new_user_name"))
sprintf(mail_text + strlen(mail_text), "%s : %s\r\n", sprintf(mail_text + strlen(mail_text), "%s : %s\r\n",
loc("Login name"), getparam("new_user_name")); loc("Login name"), getparam("new_user_name"));
if (isparam("new_full_name")) if (isparam("new_full_name"))
sprintf(mail_text + strlen(mail_text), "%s : %s\r\n", sprintf(mail_text + strlen(mail_text), "%s : %s\r\n",
loc("Full name"), getparam("new_full_name")); loc("Full name"), getparam("new_full_name"));
if (isparam("new_user_email")) if (isparam("new_user_email"))
sprintf(mail_text + strlen(mail_text), "%s : %s\r\n", sprintf(mail_text + strlen(mail_text), "%s : %s\r\n",
loc("Email"), getparam("new_user_email")); loc("Email"), getparam("new_user_email"));
if (self_register == 3) { if (self_register == 3) {
sprintf(mail_text + strlen(mail_text), "\r\n%s:\r\n", sprintf(mail_text + strlen(mail_text), "\r\n%s:\r\n",
@ -10953,10 +10952,12 @@ int save_user_config(LOGBOOK * lbs, char *user, BOOL new_user, BOOL activate)
enc_pwd[0] = 0; enc_pwd[0] = 0;
url_encode(enc_pwd, sizeof(enc_pwd)); url_encode(enc_pwd, sizeof(enc_pwd));
if (isparam("new_user_name")) if (isparam("new_user_name"))
sprintf(mail_text + strlen(mail_text), "?cmd=Activate&new_user_name=%s&new_full_name=%s", sprintf(mail_text + strlen(mail_text),
getparam("new_user_name"), str); "?cmd=Activate&new_user_name=%s&new_full_name=%s", getparam("new_user_name"),
str);
if (isparam("new_user_email")) if (isparam("new_user_email"))
sprintf(mail_text + strlen(mail_text), "&new_user_email=%s", getparam("new_user_email")); sprintf(mail_text + strlen(mail_text), "&new_user_email=%s",
getparam("new_user_email"));
for (i = 0; lb_list[i].name[0]; i++) { for (i = 0; lb_list[i].name[0]; i++) {
sprintf(str, "sub_lb%d", i); sprintf(str, "sub_lb%d", i);
@ -10968,12 +10969,13 @@ int save_user_config(LOGBOOK * lbs, char *user, BOOL new_user, BOOL activate)
} else { } else {
if (isparam("new_user_name")) if (isparam("new_user_name"))
sprintf(mail_text + strlen(mail_text), sprintf(mail_text + strlen(mail_text),
"\r\n%s URL : %s?cmd=Config&cfg_user=%s&unm=%s\r\n", "\r\n%s URL : %s?cmd=Config&cfg_user=%s&unm=%s\r\n",
loc("Logbook"), url, getparam("new_user_name"), pl); loc("Logbook"), url, getparam("new_user_name"), pl);
} }
if (sendmail(lbs, smtp_host, mail_from, email_addr, mail_text, error, sizeof(error)) == -1) { if (sendmail(lbs, smtp_host, mail_from, email_addr, mail_text, error, sizeof(error)) == -1) {
sprintf(str, loc("Cannot send email notification to \"%s\""), getparam("new_user_email")); sprintf(str, loc("Cannot send email notification to \"%s\""),
getparam("new_user_email"));
strlcat(str, " : ", sizeof(str)); strlcat(str, " : ", sizeof(str));
strlcat(str, error, sizeof(str)); strlcat(str, error, sizeof(str));
show_error(str); show_error(str);
@ -11321,7 +11323,8 @@ void show_forgot_pwd_page(LOGBOOK * lbs)
mail_text, sizeof(mail_text), 1, 0, NULL); mail_text, sizeof(mail_text), 1, 0, NULL);
strlcat(mail_text, "\r\n", sizeof(mail_text)); strlcat(mail_text, "\r\n", sizeof(mail_text));
sprintf(mail_text+strlen(mail_text), loc("A new password has been created for you on host %s"), host_name); sprintf(mail_text + strlen(mail_text), loc("A new password has been created for you on host %s"),
host_name);
strlcat(mail_text, ".\r\n", sizeof(mail_text)); strlcat(mail_text, ".\r\n", sizeof(mail_text));
strlcat(mail_text, strlcat(mail_text,
loc loc
@ -11505,7 +11508,7 @@ void show_new_user_page(LOGBOOK * lbs)
void show_elog_delete(LOGBOOK * lbs, int message_id) void show_elog_delete(LOGBOOK * lbs, int message_id)
{ {
int i, status, reply=0, next, nsel; int i, status, reply = 0, next, nsel;
char str[256], in_reply_to[80], reply_to[MAX_REPLY_TO * 10], owner[256]; char str[256], in_reply_to[80], reply_to[MAX_REPLY_TO * 10], owner[256];
char attrib[MAX_N_ATTR][NAME_LENGTH]; char attrib[MAX_N_ATTR][NAME_LENGTH];
@ -11618,9 +11621,8 @@ void show_elog_delete(LOGBOOK * lbs, int message_id)
} }
if (!reply) { if (!reply) {
el_retrieve(lbs, isparam(str) ? atoi(getparam(str)) : 0, el_retrieve(lbs, isparam(str) ? atoi(getparam(str)) : 0,
NULL, attr_list, NULL, 0, NULL, NULL, NULL, attr_list, NULL, 0, NULL, NULL, in_reply_to, reply_to, NULL, NULL, NULL);
in_reply_to, reply_to, NULL, NULL, NULL);
if (reply_to[0]) if (reply_to[0])
reply = TRUE; reply = TRUE;
} }
@ -12298,7 +12300,7 @@ int show_md5_page(LOGBOOK * lbs)
/* header */ /* header */
rsprintf("HTTP/1.1 200 Document follows\r\n"); rsprintf("HTTP/1.1 200 Document follows\r\n");
rsprintf("Server: ELOG HTTP %s-%d\r\n", VERSION, atoi(svn_revision+13)); rsprintf("Server: ELOG HTTP %s-%d\r\n", VERSION, atoi(svn_revision + 13));
rsprintf("Accept-Ranges: bytes\r\n"); rsprintf("Accept-Ranges: bytes\r\n");
rsprintf("Connection: close\r\n"); rsprintf("Connection: close\r\n");
rsprintf("Content-Type: text/plain;charset=%s\r\n", DEFAULT_HTTP_CHARSET); rsprintf("Content-Type: text/plain;charset=%s\r\n", DEFAULT_HTTP_CHARSET);
@ -12404,8 +12406,8 @@ int retrieve_remote_md5(LOGBOOK * lbs, char *host, MD5_INDEX ** md5_index, char
rsputs(text); rsputs(text);
if (strstr(text, "?fail=")) if (strstr(text, "?fail="))
sprintf(error_str, loc("Invalid user name \"%s\" or password for remote logbook"), sprintf(error_str, loc("Invalid user name \"%s\" or password for remote logbook"),
isparam("unm") ? getparam("unm") : ""); isparam("unm") ? getparam("unm") : "");
else { else {
strlcpy(str, p + 9, sizeof(str)); strlcpy(str, p + 9, sizeof(str));
if (strchr(str, '?')) if (strchr(str, '?'))
@ -14292,7 +14294,7 @@ void display_line(LOGBOOK * lbs, int message_id, int number, char *mode,
ref[0] = 0; ref[0] = 0;
if (absolute_link) if (absolute_link)
compose_base_url(lbs, ref, sizeof(ref)); compose_base_url(lbs, ref, sizeof(ref));
sprintf(ref+strlen(ref), "%d", message_id); sprintf(ref + strlen(ref), "%d", message_id);
if (strieq(mode, "Summary")) { if (strieq(mode, "Summary")) {
if (highlight_mid == message_id) { if (highlight_mid == message_id) {
@ -14323,7 +14325,7 @@ void display_line(LOGBOOK * lbs, int message_id, int number, char *mode,
strcpy(sclass, "threadh"); strcpy(sclass, "threadh");
else else
strcpy(sclass, "threadreplyh"); strcpy(sclass, "threadreplyh");
} else { } else {
if (level == 0) if (level == 0)
strcpy(sclass, "thread"); strcpy(sclass, "thread");
else else
@ -14894,8 +14896,7 @@ void display_line(LOGBOOK * lbs, int message_id, int number, char *mode,
void display_reply(LOGBOOK * lbs, int message_id, int printable, void display_reply(LOGBOOK * lbs, int message_id, int printable,
int expand, int n_line, int n_attr_disp, int expand, int n_line, int n_attr_disp,
char disp_attr[MAX_N_ATTR + 4][NAME_LENGTH], BOOL show_text, char disp_attr[MAX_N_ATTR + 4][NAME_LENGTH], BOOL show_text,
int level, int highlight, regex_t * re_buf, int highlight_mid, int level, int highlight, regex_t * re_buf, int highlight_mid, int absolute_link)
int absolute_link)
{ {
char *date, *text, *in_reply_to, *reply_to, *encoding, *locked_by, *attachment, *attrib, *p; char *date, *text, *in_reply_to, *reply_to, *encoding, *locked_by, *attachment, *attrib, *p;
int status, size; int status, size;
@ -14933,15 +14934,13 @@ void display_reply(LOGBOOK * lbs, int message_id, int printable,
display_line(lbs, message_id, 0, "threaded", expand, level, printable, display_line(lbs, message_id, 0, "threaded", expand, level, printable,
n_line, FALSE, date, in_reply_to, reply_to, n_attr_disp, n_line, FALSE, date, in_reply_to, reply_to, n_attr_disp,
disp_attr, NULL, (void *) attrib, lbs->n_attr, text, show_text, disp_attr, NULL, (void *) attrib, lbs->n_attr, text, show_text,
NULL, encoding, 0, NULL, locked_by, highlight, &re_buf[0], NULL, encoding, 0, NULL, locked_by, highlight, &re_buf[0], highlight_mid, absolute_link);
highlight_mid, absolute_link);
if (reply_to[0]) { if (reply_to[0]) {
p = reply_to; p = reply_to;
do { do {
display_reply(lbs, atoi(p), printable, expand, n_line, n_attr_disp, display_reply(lbs, atoi(p), printable, expand, n_line, n_attr_disp,
disp_attr, show_text, level + 1, highlight, &re_buf[0], disp_attr, show_text, level + 1, highlight, &re_buf[0], highlight_mid, absolute_link);
highlight_mid, absolute_link);
while (*p && isdigit(*p)) while (*p && isdigit(*p))
p++; p++;
@ -15296,12 +15295,12 @@ void build_ref(char *ref, int size, char *mode, char *expand, char *attach, char
/* eliminate id=xxx */ /* eliminate id=xxx */
if (strstr(ref, "id=")) { if (strstr(ref, "id=")) {
p = strstr(ref, "id=")+3; p = strstr(ref, "id=") + 3;
while (*p && isdigit(*p)) while (*p && isdigit(*p))
p++; p++;
strcpy(strstr(ref, "id="), p); strcpy(strstr(ref, "id="), p);
if (strlen(ref) > 0 && ref[strlen(ref)-1] == '?') if (strlen(ref) > 0 && ref[strlen(ref) - 1] == '?')
ref[strlen(ref)-1] = 0; ref[strlen(ref) - 1] = 0;
} }
/* eliminate old mode if new one is present */ /* eliminate old mode if new one is present */
@ -15552,7 +15551,8 @@ void show_page_filters(LOGBOOK * lbs, int n_msg, int page_n, BOOL mode_commands,
else { else {
rsprintf("<input type=text onChange=\"document.form1.submit()\""); rsprintf("<input type=text onChange=\"document.form1.submit()\"");
rsprintf(" name=\"%s\" value=\"%s\">\n", list[index], isparam(list[index]) ? getparam(list[index]) : ""); rsprintf(" name=\"%s\" value=\"%s\">\n", list[index],
isparam(list[index]) ? getparam(list[index]) : "");
} }
} else { } else {
rsprintf("<select name=\"%s\" onChange=\"document.form1.submit()\">\n", list[index]); rsprintf("<select name=\"%s\" onChange=\"document.form1.submit()\">\n", list[index]);
@ -15882,7 +15882,7 @@ void show_rss_feed(LOGBOOK * lbs)
struct tm *ts; struct tm *ts;
rsprintf("HTTP/1.1 200 Document follows\r\n"); rsprintf("HTTP/1.1 200 Document follows\r\n");
rsprintf("Server: ELOG HTTP %s-%d\r\n", VERSION, atoi(svn_revision+13)); rsprintf("Server: ELOG HTTP %s-%d\r\n", VERSION, atoi(svn_revision + 13));
if (!getcfg("global", "charset", charset, sizeof(charset))) if (!getcfg("global", "charset", charset, sizeof(charset)))
strcpy(charset, DEFAULT_HTTP_CHARSET); strcpy(charset, DEFAULT_HTTP_CHARSET);
@ -16078,7 +16078,7 @@ void highlight_searchtext(regex_t * re_buf, char *src, char *dst, int hidden)
void show_elog_list(LOGBOOK * lbs, int past_n, int last_n, int page_n, BOOL default_page, char *info) void show_elog_list(LOGBOOK * lbs, int past_n, int last_n, int page_n, BOOL default_page, char *info)
{ {
int i, j, n, index, size, status, d1, m1, y1, d2, m2, y2, n_line, flags, int i, j, n, index, size, status, d1, m1, y1, d2, m2, y2, n_line, flags,
current_year, current_month, current_day, printable, n_logbook, current_year, current_month, current_day, printable, n_logbook,
n_display, reverse, n_attr_disp, total_n_msg, n_msg, search_all, message_id, n_display, reverse, n_attr_disp, total_n_msg, n_msg, search_all, message_id,
n_page, i_start, i_stop, in_reply_to_id, page_mid, page_mid_head; n_page, i_start, i_stop, in_reply_to_id, page_mid, page_mid_head;
@ -16711,8 +16711,7 @@ void show_elog_list(LOGBOOK * lbs, int past_n, int last_n, int page_n, BOOL defa
if (msg_list[j].lbs == msg_list[index].lbs && msg_list[j].index == i) if (msg_list[j].lbs == msg_list[index].lbs && msg_list[j].index == i)
break; break;
if (page_mid && if (page_mid && msg_list[index].lbs->el_index[msg_list[index].index].message_id == page_mid)
msg_list[index].lbs->el_index[msg_list[index].index].message_id == page_mid)
page_mid_head = message_id; page_mid_head = message_id;
if (j < index) { if (j < index) {
@ -16805,7 +16804,7 @@ void show_elog_list(LOGBOOK * lbs, int past_n, int last_n, int page_n, BOOL defa
msg_list[i].lbs->el_index[msg_list[i].index].message_id == page_mid_head) msg_list[i].lbs->el_index[msg_list[i].index].message_id == page_mid_head)
break; break;
if (i<n_msg) if (i < n_msg)
page_n = i / n_page + 1; page_n = i / n_page + 1;
} }
@ -17594,7 +17593,7 @@ void show_elog_list(LOGBOOK * lbs, int past_n, int last_n, int page_n, BOOL defa
index, mode, expand, 0, printable, n_line, index, mode, expand, 0, printable, n_line,
show_attachments, date, in_reply_to, reply_to, show_attachments, date, in_reply_to, reply_to,
n_attr_disp, disp_attr, disp_attr_link, attrib, lbs->n_attr, text, show_text, n_attr_disp, disp_attr, disp_attr_link, attrib, lbs->n_attr, text, show_text,
attachment, encoding, isparam("select") ? atoi(getparam("select")) : 0, attachment, encoding, isparam("select") ? atoi(getparam("select")) : 0,
&n_display, locked_by, 0, re_buf, page_mid, FALSE); &n_display, locked_by, 0, re_buf, page_mid, FALSE);
if (threaded) { if (threaded) {
@ -17709,14 +17708,14 @@ void show_elog_thread(LOGBOOK * lbs, int message_id, int absolute_links, int hig
0, "Threaded", 1, 0, FALSE, 0, 0, "Threaded", 1, 0, FALSE, 0,
FALSE, date, in_reply_to, reply_to, FALSE, date, in_reply_to, reply_to,
n_attr_disp, disp_attr, NULL, attrib, lbs->n_attr, text, FALSE, n_attr_disp, disp_attr, NULL, attrib, lbs->n_attr, text, FALSE,
attachment, encoding, 0, &n_display, locked_by, message_id, NULL, attachment, encoding, 0, &n_display, locked_by, message_id, NULL,
highlight_mid, absolute_links); highlight_mid, absolute_links);
if (reply_to[0]) { if (reply_to[0]) {
p = reply_to; p = reply_to;
do { do {
display_reply(lbs, atoi(p), FALSE, 1, 0, n_attr_disp, disp_attr, FALSE, 1, display_reply(lbs, atoi(p), FALSE, 1, 0, n_attr_disp, disp_attr, FALSE, 1,
message_id, NULL, highlight_mid, absolute_links); message_id, NULL, highlight_mid, absolute_links);
while (*p && isdigit(*p)) while (*p && isdigit(*p))
p++; p++;
@ -18955,7 +18954,7 @@ void submit_elog(LOGBOOK * lbs)
message_id = message_id =
el_submit(lbs, message_id, bedit, date, attr_list, attrib, n_attr, el_submit(lbs, message_id, bedit, date, attr_list, attrib, n_attr,
getparam("text"), in_reply_to, reply_to, getparam("text"), in_reply_to, reply_to,
isparam("encoding") ? getparam("encoding") : "plain", att_file, TRUE, NULL); isparam("encoding") ? getparam("encoding") : "plain", att_file, TRUE, NULL);
if (message_id <= 0) { if (message_id <= 0) {
@ -18980,8 +18979,8 @@ void submit_elog(LOGBOOK * lbs)
sprintf(str, "elog:%d/", message_id); sprintf(str, "elog:%d/", message_id);
strsubst(p, TEXT_SIZE, "elog:/", str); strsubst(p, TEXT_SIZE, "elog:/", str);
el_submit(lbs, message_id, TRUE, date, attr_list, attrib, n_attr, el_submit(lbs, message_id, TRUE, date, attr_list, attrib, n_attr,
p, in_reply_to, reply_to, p, in_reply_to, reply_to,
isparam("encoding") ? getparam("encoding") : "plain", att_file, TRUE, NULL); isparam("encoding") ? getparam("encoding") : "plain", att_file, TRUE, NULL);
} }
/*---- email notifications ----*/ /*---- email notifications ----*/
@ -19099,7 +19098,7 @@ void submit_elog(LOGBOOK * lbs)
mail_to[strlen(mail_to) - 1] = 0; /* strip last ',' */ mail_to[strlen(mail_to) - 1] = 0; /* strip last ',' */
if (compose_email if (compose_email
(lbs, mail_to, message_id, attrib, mail_param, isparam("edit_id"), att_file, (lbs, mail_to, message_id, attrib, mail_param, isparam("edit_id"), att_file,
isparam("encoding") ? getparam("encoding") : "plain") == 0) isparam("encoding") ? getparam("encoding") : "plain") == 0)
return; return;
} }
@ -19500,7 +19499,8 @@ void show_elog_entry(LOGBOOK * lbs, char *dec_path, char *command)
/* check for locked attributes */ /* check for locked attributes */
for (i = 0; i < lbs->n_attr; i++) { for (i = 0; i < lbs->n_attr; i++) {
sprintf(lattr, "l%s", attr_list[i]); sprintf(lattr, "l%s", attr_list[i]);
if (isparam(lattr) == '1' && !(isparam(attr_list[i]) && strieq(getparam(attr_list[i]), attrib[i]))) if (isparam(lattr) == '1'
&& !(isparam(attr_list[i]) && strieq(getparam(attr_list[i]), attrib[i])))
break; break;
} }
if (i < lbs->n_attr) if (i < lbs->n_attr)
@ -19657,9 +19657,9 @@ void show_elog_entry(LOGBOOK * lbs, char *dec_path, char *command)
strcpy(str, loc(menu_item[i])); strcpy(str, loc(menu_item[i]));
url_encode(str, sizeof(str)); url_encode(str, sizeof(str));
if (strieq(menu_item[i], "list")) if (strieq(menu_item[i], "list"))
rsprintf("&nbsp;<a href=\".?id=%d\">%s</a>&nbsp;\n", message_id, loc(menu_item[i])); rsprintf("&nbsp;<a href=\".?id=%d\">%s</a>&nbsp;\n", message_id, loc(menu_item[i]));
else else
rsprintf("&nbsp;<a href=\"%d?cmd=%s\">%s</a>&nbsp;\n", message_id, str, loc(menu_item[i])); rsprintf("&nbsp;<a href=\"%d?cmd=%s\">%s</a>&nbsp;\n", message_id, str, loc(menu_item[i]));
if (i < n - 1) if (i < n - 1)
@ -21015,7 +21015,7 @@ BOOL check_user_password(LOGBOOK * lbs, char *user, char *password, char *redir)
rsprintf("<tr><td align=right class=\"dlgform\">%s:</td>\n", loc("Username")); rsprintf("<tr><td align=right class=\"dlgform\">%s:</td>\n", loc("Username"));
rsprintf rsprintf
("<td align=left class=\"dlgform\"><input type=text name=uname value=\"%s\"></td></tr>\n", ("<td align=left class=\"dlgform\"><input type=text name=uname value=\"%s\"></td></tr>\n",
isparam("unm") ? getparam("unm") : ""); isparam("unm") ? getparam("unm") : "");
rsprintf("<tr><td align=right class=\"dlgform\">%s:</td>\n", loc("Password")); rsprintf("<tr><td align=right class=\"dlgform\">%s:</td>\n", loc("Password"));
rsprintf("<td align=left class=\"dlgform\"><input type=password name=upassword></td></tr>\n"); rsprintf("<td align=left class=\"dlgform\"><input type=password name=upassword></td></tr>\n");
@ -21147,8 +21147,7 @@ void show_logbook_node(LBLIST plb, LBLIST pparent, int level, int btop)
rsprintf(plb->name); rsprintf(plb->name);
else { else {
if (getcfg_topgroup()) if (getcfg_topgroup())
rsprintf("<a href=\"%s/?gexp=%s\">+ %s</a> ", getcfg_topgroup(), plb->name, rsprintf("<a href=\"%s/?gexp=%s\">+ %s</a> ", getcfg_topgroup(), plb->name, plb->name);
plb->name);
else else
rsprintf("<a href=\".?gexp=%s\">+ %s</a> ", plb->name, plb->name); rsprintf("<a href=\".?gexp=%s\">+ %s</a> ", plb->name, plb->name);
} }
@ -21735,8 +21734,7 @@ void interprete(char *lbook, char *path)
int status, i, j, n, index, lb_index, message_id; int status, i, j, n, index, lb_index, message_id;
char exp[80], list[1000], section[256], str[NAME_LENGTH], str2[NAME_LENGTH], char exp[80], list[1000], section[256], str[NAME_LENGTH], str2[NAME_LENGTH],
enc_pwd[80], file_name[256], command[80], ref[256], enc_path[256], dec_path[256], enc_pwd[80], file_name[256], command[80], ref[256], enc_path[256], dec_path[256],
logbook[256], logbook_enc[256], *experiment, group[256], css[256], *pfile, logbook[256], logbook_enc[256], *experiment, group[256], css[256], *pfile, attachment[MAX_PATH_LENGTH];
attachment[MAX_PATH_LENGTH];
BOOL global; BOOL global;
LOGBOOK *lbs; LOGBOOK *lbs;
FILE *f; FILE *f;
@ -21748,7 +21746,7 @@ void interprete(char *lbook, char *path)
url_encode(enc_path, sizeof(enc_path)); url_encode(enc_path, sizeof(enc_path));
strcpy(command, isparam("cmd") ? getparam("cmd") : ""); strcpy(command, isparam("cmd") ? getparam("cmd") : "");
strcpy(group, isparam("group") ? getparam("group") : ""); strcpy(group, isparam("group") ? getparam("group") : "");
index = isparam("index")? atoi(getparam("index")) : 0; index = isparam("index") ? atoi(getparam("index")) : 0;
experiment = getparam("exp"); experiment = getparam("exp");
if (getcfg(lbook, "Logging Level", str, sizeof(str))) if (getcfg(lbook, "Logging Level", str, sizeof(str)))
_logging_level = atoi(str); _logging_level = atoi(str);
@ -21940,7 +21938,7 @@ void interprete(char *lbook, char *path)
if (!check_password(lbs, "Write password", enc_pwd, isparam("redir") ? getparam("redir") : "")) if (!check_password(lbs, "Write password", enc_pwd, isparam("redir") ? getparam("redir") : ""))
return; return;
rsprintf("HTTP/1.1 302 Found\r\n"); rsprintf("HTTP/1.1 302 Found\r\n");
rsprintf("Server: ELOG HTTP %s-%d\r\n", VERSION, atoi(svn_revision+13)); rsprintf("Server: ELOG HTTP %s-%d\r\n", VERSION, atoi(svn_revision + 13));
if (use_keepalive) { if (use_keepalive) {
rsprintf("Connection: Keep-Alive\r\n"); rsprintf("Connection: Keep-Alive\r\n");
rsprintf("Keep-Alive: timeout=60, max=10\r\n"); rsprintf("Keep-Alive: timeout=60, max=10\r\n");
@ -21964,7 +21962,7 @@ void interprete(char *lbook, char *path)
if (!check_password(lbs, "Admin password", enc_pwd, isparam("redir") ? getparam("redir") : "")) if (!check_password(lbs, "Admin password", enc_pwd, isparam("redir") ? getparam("redir") : ""))
return; return;
rsprintf("HTTP/1.1 302 Found\r\n"); rsprintf("HTTP/1.1 302 Found\r\n");
rsprintf("Server: ELOG HTTP %s-%d\r\n", VERSION, atoi(svn_revision+13)); rsprintf("Server: ELOG HTTP %s-%d\r\n", VERSION, atoi(svn_revision + 13));
if (use_keepalive) { if (use_keepalive) {
rsprintf("Connection: Keep-Alive\r\n"); rsprintf("Connection: Keep-Alive\r\n");
rsprintf("Keep-Alive: timeout=60, max=10\r\n"); rsprintf("Keep-Alive: timeout=60, max=10\r\n");
@ -22044,10 +22042,10 @@ void interprete(char *lbook, char *path)
return; return;
} }
if (!check_user_password(lbs, if (!check_user_password(lbs,
isparam("unm") ? getparam("unm") : "", isparam("unm") ? getparam("unm") : "",
isparam("upwd") ? getparam("upwd") : "", isparam("upwd") ? getparam("upwd") : "",
isparam("cmdline") ? getparam("cmdline") : "")) isparam("cmdline") ? getparam("cmdline") : ""))
return; return;
} }
} }
@ -22251,7 +22249,7 @@ void interprete(char *lbook, char *path)
/* check if command allowed for current user */ /* check if command allowed for current user */
if (command[0] && !is_user_allowed(lbs, command)) { if (command[0] && !is_user_allowed(lbs, command)) {
sprintf(str, loc("Error: Command \"<b>%s</b>\" is not allowed for user \"<b>%s</b>\""), sprintf(str, loc("Error: Command \"<b>%s</b>\" is not allowed for user \"<b>%s</b>\""),
command, isparam("full_name") ? getparam("full_name") : ""); command, isparam("full_name") ? getparam("full_name") : "");
show_error(str); show_error(str);
return; return;
} }
@ -22347,16 +22345,16 @@ void interprete(char *lbook, char *path)
unsetparam(str); unsetparam(str);
} }
show_edit_form(lbs, isparam("edit_id") ? atoi(getparam("edit_id")) : 0, show_edit_form(lbs, isparam("edit_id") ? atoi(getparam("edit_id")) : 0,
FALSE, TRUE, TRUE, FALSE, FALSE, FALSE); FALSE, TRUE, TRUE, FALSE, FALSE, FALSE);
return; return;
} }
} }
message_id = atoi(dec_path); message_id = atoi(dec_path);
if (strieq(command, loc("Upload"))) { if (strieq(command, loc("Upload"))) {
show_edit_form(lbs, isparam("edit_id") ? atoi(getparam("edit_id")) : 0, show_edit_form(lbs, isparam("edit_id") ? atoi(getparam("edit_id")) : 0,
FALSE, TRUE, TRUE, FALSE, FALSE, FALSE); FALSE, TRUE, TRUE, FALSE, FALSE, FALSE);
return; return;
} }
@ -22373,8 +22371,8 @@ void interprete(char *lbook, char *path)
} }
if (strieq(command, loc("Update"))) { if (strieq(command, loc("Update"))) {
show_edit_form(lbs, isparam("edit_id") ? atoi(getparam("edit_id")) : 0, show_edit_form(lbs, isparam("edit_id") ? atoi(getparam("edit_id")) : 0,
FALSE, TRUE, FALSE, TRUE, FALSE, FALSE); FALSE, TRUE, FALSE, TRUE, FALSE, FALSE);
return; return;
} }
@ -22386,8 +22384,8 @@ void interprete(char *lbook, char *path)
} }
if (strieq(command, loc("Preview"))) { if (strieq(command, loc("Preview"))) {
show_edit_form(lbs, isparam("edit_id") ? atoi(getparam("edit_id")) : 0, show_edit_form(lbs, isparam("edit_id") ? atoi(getparam("edit_id")) : 0,
FALSE, TRUE, FALSE, TRUE, FALSE, TRUE); FALSE, TRUE, FALSE, TRUE, FALSE, TRUE);
return; return;
} }
@ -23444,7 +23442,7 @@ void server_loop(void)
} else if (strstr(net_buffer, "HEAD") != NULL) { } else if (strstr(net_buffer, "HEAD") != NULL) {
/* just return header */ /* just return header */
rsprintf("HTTP/1.1 200 OK\r\n"); rsprintf("HTTP/1.1 200 OK\r\n");
rsprintf("Server: ELOG HTTP %s-%d\r\n", VERSION, atoi(svn_revision+13)); rsprintf("Server: ELOG HTTP %s-%d\r\n", VERSION, atoi(svn_revision + 13));
rsprintf("Connection: close\r\n"); rsprintf("Connection: close\r\n");
rsprintf("Content-Type: text/html\r\n\r\n"); rsprintf("Content-Type: text/html\r\n\r\n");
keep_alive = FALSE; keep_alive = FALSE;
@ -23931,7 +23929,7 @@ void server_loop(void)
if (!authorized) { if (!authorized) {
/* return request for authorization */ /* return request for authorization */
rsprintf("HTTP/1.1 401 Authorization Required\r\n"); rsprintf("HTTP/1.1 401 Authorization Required\r\n");
rsprintf("Server: ELOG HTTP %s-%d\r\n", VERSION, atoi(svn_revision+13)); rsprintf("Server: ELOG HTTP %s-%d\r\n", VERSION, atoi(svn_revision + 13));
rsprintf("WWW-Authenticate: Basic realm=\"%s\"\r\n", logbook); rsprintf("WWW-Authenticate: Basic realm=\"%s\"\r\n", logbook);
rsprintf("Connection: close\r\n"); rsprintf("Connection: close\r\n");
rsprintf("Content-Type: text/html\r\n\r\n"); rsprintf("Content-Type: text/html\r\n\r\n");