Make global_context a static variable and initialize it automatically
authorTheodore Tso <tytso@mit.edu>
Thu, 19 Jan 1995 03:02:48 +0000 (03:02 +0000)
committerTheodore Tso <tytso@mit.edu>
Thu, 19 Jan 1995 03:02:48 +0000 (03:02 +0000)
if necessary.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@4825 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/des425/ChangeLog
src/lib/des425/read_passwd.c

index 6f73c5aada12fb1fb519759d4edcb1a2428a1b3d..db9cd7e5f4248255ad26a259c3392fd91a256a90 100644 (file)
@@ -1,3 +1,8 @@
+Wed Jan 18 15:12:18 1995  Theodore Y. Ts'o  (tytso@dcl)
+
+       * read_passwd.c (des_read_password): Declare global_context and
+               initialize it if necessary.
+
 Fri Jan 13 15:23:47 1995  Chris Provenzano (proven@mit.edu)
 
     * Added krb5_context to all krb5_routines
index a618859e3fadbd964da2a5a224cd34043a928c80..5331650618aba75ac080abe045f8561d71d6b4e8 100644 (file)
@@ -33,6 +33,8 @@
 
 #include "des.h"
 
+static krb5_context global_context = 0;
+
 /*** Routines ****************************************************** */
 int
 des_read_password/*_v4_compat_crock*/(k,prompt,verify)
@@ -41,10 +43,17 @@ des_read_password/*_v4_compat_crock*/(k,prompt,verify)
     int        verify;
 {
     int ok;
+    krb5_error_code retval;
     char key_string[BUFSIZ];
     char prompt2[BUFSIZ];
     int string_size = sizeof(key_string);
 
+    if (!global_context) {
+           retval = krb5_init_context(&global_context);
+           if (retval)
+                   return retval;
+    }
+
     if (verify) {
        strcpy(prompt2, "Verifying, please re-enter ");
        strncat(prompt2, prompt, sizeof(prompt2)-(strlen(prompt2)+1));