summaryrefslogtreecommitdiff
path: root/source4/libgpo/ads_convenience.h
diff options
context:
space:
mode:
authorWilco Baan Hofman <wilco@baanhofman.nl>2009-03-01 14:06:36 +0100
committerGünther Deschner <gd@samba.org>2009-04-20 23:16:16 +0200
commitc441b7dda8507b22a94146be0df77e54e623645a (patch)
tree6e04da3f0d697527a4f3ba67a940bab8826083ef /source4/libgpo/ads_convenience.h
parent7761850b1f6062b61fbb05124e23703c191229d1 (diff)
downloadsamba-c441b7dda8507b22a94146be0df77e54e623645a.tar.gz
samba-c441b7dda8507b22a94146be0df77e54e623645a.tar.bz2
samba-c441b7dda8507b22a94146be0df77e54e623645a.zip
Add ads convenience functions to samba 4. Move gpo_ldap.c to root libgpo.
Signed-off-by: Günther Deschner <gd@samba.org>
Diffstat (limited to 'source4/libgpo/ads_convenience.h')
-rw-r--r--source4/libgpo/ads_convenience.h61
1 files changed, 61 insertions, 0 deletions
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 <http://www.gnu.org/licenses/>.
+*/
+
+#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