-/* tool/set_localid.c -- Retrieve local identity credentials
+/* tool/get_localid.c -- Retrieve local identity credentials
*
* Provide a config, a NAI and see what types of credentials are available
* in localid.db.
#include <sys/types.h>
#include <sys/stat.h>
+
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
+#include <arpa/inet.h>
+
#include <db.h>
#include <tlspool/internal.h>
"Usage: %s tlspool.conf [user@]fqdn type [outfile.der]\n"
" - tlspool.conf is the configuration file for the TLS Pool\n"
" - user@fqdn or fqdn is a network access identifier\n"
-" - type comma-sep: X.509|OpenPGP, client|server, noP11?, chained?\n"
+" - type X.509,OpenPGP,Kerberos,valexp,client,server,noP11,chained\n"
" - outfile.der optional output file for binary encoded public data\n"
"Since the public data is stored in a binary format, it will never be printed\n"
"on stdout; in absense of outfile.der the value is simply not output.\n";
struct typemap_t typemap [] = {
{ "X.509", 1 },
{ "OpenPGP", 2 },
+ { "Kerberos", 4 },
+ { "krb5", 4 },
+ { "valexp", 5 },
{ "client", 256 },
{ "server", 512 },
{ "noP11", 4096 },
}
walker++;
}
- if (flags == 0) {
+ if (walker->name == NULL) {
fprintf (stderr, "Flag name %s not recognised\n", partstr);
exit (1);
}
fprintf (stderr, "Failed to open cursor on localid.db\n");
goto failure;
}
- bzero (&k_localid, sizeof (k_localid));
+ memset (&k_localid, 0, sizeof (k_localid));
k_localid.data = localid;
k_localid.size = strlen (localid);
nomore = crs->get (crs, &k_localid, &e_value, DB_SET);
e_p11uri = (char *) & ((uint32_t *) e_value.data) [1];
e_bindata = e_p11uri + strnlen (e_p11uri, e_value.size - 4) + 1;
e_binlen = e_value.size - 4 - strnlen (e_p11uri, e_value.size - 4) - 1;
- if (e_binlen <= 0) {
+ if (e_binlen < 0) {
fprintf (stderr, "Error retrieving binary data\n");
crs->close (crs);
goto failure;
goto failure;
}
if (txn->commit (txn, 0) != 0) {
- txn->abort (txn);
fprintf (stderr, "Failed to commit readonly transaction\n");
exit (1);
}