More info on this:
The keymgr command invokes first the init_confile function. This results in the
following backtrace:
#0 conf_db_get (conf=0x6bfcc0, txn=0x7fffffffe1b0,
key0=0x47b76a "\bkeystore", key1=0x47b761 "\abackend",
id=0x6c6648 "TheBackend", id_len=11, data=0x7fffffffdf70)
at knot/conf/confdb.c:704
#1 0x0000000000410018 in conf_rawid_get_txn (conf=0x6bfcc0,
txn=0x7fffffffe1b0, key0_name=0x47b76a "\bkeystore",
key1_name=0x47b761 "\abackend", id=0x6c6648 "TheBackend",
id_len=11)
at knot/conf/conf.c:78
#2 0x0000000000417f4a in check_keystore (args=0x7fffffffe090)
at knot/conf/tools.c:268
#3 0x000000000041777d in conf_exec_callbacks (args=0x7fffffffe090)
at knot/conf/tools.c:62
#4 0x000000000040ebaa in finalize_previous_section (conf=0x6bfcc0,
txn=0x7fffffffe1b0, parser=0x6ed560, ctx=0x6c6620) at knot/conf/base.c:506
#5 0x000000000040ee8d in conf_parse (conf=0x6bfcc0, txn=0x7fffffffe1b0,
input=0x4783c7 "/etc/knot/knot.conf", is_file=true)
at knot/conf/base.c:592
#6 0x000000000040f128 in conf_import (conf=0x6bfcc0,
input=0x4783c7 "/etc/knot/knot.conf", is_file=true)
at knot/conf/base.c:669
#7 0x000000000040b677 in init_confile (
confile=0x4783c7 "/etc/knot/knot.conf")
at utils/keymgr/main.c:240
#8 0x000000000040bb70 in main (argc=4, argv=0x7fffffffe488)
at utils/keymgr/main.c:349
A few lines later, keymgr invokes key_command. I get the following backtrace:
#0 conf_db_get (conf=0x6bfcc0, txn=0x6bfce0, key0=0x47c042 "\bkeystore",
key1=0x47c04c "\abackend", id=0x0, id_len=0, data=0x7fffffffdf90)
at knot/conf/confdb.c:705
#1 0x00000000004101a3 in conf_id_get_txn (conf=0x6bfcc0, txn=0x6bfce0,
key0_name=0x47c042 "\bkeystore", key1_name=0x47c04c "\abackend",
id=0x7fffffffe090) at knot/conf/conf.c:109
#2 0x0000000000419117 in conf_id_get (conf=0x6bfcc0,
key0_name=0x47c042 "\bkeystore", key1_name=0x47c04c "\abackend",
id=0x7fffffffe090) at ./knot/conf/conf.h:138
#3 0x000000000041a516 in kdnssec_ctx_init (conf=0x6bfcc0, ctx=0x7fffffffe180,
zone_name=0x6a81d0 "\aexample\003com", from_module=0x0)
at knot/dnssec/context.c:169
#4 0x000000000040aee4 in key_command (argc=3, argv=0x7fffffffe490, optind=1)
at utils/keymgr/main.c:113
#5 0x000000000040bba9 in main (argc=4, argv=0x7fffffffe488)
at utils/keymgr/main.c:359
In both cases conf_db_get is eventually invoked. With a big difference: the first time,
the information concerning the keystore id is present, as the value of id - namely,
"TheBackend". With this value, conf_db_get returns KNOT_EOK, and the backend id
is retrieved as KEYSTORE_BACKEND_PKCS11.
The second time, however, the value of this argument is just the NULL pointer. This
causes conf_db_get to return KNOT_ENOENT, and the value of the backend is therefore
eventually set to the default - KEYSTORE_BACKEND_PEM.
What am I doing wrong? What is causing for the second invocation to of conf_db_get to
receive an id argument set to NULL? Is this the way it is supposed to work, or is it a bug
in the Knot 2.7.3 code? If it is not, what do I have to do in order to get Knot to use the
PKCS #11 interface? By the way, I forgot to mention in my previous email that Knot was
built with PKCS #11 support all right.