diff --git a/kadmin/dump.c b/kadmin/dump.c index 0bcfff57c..162537f7d 100644 --- a/kadmin/dump.c +++ b/kadmin/dump.c @@ -37,12 +37,21 @@ RCSID("$Id$"); +extern int local_flag; + int dump(struct dump_options *opt, int argc, char **argv) { krb5_error_code ret; FILE *f; - HDB *db = _kadm5_s_get_db(kadm_handle); + HDB *db; + + if(!local_flag) { + krb5_warnx(context, "dump is only available in local (-l) mode"); + return 0; + } + + db = _kadm5_s_get_db(kadm_handle); if(argc == 0) f = stdout; diff --git a/kadmin/init.c b/kadmin/init.c index 5d070c3b8..5465d7363 100644 --- a/kadmin/init.c +++ b/kadmin/init.c @@ -107,6 +107,8 @@ create_random_entry(krb5_principal princ, return ret; } +extern int local_flag; + int init(struct init_options *opt, int argc, char **argv) { @@ -115,6 +117,11 @@ init(struct init_options *opt, int argc, char **argv) HDB *db; krb5_deltat max_life, max_rlife; + if(!local_flag) { + krb5_warnx(context, "init is only available in local (-l) mode"); + return 0; + } + if(argc == 0) { printf("must have atleast one realm\n"); return 0; diff --git a/kadmin/load.c b/kadmin/load.c index 1ada2edff..d67090824 100644 --- a/kadmin/load.c +++ b/kadmin/load.c @@ -484,14 +484,22 @@ doit(const char *filename, int merge) } +extern int local_flag; + static int loadit(int merge, int argc, char **argv) { + const char *myname = merge ? "merge" : "load"; + if(!local_flag) { + krb5_warnx(context, "%s is only available in local (-l) mode", myname); + return 0; + } + if(argc != 1) { - printf("%s file", merge ? "merge" : "load"); + printf("%s file", myname); return 0; } - doit(argv[optind], 0); + doit(argv[optind], merge); return 0; } diff --git a/kadmin/stash.c b/kadmin/stash.c index bbcaed6f0..fee2d3fa8 100644 --- a/kadmin/stash.c +++ b/kadmin/stash.c @@ -36,6 +36,8 @@ RCSID("$Id$"); +extern int local_flag; + int stash(struct stash_options *opt, int argc, char **argv) { @@ -44,6 +46,11 @@ stash(struct stash_options *opt, int argc, char **argv) krb5_enctype enctype; hdb_master_key mkey; + if(!local_flag) { + krb5_warnx(context, "stash is only available in local (-l) mode"); + return 0; + } + ret = krb5_string_to_enctype(context, opt->enctype_string, &enctype); if(ret) krb5_warn(context, ret, "%s", opt->enctype_string);