
We turn on a few extra warnings and fix the fallout that occurs when building with --enable-developer. Note that we get different warnings on different machines and so this will be a work in progress. So far, we have built on NetBSD/amd64 5.99.64 (which uses gcc 4.5.3) and Ubuntu 10.04.3 LTS (which uses gcc 4.4.3). Notably, we fixed 1. a lot of missing structure initialisers, 2. unchecked return values for functions that glibc marks as __attribute__((warn-unused-result)), 3. made minor modifications to slc and asn1_compile which can generate code which generates warnings, and 4. a few stragglers here and there. We turned off the extended warnings for many programs in appl/ as they are nearing the end of their useful lifetime, e.g. rsh, rcp, popper, ftp and telnet. Interestingly, glibc's strncmp() macro needed to be worked around whereas the function calls did not. We have not yet tried this on 32 bit platforms, so there will be a few more warnings when we do.
56 lines
1.1 KiB
C
56 lines
1.1 KiB
C
|
|
#include "hdb_locl.h"
|
|
#include <getarg.h>
|
|
#include <base64.h>
|
|
|
|
static char *mkey_file;
|
|
static int help_flag;
|
|
static int version_flag;
|
|
|
|
struct getargs args[] = {
|
|
{ "mkey-file", 0, arg_string, &mkey_file, NULL, NULL },
|
|
{ "help", 'h', arg_flag, &help_flag, NULL, NULL },
|
|
{ "version", 0, arg_flag, &version_flag, NULL, NULL }
|
|
};
|
|
|
|
static int num_args = sizeof(args) / sizeof(args[0]);
|
|
|
|
int
|
|
main(int argc, char **argv)
|
|
{
|
|
krb5_context context;
|
|
int ret, o = 0;
|
|
|
|
setprogname(argv[0]);
|
|
|
|
if(getarg(args, num_args, argc, argv, &o))
|
|
krb5_std_usage(1, args, num_args);
|
|
|
|
if(help_flag)
|
|
krb5_std_usage(0, args, num_args);
|
|
|
|
if(version_flag){
|
|
print_version(NULL);
|
|
exit(0);
|
|
}
|
|
|
|
ret = krb5_init_context(&context);
|
|
if (ret)
|
|
errx(1, "krb5_init_context failed: %d", ret);
|
|
|
|
if (mkey_file) {
|
|
hdb_master_key mkey;
|
|
|
|
ret = hdb_read_master_key(context, mkey_file, &mkey);
|
|
if (ret)
|
|
krb5_err(context, 1, ret, "failed to read master key %s", mkey_file);
|
|
|
|
hdb_free_master_key(context, mkey);
|
|
} else
|
|
krb5_errx(context, 1, "no command option given");
|
|
|
|
krb5_free_context(context);
|
|
|
|
return 0;
|
|
}
|