Show errer of forbidden attributes are used

SVN revision: 2172
This commit is contained in:
Stefan Ritt 2009-02-13 09:59:57 +00:00
parent 5209e28b51
commit 737d448beb

View File

@ -7064,6 +7064,21 @@ int scan_attributes(char *logbook)
memset(attr_list, 0, sizeof(attr_list)); memset(attr_list, 0, sizeof(attr_list));
n = strbreak(list, attr_list, MAX_N_ATTR, ",", FALSE); n = strbreak(list, attr_list, MAX_N_ATTR, ",", FALSE);
/* check for forbidden attributes */
for (i = 0; i < n; i++) {
if (strieq(attr_list[i], "text") ||
strieq(attr_list[i], "date") ||
strieq(attr_list[i], "encoding") ||
strieq(attr_list[i], "reply to") ||
strieq(attr_list[i], "locked by") ||
strieq(attr_list[i], "in reply to") ||
strieq(attr_list[i], "attachment")) {
sprintf(str, loc("Forbidden attribute: %s"), attr_list[i]);
show_error(str);
return -1;
}
}
/* get options lists for attributes */ /* get options lists for attributes */
memset(attr_options, 0, sizeof(attr_options)); memset(attr_options, 0, sizeof(attr_options));
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
@ -22216,12 +22231,14 @@ void submit_elog(LOGBOOK * lbs)
else else
index--; /* repeat this loop */ index--; /* repeat this loop */
} else } else
strlcpy(str2, ua, sizeof(str)); strlcpy(str2, ua, sizeof(str2));
if (isparam(str2)) { if (isparam(str2)) {
if (strchr(getparam(str2), ' ')) if (strchr(getparam(str2), ' ')) {
sprintf(str + strlen(str), "\"%s\"", getparam(str2)); strlcat(str, "\"", sizeof(str));
else strlcat(str, getparam(str2), sizeof(str));
strlcat(str, "\"", sizeof(str));
} else
strlcat(str, getparam(str2), sizeof(str)); strlcat(str, getparam(str2), sizeof(str));
} }
} else } else
@ -25505,6 +25522,10 @@ void interprete(char *lbook, char *path)
lbs = lb_list + i; lbs = lb_list + i;
lbs->n_attr = scan_attributes(lbs->name); lbs->n_attr = scan_attributes(lbs->name);
/* check for error during attribute scan */
if (lbs->n_attr < 0)
return;
if (isparam("wpassword")) { if (isparam("wpassword")) {
/* check if password correct */ /* check if password correct */
do_crypt(getparam("wpassword"), enc_pwd, sizeof(enc_pwd)); do_crypt(getparam("wpassword"), enc_pwd, sizeof(enc_pwd));