* Netconf lock/unlock behaviour changed to adhere to RFC 6241

* Changed commit lock error tag from "lock denied" to "in-use".
  * Changed unlock error message from "lock is already held" to #lock not active" or "lock held by other session".
  * Fixed [lock candidate succeeded even though it is modified #110](https://github.com/clicon/clixon/issues/110)
This commit is contained in:
Olof hagsand 2020-07-28 13:56:44 +02:00
parent 6bd9306423
commit 23bcee8185
7 changed files with 178 additions and 69 deletions

View file

@ -572,6 +572,7 @@ candidate_commit(clicon_handle h,
*/
if (xmldb_copy(h, candidate, "running") < 0)
goto done;
xmldb_modified_set(h, candidate, 0); /* reset dirty bit */
/* Here pointers to old (source) tree are obsolete */
if (td->td_dvec){
td->td_dlen = 0;
@ -640,7 +641,7 @@ from_client_commit(clicon_handle h,
goto done;
}
cprintf(cbx, "<session-id>%u</session-id>", iddb);
if (netconf_lock_denied(cbret, cbuf_get(cbx), "Operation failed, lock is already held") < 0)
if (netconf_in_use(cbret, cbuf_get(cbx), "Operation failed, lock is already held") < 0)
goto done;
goto ok;
}
@ -703,6 +704,7 @@ from_client_discard_changes(clicon_handle h,
goto done;
goto ok;
}
xmldb_modified_set(h, "candidate", 0); /* reset dirty bit */
cprintf(cbret, "<rpc-reply><ok/></rpc-reply>");
ok:
retval = 0;