diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/Makefile.in | 3 | ||||
-rwxr-xr-x | source3/configure | 2 | ||||
-rw-r--r-- | source3/configure.in | 2 | ||||
-rw-r--r-- | source3/include/config.h.in | 3 | ||||
-rw-r--r-- | source3/include/includes.h | 4 | ||||
-rw-r--r-- | source3/libads/ads_status.c | 91 | ||||
-rw-r--r-- | source3/libads/ldap.c | 59 |
7 files changed, 102 insertions, 62 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in index 6b9bcb0ee7..3b0795bd1d 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -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 \ diff --git a/source3/configure b/source3/configure index 10a497669d..1497175bfc 100755 --- a/source3/configure +++ b/source3/configure @@ -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 diff --git a/source3/configure.in b/source3/configure.in index 059936e0a4..d3f13e586a 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -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. diff --git a/source3/include/config.h.in b/source3/include/config.h.in index f85de1b1af..9aa9a1b203 100644 --- a/source3/include/config.h.in +++ b/source3/include/config.h.in @@ -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 diff --git a/source3/include/includes.h b/source3/include/includes.h index 92ac462e1b..3a4c50ab9a 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -385,6 +385,10 @@ #undef HAVE_KRB5 #endif +#if HAVE_LBER_H +#include <lber.h> +#endif + #if HAVE_LDAP_H #include <ldap.h> #else diff --git a/source3/libads/ads_status.c b/source3/libads/ads_status.c new file mode 100644 index 0000000000..6dac335cc4 --- /dev/null +++ b/source3/libads/ads_status.c @@ -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?)"; + } + +} + + diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c index 8966ceb32a..5503b6e353 100644 --- a/source3/libads/ldap.c +++ b/source3/libads/ldap.c @@ -26,65 +26,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 */ ADS_STATUS ads_connect(ADS_STRUCT *ads) |