зеркало из https://github.com/mozilla/pjs.git
Resolves: bug 228704
Description: Windows: libldap and the LDAP tools should support SASL/Digest Fix Description: The biggest change was to hack sasl.m4 to make AC_CHECK_LIB work on Windows. I had to override LIBS to be able to pass in /link /LIBPATH:c:/path/to/sasl libsasl.lib, libsasl2.lib, and sasl32.lib. Another big change was to implement getlogin() on Windows, required by ldaptool-sasl.c. The implementation is pretty simple. There were several places in the Makefiles that assumed Windows meant no support for SASL, so I just changed them, and added some support for SASL_LIBS in some places where it was missing.
This commit is contained in:
Родитель
2a350e97cc
Коммит
79721b17ea
|
@ -45,7 +45,7 @@ COMPVERSIONDIR = $(DEPTH)/directory/c-sdk
|
|||
endif
|
||||
|
||||
DEFAULT_VENDOR_NAME=mozilla.org
|
||||
DEFAULT_VENDOR_VERSION=602
|
||||
DEFAULT_VENDOR_VERSION=601
|
||||
|
||||
ifndef VENDOR_NAME
|
||||
VENDOR_NAME = $(DEFAULT_VENDOR_NAME)
|
||||
|
@ -155,7 +155,7 @@ SVRCORE_LINK = $(SVRCORE_LIBS) -l$(SVRCORE_LIBNAME)
|
|||
endif
|
||||
|
||||
# sasl library
|
||||
ifneq ($(OS_ARCH), WINNT)
|
||||
ifdef SASL_LIBS
|
||||
SASL_LINK = $(SASL_LIBS)
|
||||
endif
|
||||
|
||||
|
|
|
@ -82,6 +82,19 @@ AC_ARG_WITH(sasl-lib,
|
|||
AC_MSG_RESULT(no))
|
||||
|
||||
# check for sasl
|
||||
if test -n "$_WIN32_MSVC" -a -n "$USE_WINDOWS_PATHS" ; then
|
||||
if test -n "$SASL_CFLAGS" -a -z "$SKIP_CYGWIN_FIXUP" ; then
|
||||
path=`echo $SASL_CFLAGS | sed -e 's/^-I//'`
|
||||
path=`cygpath -m $path`
|
||||
SASL_CFLAGS="/I$path"
|
||||
fi
|
||||
if test -n "$SASL_LIBS" -a -z "$SKIP_CYGWIN_FIXUP" ; then
|
||||
path=`echo $SASL_LIBS | sed -e 's/^-L//'`
|
||||
path=`cygpath -m $path`
|
||||
SASL_LIBS="/LIBPATH:$path"
|
||||
fi
|
||||
special_sasl_check_lib=1
|
||||
fi
|
||||
# set ldflags to point to where the user told us to find the sasl libs,
|
||||
# if any - otherwise it will just use the default location (e.g. /usr/lib)
|
||||
# the way AC_CHECK_LIB works is it actually attempts to compile and link
|
||||
|
@ -94,8 +107,30 @@ fi
|
|||
AC_CHECK_FUNC(getaddrinfo,,[
|
||||
AC_CHECK_LIB(socket, getaddrinfo, [LIBS="-lsocket -lnsl $LIBS"])])
|
||||
|
||||
AC_CHECK_LIB([sasl2], [sasl_client_init], [sasl_lib=-lsasl2],
|
||||
AC_CHECK_LIB([sasl], [sasl_client_init], [sasl_lib=-lsasl]))
|
||||
if test -n "$special_sasl_check_lib" ; then
|
||||
# use this to override the ac_link LIBS used by AC_CHECK_LIB
|
||||
# ac_link puts conftest.c betwen $LDFLAGS and $LIBS, but we
|
||||
# have to use /LIBPATH which must come after the /link directive
|
||||
# however, anything after /link on the command line is assumed to
|
||||
# be a linker directive, and conftest.c is not valid there
|
||||
# we want to end up with cl.exe .... conftest.c /link /LIBPATH:foo libsasl.lib
|
||||
LDFLAGS=
|
||||
SAVE_LIBS="$LIBS"
|
||||
LIBS="/link $SASL_LIBS sasl32.lib"
|
||||
AC_CHECK_LIB([sasl32], [sasl_client_init], [sasl_lib=sasl32.lib])
|
||||
if test -z "$sasl_lib" ; then
|
||||
LIBS="/link $SASL_LIBS libsasl2.lib"
|
||||
AC_CHECK_LIB([sasl2], [sasl_client_init], [sasl_lib=libsasl2.lib])
|
||||
fi
|
||||
if test -z "$sasl_lib" ; then
|
||||
LIBS="/link $SASL_LIBS libsasl.lib"
|
||||
AC_CHECK_LIB([sasl], [sasl_client_init], [sasl_lib=libsasl.lib])
|
||||
fi
|
||||
LIBS="$SAVE_LIBS"
|
||||
else
|
||||
AC_CHECK_LIB([sasl2], [sasl_client_init], [sasl_lib=-lsasl2],
|
||||
AC_CHECK_LIB([sasl], [sasl_client_init], [sasl_lib=-lsasl]))
|
||||
fi
|
||||
|
||||
SASL_LIBS="$SASL_LIBS $sasl_lib"
|
||||
LDFLAGS=$SAVE_LDFLAGS
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -97,6 +97,9 @@ LDAPPASSWD_OBJ = $(addprefix $(OBJDEST)/, ldappasswd.obj)
|
|||
LDAPTOOLCOMMON_OBJ = $(addprefix $(OBJDEST)/, common.obj) \
|
||||
$(addprefix $(OBJDEST)/, convutf8.obj) \
|
||||
$(addprefix $(OBJDEST)/, fileurl.obj)
|
||||
ifeq ($(HAVE_SASL), 1)
|
||||
LDAPTOOLCOMMON_OBJ += $(addprefix $(OBJDEST)/, ldaptool-sasl.obj)
|
||||
endif
|
||||
ifeq ($(LDAP_TOOL_ARGPIN),1)
|
||||
LDAPTOOLCOMMON_OBJ += $(addprefix $(OBJDEST)/, argpin.obj) \
|
||||
$(addprefix $(OBJDEST)/, ntuserpin.obj)
|
||||
|
@ -173,10 +176,8 @@ EXTRA_LIBS += $(LDAPTOOLS_NSS_LINK) $(NSPRLINK)
|
|||
endif
|
||||
|
||||
ifeq ($(HAVE_SASL), 1)
|
||||
ifneq ($(OS_ARCH), WINNT)
|
||||
EXTRA_LIBS += $(SASL_LINK)
|
||||
endif
|
||||
endif
|
||||
|
||||
# set platform specific libs
|
||||
ifeq ($(OS_ARCH), SunOS)
|
||||
|
|
|
@ -63,6 +63,22 @@ typedef struct {
|
|||
static int get_default(ldaptoolSASLdefaults *defaults, sasl_interact_t *interact, unsigned flags);
|
||||
static int get_new_value(sasl_interact_t *interact, unsigned flags);
|
||||
|
||||
/* WIN32 does not have getlogin() so roll our own */
|
||||
#if defined( _WINDOWS ) || defined( _WIN32 )
|
||||
#include "LMCons.h"
|
||||
static char *getlogin()
|
||||
{
|
||||
LPTSTR lpszSystemInfo; /* pointer to system information string */
|
||||
DWORD cchBuff = UNLEN; /* size of user name */
|
||||
static TCHAR tchBuffer[UNLEN + 1]; /* buffer for expanded string */
|
||||
|
||||
lpszSystemInfo = tchBuffer;
|
||||
GetUserName(lpszSystemInfo, &cchBuff);
|
||||
|
||||
return lpszSystemInfo;
|
||||
}
|
||||
#endif /* _WINDOWS || _WIN32 */
|
||||
|
||||
/*
|
||||
Note that it is important to use "" (the empty string, length 0) as the default
|
||||
username value for non-interactive cases. This allows the sasl library to find the best
|
||||
|
|
|
@ -40,6 +40,7 @@ MOD_DEPTH = ../../..
|
|||
srcdir = @srcdir@
|
||||
topsrcdir = @top_srcdir@
|
||||
SASL_CFLAGS = @SASL_CFLAGS@
|
||||
SASL_LIBS = @SASL_LIBS@
|
||||
HAVE_SASL = @HAVE_SASL@
|
||||
|
||||
include $(MOD_DEPTH)/config/autoconf.mk
|
||||
|
@ -207,13 +208,14 @@ endif
|
|||
|
||||
ifeq ($(OS_ARCH), WINNT)
|
||||
ifdef NS_USE_GCC
|
||||
EXTRA_DLL_LIBS=-L$(dist_libdir) -l$(LBER_LIBNAME)
|
||||
EXTRA_DLL_LIBS=-L$(dist_libdir) -l$(LBER_LIBNAME) $(SASL_LINK)
|
||||
else
|
||||
EXTRA_LIBS =wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib \
|
||||
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib \
|
||||
rpcrt4.lib uuid.lib winmm.lib
|
||||
EXTRA_LIBS += $(dist_libdir)/$(LDIF_LIBNAME).lib
|
||||
EXTRA_LIBS += $(dist_libdir)/$(LBER_LIBNAME).lib
|
||||
EXTRA_LIBS += $(SASL_LINK)
|
||||
endif
|
||||
endif
|
||||
|
||||
|
|
|
@ -125,8 +125,11 @@ nsldapi_sasl_pktlen( char *buf, int maxbufsize )
|
|||
{
|
||||
int size;
|
||||
|
||||
#if defined( _WINDOWS ) || defined( _WIN32 )
|
||||
size = ntohl(*(u_long *)buf);
|
||||
#else
|
||||
size = ntohl(*(uint32_t *)buf);
|
||||
|
||||
#endif
|
||||
if ( size < 0 || size > maxbufsize ) {
|
||||
return (-1 );
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче