projects
/
debian
/
sudo
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Imported Upstream version 1.8.7
[debian/sudo]
/
src
/
tgetpass.c
diff --git
a/src/tgetpass.c
b/src/tgetpass.c
index b23db4cc5fe87c9b3b9a1e684e9cb1fb47c668f4..31194b96317fcbaa1e6c123221649eca0ea958f0 100644
(file)
--- a/
src/tgetpass.c
+++ b/
src/tgetpass.c
@@
-1,5
+1,5
@@
/*
/*
- * Copyright (c) 1996, 1998-2005, 2007-201
1
+ * Copyright (c) 1996, 1998-2005, 2007-201
3
* Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
* Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
@@
-26,7
+26,6
@@
#include <config.h>
#include <sys/types.h>
#include <config.h>
#include <sys/types.h>
-#include <sys/param.h>
#include <stdio.h>
#ifdef STDC_HEADERS
# include <stdlib.h>
#include <stdio.h>
#ifdef STDC_HEADERS
# include <stdlib.h>
@@
-57,7
+56,7
@@
static volatile sig_atomic_t signo[NSIG];
static volatile sig_atomic_t signo[NSIG];
-static void handler(int);
+static void
tgetpass_
handler(int);
static char *getln(int, char *, size_t, int);
static char *sudo_askpass(const char *, const char *);
static char *getln(int, char *, size_t, int);
static char *sudo_askpass(const char *, const char *);
@@
-96,7
+95,7
@@
tgetpass(const char *prompt, int timeout, int flags)
/* If using a helper program to get the password, run it instead. */
if (ISSET(flags, TGP_ASKPASS)) {
if (askpass == NULL || *askpass == '\0')
/* If using a helper program to get the password, run it instead. */
if (ISSET(flags, TGP_ASKPASS)) {
if (askpass == NULL || *askpass == '\0')
-
errorx(1,
_("no askpass program specified, try setting SUDO_ASKPASS"));
+
fatalx(
_("no askpass program specified, try setting SUDO_ASKPASS"));
debug_return_str_masked(sudo_askpass(askpass, prompt));
}
debug_return_str_masked(sudo_askpass(askpass, prompt));
}
@@
-131,7
+130,7
@@
restart:
zero_bytes(&sa, sizeof(sa));
sigemptyset(&sa.sa_mask);
sa.sa_flags = SA_INTERRUPT; /* don't restart system calls */
zero_bytes(&sa, sizeof(sa));
sigemptyset(&sa.sa_mask);
sa.sa_flags = SA_INTERRUPT; /* don't restart system calls */
- sa.sa_handler = handler;
+ sa.sa_handler =
tgetpass_
handler;
(void) sigaction(SIGALRM, &sa, &savealrm);
(void) sigaction(SIGINT, &sa, &saveint);
(void) sigaction(SIGHUP, &sa, &savehup);
(void) sigaction(SIGALRM, &sa, &savealrm);
(void) sigaction(SIGINT, &sa, &saveint);
(void) sigaction(SIGHUP, &sa, &savehup);
@@
-215,10
+214,10
@@
sudo_askpass(const char *askpass, const char *prompt)
debug_decl(sudo_askpass, SUDO_DEBUG_CONV)
if (pipe(pfd) == -1)
debug_decl(sudo_askpass, SUDO_DEBUG_CONV)
if (pipe(pfd) == -1)
-
error(1,
_("unable to create pipe"));
+
fatal(
_("unable to create pipe"));
if ((pid = fork()) == -1)
if ((pid = fork()) == -1)
-
error(1,
_("unable to fork"));
+
fatal(
_("unable to fork"));
if (pid == 0) {
/* child, point stdout to output side of the pipe and exec askpass */
if (pid == 0) {
/* child, point stdout to output side of the pipe and exec askpass */
@@
-226,7
+225,8
@@
sudo_askpass(const char *askpass, const char *prompt)
warning("dup2");
_exit(255);
}
warning("dup2");
_exit(255);
}
- (void) setuid(ROOT_UID);
+ if (setuid(ROOT_UID) == -1)
+ warning("setuid(%d)", ROOT_UID);
if (setgid(user_details.gid)) {
warning(_("unable to set gid to %u"), (unsigned int)user_details.gid);
_exit(255);
if (setgid(user_details.gid)) {
warning(_("unable to set gid to %u"), (unsigned int)user_details.gid);
_exit(255);
@@
-316,7
+316,7
@@
getln(int fd, char *buf, size_t bufsiz, int feedback)
}
static void
}
static void
-handler(int s)
+
tgetpass_
handler(int s)
{
if (s != SIGALRM)
signo[s] = 1;
{
if (s != SIGALRM)
signo[s] = 1;