From 235c3fcd80da3c48cfc0ccde2e654bcc1a7c9f1f Mon Sep 17 00:00:00 2001 From: Richard Basch Date: Tue, 24 Oct 1995 01:18:15 +0000 Subject: [PATCH] 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 --- src/admin/edit/loadv4.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) 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; } -- 2.26.2