tests/gkdi: Remove implicit clock skew offset
[Samba.git] / source3 / include / smbldap.h
blob8820d141b8f8a3bb9671ce3e25b9671dabf27216
1 /*
2 Unix SMB/CIFS Implementation.
3 LDAP protocol helper functions for SAMBA
4 Copyright (C) Gerald Carter 2001-2003
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #ifndef _SMBLDAP_H
22 #define _SMBLDAP_H
24 #include "include/smb_ldap.h"
26 #ifdef HAVE_LDAP
28 #include <talloc.h>
29 #include <tevent.h>
31 /**
32 * Struct to keep the state for all the ldap stuff
36 struct smbldap_state;
37 typedef int (*smbldap_bind_callback_fn)(LDAP *ldap_struct,
38 struct smbldap_state *ldap_state,
39 void *data);
41 /* The following definitions come from lib/smbldap.c */
43 NTSTATUS smbldap_init(TALLOC_CTX *mem_ctx,
44 struct tevent_context *tevent_ctx,
45 const char *location,
46 bool anon,
47 const char *bind_dn,
48 const char *bind_secret,
49 struct smbldap_state **smbldap_state);
51 LDAP *smbldap_get_ldap(struct smbldap_state *state);
52 bool smbldap_get_paged_results(struct smbldap_state *state);
53 void smbldap_set_paged_results(struct smbldap_state *state,
54 bool paged_results);
56 void smbldap_set_bind_callback(struct smbldap_state *state,
57 smbldap_bind_callback_fn callback,
58 void *callback_data);
60 void smbldap_set_mod (LDAPMod *** modlist, int modop, const char *attribute, const char *value);
61 void smbldap_set_mod_blob(LDAPMod *** modlist, int modop, const char *attribute, const DATA_BLOB *newblob);
62 void smbldap_make_mod(LDAP *ldap_struct, LDAPMessage *existing,
63 LDAPMod ***mods,
64 const char *attribute, const char *newval);
65 void smbldap_make_mod_blob(LDAP *ldap_struct, LDAPMessage *existing,
66 LDAPMod ***mods,
67 const char *attribute, const DATA_BLOB *newblob);
68 bool smbldap_get_single_attribute (LDAP * ldap_struct, LDAPMessage * entry,
69 const char *attribute, char *value,
70 int max_len);
71 int smbldap_modify(struct smbldap_state *ldap_state,
72 const char *dn,
73 LDAPMod *attrs[]);
74 int smbldap_start_tls(LDAP *ldap_struct, int version);
75 int smbldap_start_tls_start(LDAP *ldap_struct, int version);
76 int smbldap_setup_full_conn(LDAP **ldap_struct, const char *uri);
77 int smbldap_search(struct smbldap_state *ldap_state,
78 const char *base, int scope, const char *filter,
79 const char *attrs[], int attrsonly,
80 LDAPMessage **res);
81 int smbldap_search_paged(struct smbldap_state *ldap_state,
82 const char *base, int scope, const char *filter,
83 const char **attrs, int attrsonly, int pagesize,
84 LDAPMessage **res, void **cookie);
85 int smbldap_modify(struct smbldap_state *ldap_state, const char *dn, LDAPMod *attrs[]);
86 int smbldap_add(struct smbldap_state *ldap_state, const char *dn, LDAPMod *attrs[]);
87 int smbldap_delete(struct smbldap_state *ldap_state, const char *dn);
88 int smbldap_extended_operation(struct smbldap_state *ldap_state,
89 LDAP_CONST char *reqoid, struct berval *reqdata,
90 LDAPControl **serverctrls, LDAPControl **clientctrls,
91 char **retoidp, struct berval **retdatap);
92 int smbldap_search_suffix (struct smbldap_state *ldap_state,
93 const char *filter, const char **search_attr,
94 LDAPMessage ** result);
95 void smbldap_free_struct(struct smbldap_state **ldap_state) ;
96 bool smbldap_has_control(LDAP *ld, const char *control);
97 bool smbldap_has_extension(LDAP *ld, const char *extension);
98 bool smbldap_has_naming_context(LDAP *ld, const char *naming_context);
99 bool smbldap_set_creds(struct smbldap_state *ldap_state, bool anon, const char *dn, const char *secret);
100 char * smbldap_talloc_single_attribute(LDAP *ldap_struct, LDAPMessage *entry,
101 const char *attribute,
102 TALLOC_CTX *mem_ctx);
103 char * smbldap_talloc_first_attribute(LDAP *ldap_struct, LDAPMessage *entry,
104 const char *attribute,
105 TALLOC_CTX *mem_ctx);
106 char * smbldap_talloc_smallest_attribute(LDAP *ldap_struct, LDAPMessage *entry,
107 const char *attribute,
108 TALLOC_CTX *mem_ctx);
109 bool smbldap_talloc_single_blob(TALLOC_CTX *mem_ctx, LDAP *ld,
110 LDAPMessage *msg, const char *attrib,
111 DATA_BLOB *blob);
112 bool smbldap_pull_sid(LDAP *ld, LDAPMessage *msg, const char *attrib,
113 struct dom_sid *sid);
114 void smbldap_talloc_autofree_ldapmsg(TALLOC_CTX *mem_ctx, LDAPMessage *result);
115 void smbldap_talloc_autofree_ldapmod(TALLOC_CTX *mem_ctx, LDAPMod **mod);
116 char *smbldap_talloc_dn(TALLOC_CTX *mem_ctx, LDAP *ld,
117 LDAPMessage *entry);
119 #endif /* HAVE_LDAP */
121 #endif /* _SMBLDAP_H */