VERSION: Bump version up to 4.10.8...
[Samba.git] / source3 / libads / ads_proto.h
blob154bf67f9641b5f05401e8f3622ce5c42de810f3
1 /*
2 * Unix SMB/CIFS implementation.
3 * ads (active directory) utility library
5 * Copyright (C) Andrew Bartlett 2001
6 * Copyright (C) Andrew Tridgell 2001
7 * Copyright (C) Remus Koos (remuskoos@yahoo.com) 2001
8 * Copyright (C) Alexey Kotovich 2002
9 * Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2002-2003
10 * Copyright (C) Luke Howard 2003
11 * Copyright (C) Guenther Deschner 2003-2008
12 * Copyright (C) Rakesh Patel 2004
13 * Copyright (C) Dan Perry 2004
14 * Copyright (C) Jeremy Allison 2004
15 * Copyright (C) Gerald Carter 2006
16 * Copyright (C) Stefan Metzmacher 2007
18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation; either version 3 of the License, or
21 * (at your option) any later version.
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
28 * You should have received a copy of the GNU General Public License
29 * along with this program. If not, see <http://www.gnu.org/licenses/>.
32 #ifndef _LIBADS_ADS_PROTO_H_
33 #define _LIBADS_ADS_PROTO_H_
35 /* The following definitions come from libads/ads_struct.c */
37 char *ads_build_path(const char *realm, const char *sep, const char *field, int reverse);
38 char *ads_build_dn(const char *realm);
39 char *ads_build_domain(const char *dn);
40 ADS_STRUCT *ads_init(const char *realm,
41 const char *workgroup,
42 const char *ldap_server);
43 bool ads_set_sasl_wrap_flags(ADS_STRUCT *ads, int flags);
44 void ads_destroy(ADS_STRUCT **ads);
46 /* The following definitions come from libads/disp_sec.c */
48 void ads_disp_sd(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, struct security_descriptor *sd);
50 /* The following definitions come from libads/kerberos_keytab.c */
52 int ads_keytab_add_entry(ADS_STRUCT *ads, const char *srvPrinc,
53 bool update_ads);
54 int ads_keytab_flush(ADS_STRUCT *ads);
55 int ads_keytab_create_default(ADS_STRUCT *ads);
56 int ads_keytab_list(const char *keytab_name);
58 /* The following definitions come from libads/net_ads_setspn.c */
59 bool ads_setspn_list(ADS_STRUCT *ads, const char *machine);
60 bool ads_setspn_add(ADS_STRUCT *ads, const char *machine_name,
61 const char * spn);
62 bool ads_setspn_delete(ADS_STRUCT *ads, const char *machine_name,
63 const char * spn);
65 /* The following definitions come from libads/krb5_errs.c */
67 /* The following definitions come from libads/kerberos_util.c */
69 int ads_kinit_password(ADS_STRUCT *ads);
71 /* The following definitions come from libads/ldap.c */
73 bool ads_sitename_match(ADS_STRUCT *ads);
74 bool ads_closest_dc(ADS_STRUCT *ads);
75 ADS_STATUS ads_connect(ADS_STRUCT *ads);
76 ADS_STATUS ads_connect_user_creds(ADS_STRUCT *ads);
77 void ads_disconnect(ADS_STRUCT *ads);
78 ADS_STATUS ads_do_search_all_fn(ADS_STRUCT *ads, const char *bind_path,
79 int scope, const char *expr, const char **attrs,
80 bool (*fn)(ADS_STRUCT *, char *, void **, void *),
81 void *data_area);
82 char *ads_parent_dn(const char *dn);
83 ADS_MODLIST ads_init_mods(TALLOC_CTX *ctx);
84 ADS_STATUS ads_mod_str(TALLOC_CTX *ctx, ADS_MODLIST *mods,
85 const char *name, const char *val);
86 ADS_STATUS ads_mod_strlist(TALLOC_CTX *ctx, ADS_MODLIST *mods,
87 const char *name, const char **vals);
88 ADS_STATUS ads_gen_mod(ADS_STRUCT *ads, const char *mod_dn, ADS_MODLIST mods);
89 ADS_STATUS ads_gen_add(ADS_STRUCT *ads, const char *new_dn, ADS_MODLIST mods);
90 ADS_STATUS ads_del_dn(ADS_STRUCT *ads, char *del_dn);
91 char *ads_ou_string(ADS_STRUCT *ads, const char *org_unit);
92 char *ads_default_ou_string(ADS_STRUCT *ads, const char *wknguid);
93 ADS_STATUS ads_add_strlist(TALLOC_CTX *ctx, ADS_MODLIST *mods,
94 const char *name, const char **vals);
95 uint32_t ads_get_kvno(ADS_STRUCT *ads, const char *account_name);
96 uint32_t ads_get_machine_kvno(ADS_STRUCT *ads, const char *machine_name);
98 bool ads_element_in_array(const char **el_array, size_t num_el, const char *el);
100 ADS_STATUS ads_get_service_principal_names(TALLOC_CTX *mem_ctx,
101 ADS_STRUCT *ads,
102 const char *machine_name,
103 char ***spn_array,
104 size_t *num_spns);
105 ADS_STATUS ads_clear_service_principal_names(ADS_STRUCT *ads, const char *machine_name);
106 ADS_STATUS ads_add_service_principal_names(ADS_STRUCT *ads, const char *machine_name,
107 const char **spns);
108 ADS_STATUS ads_create_machine_acct(ADS_STRUCT *ads,
109 const char *machine_name,
110 const char *org_unit,
111 uint32_t etype_list);
112 ADS_STATUS ads_move_machine_acct(ADS_STRUCT *ads, const char *machine_name,
113 const char *org_unit, bool *moved);
114 int ads_count_replies(ADS_STRUCT *ads, void *res);
115 ADS_STATUS ads_USN(ADS_STRUCT *ads, uint32_t *usn);
116 ADS_STATUS ads_current_time(ADS_STRUCT *ads);
117 ADS_STATUS ads_domain_func_level(ADS_STRUCT *ads, uint32_t *val);
118 ADS_STATUS ads_domain_sid(ADS_STRUCT *ads, struct dom_sid *sid);
119 ADS_STATUS ads_site_dn(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, const char **site_name);
120 ADS_STATUS ads_site_dn_for_machine(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, const char *computer_name, const char **site_dn);
121 ADS_STATUS ads_upn_suffixes(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, char ***suffixes, size_t *num_suffixes);
122 ADS_STATUS ads_get_joinable_ous(ADS_STRUCT *ads,
123 TALLOC_CTX *mem_ctx,
124 char ***ous,
125 size_t *num_ous);
126 ADS_STATUS ads_get_sid_from_extended_dn(TALLOC_CTX *mem_ctx,
127 const char *extended_dn,
128 enum ads_extended_dn_flags flags,
129 struct dom_sid *sid);
130 char* ads_get_dnshostname( ADS_STRUCT *ads, TALLOC_CTX *ctx, const char *machine_name );
131 char* ads_get_upn( ADS_STRUCT *ads, TALLOC_CTX *ctx, const char *machine_name );
132 bool ads_has_samaccountname( ADS_STRUCT *ads, TALLOC_CTX *ctx, const char *machine_name );
133 ADS_STATUS ads_join_realm(ADS_STRUCT *ads, const char *machine_name,
134 uint32_t account_type, const char *org_unit);
135 ADS_STATUS ads_leave_realm(ADS_STRUCT *ads, const char *hostname);
136 ADS_STATUS ads_find_samaccount(ADS_STRUCT *ads,
137 TALLOC_CTX *mem_ctx,
138 const char *samaccountname,
139 uint32_t *uac_ret,
140 const char **dn_ret);
141 ADS_STATUS ads_config_path(ADS_STRUCT *ads,
142 TALLOC_CTX *mem_ctx,
143 char **config_path);
144 const char *ads_get_extended_right_name_by_guid(ADS_STRUCT *ads,
145 const char *config_path,
146 TALLOC_CTX *mem_ctx,
147 const struct GUID *rights_guid);
148 ADS_STATUS ads_check_ou_dn(TALLOC_CTX *mem_ctx,
149 ADS_STRUCT *ads,
150 const char **account_ou);
152 /* The following definitions come from libads/ldap_printer.c */
154 ADS_STATUS ads_mod_printer_entry(ADS_STRUCT *ads, char *prt_dn,
155 TALLOC_CTX *ctx, const ADS_MODLIST *mods);
156 ADS_STATUS ads_add_printer_entry(ADS_STRUCT *ads, char *prt_dn,
157 TALLOC_CTX *ctx, ADS_MODLIST *mods);
158 WERROR get_remote_printer_publishing_data(struct rpc_pipe_client *cli,
159 TALLOC_CTX *mem_ctx,
160 ADS_MODLIST *mods,
161 const char *printer);
163 /* The following definitions come from libads/ldap_user.c */
165 ADS_STATUS ads_add_user_acct(ADS_STRUCT *ads, const char *user,
166 const char *container, const char *fullname);
167 ADS_STATUS ads_add_group_acct(ADS_STRUCT *ads, const char *group,
168 const char *container, const char *comment);
170 /* The following definitions come from libads/ldap_utils.c */
172 ADS_STATUS ads_ranged_search(ADS_STRUCT *ads,
173 TALLOC_CTX *mem_ctx,
174 int scope,
175 const char *base,
176 const char *filter,
177 void *args,
178 const char *range_attr,
179 char ***strings,
180 size_t *num_strings);
182 /* The following definitions come from libads/ndr.c */
184 struct ndr_print;
185 void ndr_print_ads_struct(struct ndr_print *ndr, const char *name, const struct ads_struct *r);
187 /* The following definitions come from libads/sasl.c */
189 ADS_STATUS ads_sasl_bind(ADS_STRUCT *ads);
191 /* The following definitions come from libads/sasl_wrapping.c */
193 ADS_STATUS ads_setup_sasl_wrapping(struct ads_saslwrap *wrap, LDAP *ld,
194 const struct ads_saslwrap_ops *ops,
195 void *private_data);
196 void ndr_print_ads_saslwrap_struct(struct ndr_print *ndr,
197 const char *name,
198 const struct ads_saslwrap *r);
200 /* The following definitions come from libads/util.c */
202 ADS_STATUS ads_change_trust_account_password(ADS_STRUCT *ads, char *host_principal);
204 struct spn_struct {
205 const char *serviceclass;
206 const char *servicename;
207 const char *host;
208 int32_t port;
211 /* parse a windows style SPN, returns NULL if parsing fails */
212 struct spn_struct *parse_spn(TALLOC_CTX *ctx, const char *srvprinc);
214 #endif /* _LIBADS_ADS_PROTO_H_ */