mirror of
https://gitea.psi.ch/ELOG/elog.git
synced 2026-09-12 19:06:50 +00:00
Added length check for new user names
This commit is contained in:
parent
c89114fab7
commit
209deb00af
@ -13276,6 +13276,24 @@ int save_user_config(LOGBOOK *lbs, const char *user, BOOL new_user) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* check for string lengths */
|
||||||
|
if (strlen(getparam("new_user_name")) > 40) {
|
||||||
|
sprintf(str, "%s %s", loc("Login name"), loc("is too long"));
|
||||||
|
show_error(str);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (strlen(getparam("new_full_name")) > 80) {
|
||||||
|
sprintf(str, "%s %s", loc("Full name"), loc("is too long"));
|
||||||
|
show_error(str);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (strlen(getparam("new_user_email")) > 80) {
|
||||||
|
sprintf(str, "%s %s", loc("Email address"), loc("is too long"));
|
||||||
|
show_error(str);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* check for blank password if not external authentication */
|
/* check for blank password if not external authentication */
|
||||||
if (isparam("newpwd")) {
|
if (isparam("newpwd")) {
|
||||||
strlcpy(str, getparam("newpwd"), sizeof(str));
|
strlcpy(str, getparam("newpwd"), sizeof(str));
|
||||||
@ -25710,7 +25728,7 @@ int get_user_line(LOGBOOK *lbs, char *user, char *password, char *full_name, cha
|
|||||||
/* return value: 0:cannot access password file, 1: OK, 2: user not found */
|
/* return value: 0:cannot access password file, 1: OK, 2: user not found */
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
char str[256];
|
char str[1024];
|
||||||
PMXML_NODE user_node, node, subnode;
|
PMXML_NODE user_node, node, subnode;
|
||||||
|
|
||||||
if (password)
|
if (password)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user