4791223f2d4e4d9cd57c9e3ab0abbee96f097db0
[abartlet/samba.git/.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 struct 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 struct 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 struct dom_sid *user_sid,
36                                             bool is_guest,
37                                             int num_groupsids,
38                                             const struct 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 enum netr_SchannelType get_sec_channel_type(const char *param);
46
47 /* The following definitions come from utils/net_ads.c  */
48 struct ads_struct;
49 ADS_STATUS ads_startup(struct net_context *c, bool only_own_domain, struct ads_struct **ads);
50 ADS_STATUS ads_startup_nobind(struct net_context *c, bool only_own_domain, struct 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(struct net_context *c, int argc, const char **argv);
149
150 /* The following definitions come from utils/net_registry.c  */
151
152 int net_registry(struct net_context *c, int argc, const char **argv);
153
154 /* The following definitions come from utils/net_rpc.c  */
155
156 NTSTATUS net_get_remote_domain_sid(struct cli_state *cli, TALLOC_CTX *mem_ctx,
157                                    struct dom_sid **domain_sid,
158                                    const char **domain_name);
159 int run_rpc_command(struct net_context *c,
160                         struct cli_state *cli_arg,
161                         const struct ndr_syntax_id *interface,
162                         int conn_flags,
163                         rpc_command_fn fn,
164                         int argc,
165                         const char **argv);
166 int net_rpc_changetrustpw(struct net_context *c, int argc, const char **argv);
167 int net_rpc_join(struct net_context *c, int argc, const char **argv);
168 NTSTATUS rpc_info_internals(struct net_context *c,
169                         const struct dom_sid *domain_sid,
170                         const char *domain_name,
171                         struct cli_state *cli,
172                         struct rpc_pipe_client *pipe_hnd,
173                         TALLOC_CTX *mem_ctx,
174                         int argc,
175                         const char **argv);
176 int net_rpc_info(struct net_context *c, int argc, const char **argv);
177 int net_rpc_getsid(struct net_context *c, int argc, const char **argv);
178 int net_rpc_user(struct net_context *c, int argc, const char **argv);
179 struct rpc_sh_cmd *net_rpc_user_edit_cmds(struct net_context *c,
180                                           TALLOC_CTX *mem_ctx,
181                                           struct rpc_sh_ctx *ctx);
182 struct rpc_sh_cmd *net_rpc_user_cmds(struct net_context *c,
183                                      TALLOC_CTX *mem_ctx,
184                                      struct rpc_sh_ctx *ctx);
185 int net_rpc_group(struct net_context *c, int argc, const char **argv);
186 bool copy_top_level_perms(struct net_context *c,
187                                 struct copy_clistate *cp_clistate,
188                                 const char *sharename);
189 int net_usersidlist(struct net_context *c, int argc, const char **argv);
190 int net_usersidlist_usage(struct net_context *c, int argc, const char **argv);
191 int net_rpc_share(struct net_context *c, int argc, const char **argv);
192 struct rpc_sh_cmd *net_rpc_share_cmds(struct net_context *c, TALLOC_CTX *mem_ctx,
193                                       struct rpc_sh_ctx *ctx);
194 int net_rpc_file(struct net_context *c, int argc, const char **argv);
195 NTSTATUS rpc_init_shutdown_internals(struct net_context *c,
196                                      const struct dom_sid *domain_sid,
197                                      const char *domain_name,
198                                      struct cli_state *cli,
199                                      struct rpc_pipe_client *pipe_hnd,
200                                      TALLOC_CTX *mem_ctx,
201                                      int argc,
202                                      const char **argv);
203 NTSTATUS rpc_reg_shutdown_internals(struct net_context *c,
204                                     const struct dom_sid *domain_sid,
205                                     const char *domain_name,
206                                     struct cli_state *cli,
207                                     struct rpc_pipe_client *pipe_hnd,
208                                     TALLOC_CTX *mem_ctx,
209                                     int argc,
210                                     const char **argv);
211 bool net_rpc_check(struct net_context *c, unsigned flags);
212 int rpc_printer_migrate(struct net_context *c, int argc, const char **argv);
213 int rpc_printer_usage(struct net_context *c, int argc, const char **argv);
214 int net_rpc_printer(struct net_context *c, int argc, const char **argv);
215 int net_rpc(struct net_context *c, int argc, const char **argv);
216
217 /* The following definitions come from utils/net_rpc_audit.c  */
218
219 int net_rpc_audit(struct net_context *c, int argc, const char **argv);
220
221 /* The following definitions come from utils/net_rpc_join.c  */
222
223 NTSTATUS net_rpc_join_ok(struct net_context *c, const char *domain,
224                          const char *server, struct sockaddr_storage *pss);
225 int net_rpc_join_newstyle(struct net_context *c, int argc, const char **argv);
226 int net_rpc_testjoin(struct net_context *c, int argc, const char **argv);
227
228 /* The following definitions come from utils/net_rpc_printer.c  */
229
230 NTSTATUS net_copy_fileattr(struct net_context *c,
231                   TALLOC_CTX *mem_ctx,
232                   struct cli_state *cli_share_src,
233                   struct cli_state *cli_share_dst,
234                   const char *src_name, const char *dst_name,
235                   bool copy_acls, bool copy_attrs,
236                   bool copy_timestamps, bool is_file);
237 NTSTATUS net_copy_file(struct net_context *c,
238                        TALLOC_CTX *mem_ctx,
239                        struct cli_state *cli_share_src,
240                        struct cli_state *cli_share_dst,
241                        const char *src_name, const char *dst_name,
242                        bool copy_acls, bool copy_attrs,
243                        bool copy_timestamps, bool is_file);
244 NTSTATUS rpc_printer_list_internals(struct net_context *c,
245                                         const struct dom_sid *domain_sid,
246                                         const char *domain_name,
247                                         struct cli_state *cli,
248                                         struct rpc_pipe_client *pipe_hnd,
249                                         TALLOC_CTX *mem_ctx,
250                                         int argc,
251                                         const char **argv);
252 NTSTATUS rpc_printer_driver_list_internals(struct net_context *c,
253                                                 const struct dom_sid *domain_sid,
254                                                 const char *domain_name,
255                                                 struct cli_state *cli,
256                                                 struct rpc_pipe_client *pipe_hnd,
257                                                 TALLOC_CTX *mem_ctx,
258                                                 int argc,
259                                                 const char **argv);
260 NTSTATUS rpc_printer_publish_publish_internals(struct net_context *c,
261                                                 const struct dom_sid *domain_sid,
262                                                 const char *domain_name,
263                                                 struct cli_state *cli,
264                                                 struct rpc_pipe_client *pipe_hnd,
265                                                 TALLOC_CTX *mem_ctx,
266                                                 int argc,
267                                                 const char **argv);
268 NTSTATUS rpc_printer_publish_unpublish_internals(struct net_context *c,
269                                                 const struct dom_sid *domain_sid,
270                                                 const char *domain_name,
271                                                 struct cli_state *cli,
272                                                 struct rpc_pipe_client *pipe_hnd,
273                                                 TALLOC_CTX *mem_ctx,
274                                                 int argc,
275                                                 const char **argv);
276 NTSTATUS rpc_printer_publish_update_internals(struct net_context *c,
277                                                 const struct dom_sid *domain_sid,
278                                                 const char *domain_name,
279                                                 struct cli_state *cli,
280                                                 struct rpc_pipe_client *pipe_hnd,
281                                                 TALLOC_CTX *mem_ctx,
282                                                 int argc,
283                                                 const char **argv);
284 NTSTATUS rpc_printer_publish_list_internals(struct net_context *c,
285                                                 const struct dom_sid *domain_sid,
286                                                 const char *domain_name,
287                                                 struct cli_state *cli,
288                                                 struct rpc_pipe_client *pipe_hnd,
289                                                 TALLOC_CTX *mem_ctx,
290                                                 int argc,
291                                                 const char **argv);
292 NTSTATUS rpc_printer_migrate_security_internals(struct net_context *c,
293                                                 const struct dom_sid *domain_sid,
294                                                 const char *domain_name,
295                                                 struct cli_state *cli,
296                                                 struct rpc_pipe_client *pipe_hnd,
297                                                 TALLOC_CTX *mem_ctx,
298                                                 int argc,
299                                                 const char **argv);
300 NTSTATUS rpc_printer_migrate_forms_internals(struct net_context *c,
301                                                 const struct dom_sid *domain_sid,
302                                                 const char *domain_name,
303                                                 struct cli_state *cli,
304                                                 struct rpc_pipe_client *pipe_hnd,
305                                                 TALLOC_CTX *mem_ctx,
306                                                 int argc,
307                                                 const char **argv);
308 NTSTATUS rpc_printer_migrate_drivers_internals(struct net_context *c,
309                                                 const struct dom_sid *domain_sid,
310                                                 const char *domain_name,
311                                                 struct cli_state *cli,
312                                                 struct rpc_pipe_client *pipe_hnd,
313                                                 TALLOC_CTX *mem_ctx,
314                                                 int argc,
315                                                 const char **argv);
316 NTSTATUS rpc_printer_migrate_printers_internals(struct net_context *c,
317                                                 const struct dom_sid *domain_sid,
318                                                 const char *domain_name,
319                                                 struct cli_state *cli,
320                                                 struct rpc_pipe_client *pipe_hnd,
321                                                 TALLOC_CTX *mem_ctx,
322                                                 int argc,
323                                                 const char **argv);
324 NTSTATUS rpc_printer_migrate_settings_internals(struct net_context *c,
325                                                 const struct dom_sid *domain_sid,
326                                                 const char *domain_name,
327                                                 struct cli_state *cli,
328                                                 struct rpc_pipe_client *pipe_hnd,
329                                                 TALLOC_CTX *mem_ctx,
330                                                 int argc,
331                                                 const char **argv);
332
333 /* The following definitions come from utils/net_rpc_registry.c  */
334
335 int net_rpc_registry(struct net_context *c, int argc, const char **argv);
336
337 /* The following definitions come from utils/net_rpc_rights.c  */
338
339 int net_rpc_rights(struct net_context *c, int argc, const char **argv);
340 struct rpc_sh_cmd *net_rpc_rights_cmds(struct net_context *c, TALLOC_CTX *mem_ctx,
341                                        struct rpc_sh_ctx *ctx);
342
343 /* The following definitions come from utils/net_rpc_samsync.c  */
344
345 NTSTATUS rpc_samdump_internals(struct net_context *c,
346                                 const struct dom_sid *domain_sid,
347                                 const char *domain_name,
348                                 struct cli_state *cli,
349                                 struct rpc_pipe_client *pipe_hnd,
350                                 TALLOC_CTX *mem_ctx,
351                                 int argc,
352                                 const char **argv);
353 int rpc_vampire_usage(struct net_context *c, int argc, const char **argv);
354 NTSTATUS rpc_vampire_internals(struct net_context *c,
355                                 const struct dom_sid *domain_sid,
356                                 const char *domain_name,
357                                 struct cli_state *cli,
358                                 struct rpc_pipe_client *pipe_hnd,
359                                 TALLOC_CTX *mem_ctx,
360                                 int argc,
361                                 const char **argv);
362 int rpc_vampire_passdb(struct net_context *c, int argc, const char **argv);
363 int rpc_vampire_ldif(struct net_context *c, int argc, const char **argv);
364 NTSTATUS rpc_vampire_ldif_internals(struct net_context *c,
365                                     const struct dom_sid *domain_sid,
366                                     const char *domain_name,
367                                     struct cli_state *cli,
368                                     struct rpc_pipe_client *pipe_hnd,
369                                     TALLOC_CTX *mem_ctx,
370                                     int argc,
371                                     const char **argv);
372 NTSTATUS rpc_vampire_keytab_internals(struct net_context *c,
373                                       const struct dom_sid *domain_sid,
374                                       const char *domain_name,
375                                       struct cli_state *cli,
376                                       struct rpc_pipe_client *pipe_hnd,
377                                       TALLOC_CTX *mem_ctx,
378                                       int argc,
379                                       const char **argv);
380 int rpc_vampire_keytab(struct net_context *c, int argc, const char **argv);
381
382 /* The following definitions come from utils/net_rpc_service.c  */
383
384 const char *svc_status_string( uint32 state );
385 int net_rpc_service(struct net_context *c, int argc, const char **argv);
386
387 /* The following definitions come from utils/net_rpc_sh_acct.c  */
388
389 struct rpc_sh_cmd *net_rpc_acct_cmds(struct net_context *c, TALLOC_CTX *mem_ctx,
390                                      struct rpc_sh_ctx *ctx);
391
392 /* The following definitions come from utils/net_rpc_shell.c  */
393
394 int net_rpc_shell(struct net_context *c, int argc, const char **argv);
395
396 /* The following definitions come from utils/net_sam.c  */
397
398 int net_sam(struct net_context *c, int argc, const char **argv);
399
400 /* The following definitions come from utils/net_share.c  */
401
402 int net_share_usage(struct net_context *c, int argc, const char **argv);
403 int net_share(struct net_context *c, int argc, const char **argv);
404
405 /* The following definitions come from utils/net_status.c  */
406
407 int net_status_usage(struct net_context *c, int argc, const char **argv);
408 int net_status(struct net_context *c, int argc, const char **argv);
409
410 /* The following definitions come from utils/net_time.c  */
411
412 int net_time_usage(struct net_context *c, int argc, const char **argv);
413 int net_time(struct net_context *c, int argc, const char **argv);
414
415 /* The following definitions come from utils/net_user.c  */
416
417 int net_user_usage(struct net_context *c, int argc, const char **argv);
418 int net_user(struct net_context *c, int argc, const char **argv);
419
420 /* The following definitions come from utils/net_usershare.c  */
421
422 int net_usershare_usage(struct net_context *c, int argc, const char **argv);
423 int net_usershare_help(struct net_context *c, int argc, const char **argv);
424 int net_usershare(struct net_context *c, int argc, const char **argv);
425
426 /* The following definitions come from utils/net_eventlog.c  */
427
428 int net_eventlog(struct net_context *c, int argc, const char **argv);
429
430 /* The following definitions come from utils/net_printing.c  */
431
432 int net_printing(struct net_context *c, int argc, const char **argv);
433
434 /* The following definitions come from utils/net_serverid.c  */
435
436 int net_serverid(struct net_context *c, int argc, const char **argv);
437
438 /* The following definitions come from utils/net_util.c  */
439
440 NTSTATUS net_rpc_lookup_name(struct net_context *c,
441                              TALLOC_CTX *mem_ctx, struct cli_state *cli,
442                              const char *name, const char **ret_domain,
443                              const char **ret_name, struct dom_sid *ret_sid,
444                              enum lsa_SidType *ret_type);
445 NTSTATUS connect_to_service(struct net_context *c,
446                                         struct cli_state **cli_ctx,
447                                         struct sockaddr_storage *server_ss,
448                                         const char *server_name,
449                                         const char *service_name,
450                                         const char *service_type);
451 NTSTATUS connect_to_ipc(struct net_context *c,
452                         struct cli_state **cli_ctx,
453                         struct sockaddr_storage *server_ss,
454                         const char *server_name);
455 NTSTATUS connect_to_ipc_anonymous(struct net_context *c,
456                                 struct cli_state **cli_ctx,
457                                 struct sockaddr_storage *server_ss,
458                                 const char *server_name);
459 NTSTATUS connect_to_ipc_krb5(struct net_context *c,
460                         struct cli_state **cli_ctx,
461                         struct sockaddr_storage *server_ss,
462                         const char *server_name);
463 NTSTATUS connect_dst_pipe(struct net_context *c, struct cli_state **cli_dst,
464                           struct rpc_pipe_client **pp_pipe_hnd,
465                           const struct ndr_syntax_id *interface);
466 int net_use_krb_machine_account(struct net_context *c);
467 int net_use_machine_account(struct net_context *c);
468 bool net_find_server(struct net_context *c,
469                         const char *domain,
470                         unsigned flags,
471                         struct sockaddr_storage *server_ss,
472                         char **server_name);
473 bool net_find_pdc(struct sockaddr_storage *server_ss,
474                 fstring server_name,
475                 const char *domain_name);
476 NTSTATUS net_make_ipc_connection(struct net_context *c, unsigned flags,
477                                  struct cli_state **pcli);
478 NTSTATUS net_make_ipc_connection_ex(struct net_context *c ,const char *domain,
479                                     const char *server,
480                                     struct sockaddr_storage *pss,
481                                     unsigned flags, struct cli_state **pcli);
482 const char *net_prompt_pass(struct net_context *c, const char *user);
483 int net_run_function(struct net_context *c, int argc, const char **argv,
484                       const char *whoami, struct functable *table);
485 void net_display_usage_from_functable(struct functable *table);
486
487 const char *net_share_type_str(int num_type);
488
489 NTSTATUS net_scan_dc(struct net_context *c,
490                      struct cli_state *cli,
491                      struct net_dc_info *dc_info);
492
493 /* The following definitions come from utils/netlookup.c  */
494
495 NTSTATUS net_lookup_name_from_sid(struct net_context *c,
496                                 TALLOC_CTX *ctx,
497                                 struct dom_sid *psid,
498                                 const char **ppdomain,
499                                 const char **ppname);
500 NTSTATUS net_lookup_sid_from_name(struct net_context *c, TALLOC_CTX *ctx,
501                                   const char *full_name, struct dom_sid *pret_sid);
502
503 /* The following definitions come from utils/passwd_util.c  */
504
505 char *stdin_new_passwd( void);
506 char *get_pass( const char *prompt, bool stdin_get);
507
508 /* The following definitions come from utils/net_g_lock.c  */
509 int net_g_lock(struct net_context *c, int argc, const char **argv);
510
511 #endif /*  _NET_PROTO_H_  */