/* include/portable.h.nt -- manually updated of MS NT (MS VC5) */
/* synced with portable.h.in 1.24 */
/*
-Copyright 1998 The OpenLDAP Foundation, Redwood City, California, USA
-All rights reserved.
-
-Redistribution and use in source and binary forms are permitted only
-as authorized by the OpenLDAP Public License. A copy of this
-license is available at http://www.OpenLDAP.org/license.html or
-in file LICENSE in the top-level directory of the distribution.
-
-This work is derived from the University of Michigan LDAP v3.3
-distribution. Information concerning is available at
- http://www.umich.edu/~dirsvcs/ldap/ldap.html.
-
-This work also contains materials derived from public sources.
-
----
-
-Portions Copyright (c) 1992-1996 Regents of the University of Michigan.
-All rights reserved.
-
-Redistribution and use in source and binary forms are permitted
-provided that this notice is preserved and that due credit is given
-to the University of Michigan at Ann Arbor. The name of the University
-may not be used to endorse or promote products derived from this
-software without specific prior written permission. This software
-is provided ``as is'' without express or implied warranty.
-
-*/
+ * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted only
+ * as authorized by the OpenLDAP Public License. A copy of this
+ * license is available at http://www.OpenLDAP.org/license.html or
+ * in file LICENSE in the top-level directory of the distribution.
+ */
#ifndef _LDAP_PORTABLE_H
#define _LDAP_PORTABLE_H
+/* end of preamble */
+
+/* --------------------------------------------------- */
+/* begin of MSVC5 specific entries */
+
/* MSVC5 doesn't define _STDC_ but supports _STDC_ features */
#define __NEED_PROTOTYPES 1
#define HAVE_STDARG 1
/* we have <process.h> */
#define HAVE_PROCESS_H 1
+/* end of MSVC5 specific entries */
/* --------------------------------------------------- */
/* Define if on AIX 3.
/* Define if you have the vprintf function. */
#define HAVE_VPRINTF 1
-/* Define if you have the wait3 system call. */
-/* #undef HAVE_WAIT3 */
-
/* Define if on MINIX. */
/* #undef _MINIX */
/* Define to `int' if <sys/types.h> doesn't define. */
#define uid_t long
-/* define this if needed to get reentrant functions */
-/* #undef _REENTRANT */
+/* Define if your processor stores words with the most significant
+ byte first (like Motorola and SPARC, unlike Intel and VAX). */
+/* #undef WORDS_BIGENDIAN */
-/* define this if needed to get threadsafe functions */
-/* #undef _THREAD_SAFE */
+/* define this if needed to get reentrant functions */
+#ifndef REENTRANT
+/* #undef REENTRANT */
+#endif
+#ifndef _REENTRANT
+#undef _REENTRANT
+#endif
/* define this if needed to get threadsafe functions */
+#ifndef THREADSAFE
+/* #undef THREADSAFE */
+#endif
+#ifndef _THREADSAFE
/* #undef _THREADSAFE */
+#endif
+#ifndef THREAD_SAFE
+/* #undef THREAD_SAFE */
+#endif
+#ifndef _THREAD_SAFE
+/* #undef _THREAD_SAFE *
+#endif
/* define this if toupper() requires tolower() */
#define C_UPPER_LOWER
+/* define this to the number of arguments ctime_r() expects */
+/* #undef CTIME_R_NARGS */
+
/* define this if sys_errlist is not defined in stdio.h or errno.h */
/* #undef DECL_SYS_ERRLIST */
-/* define this if TIOCGWINSZ is defined in sys/ioctl.h */
-/* #undef GWINSZ_IN_SYS_IOCTL */
-
/* define if you have berkeley db */
/* #undef HAVE_BERKELEY_DB */
/* define if you have crypt */
/* #undef HAVE_CRYPT */
-/* define if you have DSAP */
-/* #undef HAVE_DSAP */
-
/* define if you have GDBM */
/* #undef HAVE_GDBM */
-/* define if you have ISODE */
-/* #undef HAVE_ISODE */
-
-/* define if you have Kerberos */
-/* #undef HAVE_KERBEROS */
-
-/* define if you have LinuxThreads */
-/* #undef HAVE_LINUX_THREADS */
-
-/* define if you have Sun LWP (SunOS style) */
-/* #undef HAVE_LWP */
-
-/* define if you have -lncurses */
-/* #undef HAVE_NCURSES */
-
/* define if you have NDBM */
/* #undef HAVE_NDBM */
-/* define if you have Mach CThreads */
-/* #undef HAVE_MACH_CTHREADS */
-
-/* define if you have POSIX termios */
-/* #undef HAVE_POSIX_TERMIOS */
-
-/* define if you have PP */
-/* #undef HAVE_PP */
-
-/* define if you have POSIX Threads */
-/* #undef HAVE_PTHREADS */
-
-/* define if your POSIX Threads implementatin is circa Final Draft */
-/* #undef HAVE_PTHREADS_FINAL */
-
-/* define if your POSIX Threads implementatin is circa Draft 4 */
-/* #undef HAVE_PTHREADS_D4 */
-
-/* define if you have ptrdiff_t */
-#define HAVE_PTRDIFF_T
+/* define if you have res_search() */
+#ifdef __notdef__
+/* see second res_search define */
+/* #undef HAVE_RES_SEARCH */
+#endif
/* define if you have sched_yield() */
#ifdef __notdef__
/* define if you have setproctitle() */
#undef HAVE_SETPROCTITLE
-/* define if you have -lwrap */
-/* #undef HAVE_TCPD */
-
-/* define if you have -ltermcap */
-/* #undef HAVE_TERMCAP */
-
-/* define if you have Solaris LWP Threads */
-/* #undef HAVE_THR */
-
-/* define if you have XTPP */
-/* #undef HAVE_XTPP */
-
-/* define this if select() implicitly yields in thread environments */
-#define HAVE_YIELDING_SELECT 1
-
/* define this for connectionless LDAP support */
/* #undef LDAP_CONNECTIONLESS */
/* define this for LDAP User Interface support */
/* #undef LDAP_LIBUI */
+/* define this to add syslog code */
+/* #undef LDAP_SYSLOG */
+
/* define this to use DBBTREE w/ LDBM backend */
/* #undef LDBM_USE_DBBTREE */
/* define this to use DBHASH w/ LDBM backend */
/* #undef LDBM_USE_DBHASH */
-/* define this if you want no termcap support */
-#define NO_TERMCAP 1
+/* define this for ACL Group support */
+/* #undef SLAPD_ACLGROUPS */
-/* define this if you want no thread support */
-#define NO_THREADS 1
+/* define this to use SLAPD Berkeley DB2 backend */
+/* #undef SLAPD_BDB2 */
-/* define this for ACL Group support */
-#define SLAPD_ACLGROUPS
+/* define this for ClearText password support */
+/* #undef SLAPD_CLEARTEXT */
/* define this for crypt(3) password support */
/* #undef SLAPD_CRYPT */
/* define this to use SLAPD LDBM backend */
/* #undef SLAPD_LDBM */
-/* define this for MD5 password support */
-#define SLAPD_MD5 1
-
/* define this to use SLAPD passwd backend */
/* #undef SLAPD_PASSWD */
+/* define this to use SLAPD perl backend */
+/* #undef SLAPD_PERL */
+
/* define this for phonetic support */
/* #undef SLAPD_PHONETIC */
/* define this for Reverse Lookup support */
-#define SLAPD_RLOOKUPS 1
-
-/* define this for SHA1 password support */
-#define SLAPD_SHA1 1
+/* #undef SLAPD_RLOOKUPS */
/* define this to use SLAPD shell backend */
/* #undef SLAPD_SHELL */
+/* define this to be empty if your compiler doesn't support volatile */
+/* #undef volatile */
+
+/* define this if sig_atomic_t isn't defined in signal.h */
+/* #undef sig_atomic_t */
+
/* These are defined in ldap_features.h */
/*
+ LDAP_API_FEATURE_X_OPENLDAP_REENTRANT
+ LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE
LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
*/
/* The number of bytes in a short. */
#define SIZEOF_SHORT 2
-/* Define if you have the alarm function. */
-/* #undef HAVE_ALARM */
-
/* Define if you have the bcopy function. */
/* #undef HAVE_BCOPY */
+/* Define if you have the ctime_r function. */
+/* #undef HAVE_CTIME_R */
+
/* Define if you have the flock function. */
/* #undef HAVE_FLOCK */
/* Define if you have the getdtablesize function. */
/* #undef HAVE_GETDTABLESIZE */
+/* Define if you have the gethostbyaddr_r function. */
+/* #undef HAVE_GETHOSTBYADDR_R */
+
+/* Define if you have the gethostbyname_r function. */
+/* #undef HAVE_GETHOSTBYNAME_R */
+
/* Define if you have the gethostname function. */
#define HAVE_GETHOSTNAME 1
/* Define if you have the mkstemp function. */
/* #undef HAVE_MKSTEMP */
-/* Define if you have the pow function. */
-/* #undef HAVE_POW */
-
-/* Define if you have the pthread_attr_create function. */
-/* #undef HAVE_PTHREAD_ATTR_CREATE */
-
-/* Define if you have the pthread_attr_delete function. */
-/* #undef HAVE_PTHREAD_ATTR_DELETE */
-
-/* Define if you have the pthread_attr_destroy function. */
-/* #undef HAVE_PTHREAD_ATTR_DESTROY */
-
-/* Define if you have the pthread_attr_init function. */
-/* #undef HAVE_PTHREAD_ATTR_INIT */
-
-/* Define if you have the pthread_attr_setdetach_np function. */
-/* #undef HAVE_PTHREAD_ATTR_SETDETACH_NP */
-
-/* Define if you have the pthread_attr_setdetachstate function. */
-/* #undef HAVE_PTHREAD_ATTR_SETDETACHSTATE */
+/* Define if you have the pthread_getconcurrency function. */
+/* #undef HAVE_PTHREAD_GETCONCURRENCY */
/* Define if you have the pthread_kill function. */
/* #undef HAVE_PTHREAD_KILL */
/* Define if you have the strsep function. */
/* #undef HAVE_STRSEP */
+/* Define if you have the strspn function. */
+#define HAVE_STRSPN 1
+
/* Define if you have the strstr function. */
#define HAVE_STRSTR 1
/* Define if you have the strtok function. */
#define HAVE_STRTOK 1
+/* Define if you have the strtok_r function. */
+/* #undef HAVE_STRTOK_R */
+
/* Define if you have the strtol function. */
#define HAVE_STRTOL 1
/* Define if you have the tempnam function. */
/* #undef HAVE_TEMPNAM */
+/* Define if you have the thr_getconcurrency function. */
+/* #undef HAVE_THR_GETCONCURRENCY */
+
/* Define if you have the thr_setconcurrency function. */
/* #undef HAVE_THR_SETCONCURRENCY */
+/* Define if you have the thr_yield function. */
+/* #undef HAVE_THR_YIELD */
+
/* Define if you have the vsnprintf function. */
/* #undef HAVE_VSNPRINTF */
+/* Define if you have the vsprintf function. */
+/* #undef HAVE_VSPRINTF */
+
/* Define if you have the waitpid function. */
#define HAVE_WAITPID 1
+/* Define if you have the <arpa/nameser.h> header file. */
+/* #undef HAVE_ARPA_NAMESER_H */
+
/* Define if you have the <crypt.h> header file. */
/* #undef HAVE_CRYPT_H */
/* Define if you have the <dirent.h> header file. */
/* #undef HAVE_DIRENT_H */
+/* Define if you have the <dmalloc.h> header file. */
+/* #undef HAVE_DMALLOC_H */
+
/* Define if you have the <errno.h> header file. */
#define HAVE_ERRNO_H 1
/* Define if you have the <regex.h> header file. */
/* #undef HAVE_REGEX_H */
+/* Define if you have the <resolv.h> header file. */
+/* #undef HAVE_RESOLV_H */
+
/* Define if you have the <sched.h> header file. */
/* #undef HAVE_SCHED_H */
/* Define if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
+/* Define if you have the <sysexits.h> header file. */
+/* #undef HAVE_SYSEXITS_H */
+
/* Define if you have the <syslog.h> header file. */
/* #undef HAVE_SYSLOG_H */
+/* Define if you have the <tcpd.h> header file. */
+/* #undef HAVE_TCPD_H */
+
/* Define if you have the <termcap.h> header file. */
/* #undef HAVE_TERMCAP_H */
/* Define if you have the V3 library (-lV3). */
/* #undef HAVE_LIBV3 */
+/* Define if you have the bind library (-lbind). */
+/* #undef HAVE_LIBBIND */
+
+/* Define if you have the dmalloc library (-ldmalloc). */
+/* #undef HAVE_LIBDMALLOC */
+
/* Define if you have the gen library (-lgen). */
/* #undef HAVE_LIBGEN */
/* Define if you have the socket library (-lsocket). */
/* #undef HAVE_LIBSOCKET */
+/* define if you have -lxttp */
+/* #undef HAVE_XTPP */
+
+/* define if you have -ldsap */
+/* #undef HAVE_DSAP */
+
+/* define if you have -lisode */
+/* #undef HAVE_ISODE */
+
+/* define if you have -lpp */
+/* #undef HAVE_PP */
+
+/* define if you have Kerberos des_debug */
+/* #undef HAVE_DES_DEBUG */
+
+/* define if you have Kerberos */
+/* #undef HAVE_KERBEROS */
+
+/* define if pthreads API compatible with final spec */
+/* #undef HAVE_PTHREADS_FINAL */
+
+/* define if pthreads API compatible with draft4 spec */
+/* #undef HAVE_PTHREADS_D4 */
+
+/* define if you have LinuxThreads */
+/* #undef HAVE_LINUX_THREADS */
+
+/* define if you have POSIX Threads */
+/* #undef HAVE_PTHREADS */
+
+/* define if you have pthread_detach function */
+/* #undef HAVE_PTHREAD_DETACH */
+
+/* define if you have Mach Cthreads */
+/* #undef HAVE_MACH_CTHREADS */
+
+/* if you have Solaris LWP (thr) package */
+/* #undef HAVE_THR */
+
+/* if you have SunOS LWP package */
+/* #undef HAVE_LWP */
+
+/* define if select implicitly yields */
+#define HAVE_YIELDING_SELECT 1
+
+/* define if you have (or want) no threads */
+/* #undef NO_THREADS */
+
+/* define if you have -lwrap */
+/* #undef HAVE_TCPD */
+
+/* define if you have -ltermcap */
+/* #undef HAVE_TERMCAP */
+
+/* define if you have -lncurses */
+/* #undef HAVE_NCURSES */
+
+/* define if you have no termcap support */
+#define NO_TERMCAP 1
+
+/* Define if TIOCGWINSZ requires sys/ioctl.h */
+/* #undef GWINSZ_IN_SYS_IOCTL */
+
+/* define if you have POSIX termios */
+/* #undef HAVE_POSIX_TERMIOS */
+
+/* Define if system has ptrdiff_t type */
+#define HAVE_PTRDIFF_T 1
+
+/* define if cross compiling */
+/* #undef CROSS_COMPILING */
+
+/* begin of postamble */
+
#ifdef HAVE_STDDEF_H
# include <stddef.h>
#endif
--- /dev/null
+/*
+ * Copyright (c) 1992, 1993 Regents of the University of Michigan.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that this notice is preserved and that due credit is given
+ * to the University of Michigan at Ann Arbor. The name of the University
+ * may not be used to endorse or promote products derived from this
+ * software without specific prior written permission. This software
+ * is provided ``as is'' without express or implied warranty.
+ */
+
+#include "portable.h"
+
+#ifndef HAVE_GETPASS
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <ac/ctype.h>
+#include <ac/errno.h>
+#include <ac/signal.h>
+#include <ac/string.h>
+#include <ac/termios.h>
+#include <ac/time.h>
+#include <ac/unistd.h>
+
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+
+#ifdef HAVE_CONIO_H
+#include <conio.h>
+#endif
+
+#include <lber.h>
+#include <ldap.h>
+#include <ldapconfig.h>
+
+char *
+getpass( const char *prompt )
+{
+#if !defined(HAVE_POSIX_TERMIOS) && !defined(HAVE_SGTTY_H)
+ static char buf[256];
+ int i, c;
+
+#ifdef DEBUG
+ if (debug & D_TRACE)
+ printf("->getpass(%s)\n", prompt);
+#endif
+ printf("%s", prompt);
+ i = 0;
+ while ( (c = getch()) != EOF && c != '\n' && c != '\r' )
+ buf[i++] = c;
+ if ( c == EOF )
+ return( NULL );
+ buf[i] = '\0';
+ return (buf);
+#else
+ int no_pass = 0;
+ char i, j, k;
+ TERMIO_TYPE ttyb;
+ TERMFLAG_TYPE flags;
+ static char pbuf[513];
+ register char *p;
+ register int c;
+ FILE *fi;
+ RETSIGTYPE (*sig)( int sig );
+
+#ifdef DEBUG
+ if (debug & D_TRACE)
+ printf("->getpass(%s)\n", prompt);
+#endif
+ /*
+ * Stolen from the getpass() routine. Can't use the plain
+ * getpass() for two reasons. One is that LDAP passwords
+ * can be really, really long - much longer than 8 chars.
+ * The second is that we like to make this client available
+ * out of inetd via a Merit asynch port, and we need to be
+ * able to do telnet control codes to turn on and off line
+ * blanking.
+ */
+ if ((fi = fdopen(open("/dev/tty", 2), "r")) == NULL)
+ fi = stdin;
+ else
+ setbuf(fi, (char *)NULL);
+ sig = SIGNAL (SIGINT, SIG_IGN);
+ if (fi != stdin) {
+ if (GETATTR(fileno(fi), &ttyb) < 0)
+ perror("GETATTR");
+ }
+ flags = GETFLAGS( ttyb );
+ SETFLAGS( ttyb, flags & ~ECHO );
+ if (fi != stdin) {
+ if (SETATTR(fileno(fi), &ttyb) < 0)
+ perror("SETATTR");
+ }
+
+ /* blank the line if through Merit */
+ if (fi == stdin) {
+ printf("%c%c%c", 255, 251, 1);
+ fflush(stdout);
+ (void) scanf("%c%c%c", &i, &j, &k);
+ fflush(stdin);
+ }
+
+ /* fetch the password */
+ fprintf(stdout, "%s", prompt);
+ fflush(stdout);
+ for (p=pbuf; (c = getc(fi))!='\n' && c!=EOF;) {
+ if (c == '\r')
+ break;
+ if (p < &pbuf[512])
+ *p++ = c;
+ }
+ if (c == EOF)
+ no_pass = 1;
+ else {
+ *p = '\0';
+ if (*(p - 1) == '\r')
+ *(p - 1) = '\0';
+ }
+
+ /* unblank the line if through Merit */
+ if (fi == stdin) {
+ printf("%c%c%c", 255, 252, 1);
+ fflush(stdout);
+ (void) scanf("%c%c%c", &i, &j, &k);
+ fflush(stdin);
+ printf("\n"); fflush(stdout);
+ }
+ fprintf(stdout, "\n");
+ fflush(stdout);
+
+ /* tidy up */
+ SETFLAGS( ttyb, flags );
+ if (fi != stdin) {
+ if (SETATTR(fileno(fi), &ttyb) < 0)
+ perror("SETATTR");
+ }
+ (void) SIGNAL (SIGINT, sig);
+ if (fi != stdin)
+ (void) fclose(fi);
+ else
+ i = getchar();
+ if (no_pass)
+ return(NULL);
+ return(pbuf);
+#endif /* DOS */
+}
+
+#endif /* !HAVE_GETPASS */
\ No newline at end of file