From 248554370af30f485a4088d0d5de675e77b2aa7b Mon Sep 17 00:00:00 2001 From: Wilco Baan Hofman Date: Sun, 1 Mar 2009 16:25:57 +0100 Subject: Make gpo_ldap.c compatible with samba 4. Add ads_get_ldap_server_name() function to samba 3. Move prototypes to root libgpo where appropriate. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gpo_ldap.c now compiles for both samba 3 and 4. Signed-off-by: Günther Deschner --- source4/libgpo/ads_convenience.h | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'source4/libgpo/ads_convenience.h') diff --git a/source4/libgpo/ads_convenience.h b/source4/libgpo/ads_convenience.h index 13bd54b588..48e7357fda 100644 --- a/source4/libgpo/ads_convenience.h +++ b/source4/libgpo/ads_convenience.h @@ -22,9 +22,13 @@ #ifndef __ADS_CONVENIENCE_H__ #define __ADS_CONVENIENCE_H__ +#include "librpc/gen_ndr/security.h" + #define ADS_ERR_OK(status) ((status.error_type == ENUM_ADS_ERROR_NT) ? NT_STATUS_IS_OK(status.err.nt_status):(status.err.rc == 0)) #define ADS_ERROR(rc) ads_build_ldap_error(rc) #define ADS_ERROR_NT(rc) ads_build_nt_error(rc) +#define ADS_SUCCESS ADS_ERROR(0) + #define ADS_ERROR_HAVE_NO_MEMORY(x) do { \ if (!(x)) {\ return ADS_ERROR_NT(NT_STATUS_NO_MEMORY);\ @@ -44,7 +48,7 @@ typedef struct { } ADS_STRUCT; typedef struct ldb_result LDAPMessage; -typedef struct void ** ADS_MODLIST; +typedef void ** ADS_MODLIST; /* there are 3 possible types of errors the ads subsystem can produce */ enum ads_error_type { ENUM_ADS_ERROR_LDAP, ENUM_ADS_ERROR_SYSTEM, ENUM_ADS_ERROR_NT}; @@ -58,4 +62,32 @@ typedef struct { int minor_status; } ADS_STATUS; + +/* Prototypes from ads_convenience.c */ +ADS_STATUS ads_build_nt_error(NTSTATUS); +ADS_STATUS ads_build_ldap_error(int); + +ADS_STATUS ads_startup (struct libnet_context *netctx, ADS_STRUCT **ads); +const char *ads_errstr(ADS_STATUS status); +const char * ads_get_dn(ADS_STRUCT *ads, LDAPMessage *res); +bool ads_pull_sd(ADS_STRUCT *ads, TALLOC_CTX *ctx, LDAPMessage *res, const char *field, struct security_descriptor **sd); +const char * ads_pull_string(ADS_STRUCT *ads, TALLOC_CTX *ctx, LDAPMessage *res, const char *field); +bool ads_pull_uint32(ADS_STRUCT *ads, LDAPMessage *res, const char *field, uint32_t *ret); +int ads_count_replies(ADS_STRUCT *ads, LDAPMessage *res); +ADS_STATUS ads_do_search_all_sd_flags (ADS_STRUCT *ads, const char *dn, int scope, + const char *filter, const char **attrs, + uint32_t sd_flags, LDAPMessage **res); +ADS_STATUS ads_search_dn(ADS_STRUCT *ads, LDAPMessage **res, + const char *dn, const char **attrs); +ADS_STATUS ads_search_retry_dn_sd_flags(ADS_STRUCT *ads, LDAPMessage **res, uint32_t sd_flags, + const char *dn, const char **attrs); +ADS_STATUS ads_msgfree(ADS_STRUCT *ads, LDAPMessage *res); +NTSTATUS ads_ntstatus(ADS_STATUS status); +ADS_STATUS ads_build_ldap_error(int ldb_error); +ADS_STATUS ads_build_nt_error(NTSTATUS nt_status); +ADS_MODLIST ads_init_mods(TALLOC_CTX *ctx); +ADS_STATUS ads_mod_str(TALLOC_CTX *ctx, ADS_MODLIST *mods, const char *name, const char *val); +ADS_STATUS ads_gen_mod(ADS_STRUCT *ads, const char *mod_dn, ADS_MODLIST mods); + + #endif -- cgit