Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/crypto/external/bsd/openssh/dist Minimize diffs.



details:   https://anonhg.NetBSD.org/src/rev/1c0b3b4e502f
branches:  trunk
changeset: 778805:1c0b3b4e502f
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Apr 14 01:34:37 2012 +0000

description:
Minimize diffs.

diffstat:

 crypto/external/bsd/openssh/dist/readpassphrase.c |  64 +++++++++-------------
 1 files changed, 27 insertions(+), 37 deletions(-)

diffs (96 lines):

diff -r 8a9e78d70466 -r 1c0b3b4e502f crypto/external/bsd/openssh/dist/readpassphrase.c
--- a/crypto/external/bsd/openssh/dist/readpassphrase.c Sat Apr 14 01:34:08 2012 +0000
+++ b/crypto/external/bsd/openssh/dist/readpassphrase.c Sat Apr 14 01:34:37 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: readpassphrase.c,v 1.2 2012/04/13 23:57:08 christos Exp $      */
+/*     $NetBSD: readpassphrase.c,v 1.3 2012/04/14 01:34:37 christos Exp $      */
 /*
  * Copyright (c) 2000 Todd C. Miller <Todd.Miller%courtesan.com@localhost>
  * All rights reserved.
@@ -43,14 +43,32 @@
 #include <readpassphrase.h>
 
 char *
-readpassphrase(
-       const char *prompt,
-       char *buf,
-       size_t bufsiz,
-       int flags)
+readpassphrase(prompt, buf, bufsiz, flags)
+       const char *prompt;
+       char *buf;
+       size_t bufsiz;
+       int flags;
 {
+#ifdef GETPASS_ECHO
+       int gflags = GETPASS_ECHO_NL;
+
+       if (flags & RPP_ECHO_ON)
+               gflags |= GETPASS_ECHO;
+       if (flags & RPP_REQUIRE_TTY)
+               gflags |= GETPASS_NEED_TTY;
+       if (flags & RPP_FORCELOWER)
+               gflags |= GETPASS_FORCE_LOWER;
+       if (flags & RPP_FORCEUPPER)
+               gflags |= GETPASS_FORCE_UPPER;
+       if (flags & RPP_SEVENBIT)
+               gflags |= GETPASS_7BIT;
+
+       return getpassfd(prompt, buf, bufsiz, NULL, gflags, 0);
+#else
+       struct termios term, oterm;
+       char ch, *p, *end;
        int input, output;
-       char *ret;
+       sigset_t oset, nset;
 
        /* I suppose we could alloc on demand in this case (XXX). */
        if (bufsiz == 0) {
@@ -71,11 +89,6 @@
                output = STDERR_FILENO;
        }
 
-#ifndef GETPASS_ECHO
-       struct termios term, oterm;
-       char ch, *p, *end;
-       sigset_t oset, nset;
-
        /*
         * We block SIGINT and SIGTSTP so the terminal is not left
         * in an inconsistent state (ie: no echo).  It would probably
@@ -122,33 +135,10 @@
        if (memcmp(&term, &oterm, sizeof(term)) != 0)
                (void)tcsetattr(input, TCSAFLUSH|TCSASOFT, &oterm);
        (void)sigprocmask(SIG_SETMASK, &oset, NULL);
-       ret = buf;
-#else
-       int gflags = 0;
-       int fd[3];
-
-       if (flags & RPP_ECHO_ON)
-               gflags |= GETPASS_ECHO;
-       if (flags & RPP_REQUIRE_TTY)
-               gflags |= GETPASS_NEED_TTY;
-       if (flags & RPP_FORCELOWER)
-               gflags |= GETPASS_FORCE_LOWER;
-       if (flags & RPP_FORCEUPPER)
-               gflags |= GETPASS_FORCE_UPPER;
-       if (flags & RPP_SEVENBIT)
-               gflags |= GETPASS_7BIT;
-
-       fd[0] = input;
-       fd[1] = fd[2] = output;
-       ret = getpassfd(prompt, buf, bufsiz, fd, gflags, 0);
-       if ((gflags & GETPASS_ECHO) == 0)
-               (void)write(output, "\n", 1);
-
-#endif
        if (input != STDIN_FILENO)
                (void)close(input);
-       
-       return ret;
+       return(buf);
+#endif
 }
 
 char *



Home | Main Index | Thread Index | Old Index