Moved krb5_read_password back into the library (Win32)
authorRichard Basch <probe@mit.edu>
Tue, 25 Feb 1997 06:11:51 +0000 (06:11 +0000)
committerRichard Basch <probe@mit.edu>
Tue, 25 Feb 1997 06:11:51 +0000 (06:11 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@9968 dc483132-0cff-0310-8789-dd5450dbe970

src/clients/kinit/ChangeLog
src/clients/kinit/kinit.c

index cf3e5d924ff7e3a24122f5b939a9b47039b82c65..3aa66c281f6e1847e443708fefae659bdfee51b9 100644 (file)
@@ -1,3 +1,7 @@
+Tue Feb 25 00:29:46 1997  Richard Basch  <basch@lehman.com>
+
+       * kinit.c: Moved krb5_read_password back into the library (win32)
+
 Sat Feb 15 12:24:32 1997  Richard Basch  <basch@lehman.com>
 
        * Makefile.in: Link in ComErr library $(CLIB)
index f5ca4268314e1d619e1042a433018fd577bd45e4..bae27955d5d095ec00d9be3ea7568ac8de9568fd 100644 (file)
@@ -446,91 +446,3 @@ cleanup:
 
     return retval;
 }
-
-#ifdef _WIN32
-krb5_error_code
-krb5_read_password(
-    krb5_context       context,
-    const char         * prompt,
-    const char         * prompt2,
-    char               * password,
-    int                        * pwsize)
-{
-    HANDLE             handle;
-    DWORD              old_mode, new_mode;
-    char               *tmpstr = 0;
-    char               *ptr;
-    int                        scratchchar;
-    krb5_error_code    errcode = 0;
-
-    handle = GetStdHandle(STD_INPUT_HANDLE);
-    if (handle == INVALID_HANDLE_VALUE)
-       return ENOTTY;
-    if (!GetConsoleMode(handle, &old_mode))
-       return ENOTTY;
-
-    new_mode = old_mode;
-    new_mode |=  ( ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT );
-    new_mode &= ~( ENABLE_ECHO_INPUT );
-
-    if (!SetConsoleMode(handle, new_mode))
-       return ENOTTY;
-
-    (void) fputs(prompt, stdout);
-    (void) fflush(stdout);
-    (void) memset(password, 0, *pwsize);
-
-    if (fgets(password, *pwsize, stdin) == NULL) {
-       (void) putchar('\n');
-       errcode = KRB5_LIBOS_CANTREADPWD;
-       goto cleanup;
-    }
-    (void) putchar('\n');
-
-    if ((ptr = strchr(password, '\n')))
-       *ptr = '\0';
-    else /* need to flush */
-       do {
-           scratchchar = getchar();
-       } while (scratchchar != EOF && scratchchar != '\n');
-
-    if (prompt2) {
-       if (! (tmpstr = (char *)malloc(*pwsize))) {
-           errcode = ENOMEM;
-           goto cleanup;
-       }
-       (void) fputs(prompt2, stdout);
-       (void) fflush(stdout);
-       if (fgets(tmpstr, *pwsize, stdin) == NULL) {
-           (void) putchar('\n');
-           errcode = KRB5_LIBOS_CANTREADPWD;
-           goto cleanup;
-       }
-       (void) putchar('\n');
-
-       if ((ptr = strchr(tmpstr, '\n')))
-           *ptr = '\0';
-       else /* need to flush */
-           do {
-               scratchchar = getchar();
-           } while (scratchchar != EOF && scratchchar != '\n');
-
-       if (strncmp(password, tmpstr, *pwsize)) {
-           errcode = KRB5_LIBOS_BADPWDMATCH;
-           goto cleanup;
-       }
-    }
-
-cleanup:
-    (void) SetConsoleMode(handle, old_mode);
-    if (tmpstr) {
-       (void) memset(tmpstr, 0, *pwsize);
-       (void) free(tmpstr);
-    }
-    if (errcode)
-       (void) memset(password, 0, *pwsize);
-    else
-       *pwsize = strlen(password);
-    return errcode;
-}
-#endif