summaryrefslogtreecommitdiff
path: root/source4/lib/replace
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-01-22 16:39:56 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-01-22 16:39:56 +0100
commit4075a2ba982ea56ff925e0a33839f0760fd71911 (patch)
tree87d87734257f814b7960a843e54455c447f34a9e /source4/lib/replace
parent24da29746998de1001d18871dcbe8d37643667d5 (diff)
parent35c68316442808a135aafa864d19592108a4d879 (diff)
downloadsamba-4075a2ba982ea56ff925e0a33839f0760fd71911.tar.gz
samba-4075a2ba982ea56ff925e0a33839f0760fd71911.tar.bz2
samba-4075a2ba982ea56ff925e0a33839f0760fd71911.zip
Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into v4-0-python
(This used to be commit 2f57e25f8f692889d9e057e13256f8a24c5ec10c)
Diffstat (limited to 'source4/lib/replace')
-rw-r--r--source4/lib/replace/getpass.m410
-rw-r--r--source4/lib/replace/libreplace.m41
-rw-r--r--source4/lib/replace/libreplace_ld.m42
-rw-r--r--source4/lib/replace/replace.c2
-rw-r--r--source4/lib/replace/replace.h8
-rw-r--r--source4/lib/replace/system/config.m425
-rw-r--r--source4/lib/replace/system/network.h4
-rw-r--r--source4/lib/replace/system/passwd.h4
8 files changed, 54 insertions, 2 deletions
diff --git a/source4/lib/replace/getpass.m4 b/source4/lib/replace/getpass.m4
index 17dfdf7bf5..c4da9aae59 100644
--- a/source4/lib/replace/getpass.m4
+++ b/source4/lib/replace/getpass.m4
@@ -1,3 +1,11 @@
+AC_CHECK_FUNC(getpass, samba_cv_HAVE_GETPASS=yes)
+AC_CHECK_FUNC(getpassphrase, samba_cv_HAVE_GETPASSPHRASE=yes)
+if test x"$samba_cv_HAVE_GETPASS" = x"yes" -a x"$samba_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} getpass.o"
+else
+
AC_CACHE_CHECK([whether getpass should be replaced],samba_cv_REPLACE_GETPASS,[
SAVE_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -I$libreplacedir/"
@@ -12,3 +20,5 @@ if test x"$samba_cv_REPLACE_GETPASS" = x"yes"; then
AC_DEFINE(REPLACE_GETPASS,1,[Whether getpass should be replaced])
LIBREPLACEOBJ="${LIBREPLACEOBJ} getpass.o"
fi
+
+fi
diff --git a/source4/lib/replace/libreplace.m4 b/source4/lib/replace/libreplace.m4
index a577285639..6d1d6b8afc 100644
--- a/source4/lib/replace/libreplace.m4
+++ b/source4/lib/replace/libreplace.m4
@@ -100,6 +100,7 @@ AC_CHECK_HEADERS(sys/socket.h netinet/in.h netdb.h arpa/inet.h)
AC_CHECK_HEADERS(netinet/ip.h netinet/tcp.h netinet/in_systm.h netinet/in_ip.h)
AC_CHECK_HEADERS(sys/sockio.h sys/un.h)
AC_CHECK_HEADERS(sys/mount.h mntent.h)
+AC_CHECK_HEADERS(stropts.h)
dnl we need to check that net/if.h really can be used, to cope with hpux
dnl where including it always fails
diff --git a/source4/lib/replace/libreplace_ld.m4 b/source4/lib/replace/libreplace_ld.m4
index cb8e21434e..2aec698967 100644
--- a/source4/lib/replace/libreplace_ld.m4
+++ b/source4/lib/replace/libreplace_ld.m4
@@ -265,7 +265,7 @@ AC_DEFUN([AC_LIBREPLACE_LD_SHLIB_ALLOW_UNDEF_FLAG],
LD_SHLIB_ALLOW_UNDEF_FLAG="-Wl,--allow-shlib-undefined"
;;
*osf*)
- LD_SHLIB_ALLOW_UNDEF_FLAG="-expect_unresolved '*'"
+ LD_SHLIB_ALLOW_UNDEF_FLAG="-Wl,-expect_unresolved,\"*\""
;;
*darwin*)
LD_SHLIB_ALLOW_UNDEF_FLAG="-undefined dynamic_lookup"
diff --git a/source4/lib/replace/replace.c b/source4/lib/replace/replace.c
index cec158be31..b2a240e8ab 100644
--- a/source4/lib/replace/replace.c
+++ b/source4/lib/replace/replace.c
@@ -218,7 +218,7 @@ long nap(long milliseconds) {
#ifndef HAVE_MEMMOVE
/*******************************************************************
safely copies memory, ensuring no overlap problems.
-this is only used if the machine does not have it's own memmove().
+this is only used if the machine does not have its own memmove().
this is not the fastest algorithm in town, but it will do for our
needs.
********************************************************************/
diff --git a/source4/lib/replace/replace.h b/source4/lib/replace/replace.h
index f8a89a7213..3f91544e97 100644
--- a/source4/lib/replace/replace.h
+++ b/source4/lib/replace/replace.h
@@ -546,4 +546,12 @@ typedef int bool;
#define QSORT_CAST (int (*)(const void *, const void *))
#endif
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
+
+#ifndef MAX_DNS_NAME_LENGTH
+#define MAX_DNS_NAME_LENGTH 256 /* Actually 255 but +1 for terminating null. */
+#endif
+
#endif /* _LIBREPLACE_REPLACE_H */
diff --git a/source4/lib/replace/system/config.m4 b/source4/lib/replace/system/config.m4
index 799187af7d..1c05733126 100644
--- a/source4/lib/replace/system/config.m4
+++ b/source4/lib/replace/system/config.m4
@@ -73,6 +73,18 @@ AC_VERIFY_C_PROTOTYPE([struct passwd *getpwent_r(struct passwd *src, char *buf,
#include <unistd.h>
#include <pwd.h>
])
+AC_VERIFY_C_PROTOTYPE([struct passwd *getpwent_r(struct passwd *src, char *buf, size_t buflen)],
+ [
+ #ifndef HAVE_GETPWENT_R_DECL
+ #error missing getpwent_r prototype
+ #endif
+ return NULL;
+ ],[
+ AC_DEFINE(SOLARIS_GETPWENT_R, 1, [getpwent_r irix (similar to solaris) function prototype])
+ ],[],[
+ #include <unistd.h>
+ #include <pwd.h>
+ ])
AC_CHECK_FUNCS(getgrnam_r getgrgid_r getgrent_r)
AC_HAVE_DECL(getgrent_r, [
#include <unistd.h>
@@ -91,6 +103,19 @@ AC_VERIFY_C_PROTOTYPE([struct group *getgrent_r(struct group *src, char *buf, in
#include <grp.h>
])
+AC_VERIFY_C_PROTOTYPE([struct group *getgrent_r(struct group *src, char *buf, size_t buflen)],
+ [
+ #ifndef HAVE_GETGRENT_R_DECL
+ #error missing getgrent_r prototype
+ #endif
+ return NULL;
+ ],[
+ AC_DEFINE(SOLARIS_GETGRENT_R, 1, [getgrent_r irix (similar to solaris) function prototype])
+ ],[],[
+ #include <unistd.h>
+ #include <grp.h>
+ ])
+
# locale
AC_CHECK_HEADERS(ctype.h locale.h)
diff --git a/source4/lib/replace/system/network.h b/source4/lib/replace/system/network.h
index e2fad5f686..53bef66d48 100644
--- a/source4/lib/replace/system/network.h
+++ b/source4/lib/replace/system/network.h
@@ -79,6 +79,10 @@
#include <sys/ioctl.h>
#endif
+#ifdef HAVE_STROPTS_H
+#include <stropts.h>
+#endif
+
#ifdef REPLACE_INET_NTOA
/* define is in "replace.h" */
char *rep_inet_ntoa(struct in_addr ip);
diff --git a/source4/lib/replace/system/passwd.h b/source4/lib/replace/system/passwd.h
index 36fca7b4f8..cad3197ccb 100644
--- a/source4/lib/replace/system/passwd.h
+++ b/source4/lib/replace/system/passwd.h
@@ -68,9 +68,13 @@
#endif
#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
#ifndef NGROUPS_MAX
#define NGROUPS_MAX 32 /* Guess... */