client: bug fix in acct mgr logic

This commit is contained in:
David Anderson 2017-06-15 19:30:49 -07:00
parent 763a8c5fb9
commit 34ccd8b19c
2 changed files with 5 additions and 1 deletions

View File

@ -65,6 +65,7 @@ int ACCT_MGR_OP::do_rpc(
strlcpy(url, _url.c_str(), sizeof(url));
error_num = ERR_IN_PROGRESS;
error_str = "";
via_gui = _via_gui;
if (global_prefs_xml) {
free(global_prefs_xml);

View File

@ -979,7 +979,10 @@ static void handle_acct_mgr_rpc(GUI_RPC_CONN& grc) {
}
if (bad_arg) {
grc.mfout.printf("<error>bad arg</error>\n");
} else if (!gstate.acct_mgr_info.same_am(url.c_str(), name.c_str(), password_hash.c_str())) {
} else if (gstate.acct_mgr_info.using_am()
&& !url.empty()
&& !gstate.acct_mgr_info.same_am(url.c_str(), name.c_str(), password_hash.c_str())
){
grc.mfout.printf("<error>attached to a different AM - detach first</error>\n");
} else {
gstate.acct_mgr_op.do_rpc(url, name, password_hash, true);