2 * lib/des425/read_passwd.c
4 * Copyright 1985,1986,1987,1988,1991 by the Massachusetts Institute
8 * Export of this software from the United States of America may
9 * require a specific license from the United States Government.
10 * It is the responsibility of any person or organization contemplating
11 * export to obtain such a license before exporting.
13 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
14 * distribute this software and its documentation for any purpose and
15 * without fee is hereby granted, provided that the above copyright
16 * notice appear in all copies and that both that copyright notice and
17 * this permission notice appear in supporting documentation, and that
18 * the name of M.I.T. not be used in advertising or publicity pertaining
19 * to distribution of the software without specific, written prior
20 * permission. M.I.T. makes no representations about the suitability of
21 * this software for any purpose. It is provided "as is" without express
22 * or implied warranty.
25 * This routine prints the supplied string to standard
26 * output as a prompt, and reads a password string without
32 static krb5_context krb4_global_context = 0;
34 /*** Routines ****************************************************** */
36 des_read_password/*_v4_compat_crock*/(k,prompt,verify)
42 krb5_error_code retval;
43 char key_string[BUFSIZ];
45 int string_size = sizeof(key_string);
47 if (!krb4_global_context) {
48 retval = krb5_init_context(&krb4_global_context);
54 strcpy(prompt2, "Verifying, please re-enter ");
55 strncat(prompt2, prompt, sizeof(prompt2)-(strlen(prompt2)+1));
57 ok = krb5_read_password(krb4_global_context, prompt, verify ? prompt2 : 0,
58 key_string, &string_size);
61 des_string_to_key(key_string, k);
63 memset(key_string, 0, sizeof (key_string));