summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2012-11-23 14:58:38 +0100
committerAndreas Schneider <asn@samba.org>2012-12-03 14:35:10 +0100
commit532350877322cd3446cfa65459e82a45d5cef76c (patch)
tree4f76603c816a1940868023443ebf3247d4830b1e
parentce29ecfd44613e4f3bae98418add1cc4d0ed59ab (diff)
downloadsamba-532350877322cd3446cfa65459e82a45d5cef76c.tar.gz
samba-532350877322cd3446cfa65459e82a45d5cef76c.tar.bz2
samba-532350877322cd3446cfa65459e82a45d5cef76c.zip
replace: Remove deprecated getpass() support.
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
-rw-r--r--lib/replace/README1
-rw-r--r--lib/replace/getpass.c218
-rw-r--r--lib/replace/getpass.m424
-rw-r--r--lib/replace/libreplace.m41
-rw-r--r--lib/replace/replace.h11
-rw-r--r--lib/replace/system/passwd.h11
-rw-r--r--lib/replace/test/testsuite.c7
-rw-r--r--lib/replace/wscript12
8 files changed, 0 insertions, 285 deletions
diff --git a/lib/replace/README b/lib/replace/README
index e960dc877e..9dd4f7305f 100644
--- a/lib/replace/README
+++ b/lib/replace/README
@@ -49,7 +49,6 @@ pread
pwrite
chown
lchown
-getpass
readline (the library)
inet_ntoa
inet_ntop
diff --git a/lib/replace/getpass.c b/lib/replace/getpass.c
deleted file mode 100644
index f95109f2b4..0000000000
--- a/lib/replace/getpass.c
+++ /dev/null
@@ -1,218 +0,0 @@
-/* Copyright (C) 1992-1998 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public License as
-published by the Free Software Foundation; either version 3 of the
-License, or (at your option) any later version.
-
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with the GNU C Library; see the file COPYING.LIB. If
-not, see <http://www.gnu.org/licenses/>. */
-
-/* Modified to use with samba by Jeremy Allison, 8th July 1995. */
-
-#include "replace.h"
-#include "system/filesys.h"
-#include "system/wait.h"
-#include "system/terminal.h"
-#include "system/passwd.h"
-
-/*
- * Define additional missing types
- */
-#ifndef HAVE_SIG_ATOMIC_T_TYPE
-typedef int sig_atomic_t;
-#endif
-
-#ifndef SIGCLD
-#define SIGCLD SIGCHLD
-#endif
-
-#ifdef SYSV_TERMIO
-
-/* SYSTEM V TERMIO HANDLING */
-
-static struct termio t;
-
-#define ECHO_IS_ON(t) ((t).c_lflag & ECHO)
-#define TURN_ECHO_OFF(t) ((t).c_lflag &= ~ECHO)
-#define TURN_ECHO_ON(t) ((t).c_lflag |= ECHO)
-
-#ifndef TCSAFLUSH
-#define TCSAFLUSH 1
-#endif
-
-#ifndef TCSANOW
-#define TCSANOW 0
-#endif
-
-static int tcgetattr(int fd, struct termio *_t)
-{
- return ioctl(fd, TCGETA, _t);
-}
-
-static int tcsetattr(int fd, int flags, struct termio *_t)
-{
- if(flags & TCSAFLUSH)
- ioctl(fd, TCFLSH, TCIOFLUSH);
- return ioctl(fd, TCSETS, _t);
-}
-
-#elif !defined(TCSAFLUSH)
-
-/* BSD TERMIO HANDLING */
-
-static struct sgttyb t;
-
-#define ECHO_IS_ON(t) ((t).sg_flags & ECHO)
-#define TURN_ECHO_OFF(t) ((t).sg_flags &= ~ECHO)
-#define TURN_ECHO_ON(t) ((t).sg_flags |= ECHO)
-
-#define TCSAFLUSH 1
-#define TCSANOW 0
-
-static int tcgetattr(int fd, struct sgttyb *_t)
-{
- return ioctl(fd, TIOCGETP, (char *)_t);
-}
-
-static int tcsetattr(int fd, int flags, struct sgttyb *_t)
-{
- return ioctl(fd, TIOCSETP, (char *)_t);
-}
-
-#else /* POSIX TERMIO HANDLING */
-#define ECHO_IS_ON(t) ((t).c_lflag & ECHO)
-#define TURN_ECHO_OFF(t) ((t).c_lflag &= ~ECHO)
-#define TURN_ECHO_ON(t) ((t).c_lflag |= ECHO)
-
-static struct termios t;
-#endif /* SYSV_TERMIO */
-
-static void catch_signal(int signum, void (*handler)(int ))
-{
-#ifdef HAVE_SIGACTION
- struct sigaction act;
- struct sigaction oldact;
-
- memset(&act, 0, sizeof(act));
-
- act.sa_handler = handler;
-#ifdef SA_RESTART
- /*
- * We *want* SIGALRM to interrupt a system call.
- */
- if(signum != SIGALRM)
- act.sa_flags = SA_RESTART;
-#endif
- sigemptyset(&act.sa_mask);
- sigaddset(&act.sa_mask,signum);
- sigaction(signum,&act,&oldact);
-#else /* !HAVE_SIGACTION */
- /* FIXME: need to handle sigvec and systems with broken signal() */
- signal(signum, handler);
-#endif
-}
-
-static sig_atomic_t gotintr;
-static int in_fd = -1;
-
-/***************************************************************
- Signal function to tell us were ^C'ed.
-****************************************************************/
-
-static void gotintr_sig(int signum)
-{
- gotintr = 1;
- if (in_fd != -1)
- close(in_fd); /* Safe way to force a return. */
- in_fd = -1;
-}
-
-char *rep_getpass(const char *prompt)
-{
- FILE *in, *out;
- int echo_off;
- static char buf[256];
- static size_t bufsize = sizeof(buf);
- size_t nread;
-
- /* Catch problematic signals */
- catch_signal(SIGINT, gotintr_sig);
-
- /* Try to write to and read from the terminal if we can.
- If we can't open the terminal, use stderr and stdin. */
-
- in = fopen ("/dev/tty", "w+");
- if (in == NULL) {
- in = stdin;
- out = stderr;
- } else {
- out = in;
- }
-
- setvbuf(in, NULL, _IONBF, 0);
-
- /* Turn echoing off if it is on now. */
-
- if (tcgetattr (fileno (in), &t) == 0) {
- if (ECHO_IS_ON(t)) {
- TURN_ECHO_OFF(t);
- echo_off = tcsetattr (fileno (in), TCSAFLUSH, &t) == 0;
- TURN_ECHO_ON(t);
- } else {
- echo_off = 0;
- }
- } else {
- echo_off = 0;
- }
-
- /* Write the prompt. */
- fputs(prompt, out);
- fflush(out);
-
- /* Read the password. */
- buf[0] = 0;
- if (!gotintr) {
- in_fd = fileno(in);
- if (fgets(buf, bufsize, in) == NULL) {
- buf[0] = 0;
- }
- }
- nread = strlen(buf);
- if (nread) {
- if (buf[nread - 1] == '\n')
- buf[nread - 1] = '\0';
- }
-
- /* Restore echoing. */
- if (echo_off) {
- if (gotintr && in_fd == -1) {
- in = fopen ("/dev/tty", "w+");
- }
- if (in != NULL)
- tcsetattr (fileno (in), TCSANOW, &t);
- }
-
- fprintf(out, "\n");
- fflush(out);
-
- if (in && in != stdin) /* We opened the terminal; now close it. */
- fclose(in);
-
- /* Catch problematic signals */
- catch_signal(SIGINT, SIG_DFL);
-
- if (gotintr) {
- printf("Interrupted by signal.\n");
- fflush(stdout);
- exit(1);
- }
- return buf;
-}
diff --git a/lib/replace/getpass.m4 b/lib/replace/getpass.m4
deleted file mode 100644
index 78a0afe453..0000000000
--- a/lib/replace/getpass.m4
+++ /dev/null
@@ -1,24 +0,0 @@
-AC_CHECK_FUNC(getpass, libreplace_cv_HAVE_GETPASS=yes)
-AC_CHECK_FUNC(getpassphrase, libreplace_cv_HAVE_GETPASSPHRASE=yes)
-if test x"$libreplace_cv_HAVE_GETPASS" = x"yes" -a x"$libreplace_cv_HAVE_GETPASSPHRASE" = x"yes"; then
- AC_DEFINE(REPLACE_GETPASS_BY_GETPASSPHRASE, 1, [getpass returns <9 chars where getpassphrase returns <265 chars])
- AC_DEFINE(REPLACE_GETPASS,1,[Whether getpass should be replaced])
- LIBREPLACEOBJ="${LIBREPLACEOBJ} $libreplacedir/getpass.o"
-else
-
-AC_CACHE_CHECK([whether getpass should be replaced],libreplace_cv_REPLACE_GETPASS,[
-SAVE_CPPFLAGS="$CPPFLAGS"
-CPPFLAGS="$CPPFLAGS -I$libreplacedir/"
-AC_TRY_COMPILE([
-#include "confdefs.h"
-#define NO_CONFIG_H
-#include "$libreplacedir/getpass.c"
-],[],libreplace_cv_REPLACE_GETPASS=yes,libreplace_cv_REPLACE_GETPASS=no)
-CPPFLAGS="$SAVE_CPPFLAGS"
-])
-if test x"$libreplace_cv_REPLACE_GETPASS" = x"yes"; then
- AC_DEFINE(REPLACE_GETPASS,1,[Whether getpass should be replaced])
- LIBREPLACEOBJ="${LIBREPLACEOBJ} $libreplacedir/getpass.o"
-fi
-
-fi
diff --git a/lib/replace/libreplace.m4 b/lib/replace/libreplace.m4
index 796069c8ca..ac2af27f31 100644
--- a/lib/replace/libreplace.m4
+++ b/lib/replace/libreplace.m4
@@ -381,7 +381,6 @@ fi
m4_include(system/config.m4)
m4_include(dlfcn.m4)
-m4_include(getpass.m4)
m4_include(strptime.m4)
m4_include(win32.m4)
m4_include(timegm.m4)
diff --git a/lib/replace/replace.h b/lib/replace/replace.h
index 4cdc362b6a..62172a9a12 100644
--- a/lib/replace/replace.h
+++ b/lib/replace/replace.h
@@ -843,17 +843,6 @@ int fdatasync(int );
/* prototype is in "system/network.h" */
#endif
-#if !defined(getpass)
-#ifdef REPLACE_GETPASS
-#if defined(REPLACE_GETPASS_BY_GETPASSPHRASE)
-#define getpass(prompt) getpassphrase(prompt)
-#else
-#define getpass(prompt) rep_getpass(prompt)
-char *rep_getpass(const char *prompt);
-#endif
-#endif
-#endif
-
#ifndef HAVE_GETPEEREID
#define getpeereid rep_getpeereid
int rep_getpeereid(int s, uid_t *uid, gid_t *gid);
diff --git a/lib/replace/system/passwd.h b/lib/replace/system/passwd.h
index 223324c4b4..8257e066ac 100644
--- a/lib/replace/system/passwd.h
+++ b/lib/replace/system/passwd.h
@@ -67,17 +67,6 @@
#include <compat.h>
#endif
-#if !defined(getpass)
-#ifdef REPLACE_GETPASS
-#if defined(REPLACE_GETPASS_BY_GETPASSPHRASE)
-#define getpass(prompt) getpassphrase(prompt)
-#else
-#define getpass(prompt) rep_getpass(prompt)
-char *rep_getpass(const char *prompt);
-#endif
-#endif
-#endif
-
#ifndef NGROUPS_MAX
#define NGROUPS_MAX 32 /* Guess... */
#endif
diff --git a/lib/replace/test/testsuite.c b/lib/replace/test/testsuite.c
index 04658bea05..52629ec82e 100644
--- a/lib/replace/test/testsuite.c
+++ b/lib/replace/test/testsuite.c
@@ -463,12 +463,6 @@ static int test_pwrite(void)
return true;
}
-static int test_getpass(void)
-{
- /* FIXME */
- return true;
-}
-
static int test_inet_ntoa(void)
{
/* FIXME */
@@ -1089,7 +1083,6 @@ bool torture_local_replace(struct torture_context *ctx)
ret &= test_mkstemp();
ret &= test_pread();
ret &= test_pwrite();
- ret &= test_getpass();
ret &= test_inet_ntoa();
ret &= test_strtoll();
ret &= test_strtoull();
diff --git a/lib/replace/wscript b/lib/replace/wscript
index 9dfa985aec..296dae907f 100644
--- a/lib/replace/wscript
+++ b/lib/replace/wscript
@@ -482,17 +482,6 @@ removeea setea
execute=True):
break
- if conf.CHECK_FUNCS('getpass getpassphrase'):
- # if we have both, then we prefer getpassphrase
- conf.DEFINE('REPLACE_GETPASS_BY_GETPASSPHRASE', 1)
- conf.DEFINE('REPLACE_GETPASS', 1)
- else:
- conf.CHECK_CODE('''#include "getpass.c"
- int main(void) { return 0; }''',
- addmain=False,
- define='REPLACE_GETPASS',
- cflags='-DNO_CONFIG_H')
-
conf.RECURSE('system')
conf.SAMBA_CONFIG_H()
@@ -542,7 +531,6 @@ def build(bld):
REPLACE_SOURCE = REPLACE_HOSTCC_SOURCE
- if bld.CONFIG_SET('REPLACE_GETPASS'): REPLACE_SOURCE += ' getpass.c'
if not bld.CONFIG_SET('HAVE_CRYPT'): REPLACE_SOURCE += ' crypt.c'
if not bld.CONFIG_SET('HAVE_DLOPEN'): REPLACE_SOURCE += ' dlfcn.c'
if not bld.CONFIG_SET('HAVE_POLL'): REPLACE_SOURCE += ' poll.c'