1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-23 09:57:40 +03:00

Make Samba compile on RH 6.2 again.

We now include the libber.h file if required, but currently we just don't use
ldap.  (I'll chase this up).

In the meantime, I've moved the ads_status code about, its now in its own file,
and has a couple of #ifdefs to allow smbd to link - becouse the lack of LDAP
caused HAVE_ADS to be undefined. (I hope its not too ugly).

Andrew Bartlett
(This used to be commit 14407c87e2dcccae1784290e3eb7a2d611516aff)
This commit is contained in:
Andrew Bartlett 2001-12-30 05:59:43 +00:00
parent bb81e23e17
commit 34037e2479
7 changed files with 102 additions and 62 deletions

View File

@ -133,7 +133,8 @@ UBIQX_OBJ = ubiqx/ubi_BinTree.o ubiqx/ubi_Cache.o ubiqx/ubi_SplayTree.o \
PARAM_OBJ = param/loadparm.o param/params.o dynconfig.o
LIBADS_OBJ = libads/ldap.o libads/sasl.o libads/krb5_setpw.o libads/kerberos.o \
libads/ads_struct.o passdb/secrets.o libads/util.o
libads/ads_struct.o libads/ads_status.o passdb/secrets.o \
libads/util.o
LIBSMB_OBJ = libsmb/clientgen.o libsmb/cliconnect.o libsmb/clifile.o \
libsmb/clikrb5.o libsmb/clispnego.o libsmb/asn1.o \

2
source3/configure vendored
View File

@ -2172,7 +2172,7 @@ else
fi
done
for ac_hdr in security/pam_modules.h security/_pam_macros.h ldap.h
for ac_hdr in security/pam_modules.h security/_pam_macros.h ldap.h lber.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6

View File

@ -257,7 +257,7 @@ AC_CHECK_HEADERS(sys/param.h ctype.h sys/wait.h sys/resource.h sys/ioctl.h sys/i
AC_CHECK_HEADERS(sys/mman.h sys/filio.h sys/priv.h sys/shm.h string.h strings.h stdlib.h sys/socket.h)
AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h termio.h)
AC_CHECK_HEADERS(sys/termio.h sys/statfs.h sys/dustat.h sys/statvfs.h stdarg.h sys/sockio.h)
AC_CHECK_HEADERS(security/pam_modules.h security/_pam_macros.h ldap.h)
AC_CHECK_HEADERS(security/pam_modules.h security/_pam_macros.h ldap.h lber.h)
#
# HPUX has a bug in that including shadow.h causes a re-definition of MAXINT.

View File

@ -842,6 +842,9 @@
/* Define if you have the <lastlog.h> header file. */
#undef HAVE_LASTLOG_H
/* Define if you have the <lber.h> header file. */
#undef HAVE_LBER_H
/* Define if you have the <ldap.h> header file. */
#undef HAVE_LDAP_H

View File

@ -385,6 +385,10 @@
#undef HAVE_KRB5
#endif
#if HAVE_LBER_H
#include <lber.h>
#endif
#if HAVE_LDAP_H
#include <ldap.h>
#else

View File

@ -0,0 +1,91 @@
/*
Unix SMB/Netbios implementation.
Version 3.0
ads (active directory) utility library
Copyright (C) Andrew Tridgell 2001
Copyright (C) Remus Koos 2001
Copyright (C) Andrew Bartlett 2001
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "includes.h"
/*
build a ADS_STATUS structure
*/
ADS_STATUS ads_build_error(enum ads_error_type etype,
int rc, int minor_status)
{
ADS_STATUS ret;
ret.error_type = etype;
ret.rc = rc;
ret.minor_status = minor_status;
return ret;
}
/*
do a rough conversion between ads error codes and NT status codes
we'll need to fill this in more
*/
NTSTATUS ads_ntstatus(ADS_STATUS rc)
{
if (ADS_ERR_OK(rc)) return NT_STATUS_OK;
return NT_STATUS_UNSUCCESSFUL;
}
/*
return a string for an error from a ads routine
*/
const char *ads_errstr(ADS_STATUS status)
{
gss_buffer_desc msg1, msg2;
uint32 minor;
int msg_ctx;
static char *ret;
SAFE_FREE(ret);
msg_ctx = 0;
switch (status.error_type) {
case ADS_ERROR_SYSTEM:
return strerror(status.rc);
#ifdef HAVE_LDAP
case ADS_ERROR_LDAP:
return ldap_err2string(status.rc);
#endif
#ifdef HAVE_KRB5
case ADS_ERROR_KRB5:
return error_message(status.rc);
case ADS_ERROR_GSS:
msg1.value = NULL;
msg2.value = NULL;
gss_display_status(&minor, status.rc, GSS_C_GSS_CODE,
GSS_C_NULL_OID, &msg_ctx, &msg1);
gss_display_status(&minor, status.minor_status, GSS_C_MECH_CODE,
GSS_C_NULL_OID, &msg_ctx, &msg2);
asprintf(&ret, "%s : %s", (char *)msg1.value, (char *)msg2.value);
gss_release_buffer(&minor, &msg1);
gss_release_buffer(&minor, &msg2);
return ret;
#endif
default:
return "Unknown ADS error type!? (not compiled in?)";
}
}

View File

@ -25,65 +25,6 @@
#ifdef HAVE_ADS
/*
build a ADS_STATUS structure
*/
ADS_STATUS ads_build_error(enum ads_error_type etype,
int rc, int minor_status)
{
ADS_STATUS ret;
ret.error_type = etype;
ret.rc = rc;
ret.minor_status = minor_status;
return ret;
}
/*
do a rough conversion between ads error codes and NT status codes
we'll need to fill this in more
*/
NTSTATUS ads_ntstatus(ADS_STATUS rc)
{
if (ADS_ERR_OK(rc)) return NT_STATUS_OK;
return NT_STATUS_UNSUCCESSFUL;
}
/*
return a string for an error from a ads routine
*/
const char *ads_errstr(ADS_STATUS status)
{
gss_buffer_desc msg1, msg2;
uint32 minor;
int msg_ctx;
static char *ret;
SAFE_FREE(ret);
msg_ctx = 0;
switch (status.error_type) {
case ADS_ERROR_KRB5:
return error_message(status.rc);
case ADS_ERROR_LDAP:
return ldap_err2string(status.rc);
case ADS_ERROR_SYSTEM:
return strerror(status.rc);
case ADS_ERROR_GSS:
msg1.value = NULL;
msg2.value = NULL;
gss_display_status(&minor, status.rc, GSS_C_GSS_CODE,
GSS_C_NULL_OID, &msg_ctx, &msg1);
gss_display_status(&minor, status.minor_status, GSS_C_MECH_CODE,
GSS_C_NULL_OID, &msg_ctx, &msg2);
asprintf(&ret, "%s : %s", (char *)msg1.value, (char *)msg2.value);
gss_release_buffer(&minor, &msg1);
gss_release_buffer(&minor, &msg2);
return ret;
}
return "Unknown ADS error type!?";
}
/*
connect to the LDAP server
*/