NACM: Improved error message when no username included, and added username

This commit is contained in:
Olof hagsand 2024-04-14 11:26:11 +02:00
parent 87e49ca37a
commit 1be158b7be
4 changed files with 18 additions and 8 deletions

View file

@ -1805,7 +1805,7 @@ from_client_msg(clixon_handle h,
goto done;
if (ret == 0){ /* Do NACM RPC validation */
creds = clicon_nacm_credentials(h);
if ((ret = verify_nacm_user(h, creds, ce->ce_username, username, cbret)) < 0)
if ((ret = verify_nacm_user(h, creds, ce->ce_username, username, rpc, cbret)) < 0)
goto done;
if (ret == 0){ /* credentials fail */
ce->ce_out_rpc_errors++;

View file

@ -1908,9 +1908,10 @@ cli_process_control(clixon_handle h,
clixon_err(OE_UNIX, errno, "cbuf_new");
goto done;
}
cprintf(cb, "<rpc xmlns=\"%s\"", NETCONF_BASE_NAMESPACE);
cprintf(cb, " %s", NETCONF_MESSAGE_ID_ATTR);
cprintf(cb, ">");
cprintf(cb, "<rpc xmlns=\"%s\" username=\"%s\" %s>",
NETCONF_BASE_NAMESPACE,
clicon_username_get(h),
NETCONF_MESSAGE_ID_ATTR);
cprintf(cb, "<process-control xmlns=\"%s\">", CLIXON_LIB_NS);
cprintf(cb, "<name>%s</name>", name);
cprintf(cb, "<operation>%s</operation>", opstr);