check for local mode

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14008 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Johan Danielsson
2004-06-27 17:33:33 +00:00
parent 138873b8b9
commit cf22688e0c
4 changed files with 34 additions and 3 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -484,14 +484,22 @@ doit(const char *filename, int merge)
}
extern int local_flag;
static int
loadit(int merge, int argc, char **argv)
{
if(argc != 1) {
printf("%s file", merge ? "merge" : "load");
const char *myname = merge ? "merge" : "load";
if(!local_flag) {
krb5_warnx(context, "%s is only available in local (-l) mode", myname);
return 0;
}
doit(argv[optind], 0);
if(argc != 1) {
printf("%s file", myname);
return 0;
}
doit(argv[optind], merge);
return 0;
}

View File

@@ -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);