Hi!
When trying to remove certs from the server, libnetconf2 assertion killed the process. The RPC:
<ks:keystore>
<ks:asymmetric-keys>
<ks:asymmetric-key nc:operation="remove">
<ks:name>server_key</ks:name>
</ks:asymmetric-key>
</ks:asymmetric-keys>
</ks:keystore>
<ts:truststore>
<ts:certificate-bags nc:operation="remove">
<ts:certificate-bag>
<ts:name>ca_cert</ts:name>
</ts:certificate-bag>
</ts:certificate-bags>
</ts:truststore>
<ncs:netconf-server>
<ncs:listen>
<ncs:endpoints>
<ncs:endpoint nc:operation="remove">
<ncs:name>main_tls</ncs:name>
</ncs:endpoint>
</ncs:endpoints>
</ncs:listen>
</ncs:netconf-server>
Apparently, it was because in config_asymmetric_key the assertion fails when a diff walks an asymmetric-key list entry (as a parent traversal with operation="none" or "delete") that is no longer present in the internal keystore->entries array.
I've attached a simple reproduction code that kind of simulates what is happening.
It seems that internally, libnetconf2's diff walker visits the asymmetric-key as a parent traversal after it's already removed from keystore->entries, and the assertion kills the server.
Maybe it'd be better if config_asymmetric_key would not assert() in this case and on "entry not found" during NC_OP_DELETE / NC_OP_NONE, it would return a error (or no-op for NC_OP_NONE) instead?
I'm using libnetconf2 version 4.2.14.
Thanks!
libnetconf2_bug_repro.zip
Hi!
When trying to remove certs from the server, libnetconf2 assertion killed the process. The RPC:
Apparently, it was because in
config_asymmetric_keythe assertion fails when a diff walks an asymmetric-key list entry (as a parent traversal with operation="none" or "delete") that is no longer present in the internalkeystore->entriesarray.I've attached a simple reproduction code that kind of simulates what is happening.
It seems that internally, libnetconf2's diff walker visits the asymmetric-key as a parent traversal after it's already removed from
keystore->entries, and the assertion kills the server.Maybe it'd be better if
config_asymmetric_keywould not assert() in this case and on "entry not found" duringNC_OP_DELETE/NC_OP_NONE, it would return a error (or no-op forNC_OP_NONE) instead?I'm using libnetconf2 version 4.2.14.
Thanks!
libnetconf2_bug_repro.zip