diff --git a/src/elogd.c b/src/elogd.c
index f640c2b3..e2c123ed 100755
--- a/src/elogd.c
+++ b/src/elogd.c
@@ -1705,7 +1705,8 @@ void compose_email_header(LOGBOOK *lbs, char *subject, char *from, char *to,
strlcat(mail_text, "This is a multi-part message in MIME format.\r\n", size);
} else {
- multipart_boundary[0] = 0;
+ if (multipart_boundary)
+ multipart_boundary[0] = 0;
}
}
}
@@ -2066,7 +2067,7 @@ int retrieve_url(char *url, char **buffer, char *rpwd)
sprintf(str, "GET %s%s HTTP/1.0\r\nConnection: Close\r\n", subdir, param);
/* add local username/password */
- if (isparam("unm"))
+ if (isparam("unm") && isparam("upwd"))
sprintf(str + strlen(str), "Cookie: unm=%s; upwd=%s\r\n", getparam("unm"), getparam("upwd"));
if (rpwd && rpwd[0]) {
@@ -2961,7 +2962,7 @@ void retrieve_email_from(LOGBOOK * lbs, char *ret, char *ret_name, char attrib[M
int i;
if (!getcfg(lbs->name, "Use Email from", str, sizeof(str))) {
- if (isparam("user_email") && *getparam("user_email")) {
+ if (isparam("full_name") && isparam("user_email")) {
sprintf(email_from_name, "%s <%s>", getparam("full_name"), getparam("user_email"));
strlcpy(email_from, getparam("user_email"), sizeof(email_from));
} else {
@@ -4724,7 +4725,7 @@ void write_logfile(LOGBOOK * lbs, const char *text)
strftime(buf, sizeof(buf), "%d-%b-%Y %H:%M:%S", localtime(&now));
strcat(buf, " ");
- if (*getparam("unm") && rem_host[0])
+ if (isparam("unm") && rem_host[0])
sprintf(buf + strlen(buf), "[%s@%s] ", getparam("unm"), rem_host);
else if (rem_host[0])
sprintf(buf + strlen(buf), "[%s] ", rem_host);
@@ -5679,7 +5680,7 @@ char *getparam(char *param)
if (strieq(param, _param[i]))
break;
- if (i < MAX_PARAM)
+ if (i < MAX_PARAM && _param[i][0])
return _value[i];
return NULL;
@@ -5705,6 +5706,9 @@ BOOL isparam(char *param)
{
int i;
+ if (strieq(param, "text"))
+ return _mtext[0] != 0;
+
for (i = 0; i < MAX_PARAM && _param[i][0]; i++)
if (strieq(param, _param[i]))
break;
@@ -6712,7 +6716,7 @@ void show_standard_title(char *logbook, char *text, int printable)
rsprintf(" \n");
/* middle cell */
- if (*getparam("full_name"))
+ if (isparam("full_name"))
rsprintf("
| \n");
- rsprintf("\n", getparam("nsel"));
+ if (isparam("nsel"))
+ rsprintf("\n", getparam("nsel"));
if (isparam("lastcmd")) {
strcpy(str, getparam("lastcmd"));
rsprintf("\n", str);
}
- for (i = reply = 0; i < atoi(getparam("nsel")); i++) {
- sprintf(str, "s%d", i);
- if (isparam(str)) {
- rsprintf("#%s ", getparam(str));
- rsprintf("\n", str, getparam(str));
- }
+ if (isparam("nsel")) {
+ for (i = reply = 0; i < atoi(getparam("nsel")); i++) {
+ sprintf(str, "s%d", i);
+ if (isparam(str)) {
+ rsprintf("#%s ", getparam(str));
+ rsprintf("\n", str, getparam(str));
+ }
- if (!reply) {
- el_retrieve(lbs, atoi(getparam(str)), NULL, attr_list, NULL, 0, NULL, NULL,
- in_reply_to, reply_to, NULL, NULL, NULL);
- if (reply_to[0])
- reply = TRUE;
+ if (!reply) {
+ el_retrieve(lbs, isparam(str) ? atoi(getparam(str)) : 0,
+ NULL, attr_list, NULL, 0, NULL, NULL,
+ in_reply_to, reply_to, NULL, NULL, NULL);
+ if (reply_to[0])
+ reply = TRUE;
+ }
}
}
@@ -11286,14 +11342,13 @@ void show_logbook_delete(LOGBOOK * lbs)
char str[256];
/* redirect if confirm = NO */
- if (getparam("confirm") && *getparam("confirm")
- && strcmp(getparam("confirm"), loc("No")) == 0) {
+ if (isparam("confirm") && strcmp(getparam("confirm"), loc("No")) == 0) {
redirect(lbs, "?cmd=Config");
return;
}
- if (getparam("confirm") && *getparam("confirm")) {
+ if (isparam("confirm")) {
if (strcmp(getparam("confirm"), loc("Yes")) == 0) {
/* delete logbook */
@@ -11339,7 +11394,7 @@ void show_logbook_rename(LOGBOOK * lbs)
int i;
char str[256], lbn[256];
- if (getparam("lbname") && *getparam("lbname")) {
+ if (isparam("lbname")) {
/* check if logbook name exists already */
strcpy(lbn, getparam("lbname"));
@@ -11390,7 +11445,7 @@ void show_logbook_new(LOGBOOK * lbs)
char str[256], lbn[256];
int i;
- if (getparam("lbname") && *getparam("lbname")) {
+ if (isparam("lbname")) {
/* check if logbook name exists already */
strcpy(lbn, getparam("lbname"));
@@ -11782,7 +11837,7 @@ void csv_import(LOGBOOK * lbs, char *csv, char *csvfile)
}
/* check if text column is present */
- if (first && atoi(getparam("filltext"))) {
+ if (first && isparam("filltext") && atoi(getparam("filltext"))) {
for (i = 0; i < n; i++)
if (strieq(list + i * NAME_LENGTH, loc("text"))) {
filltext = TRUE;
@@ -12019,7 +12074,8 @@ int retrieve_remote_md5(LOGBOOK * lbs, char *host, MD5_INDEX ** md5_index, char
rsputs(text);
if (strstr(text, "?fail="))
- sprintf(error_str, loc("Invalid user name \"%s\" or password for remote logbook"), getparam("unm"));
+ sprintf(error_str, loc("Invalid user name \"%s\" or password for remote logbook"),
+ isparam("unm") ? getparam("unm") : "");
else {
strlcpy(str, p + 9, sizeof(str));
if (strchr(str, '?'))
@@ -14241,10 +14297,10 @@ void display_line(LOGBOOK * lbs, int message_id, int number, char *mode,
if (is_html(display))
rsputs(display);
else {
- if (*getparam(attr_list[i])) {
+ if (isparam(attr_list[i])) {
highlight_searchtext(re_buf + 1 + i, display, str, TRUE);
strlcpy(display, str, sizeof(display));
- } else if (*getparam("subtext") && atoi(getparam("sall"))) {
+ } else if (isparam("subtext") && isparam("sall") && atoi(getparam("sall"))) {
highlight_searchtext(re_buf, display, str, TRUE);
strlcpy(display, str, sizeof(display));
}
@@ -14662,6 +14718,10 @@ BOOL is_user_allowed(LOGBOOK * lbs, char *command)
/* check for deny */
sprintf(str, "Deny %s", command);
if (getcfg(lbs->name, str, users, sizeof(users))) {
+
+ if (!isparam("unm"))
+ return FALSE;
+
/* check if current user in list */
n = strbreak(users, list, MAX_N_LIST, ",");
for (i = 0; i < n; i++)
@@ -14685,6 +14745,9 @@ BOOL is_user_allowed(LOGBOOK * lbs, char *command)
return TRUE;
/* check if current user in list */
+ if (!isparam("unm"))
+ return FALSE;
+
n = strbreak(users, list, MAX_N_LIST, ",");
for (i = 0; i < n; i++)
if (strieq(list[i], getparam("unm")))
@@ -14706,7 +14769,7 @@ BOOL is_command_allowed(LOGBOOK * lbs, char *command)
/* check for guest access */
if (!getcfg(lbs->name, "Guest Menu commands", menu_str, sizeof(menu_str))
- || *getparam("unm") != 0)
+ || isparam("unm") != 0)
getcfg(lbs->name, "Menu commands", menu_str, sizeof(menu_str));
/* default menu commands */
@@ -14799,12 +14862,12 @@ BOOL is_command_allowed(LOGBOOK * lbs, char *command)
/* check list menu commands */
str[0] = 0;
if (!getcfg(lbs->name, "Guest List Menu commands", str, sizeof(str))
- || *getparam("unm") != 0)
+ || isparam("unm") != 0)
getcfg(lbs->name, "list menu commands", str, sizeof(str));
if (!str[0]) {
if (!getcfg(lbs->name, "Guest Find Menu commands", str, sizeof(str))
- || *getparam("unm") != 0)
+ || isparam("unm") != 0)
getcfg(lbs->name, "Find Menu commands", str, sizeof(str));
}
@@ -14872,7 +14935,7 @@ void build_ref(char *ref, int size, char *mode, char *expand, char *attach, char
{
char str[1000];
- if (strchr(getparam("cmdline"), '?'))
+ if (isparam("cmdline") && strchr(getparam("cmdline"), '?'))
strlcat(ref, strchr(getparam("cmdline"), '?'), size);
/* eliminate old search */
@@ -14896,7 +14959,8 @@ void build_ref(char *ref, int size, char *mode, char *expand, char *attach, char
subst_param(ref, size, "new_entries", new_entries);
/* eliminate old last= */
- subst_param(ref, size, "last", getparam("last"));
+ if (isparam("last"))
+ subst_param(ref, size, "last", getparam("last"));
/* replace any '&' by '&' */
strlcpy(str, ref, sizeof(str));
@@ -15063,7 +15127,7 @@ void show_page_filters(LOGBOOK * lbs, int n_msg, int page_n, BOOL mode_commands,
for (index = 0; index < n; index++) {
if (strieq(list[index], loc("Date"))) {
- i = atoi(getparam("last"));
+ i = isparam("last") ? atoi(getparam("last")) : 0;
rsprintf(" \n", loc("Show last"));
@@ -15093,7 +15157,7 @@ void show_page_filters(LOGBOOK * lbs, int n_msg, int page_n, BOOL mode_commands,
rsprintf(" |