s3-rpc_server request both sign and seal for clarity
[mat/samba.git] / source3 / libads / ads_ldap_protos.h
1 /*
2    Unix SMB/CIFS implementation.
3    ads (active directory) utility library
4    Copyright (C) Andrew Tridgell 2001
5    Copyright (C) Remus Koos 2001
6    Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2002
7    Copyright (C) Guenther Deschner 2005
8    Copyright (C) Gerald Carter 2006
9
10    This program is free software; you can redistribute it and/or modify
11    it under the terms of the GNU General Public License as published by
12    the Free Software Foundation; either version 3 of the License, or
13    (at your option) any later version.
14
15    This program is distributed in the hope that it will be useful,
16    but WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18    GNU General Public License for more details.
19
20    You should have received a copy of the GNU General Public License
21    along with this program.  If not, see <http://www.gnu.org/licenses/>.
22 */
23
24 #ifndef _LIBADS_ADS_LDAP_PROTOS_H_
25 #define _LIBADS_ADS_LDAP_PROTOS_H_
26
27 #ifdef HAVE_LDAP_INIT_FD
28 int ldap_init_fd(ber_socket_t fd, int proto, char *uri, LDAP **ldp);
29 #endif
30
31 /*
32  * Prototypes for ads
33  */
34
35 LDAP *ldap_open_with_timeout(const char *server,
36                              struct sockaddr_storage *ss,
37                              int port, unsigned int to);
38 void ads_msgfree(ADS_STRUCT *ads, LDAPMessage *msg);
39 char *ads_get_dn(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, LDAPMessage *msg);
40
41 char *ads_pull_string(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, LDAPMessage *msg,
42                       const char *field);
43 char **ads_pull_strings(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx,
44                         LDAPMessage *msg, const char *field,
45                         size_t *num_values);
46 char **ads_pull_strings_range(ADS_STRUCT *ads,
47                               TALLOC_CTX *mem_ctx,
48                               LDAPMessage *msg, const char *field,
49                               char **current_strings,
50                               const char **next_attribute,
51                               size_t *num_strings,
52                               bool *more_strings);
53 bool ads_pull_uint32(ADS_STRUCT *ads, LDAPMessage *msg, const char *field,
54                      uint32 *v);
55 bool ads_pull_guid(ADS_STRUCT *ads, LDAPMessage *msg, struct GUID *guid);
56 bool ads_pull_sid(ADS_STRUCT *ads, LDAPMessage *msg, const char *field,
57                   struct dom_sid *sid);
58 int ads_pull_sids(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx,
59                   LDAPMessage *msg, const char *field, struct dom_sid **sids);
60 bool ads_pull_sd(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx,
61                  LDAPMessage *msg, const char *field, struct security_descriptor **sd);
62 char *ads_pull_username(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx,
63                         LDAPMessage *msg);
64 int ads_pull_sids_from_extendeddn(ADS_STRUCT *ads,
65                                   TALLOC_CTX *mem_ctx,
66                                   LDAPMessage *msg,
67                                   const char *field,
68                                   enum ads_extended_dn_flags flags,
69                                   struct dom_sid **sids);
70
71 ADS_STATUS ads_find_machine_acct(ADS_STRUCT *ads, LDAPMessage **res,
72                                  const char *machine);
73 ADS_STATUS ads_find_printer_on_server(ADS_STRUCT *ads, LDAPMessage **res,
74                                       const char *printer,
75                                       const char *servername);
76 ADS_STATUS ads_find_printers(ADS_STRUCT *ads, LDAPMessage **res);
77 ADS_STATUS ads_find_user_acct(ADS_STRUCT *ads, LDAPMessage **res,
78                               const char *user);
79
80 ADS_STATUS ads_do_search(ADS_STRUCT *ads, const char *bind_path, int scope,
81                          const char *expr,
82                          const char **attrs, LDAPMessage **res);
83 ADS_STATUS ads_search(ADS_STRUCT *ads, LDAPMessage **res,
84                       const char *expr, const char **attrs);
85 ADS_STATUS ads_search_dn(ADS_STRUCT *ads, LDAPMessage **res,
86                          const char *dn, const char **attrs);
87 ADS_STATUS ads_do_search_all_args(ADS_STRUCT *ads, const char *bind_path,
88                                   int scope, const char *expr,
89                                   const char **attrs, void *args,
90                                   LDAPMessage **res);
91 ADS_STATUS ads_do_search_all(ADS_STRUCT *ads, const char *bind_path,
92                              int scope, const char *expr,
93                              const char **attrs, LDAPMessage **res);
94 ADS_STATUS ads_do_search_retry(ADS_STRUCT *ads, const char *bind_path,
95                                int scope,
96                                const char *expr,
97                                const char **attrs, LDAPMessage **res);
98 ADS_STATUS ads_search_retry(ADS_STRUCT *ads, LDAPMessage **res,
99                             const char *expr, const char **attrs);
100 ADS_STATUS ads_search_retry_dn(ADS_STRUCT *ads, LDAPMessage **res,
101                                const char *dn,
102                                const char **attrs);
103 ADS_STATUS ads_search_retry_extended_dn_ranged(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx,
104                                                 const char *dn,
105                                                 const char **attrs,
106                                                 enum ads_extended_dn_flags flags,
107                                                 char ***strings,
108                                                 size_t *num_strings);
109 ADS_STATUS ads_search_retry_sid(ADS_STRUCT *ads, LDAPMessage **res,
110                                 const struct dom_sid *sid,
111                                 const char **attrs);
112
113
114 LDAPMessage *ads_first_entry(ADS_STRUCT *ads, LDAPMessage *res);
115 LDAPMessage *ads_next_entry(ADS_STRUCT *ads, LDAPMessage *res);
116 LDAPMessage *ads_first_message(ADS_STRUCT *ads, LDAPMessage *res);
117 LDAPMessage *ads_next_message(ADS_STRUCT *ads, LDAPMessage *res);
118 void ads_process_results(ADS_STRUCT *ads, LDAPMessage *res,
119                          bool (*fn)(ADS_STRUCT *,char *, void **, void *),
120                          void *data_area);
121 void ads_dump(ADS_STRUCT *ads, LDAPMessage *res);
122
123 struct GROUP_POLICY_OBJECT;
124 ADS_STATUS ads_parse_gpo(ADS_STRUCT *ads,
125                          TALLOC_CTX *mem_ctx,
126                          LDAPMessage *res,
127                          const char *gpo_dn,
128                          struct GROUP_POLICY_OBJECT *gpo);
129 ADS_STATUS ads_search_retry_dn_sd_flags(ADS_STRUCT *ads, LDAPMessage **res,
130                                          uint32 sd_flags,
131                                          const char *dn,
132                                          const char **attrs);
133 ADS_STATUS ads_do_search_all_sd_flags(ADS_STRUCT *ads, const char *bind_path,
134                                        int scope, const char *expr,
135                                        const char **attrs, uint32 sd_flags,
136                                        LDAPMessage **res);
137 ADS_STATUS ads_get_tokensids(ADS_STRUCT *ads,
138                               TALLOC_CTX *mem_ctx,
139                               const char *dn,
140                               struct dom_sid *user_sid,
141                               struct dom_sid *primary_group_sid,
142                               struct dom_sid **sids,
143                               size_t *num_sids);
144 ADS_STATUS ads_get_joinable_ous(ADS_STRUCT *ads,
145                                 TALLOC_CTX *mem_ctx,
146                                 char ***ous,
147                                 size_t *num_ous);
148
149 #endif /* _LIBADS_ADS_LDAP_PROTOS_H_ */