From c441b7dda8507b22a94146be0df77e54e623645a Mon Sep 17 00:00:00 2001 From: Wilco Baan Hofman Date: Sun, 1 Mar 2009 14:06:36 +0100 Subject: Add ads convenience functions to samba 4. Move gpo_ldap.c to root libgpo. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Günther Deschner --- source4/libgpo/ads_convenience.h | 61 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 source4/libgpo/ads_convenience.h (limited to 'source4/libgpo/ads_convenience.h') diff --git a/source4/libgpo/ads_convenience.h b/source4/libgpo/ads_convenience.h new file mode 100644 index 0000000000..13bd54b588 --- /dev/null +++ b/source4/libgpo/ads_convenience.h @@ -0,0 +1,61 @@ +/* + Samba CIFS implementation + ADS convenience functions for GPO + + Copyright (C) 2008 Jelmer Vernooij, jelmer@samba.org + Copyright (C) 2008 Wilco Baan Hofman, wilco@baanhofman.nl + + 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 3 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, see . +*/ + +#ifndef __ADS_CONVENIENCE_H__ +#define __ADS_CONVENIENCE_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_ERROR_HAVE_NO_MEMORY(x) do { \ + if (!(x)) {\ + return ADS_ERROR_NT(NT_STATUS_NO_MEMORY);\ + }\ +} while (0) + +#define LDAP_SCOPE_BASE LDB_SCOPE_BASE +#define LDAP_SCOPE_SUBTREE LDB_SCOPE_SUBTREE +#define LDAP_SCOPE_ONELEVEL LDB_SCOPE_ONELEVEL + + + + +typedef struct { + struct libnet_context *netctx; + struct ldb_context *ldbctx; +} ADS_STRUCT; + +typedef struct ldb_result LDAPMessage; +typedef struct 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}; + +typedef struct { + enum ads_error_type error_type; + union err_state{ + int rc; + NTSTATUS nt_status; + } err; + int minor_status; +} ADS_STATUS; + +#endif -- cgit