add password/bare options
This commit is contained in:
@@ -3,6 +3,8 @@
|
|||||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
|
* Portions Copyright (c) 2009 Apple Inc. All rights reserved.
|
||||||
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
* are met:
|
* are met:
|
||||||
@@ -157,15 +159,9 @@ init(struct init_options *opt, int argc, char **argv)
|
|||||||
krb5_principal princ;
|
krb5_principal princ;
|
||||||
const char *realm = argv[i];
|
const char *realm = argv[i];
|
||||||
|
|
||||||
/* Create `krbtgt/REALM' */
|
|
||||||
ret = krb5_make_principal(context, &princ, realm,
|
|
||||||
KRB5_TGS_NAME, realm, NULL);
|
|
||||||
if(ret)
|
|
||||||
return 0;
|
|
||||||
if (opt->realm_max_ticket_life_string == NULL) {
|
if (opt->realm_max_ticket_life_string == NULL) {
|
||||||
max_life = 0;
|
max_life = 0;
|
||||||
if(edit_deltat ("Realm max ticket life", &max_life, NULL, 0)) {
|
if(edit_deltat ("Realm max ticket life", &max_life, NULL, 0)) {
|
||||||
krb5_free_principal(context, princ);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -173,13 +169,22 @@ init(struct init_options *opt, int argc, char **argv)
|
|||||||
max_rlife = 0;
|
max_rlife = 0;
|
||||||
if(edit_deltat("Realm max renewable ticket life", &max_rlife,
|
if(edit_deltat("Realm max renewable ticket life", &max_rlife,
|
||||||
NULL, 0)) {
|
NULL, 0)) {
|
||||||
krb5_free_principal(context, princ);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Create `krbtgt/REALM' */
|
||||||
|
ret = krb5_make_principal(context, &princ, realm,
|
||||||
|
KRB5_TGS_NAME, realm, NULL);
|
||||||
|
if(ret)
|
||||||
|
return 0;
|
||||||
|
|
||||||
create_random_entry(princ, max_life, max_rlife, 0);
|
create_random_entry(princ, max_life, max_rlife, 0);
|
||||||
krb5_free_principal(context, princ);
|
krb5_free_principal(context, princ);
|
||||||
|
|
||||||
|
if (opt->bare_flag)
|
||||||
|
continue;
|
||||||
|
|
||||||
/* Create `kadmin/changepw' */
|
/* Create `kadmin/changepw' */
|
||||||
krb5_make_principal(context, &princ, realm,
|
krb5_make_principal(context, &princ, realm,
|
||||||
"kadmin", "changepw", NULL);
|
"kadmin", "changepw", NULL);
|
||||||
|
@@ -54,6 +54,11 @@ command = {
|
|||||||
type = "flag"
|
type = "flag"
|
||||||
help = "just convert keyfile to new format"
|
help = "just convert keyfile to new format"
|
||||||
}
|
}
|
||||||
|
option = {
|
||||||
|
long = "random-password"
|
||||||
|
type = "flag"
|
||||||
|
help = "use a random password (and print the password to stdout)"
|
||||||
|
}
|
||||||
option = {
|
option = {
|
||||||
long = "master-key-fd"
|
long = "master-key-fd"
|
||||||
type = "integer"
|
type = "integer"
|
||||||
@@ -89,6 +94,11 @@ command = {
|
|||||||
type = "string"
|
type = "string"
|
||||||
help = "realm max renewable lifetime"
|
help = "realm max renewable lifetime"
|
||||||
}
|
}
|
||||||
|
option = {
|
||||||
|
long = "bare"
|
||||||
|
type = "flag"
|
||||||
|
help = "only create krbtgt for realm"
|
||||||
|
}
|
||||||
argument = "realm..."
|
argument = "realm..."
|
||||||
min_args = "1"
|
min_args = "1"
|
||||||
help = "Initializes the default principals for a realm. Creates the database\nif necessary. Local (-l) mode only."
|
help = "Initializes the default principals for a realm. Creates the database\nif necessary. Local (-l) mode only."
|
||||||
|
@@ -3,6 +3,8 @@
|
|||||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
|
* Portions Copyright (c) 2009 Apple Inc. All rights reserved.
|
||||||
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
* are met:
|
* are met:
|
||||||
@@ -93,6 +95,9 @@ stash(struct stash_options *opt, int argc, char **argv)
|
|||||||
}
|
}
|
||||||
buf[n] = '\0';
|
buf[n] = '\0';
|
||||||
buf[strcspn(buf, "\r\n")] = '\0';
|
buf[strcspn(buf, "\r\n")] = '\0';
|
||||||
|
} else if (opt->random_password_flag) {
|
||||||
|
random_password (buf, sizeof(buf));
|
||||||
|
printf("Using random master stash password: %s\n", buf);
|
||||||
} else {
|
} else {
|
||||||
if(UI_UTIL_read_pw_string(buf, sizeof(buf), "Master key: ", 1)) {
|
if(UI_UTIL_read_pw_string(buf, sizeof(buf), "Master key: ", 1)) {
|
||||||
hdb_free_master_key(context, mkey);
|
hdb_free_master_key(context, mkey);
|
||||||
|
Reference in New Issue
Block a user