summaryrefslogtreecommitdiff
path: root/readpass.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2009-12-29 21:38:40 +0000
committerColin Watson <cjwatson@debian.org>2009-12-29 21:38:40 +0000
commit1b816ea846aca3ee89e7995373ace609e9518424 (patch)
treeb41cdc8495cae7fa9c2e0f98a5f2e71656b61f9a /readpass.c
parentfa585019a79ebcb4e0202b1c33f87ff1c5c9ce1c (diff)
parent086ea76990b1e6287c24b6db74adffd4605eb3b0 (diff)
import openssh-4.6p1-gsskex-20070312.patch
Diffstat (limited to 'readpass.c')
-rw-r--r--readpass.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/readpass.c b/readpass.c
index 7914799a4..bd144c2e3 100644
--- a/readpass.c
+++ b/readpass.c
@@ -1,3 +1,4 @@
1/* $OpenBSD: readpass.c,v 1.47 2006/08/03 03:34:42 deraadt Exp $ */
1/* 2/*
2 * Copyright (c) 2001 Markus Friedl. All rights reserved. 3 * Copyright (c) 2001 Markus Friedl. All rights reserved.
3 * 4 *
@@ -23,13 +24,27 @@
23 */ 24 */
24 25
25#include "includes.h" 26#include "includes.h"
26RCSID("$OpenBSD: readpass.c,v 1.33 2005/05/02 21:13:22 markus Exp $"); 27
28#include <sys/types.h>
29#include <sys/wait.h>
30
31#include <errno.h>
32#include <fcntl.h>
33#ifdef HAVE_PATHS_H
34# include <paths.h>
35#endif
36#include <stdarg.h>
37#include <stdio.h>
38#include <stdlib.h>
39#include <string.h>
40#include <unistd.h>
27 41
28#include "xmalloc.h" 42#include "xmalloc.h"
29#include "misc.h" 43#include "misc.h"
30#include "pathnames.h" 44#include "pathnames.h"
31#include "log.h" 45#include "log.h"
32#include "ssh.h" 46#include "ssh.h"
47#include "uidswap.h"
33 48
34static char * 49static char *
35ssh_askpass(char *askpass, const char *msg) 50ssh_askpass(char *askpass, const char *msg)
@@ -53,8 +68,7 @@ ssh_askpass(char *askpass, const char *msg)
53 return NULL; 68 return NULL;
54 } 69 }
55 if (pid == 0) { 70 if (pid == 0) {
56 seteuid(getuid()); 71 permanently_drop_suid(getuid());
57 setuid(getuid());
58 close(p[0]); 72 close(p[0]);
59 if (dup2(p[1], STDOUT_FILENO) < 0) 73 if (dup2(p[1], STDOUT_FILENO) < 0)
60 fatal("ssh_askpass: dup2: %s", strerror(errno)); 74 fatal("ssh_askpass: dup2: %s", strerror(errno));