From c42606a068556f2af65c0b0d8e6252d50ff1aac0 Mon Sep 17 00:00:00 2001 From: John Kohl Date: Thu, 14 Mar 1991 09:48:10 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@1888 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/des425/read_passwd.c | 52 ++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 src/lib/des425/read_passwd.c diff --git a/src/lib/des425/read_passwd.c b/src/lib/des425/read_passwd.c new file mode 100644 index 000000000..409a8ea05 --- /dev/null +++ b/src/lib/des425/read_passwd.c @@ -0,0 +1,52 @@ +/* + * $Source$ + * $Author$ + * + * Copyright 1985,1986,1987,1988,1991 by the Massachusetts Institute + * of Technology. + * All Rights Reserved. + * + * For copying and distribution information, please see the file + * . + * + * This routine prints the supplied string to standard + * output as a prompt, and reads a password string without + * echoing. + */ + +#ifndef lint +static char rcsid_read_password_c[] = +"$Id$"; +#endif /* lint */ + +#include +#include + +#include "des.h" + +/*** Routines ****************************************************** */ +int +des_read_password/*_v4_compat_crock*/(k,prompt,verify) + mit_des_cblock *k; + char *prompt; + int verify; +{ + int ok; + char key_string[BUFSIZ]; + char prompt2[BUFSIZ]; + int string_size = sizeof(key_string); + krb5_error_code retval; + + if (verify) { + strcpy(prompt2, "Verifying, please re-enter "); + strncat(prompt2, prompt, sizeof(prompt2)-(strlen(prompt2)+1)); + } + ok = krb5_read_password(prompt, verify ? prompt2 : 0, + key_string, &string_size); + + if (ok == 0) + mit_des_string_to_key(key_string, k); + + bzero(key_string, sizeof (key_string)); + return ok; +} -- 2.26.2