net: Make "net ads" use functable3
[tprouty/samba.git] / source3 / utils / net_proto.h
1 /*
2  * Unix SMB/CIFS implementation.
3  * collected prototypes header
4  *
5  * frozen from "make proto" in May 2008
6  *
7  * Copyright (C) Michael Adam 2008
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, see <http://www.gnu.org/licenses/>.
21  */
22
23 #ifndef _NET_PROTO_H_
24 #define _NET_PROTO_H_
25
26
27 /* The following definitions come from auth/token_util.c  */
28
29 bool nt_token_check_sid ( const DOM_SID *sid, const NT_USER_TOKEN *token );
30 bool nt_token_check_domain_rid( NT_USER_TOKEN *token, uint32 rid );
31 NT_USER_TOKEN *get_root_nt_token( void );
32 NTSTATUS add_aliases(const DOM_SID *domain_sid,
33                      struct nt_user_token *token);
34 struct nt_user_token *create_local_nt_token(TALLOC_CTX *mem_ctx,
35                                             const DOM_SID *user_sid,
36                                             bool is_guest,
37                                             int num_groupsids,
38                                             const DOM_SID *groupsids);
39 void debug_nt_user_token(int dbg_class, int dbg_lev, NT_USER_TOKEN *token);
40 void debug_unix_user_token(int dbg_class, int dbg_lev, uid_t uid, gid_t gid,
41                            int n_groups, gid_t *groups);
42
43 /* The following definitions come from utils/net.c  */
44
45 uint32 get_sec_channel_type(const char *param);
46
47 /* The following definitions come from utils/net_ads.c  */
48
49 ADS_STATUS ads_startup(struct net_context *c, bool only_own_domain, ADS_STRUCT **ads);
50 ADS_STATUS ads_startup_nobind(struct net_context *c, bool only_own_domain, ADS_STRUCT **ads);
51 int net_ads_check_our_domain(struct net_context *c);
52 int net_ads_check(struct net_context *c);
53 int net_ads_user(struct net_context *c, int argc, const char **argv);
54 int net_ads_group(struct net_context *c, int argc, const char **argv);
55 int net_ads_testjoin(struct net_context *c, int argc, const char **argv);
56 int net_ads_join(struct net_context *c, int argc, const char **argv);
57 int net_ads_printer_usage(struct net_context *c, int argc, const char **argv);
58 int net_ads_changetrustpw(struct net_context *c, int argc, const char **argv);
59 int net_ads_keytab(struct net_context *c, int argc, const char **argv);
60 int net_ads_kerberos(struct net_context *c, int argc, const char **argv);
61 int net_ads(struct net_context *c, int argc, const char **argv);
62
63 /* The following definitions come from utils/net_ads_gpo.c  */
64
65 int net_ads_gpo(struct net_context *c, int argc, const char **argv);
66
67 /* The following definitions come from utils/net_cache.c  */
68
69 int net_cache(struct net_context *c, int argc, const char **argv);
70
71 /* The following definitions come from utils/net_conf.c  */
72
73 int net_conf(struct net_context *c, int argc, const char **argv);
74
75 /* The following definitions come from utils/net_dns.c  */
76
77 int get_my_ip_address( struct sockaddr_storage **pp_ss );
78
79 /* The following definitions come from utils/net_dom.c  */
80
81 int net_dom_usage(struct net_context *c, int argc, const char **argv);
82 int net_dom(struct net_context *c, int argc, const char **argv);
83
84 /* The following definitions come from utils/net_file.c  */
85
86 int net_file_usage(struct net_context *c, int argc, const char **argv);
87 int net_file(struct net_context *c, int argc, const char **argv);
88
89 /* The following definitions come from utils/net_group.c  */
90
91 int net_group_usage(struct net_context *c, int argc, const char **argv);
92 int net_group(struct net_context *c, int argc, const char **argv);
93
94 /* The following definitions come from utils/net_groupmap.c  */
95
96 int net_groupmap_usage(struct net_context *c, int argc, const char **argv);
97 int net_groupmap(struct net_context *c, int argc, const char **argv);
98
99 /* The following definitions come from utils/net_help.c  */
100
101 int net_help(struct net_context *c, int argc, const char **argv);
102
103 /* The following definitions come from utils/net_idmap.c  */
104
105 bool idmap_store_secret(const char *backend, bool alloc,
106                         const char *domain, const char *identity,
107                         const char *secret);
108 int net_help_idmap(struct net_context *c, int argc, const char **argv);
109 int net_idmap(struct net_context *c, int argc, const char **argv);
110
111 /* The following definitions come from utils/net_join.c  */
112
113 int net_join_usage(struct net_context *c, int argc, const char **argv);
114 int net_join(struct net_context *c, int argc, const char **argv);
115
116 /* The following definitions come from utils/net_lookup.c  */
117
118 int net_lookup_usage(struct net_context *c, int argc, const char **argv);
119 int net_lookup(struct net_context *c, int argc, const char **argv);
120
121 /* The following definitions come from utils/net_rap.c  */
122
123 int net_rap_file_usage(struct net_context *c, int argc, const char **argv);
124 int net_rap_file(struct net_context *c, int argc, const char **argv);
125 int net_rap_share_usage(struct net_context *c, int argc, const char **argv);
126 int net_rap_share(struct net_context *c, int argc, const char **argv);
127 int net_rap_session_usage(struct net_context *c, int argc, const char **argv);
128 int net_rap_session(struct net_context *c, int argc, const char **argv);
129 int net_rap_server_usage(struct net_context *c, int argc, const char **argv);
130 int net_rap_server(struct net_context *c, int argc, const char **argv);
131 int net_rap_domain_usage(struct net_context *c, int argc, const char **argv);
132 int net_rap_domain(struct net_context *c, int argc, const char **argv);
133 int net_rap_printq_usage(struct net_context *c, int argc, const char **argv);
134 int net_rap_printq(struct net_context *c, int argc, const char **argv);
135 int net_rap_user(struct net_context *c, int argc, const char **argv);
136 int net_rap_group_usage(struct net_context *c, int argc, const char **argv);
137 int net_rap_group(struct net_context *c, int argc, const char **argv);
138 int net_rap_groupmember_usage(struct net_context *c, int argc, const char **argv);
139 int net_rap_groupmember(struct net_context *c, int argc, const char **argv);
140 int net_rap_validate_usage(struct net_context *c, int argc, const char **argv);
141 int net_rap_validate(struct net_context *c, int argc, const char **argv);
142 int net_rap_service_usage(struct net_context *c, int argc, const char **argv);
143 int net_rap_service(struct net_context *c, int argc, const char **argv);
144 int net_rap_password_usage(struct net_context *c, int argc, const char **argv);
145 int net_rap_password(struct net_context *c, int argc, const char **argv);
146 int net_rap_admin_usage(struct net_context *c, int argc, const char **argv);
147 int net_rap_admin(struct net_context *c, int argc, const char **argv);
148 int net_rap_help(struct net_context *c, int argc, const char **argv);
149 int net_rap_usage(struct net_context *c, int argc, const char **argv);
150 int net_rap(struct net_context *c, int argc, const char **argv);
151
152 /* The following definitions come from utils/net_registry.c  */
153
154 int net_registry(struct net_context *c, int argc, const char **argv);
155
156 /* The following definitions come from utils/net_rpc.c  */
157
158 NTSTATUS net_get_remote_domain_sid(struct cli_state *cli, TALLOC_CTX *mem_ctx,
159                                    DOM_SID **domain_sid,
160                                    const char **domain_name);
161 int run_rpc_command(struct net_context *c,
162                         struct cli_state *cli_arg,
163                         const int pipe_idx,
164                         int conn_flags,
165                         rpc_command_fn fn,
166                         int argc,
167                         const char **argv);
168 int net_rpc_changetrustpw(struct net_context *c, int argc, const char **argv);
169 int net_rpc_join(struct net_context *c, int argc, const char **argv);
170 NTSTATUS rpc_info_internals(struct net_context *c,
171                         const DOM_SID *domain_sid,
172                         const char *domain_name,
173                         struct cli_state *cli,
174                         struct rpc_pipe_client *pipe_hnd,
175                         TALLOC_CTX *mem_ctx,
176                         int argc,
177                         const char **argv);
178 int net_rpc_info(struct net_context *c, int argc, const char **argv);
179 int net_rpc_getsid(struct net_context *c, int argc, const char **argv);
180 int net_rpc_user(struct net_context *c, int argc, const char **argv);
181 struct rpc_sh_cmd *net_rpc_user_edit_cmds(struct net_context *c,
182                                           TALLOC_CTX *mem_ctx,
183                                           struct rpc_sh_ctx *ctx);
184 struct rpc_sh_cmd *net_rpc_user_cmds(struct net_context *c,
185                                      TALLOC_CTX *mem_ctx,
186                                      struct rpc_sh_ctx *ctx);
187 int net_rpc_group(struct net_context *c, int argc, const char **argv);
188 bool copy_top_level_perms(struct net_context *c,
189                                 struct copy_clistate *cp_clistate,
190                                 const char *sharename);
191 int net_usersidlist(struct net_context *c, int argc, const char **argv);
192 int net_usersidlist_usage(struct net_context *c, int argc, const char **argv);
193 int net_rpc_share(struct net_context *c, int argc, const char **argv);
194 struct rpc_sh_cmd *net_rpc_share_cmds(struct net_context *c, TALLOC_CTX *mem_ctx,
195                                       struct rpc_sh_ctx *ctx);
196 int net_rpc_file(struct net_context *c, int argc, const char **argv);
197 NTSTATUS rpc_init_shutdown_internals(struct net_context *c,
198                                      const DOM_SID *domain_sid,
199                                      const char *domain_name,
200                                      struct cli_state *cli,
201                                      struct rpc_pipe_client *pipe_hnd,
202                                      TALLOC_CTX *mem_ctx,
203                                      int argc,
204                                      const char **argv);
205 NTSTATUS rpc_reg_shutdown_internals(struct net_context *c,
206                                     const DOM_SID *domain_sid,
207                                     const char *domain_name,
208                                     struct cli_state *cli,
209                                     struct rpc_pipe_client *pipe_hnd,
210                                     TALLOC_CTX *mem_ctx,
211                                     int argc,
212                                     const char **argv);
213 bool net_rpc_check(struct net_context *c, unsigned flags);
214 int rpc_printer_migrate(struct net_context *c, int argc, const char **argv);
215 int rpc_printer_usage(struct net_context *c, int argc, const char **argv);
216 int net_rpc_printer(struct net_context *c, int argc, const char **argv);
217 int net_rpc_help(struct net_context *c, int argc, const char **argv);
218 int net_rpc_usage(struct net_context *c, int argc, const char **argv);
219 int net_rpc(struct net_context *c, int argc, const char **argv);
220
221 /* The following definitions come from utils/net_rpc_audit.c  */
222
223 int net_rpc_audit(struct net_context *c, int argc, const char **argv);
224
225 /* The following definitions come from utils/net_rpc_join.c  */
226
227 NTSTATUS net_rpc_join_ok(struct net_context *c, const char *domain,
228                          const char *server, struct sockaddr_storage *pss);
229 int net_rpc_join_newstyle(struct net_context *c, int argc, const char **argv);
230 int net_rpc_testjoin(struct net_context *c, int argc, const char **argv);
231
232 /* The following definitions come from utils/net_rpc_printer.c  */
233
234 NTSTATUS net_copy_fileattr(struct net_context *c,
235                   TALLOC_CTX *mem_ctx,
236                   struct cli_state *cli_share_src,
237                   struct cli_state *cli_share_dst,
238                   const char *src_name, const char *dst_name,
239                   bool copy_acls, bool copy_attrs,
240                   bool copy_timestamps, bool is_file);
241 NTSTATUS net_copy_file(struct net_context *c,
242                        TALLOC_CTX *mem_ctx,
243                        struct cli_state *cli_share_src,
244                        struct cli_state *cli_share_dst,
245                        const char *src_name, const char *dst_name,
246                        bool copy_acls, bool copy_attrs,
247                        bool copy_timestamps, bool is_file);
248 NTSTATUS rpc_printer_list_internals(struct net_context *c,
249                                         const DOM_SID *domain_sid,
250                                         const char *domain_name,
251                                         struct cli_state *cli,
252                                         struct rpc_pipe_client *pipe_hnd,
253                                         TALLOC_CTX *mem_ctx,
254                                         int argc,
255                                         const char **argv);
256 NTSTATUS rpc_printer_driver_list_internals(struct net_context *c,
257                                                 const DOM_SID *domain_sid,
258                                                 const char *domain_name,
259                                                 struct cli_state *cli,
260                                                 struct rpc_pipe_client *pipe_hnd,
261                                                 TALLOC_CTX *mem_ctx,
262                                                 int argc,
263                                                 const char **argv);
264 NTSTATUS rpc_printer_publish_publish_internals(struct net_context *c,
265                                                 const DOM_SID *domain_sid,
266                                                 const char *domain_name,
267                                                 struct cli_state *cli,
268                                                 struct rpc_pipe_client *pipe_hnd,
269                                                 TALLOC_CTX *mem_ctx,
270                                                 int argc,
271                                                 const char **argv);
272 NTSTATUS rpc_printer_publish_unpublish_internals(struct net_context *c,
273                                                 const DOM_SID *domain_sid,
274                                                 const char *domain_name,
275                                                 struct cli_state *cli,
276                                                 struct rpc_pipe_client *pipe_hnd,
277                                                 TALLOC_CTX *mem_ctx,
278                                                 int argc,
279                                                 const char **argv);
280 NTSTATUS rpc_printer_publish_update_internals(struct net_context *c,
281                                                 const DOM_SID *domain_sid,
282                                                 const char *domain_name,
283                                                 struct cli_state *cli,
284                                                 struct rpc_pipe_client *pipe_hnd,
285                                                 TALLOC_CTX *mem_ctx,
286                                                 int argc,
287                                                 const char **argv);
288 NTSTATUS rpc_printer_publish_list_internals(struct net_context *c,
289                                                 const DOM_SID *domain_sid,
290                                                 const char *domain_name,
291                                                 struct cli_state *cli,
292                                                 struct rpc_pipe_client *pipe_hnd,
293                                                 TALLOC_CTX *mem_ctx,
294                                                 int argc,
295                                                 const char **argv);
296 NTSTATUS rpc_printer_migrate_security_internals(struct net_context *c,
297                                                 const DOM_SID *domain_sid,
298                                                 const char *domain_name,
299                                                 struct cli_state *cli,
300                                                 struct rpc_pipe_client *pipe_hnd,
301                                                 TALLOC_CTX *mem_ctx,
302                                                 int argc,
303                                                 const char **argv);
304 NTSTATUS rpc_printer_migrate_forms_internals(struct net_context *c,
305                                                 const DOM_SID *domain_sid,
306                                                 const char *domain_name,
307                                                 struct cli_state *cli,
308                                                 struct rpc_pipe_client *pipe_hnd,
309                                                 TALLOC_CTX *mem_ctx,
310                                                 int argc,
311                                                 const char **argv);
312 NTSTATUS rpc_printer_migrate_drivers_internals(struct net_context *c,
313                                                 const DOM_SID *domain_sid,
314                                                 const char *domain_name,
315                                                 struct cli_state *cli,
316                                                 struct rpc_pipe_client *pipe_hnd,
317                                                 TALLOC_CTX *mem_ctx,
318                                                 int argc,
319                                                 const char **argv);
320 NTSTATUS rpc_printer_migrate_printers_internals(struct net_context *c,
321                                                 const DOM_SID *domain_sid,
322                                                 const char *domain_name,
323                                                 struct cli_state *cli,
324                                                 struct rpc_pipe_client *pipe_hnd,
325                                                 TALLOC_CTX *mem_ctx,
326                                                 int argc,
327                                                 const char **argv);
328 NTSTATUS rpc_printer_migrate_settings_internals(struct net_context *c,
329                                                 const DOM_SID *domain_sid,
330                                                 const char *domain_name,
331                                                 struct cli_state *cli,
332                                                 struct rpc_pipe_client *pipe_hnd,
333                                                 TALLOC_CTX *mem_ctx,
334                                                 int argc,
335                                                 const char **argv);
336
337 /* The following definitions come from utils/net_rpc_registry.c  */
338
339 int net_rpc_registry(struct net_context *c, int argc, const char **argv);
340
341 /* The following definitions come from utils/net_rpc_rights.c  */
342
343 int net_rpc_rights(struct net_context *c, int argc, const char **argv);
344 struct rpc_sh_cmd *net_rpc_rights_cmds(struct net_context *c, TALLOC_CTX *mem_ctx,
345                                        struct rpc_sh_ctx *ctx);
346
347 /* The following definitions come from utils/net_rpc_samsync.c  */
348
349 NTSTATUS rpc_samdump_internals(struct net_context *c,
350                                 const DOM_SID *domain_sid,
351                                 const char *domain_name,
352                                 struct cli_state *cli,
353                                 struct rpc_pipe_client *pipe_hnd,
354                                 TALLOC_CTX *mem_ctx,
355                                 int argc,
356                                 const char **argv);
357 int rpc_vampire_usage(struct net_context *c, int argc, const char **argv);
358 NTSTATUS rpc_vampire_internals(struct net_context *c,
359                                 const DOM_SID *domain_sid,
360                                 const char *domain_name,
361                                 struct cli_state *cli,
362                                 struct rpc_pipe_client *pipe_hnd,
363                                 TALLOC_CTX *mem_ctx,
364                                 int argc,
365                                 const char **argv);
366
367 /* The following definitions come from utils/net_rpc_service.c  */
368
369 const char *svc_status_string( uint32 state );
370 int net_rpc_service(struct net_context *c, int argc, const char **argv);
371
372 /* The following definitions come from utils/net_rpc_sh_acct.c  */
373
374 struct rpc_sh_cmd *net_rpc_acct_cmds(struct net_context *c, TALLOC_CTX *mem_ctx,
375                                      struct rpc_sh_ctx *ctx);
376
377 /* The following definitions come from utils/net_rpc_shell.c  */
378
379 int net_rpc_shell(struct net_context *c, int argc, const char **argv);
380
381 /* The following definitions come from utils/net_sam.c  */
382
383 int net_sam(struct net_context *c, int argc, const char **argv);
384
385 /* The following definitions come from utils/net_share.c  */
386
387 int net_share_usage(struct net_context *c, int argc, const char **argv);
388 int net_share(struct net_context *c, int argc, const char **argv);
389
390 /* The following definitions come from utils/net_status.c  */
391
392 int net_status_usage(struct net_context *c, int argc, const char **argv);
393 int net_status(struct net_context *c, int argc, const char **argv);
394
395 /* The following definitions come from utils/net_time.c  */
396
397 int net_time_usage(struct net_context *c, int argc, const char **argv);
398 int net_time(struct net_context *c, int argc, const char **argv);
399
400 /* The following definitions come from utils/net_user.c  */
401
402 int net_user_usage(struct net_context *c, int argc, const char **argv);
403 int net_user(struct net_context *c, int argc, const char **argv);
404
405 /* The following definitions come from utils/net_usershare.c  */
406
407 int net_usershare_usage(struct net_context *c, int argc, const char **argv);
408 int net_usershare_help(struct net_context *c, int argc, const char **argv);
409 int net_usershare(struct net_context *c, int argc, const char **argv);
410
411 /* The following definitions come from utils/net_util.c  */
412
413 NTSTATUS net_rpc_lookup_name(struct net_context *c,
414                              TALLOC_CTX *mem_ctx, struct cli_state *cli,
415                              const char *name, const char **ret_domain,
416                              const char **ret_name, DOM_SID *ret_sid,
417                              enum lsa_SidType *ret_type);
418 NTSTATUS connect_to_service(struct net_context *c,
419                                         struct cli_state **cli_ctx,
420                                         struct sockaddr_storage *server_ss,
421                                         const char *server_name,
422                                         const char *service_name,
423                                         const char *service_type);
424 NTSTATUS connect_to_ipc(struct net_context *c,
425                         struct cli_state **cli_ctx,
426                         struct sockaddr_storage *server_ss,
427                         const char *server_name);
428 NTSTATUS connect_to_ipc_anonymous(struct net_context *c,
429                                 struct cli_state **cli_ctx,
430                                 struct sockaddr_storage *server_ss,
431                                 const char *server_name);
432 NTSTATUS connect_to_ipc_krb5(struct net_context *c,
433                         struct cli_state **cli_ctx,
434                         struct sockaddr_storage *server_ss,
435                         const char *server_name);
436 NTSTATUS connect_dst_pipe(struct net_context *c, struct cli_state **cli_dst,
437                           struct rpc_pipe_client **pp_pipe_hnd, int pipe_num);
438 int net_use_krb_machine_account(struct net_context *c);
439 int net_use_machine_account(struct net_context *c);
440 bool net_find_server(struct net_context *c,
441                         const char *domain,
442                         unsigned flags,
443                         struct sockaddr_storage *server_ss,
444                         char **server_name);
445 bool net_find_pdc(struct sockaddr_storage *server_ss,
446                 fstring server_name,
447                 const char *domain_name);
448 NTSTATUS net_make_ipc_connection(struct net_context *c, unsigned flags,
449                                  struct cli_state **pcli);
450 NTSTATUS net_make_ipc_connection_ex(struct net_context *c ,const char *domain,
451                                     const char *server,
452                                     struct sockaddr_storage *pss,
453                                     unsigned flags, struct cli_state **pcli);
454 const char *net_prompt_pass(struct net_context *c, const char *user);
455 int net_run_function(struct net_context *c, int argc, const char **argv,
456                      struct functable *table,
457                      int (*usage_fn)(struct net_context *c,
458                                      int argc, const char **argv));
459 int net_run_function2(struct net_context *c, int argc, const char **argv,
460                       const char *whoami, struct functable2 *table);
461 int net_run_function3(struct net_context *c, int argc, const char **argv,
462                       const char *whoami, struct functable3 *table);
463 void net_display_usage_from_functable(struct functable3 *table);
464
465 /* The following definitions come from utils/netlookup.c  */
466
467 NTSTATUS net_lookup_name_from_sid(struct net_context *c,
468                                 TALLOC_CTX *ctx,
469                                 DOM_SID *psid,
470                                 const char **ppdomain,
471                                 const char **ppname);
472 NTSTATUS net_lookup_sid_from_name(struct net_context *c, TALLOC_CTX *ctx,
473                                   const char *full_name, DOM_SID *pret_sid);
474
475 /* The following definitions come from utils/passwd_util.c  */
476
477 char *stdin_new_passwd( void);
478 char *get_pass( const char *prompt, bool stdin_get);
479
480 #endif /*  _NET_PROTO_H_  */