diff --git a/doc/config.html b/doc/config.html index 303a2dc1..5a59d05b 100755 --- a/doc/config.html +++ b/doc/config.html @@ -977,6 +977,13 @@ If this flag is 1, only top level messages are displayed in the search result page for threaded display. No replies are shown. The default is 0.
+
Line as link = 0|1
+
+If this flag is 1, the full line is used as a link to each message in the
+search result page. Otherwise, only the icon at the beginning of each line is used
+as the link, which can be hard to hit for small icons. The default is 0.
++
Table align = left|center|right
Determines the text alignment inside the table of a search result for summary or
diff --git a/elogd.c b/elogd.c
index 1cd3a15a..bf9a943b 100755
--- a/elogd.c
+++ b/elogd.c
@@ -6,6 +6,9 @@
Contents: Web server program for Electronic Logbook ELOG
$Log$
+ Revision 2.109 2002/12/02 07:48:08 midas
+ Implemented 'line as link'
+
Revision 2.108 2002/11/29 14:49:12 midas
Renamed _text to _mtext (problems under AIX)
@@ -770,14 +773,14 @@ char tmp[1000], str[256], uattr[256], *ps, *pt, *p;
p++;
/* extract name */
- strcpy(str, p);
+ strlcpy(str, p, sizeof(str));
for (j=0 ; j<(int)strlen(str) ; j++)
str[j] = toupper(str[j]);
/* search name */
for (i=0 ; i", size);
- strcpy(file_name, lbs->data_dir);
+ strlcpy(file_name, lbs->data_dir, sizeof(file_name));
- strcat(file_name, attachment[index]);
+ strlcat(file_name, attachment[index], sizeof(file_name));
f = fopen(file_name, "rt");
if (f != NULL)
@@ -6637,12 +6673,12 @@ int msg_compare_reverse(const void *m1, const void *m2)
/*------------------------------------------------------------------*/
-void build_ref(char *ref)
+void build_ref(char *ref, int size)
{
char *p1, *p2;
if (strchr(getparam("cmdline"), '?'))
- strcat(ref, strchr(getparam("cmdline"), '?'));
+ strlcat(ref, strchr(getparam("cmdline"), '?'), size);
/* eliminate old search */
if (strstr(ref, "cmd=Search&"))
@@ -6688,7 +6724,7 @@ char ref[256];
if (page_n > 1)
{
sprintf(ref, "page%d", page_n - 1);
- build_ref(ref);
+ build_ref(ref, sizeof(ref));
rsprintf("%s ", ref, loc("Previous"));
}
@@ -6698,7 +6734,7 @@ char ref[256];
for (i=0 ; i<(n_msg-1)/n_page+1 ; i++)
{
sprintf(ref, "page%d", i+1);
- build_ref(ref);
+ build_ref(ref, sizeof(ref));
if (i == (n_msg-1)/n_page)
{
@@ -6720,7 +6756,7 @@ char ref[256];
if (page_n != -1 && page_n * n_page < n_msg)
{
sprintf(ref, "page%d", page_n + 1);
- build_ref(ref);
+ build_ref(ref, sizeof(ref));
rsprintf("%s ", ref, loc("Next"));
}
@@ -6728,7 +6764,7 @@ char ref[256];
if (page_n != -1 && n_page < n_msg)
{
sprintf(ref, "page");
- build_ref(ref);
+ build_ref(ref, sizeof(ref));
rsprintf("%s\n", ref, loc("All"));
}
@@ -6926,9 +6962,9 @@ LOGBOOK *lbs_cur;
atoi(str) == 1)
{
if (strchr(_cmdline, '?'))
- strcat(_cmdline, "&reverse=0");
+ strlcat(_cmdline, "&reverse=0", sizeof(_cmdline));
else
- strcat(_cmdline, "?reverse=0");
+ strlcat(_cmdline, "?reverse=0", sizeof(_cmdline));
}
redirect(_cmdline);
return;
@@ -6937,7 +6973,7 @@ LOGBOOK *lbs_cur;
/* redirect go command */
if (isparam("lastcmd")) //## and not copy to / move to / delete ...
{
- strcpy(str, getparam("lastcmd"));
+ strlcpy(str, getparam("lastcmd"), sizeof(str));
url_decode(str);
/* strip previous "last" */
@@ -6946,9 +6982,11 @@ LOGBOOK *lbs_cur;
/* add new "last" */
if (strchr(str, '?'))
- sprintf(str+strlen(str), "&last=%s", getparam("last"));
+ sprintf(str+strlen(str), "&last=");
else
- sprintf(str+strlen(str), "?last=%s", getparam("last"));
+ sprintf(str+strlen(str), "?last=");
+
+ strlcat(str, getparam("last"), sizeof(str));
redirect(str);
return;
}
@@ -7325,8 +7363,7 @@ LOGBOOK *lbs_cur;
if (equal_ustring(getparam("sort"), attr_list[i]) ||
equal_ustring(getparam("rsort"), attr_list[i]))
{
- strncpy(msg_list[index].string, attrib[i], 255);
- msg_list[index].string[255] = 0;
+ strlcpy(msg_list[index].string, attrib[i], 256);
}
if (equal_ustring(getparam("sort"), "#") ||
@@ -7566,8 +7603,8 @@ LOGBOOK *lbs_cur;
strcpy(file_name, str);
else
{
- strcpy(file_name, cfg_dir);
- strcat(file_name, str);
+ strlcpy(file_name, cfg_dir, sizeof(file_name));
+ strlcat(file_name, str, sizeof(file_name));
}
f = fopen(file_name, "rb");
@@ -7889,8 +7926,8 @@ LOGBOOK *lbs_cur;
strcpy(file_name, str);
else
{
- strcpy(file_name, cfg_dir);
- strcat(file_name, str);
+ strlcpy(file_name, cfg_dir, sizeof(file_name));
+ strlcat(file_name, str, sizeof(file_name));
}
f = fopen(file_name, "rb");
@@ -7990,8 +8027,8 @@ char slist[MAX_N_ATTR+10][NAME_LENGTH], svalue[MAX_N_ATTR+10][NAME_LENGTH];
}
else
{
- strcat(str, lbs->name);
- strcat(str, "/");
+ strlcat(str, lbs->name, sizeof(str));
+ strlcat(str, "/", sizeof(str));
}
sprintf(mail_text+strlen(mail_text), "\r\n%s URL : %s%d\r\n",
@@ -8105,9 +8142,9 @@ int i, j, n, missing, first, index, n_mail, suppress, message_id, resubmit_or
if (first)
first = 0;
else
- strcat(attrib[i], " | ");
+ strlcat(attrib[i], " | ", NAME_LENGTH);
if (strlen(attrib[i]) + strlen(getparam(str)) < NAME_LENGTH-2)
- strcat(attrib[i], getparam(str));
+ strlcat(attrib[i], getparam(str), NAME_LENGTH);
else
break;
}
@@ -8118,8 +8155,7 @@ int i, j, n, missing, first, index, n_mail, suppress, message_id, resubmit_or
}
else
{
- strncpy(attrib[i], getparam(attr_list[i]), NAME_LENGTH);
- attrib[i][NAME_LENGTH-1] = 0;
+ strlcpy(attrib[i], getparam(attr_list[i]), NAME_LENGTH);
}
if (!*getparam("edit"))
@@ -8222,13 +8258,13 @@ int i, j, n, missing, first, index, n_mail, suppress, message_id, resubmit_or
if (strchr(attr_list[index], ' '))
sprintf(str+strlen(str), "\"%s\"", attr_list[index]);
else
- strcat(str, attr_list[index]);
+ strlcat(str, attr_list[index], sizeof(str));
strcat(str, " ");
if (strchr(getparam(attr_list[index]), ' '))
sprintf(str+strlen(str), "\"%s\"", getparam(attr_list[index]));
else
- strcat(str, getparam(attr_list[index]));
+ strlcat(str, getparam(attr_list[index]), sizeof(str));
}
else
sprintf(str, "Email ALL");
@@ -8272,8 +8308,8 @@ int i, j, n, missing, first, index, n_mail, suppress, message_id, resubmit_or
strcpy(file_name, str);
else
{
- strcpy(file_name, cfg_dir);
- strcat(file_name, str);
+ strlcpy(file_name, cfg_dir, sizeof(file_name));
+ strlcat(file_name, str, sizeof(file_name));
}
send_file_direct(file_name);
return;
@@ -8350,8 +8386,8 @@ LOGBOOK *lbs_dest;
for (i=0 ; idata_dir);
- strcat(file_name, attachment[i]);
+ strlcpy(file_name, lbs->data_dir, sizeof(file_name));
+ strlcat(file_name, attachment[i], sizeof(file_name));
fh = open(file_name, O_RDONLY | O_BINARY);
if (fh > 0)
@@ -8370,8 +8406,8 @@ LOGBOOK *lbs_dest;
}
/* stip date/time from file name */
- strcpy(str, attachment[i]);
- strcpy(attachment[i], str+14);
+ strlcpy(str, attachment[i], sizeof(str));
+ strlcpy(attachment[i], str+14, NAME_LENGTH);
}
/* submit in destination logbook without links, submit all attributes from
@@ -8921,8 +8957,8 @@ BOOL first;
strcpy(file_name, str);
else
{
- strcpy(file_name, cfg_dir);
- strcat(file_name, str);
+ strlcpy(file_name, cfg_dir, sizeof(file_name));
+ strlcat(file_name, str, sizeof(file_name));
}
f = fopen(file_name, "rb");
@@ -9163,8 +9199,8 @@ BOOL first;
att[i] = 0;
/* determine size of attachment */
- strcpy(file_name, lbs->data_dir);
- strcat(file_name, attachment[index]);
+ strlcpy(file_name, lbs->data_dir, sizeof(file_name));
+ strlcat(file_name, attachment[index], sizeof(file_name));
length = 0;
fh = open(file_name, O_RDONLY | O_BINARY);
@@ -9220,8 +9256,8 @@ BOOL first;
if (!strstr(att, ".HTML"))
rsprintf("
");
- strcpy(file_name, lbs->data_dir);
- strcat(file_name, attachment[index]);
+ strlcpy(file_name, lbs->data_dir, sizeof(file_name));
+ strlcat(file_name, attachment[index], sizeof(file_name));
f = fopen(file_name, "rt");
if (f != NULL)
@@ -9266,8 +9302,8 @@ BOOL first;
strcpy(file_name, str);
else
{
- strcpy(file_name, cfg_dir);
- strcat(file_name, str);
+ strlcpy(file_name, cfg_dir, sizeof(file_name));
+ strlcat(file_name, str, sizeof(file_name));
}
f = fopen(file_name, "rb");
@@ -9364,11 +9400,11 @@ int i;
return 1;
if (str[0] == DIR_SEPARATOR || str[1] == ':')
- strcpy(file_name, str);
+ strlcpy(file_name, str, sizeof(file_name));
else
{
- strcpy(file_name, cfg_dir);
- strcat(file_name, str);
+ strlcpy(file_name, cfg_dir, sizeof(file_name));
+ strlcat(file_name, str, sizeof(file_name));
}
f = fopen(file_name, "r");
@@ -9410,7 +9446,7 @@ int i;
while (*p && *p == ' ')
p++;
- strncpy(str, p, sizeof(str)-1);
+ strlcpy(str, p, sizeof(str));
if (strchr(str, ':'))
*strchr(str, ':') = 0;
@@ -9457,8 +9493,8 @@ int i;
strcpy(file_name, str);
else
{
- strcpy(file_name, cfg_dir);
- strcat(file_name, str);
+ strlcpy(file_name, cfg_dir, sizeof(file_name));
+ strlcat(file_name, str, sizeof(file_name));
}
f = fopen(file_name, "r");
@@ -9759,11 +9795,11 @@ FILE *f;
{
/* check if file starts with an absolute directory */
if (str[0] == DIR_SEPARATOR || str[1] == ':')
- strcpy(file_name, str);
+ strlcpy(file_name, str, sizeof(file_name));
else
{
- strcpy(file_name, cfg_dir);
- strcat(file_name, str);
+ strlcpy(file_name, cfg_dir, sizeof(file_name));
+ strlcat(file_name, str, sizeof(file_name));
}
send_file_direct(file_name);
return;
@@ -10100,23 +10136,23 @@ FILE *f;
dec_path[13] = '_';
/* file from data directory requested */
- strcpy(file_name, lbs->data_dir);
- strcat(file_name, dec_path);
+ strlcpy(file_name, lbs->data_dir, sizeof(file_name));
+ strlcat(file_name, dec_path, sizeof(file_name));
}
else
{
/* file from theme directory requested */
- strcpy(file_name, cfg_dir);
+ strlcpy(file_name, cfg_dir, sizeof(file_name));
if (file_name[0])
- strcat(file_name, DIR_SEPARATOR_STR);
- strcat(file_name, "themes");
- strcat(file_name, DIR_SEPARATOR_STR);
+ strlcat(file_name, DIR_SEPARATOR_STR, sizeof(file_name));
+ strlcat(file_name, "themes", sizeof(file_name));
+ strlcat(file_name, DIR_SEPARATOR_STR, sizeof(file_name));
if (theme_name[0])
{
- strcat(file_name, theme_name);
- strcat(file_name, DIR_SEPARATOR_STR);
+ strlcat(file_name, theme_name, sizeof(file_name));
+ strlcat(file_name, DIR_SEPARATOR_STR, sizeof(file_name));
}
- strcat(file_name, dec_path);
+ strlcat(file_name, dec_path, sizeof(file_name));
}
send_file_direct(file_name);
@@ -10166,17 +10202,17 @@ FILE *f;
}
/* send local help file */
- strcpy(file_name, cfg_dir);
- strcat(file_name, "eloghelp_");
+ strlcpy(file_name, cfg_dir, sizeof(file_name));
+ strlcat(file_name, "eloghelp_", sizeof(file_name));
if (getcfg("global", "Language", str))
{
str[2] = 0;
- strcat(file_name, str);
+ strlcat(file_name, str, sizeof(file_name));
}
else
- strcat(file_name, "en");
- strcat(file_name, ".html");
+ strlcat(file_name, "en", sizeof(file_name));
+ strlcat(file_name, ".html", sizeof(file_name));
f = fopen(file_name, "r");
if (f == NULL)
@@ -10382,8 +10418,8 @@ FILE *f;
strcpy(file_name, str);
else
{
- strcpy(file_name, cfg_dir);
- strcat(file_name, str);
+ strlcpy(file_name, cfg_dir, sizeof(file_name));
+ strlcat(file_name, str, sizeof(file_name));
}
send_file_direct(file_name);
return;
@@ -10414,7 +10450,7 @@ char *p, *pitem;
setparam("cmdline", string);
- strncpy(path, string, sizeof(path));
+ strlcpy(path, string, sizeof(path));
path[255] = 0;
if (strchr(path, '?'))
*strchr(path, '?') = 0;
@@ -10472,8 +10508,7 @@ int i, n;
{
if (strstr(string, "name="))
{
- strncpy(line, strstr(string, "name=") + 5, sizeof(line)-1);
- line[sizeof(line)-1] = 0;
+ strlcpy(line, strstr(string, "name=") + 5, sizeof(line));
if (strchr(line, '\r'))
*strchr(line, '\r') = 0;
@@ -10949,11 +10984,11 @@ struct timeval timeout;
if (header_length == 0)
{
/* extract logbook */
- strncpy(str, net_buffer+6, sizeof(str));
+ strlcpy(str, net_buffer+6, sizeof(str));
if (strstr(str, "HTTP"))
*(strstr(str, "HTTP")-1) = 0;
- strcpy(logbook, str);
- strcpy(logbook_enc, str);
+ strlcpy(logbook, str, sizeof(logbook));
+ strlcpy(logbook_enc, str, sizeof(logbook));
url_decode(logbook);
/* extract header and content length */
@@ -10965,7 +11000,7 @@ struct timeval timeout;
boundary[0] = 0;
if (strstr(net_buffer, "boundary="))
{
- strncpy(boundary, strstr(net_buffer, "boundary=")+9, sizeof(boundary));
+ strlcpy(boundary, strstr(net_buffer, "boundary=")+9, sizeof(boundary));
if (strchr(boundary, '\r'))
*strchr(boundary, '\r') = 0;
}
@@ -11022,7 +11057,7 @@ struct timeval timeout;
p++;
while (*p && *p == ' ')
p++;
- strncpy(str, p, sizeof(str));
+ strlcpy(str, p, sizeof(str));
for (i=0 ; i<(int)strlen(str) ; i++)
if (str[i] == '=' || str[i] == ';')
@@ -11056,7 +11091,7 @@ struct timeval timeout;
p += 9;
while (*p && *p == ' ')
p++;
- strncpy(referer, p, sizeof(referer));
+ strlcpy(referer, p, sizeof(referer));
if (strchr(referer, '\r'))
*strchr(referer, '\r') = 0;
if (strchr(referer, '?'))
@@ -11072,7 +11107,7 @@ struct timeval timeout;
p += 11;
while (*p && *p == ' ')
p++;
- strncpy(browser, p, sizeof(browser));
+ strlcpy(browser, p, sizeof(browser));
if (strchr(browser, '\r'))
*strchr(browser, '\r') = 0;
}
@@ -11153,8 +11188,8 @@ struct timeval timeout;
strstr(logbook, ".htm"))
{
/* serve file directly */
- strcpy(str, cfg_dir);
- strcat(str, logbook);
+ strlcpy(str, cfg_dir, sizeof(str));
+ strlcat(str, logbook, sizeof(str));
send_file_direct(str);
send(_sock, return_buffer, return_length, 0);
@@ -11197,10 +11232,10 @@ struct timeval timeout;
if (verbose)
printf("\n\n\n%s\n", net_buffer);
- strcpy(logbook, str);
- strcpy(logbook_enc, logbook);
+ strlcpy(logbook, str, sizeof(logbook));
+ strlcpy(logbook_enc, logbook, sizeof(logbook_enc));
url_encode(logbook_enc);
- strcat(logbook_enc, "/");
+ strlcat(logbook_enc, "/", sizeof(logbook_enc));
/* redirect to logbook, necessary to get optional cookies for that logbook */
redirect(logbook_enc);
@@ -11663,7 +11698,7 @@ struct tm *tms;
else if (argv[i][1] == 'l')
strcpy(logbook, argv[++i]);
else if (argv[i][1] == 'h')
- strncpy(tcp_hostname, argv[++i], sizeof(tcp_hostname));
+ strlcpy(tcp_hostname, argv[++i], sizeof(tcp_hostname));
else
{
usage: