From: Richard Basch Date: Tue, 24 Oct 1995 01:18:15 +0000 (+0000) Subject: Read the V4 Kerberos master key from /.k. Only prompt the user for the X-Git-Tag: krb5-1.0-beta6~880 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=235c3fcd80da3c48cfc0ccde2e654bcc1a7c9f1f;p=krb5.git Read the V4 Kerberos master key from /.k. Only prompt the user for the V4 master key if the command-line option so indicates, or the key cannot be read from /.k. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@6989 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/admin/edit/loadv4.c b/src/admin/edit/loadv4.c index d2d063a1d..1d9def177 100644 --- a/src/admin/edit/loadv4.c +++ b/src/admin/edit/loadv4.c @@ -37,6 +37,8 @@ static C_Block master_key; static Key_schedule master_key_schedule; static long master_key_version; +static char *v4_mkeyfile = "/.k"; + #include "k5-int.h" #include "com_err.h" #include "adm.h" @@ -434,8 +436,21 @@ char *pname, *name; int manual; char *dumpfile; { - des_read_password(master_key, "Kerberos master key: ", 1); - printf("\n"); + int fd; + int ok = 0; + + if (!manual) { + fd = open(v4_mkeyfile, O_RDONLY, 0600); + if (fd >= 0) { + if (read(fd, master_key, sizeof(master_key)) == sizeof(master_key)) + ok = 1; + close(fd); + } + } + if (!ok) { + des_read_password(master_key, "V4 Kerberos master key: ", 0); + printf("\n"); + } key_sched(master_key, master_key_schedule); return 0; }