s3-auth Use security_token_debug() from common code
[bbaumbach/samba-autobuild/.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 struct security_token *token );
30 bool nt_token_check_domain_rid( struct security_token *token, uint32 rid );
31 struct security_token *get_root_nt_token( void );
32 NTSTATUS add_aliases(const struct dom_sid *domain_sid,
33                      struct security_token *token);
34 struct security_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_unix_user_token(int dbg_class, int dbg_lev, uid_t uid, gid_t gid,
40                            int n_groups, gid_t *groups);
41
42 /* The following definitions come from utils/net.c  */
43
44 enum netr_SchannelType get_sec_channel_type(const char *param);
45
46 /* The following definitions come from utils/net_ads.c  */
47 struct ads_struct;
48 ADS_STATUS ads_startup(struct net_context *c, bool only_own_domain, struct ads_struct **ads);
49 ADS_STATUS ads_startup_nobind(struct net_context *c, bool only_own_domain, struct ads_struct **ads);
50 int net_ads_check_our_domain(struct net_context *c);
51 int net_ads_check(struct net_context *c);
52 int net_ads_user(struct net_context *c, int argc, const char **argv);
53 int net_ads_group(struct net_context *c, int argc, const char **argv);
54 int net_ads_testjoin(struct net_context *c, int argc, const char **argv);
55 int net_ads_join(struct net_context *c, int argc, const char **argv);
56 int net_ads_printer_usage(struct net_context *c, int argc, const char **argv);
57 int net_ads_changetrustpw(struct net_context *c, int argc, const char **argv);
58 int net_ads_keytab(struct net_context *c, int argc, const char **argv);
59 int net_ads_kerberos(struct net_context *c, int argc, const char **argv);
60 int net_ads(struct net_context *c, int argc, const char **argv);
61
62 /* The following definitions come from utils/net_ads_gpo.c  */
63
64 int net_ads_gpo(struct net_context *c, int argc, const char **argv);
65
66 /* The following definitions come from utils/net_cache.c  */
67
68 int net_cache(struct net_context *c, int argc, const char **argv);
69
70 /* The following definitions come from utils/net_conf.c  */
71
72 int net_conf(struct net_context *c, int argc, const char **argv);
73
74 /* The following definitions come from utils/net_dns.c  */
75
76 int get_my_ip_address( struct sockaddr_storage **pp_ss );
77
78 /* The following definitions come from utils/net_dom.c  */
79
80 int net_dom_usage(struct net_context *c, int argc, const char **argv);
81 int net_dom(struct net_context *c, int argc, const char **argv);
82
83 /* The following definitions come from utils/net_file.c  */
84
85 int net_file_usage(struct net_context *c, int argc, const char **argv);
86 int net_file(struct net_context *c, int argc, const char **argv);
87
88 /* The following definitions come from utils/net_group.c  */
89
90 int net_group_usage(struct net_context *c, int argc, const char **argv);
91 int net_group(struct net_context *c, int argc, const char **argv);
92
93 /* The following definitions come from utils/net_groupmap.c  */
94
95 int net_groupmap_usage(struct net_context *c, int argc, const char **argv);
96 int net_groupmap(struct net_context *c, int argc, const char **argv);
97
98 /* The following definitions come from utils/net_help.c  */
99
100 int net_help(struct net_context *c, int argc, const char **argv);
101
102 /* The following definitions come from utils/net_idmap.c  */
103
104 bool idmap_store_secret(const char *backend, bool alloc,
105                         const char *domain, const char *identity,
106                         const char *secret);
107 int net_help_idmap(struct net_context *c, int argc, const char **argv);
108 int net_idmap(struct net_context *c, int argc, const char **argv);
109
110 /* The following definitions come from utils/net_join.c  */
111
112 int net_join_usage(struct net_context *c, int argc, const char **argv);
113 int net_join(struct net_context *c, int argc, const char **argv);
114
115 /* The following definitions come from utils/net_lookup.c  */
116
117 int net_lookup_usage(struct net_context *c, int argc, const char **argv);
118 int net_lookup(struct net_context *c, int argc, const char **argv);
119
120 /* The following definitions come from utils/net_rap.c  */
121
122 int net_rap_file_usage(struct net_context *c, int argc, const char **argv);
123 int net_rap_file(struct net_context *c, int argc, const char **argv);
124 int net_rap_share_usage(struct net_context *c, int argc, const char **argv);
125 int net_rap_share(struct net_context *c, int argc, const char **argv);
126 int net_rap_session_usage(struct net_context *c, int argc, const char **argv);
127 int net_rap_session(struct net_context *c, int argc, const char **argv);
128 int net_rap_server_usage(struct net_context *c, int argc, const char **argv);
129 int net_rap_server(struct net_context *c, int argc, const char **argv);
130 int net_rap_domain_usage(struct net_context *c, int argc, const char **argv);
131 int net_rap_domain(struct net_context *c, int argc, const char **argv);
132 int net_rap_printq_usage(struct net_context *c, int argc, const char **argv);
133 int net_rap_printq(struct net_context *c, int argc, const char **argv);
134 int net_rap_user(struct net_context *c, int argc, const char **argv);
135 int net_rap_group_usage(struct net_context *c, int argc, const char **argv);
136 int net_rap_group(struct net_context *c, int argc, const char **argv);
137 int net_rap_groupmember_usage(struct net_context *c, int argc, const char **argv);
138 int net_rap_groupmember(struct net_context *c, int argc, const char **argv);
139 int net_rap_validate_usage(struct net_context *c, int argc, const char **argv);
140 int net_rap_validate(struct net_context *c, int argc, const char **argv);
141 int net_rap_service_usage(struct net_context *c, int argc, const char **argv);
142 int net_rap_service(struct net_context *c, int argc, const char **argv);
143 int net_rap_password_usage(struct net_context *c, int argc, const char **argv);
144 int net_rap_password(struct net_context *c, int argc, const char **argv);
145 int net_rap_admin_usage(struct net_context *c, int argc, const char **argv);
146 int net_rap_admin(struct net_context *c, int argc, const char **argv);
147 int net_rap(struct net_context *c, int argc, const char **argv);
148
149 /* The following definitions come from utils/net_registry.c  */
150
151 int net_registry(struct net_context *c, int argc, const char **argv);
152
153 /* The following definitions come from utils/net_rpc.c  */
154
155 NTSTATUS net_get_remote_domain_sid(struct cli_state *cli, TALLOC_CTX *mem_ctx,
156                                    struct dom_sid **domain_sid,
157                                    const char **domain_name);
158 int run_rpc_command(struct net_context *c,
159                         struct cli_state *cli_arg,
160                         const struct ndr_syntax_id *interface,
161                         int conn_flags,
162                         rpc_command_fn fn,
163                         int argc,
164                         const char **argv);
165 int net_rpc_changetrustpw(struct net_context *c, int argc, const char **argv);
166 int net_rpc_join(struct net_context *c, int argc, const char **argv);
167 NTSTATUS rpc_info_internals(struct net_context *c,
168                         const struct dom_sid *domain_sid,
169                         const char *domain_name,
170                         struct cli_state *cli,
171                         struct rpc_pipe_client *pipe_hnd,
172                         TALLOC_CTX *mem_ctx,
173                         int argc,
174                         const char **argv);
175 int net_rpc_info(struct net_context *c, int argc, const char **argv);
176 int net_rpc_getsid(struct net_context *c, int argc, const char **argv);
177 int net_rpc_user(struct net_context *c, int argc, const char **argv);
178 struct rpc_sh_cmd *net_rpc_user_edit_cmds(struct net_context *c,
179                                           TALLOC_CTX *mem_ctx,
180                                           struct rpc_sh_ctx *ctx);
181 struct rpc_sh_cmd *net_rpc_user_cmds(struct net_context *c,
182                                      TALLOC_CTX *mem_ctx,
183                                      struct rpc_sh_ctx *ctx);
184 int net_rpc_group(struct net_context *c, int argc, const char **argv);
185 bool copy_top_level_perms(struct net_context *c,
186                                 struct copy_clistate *cp_clistate,
187                                 const char *sharename);
188 int net_usersidlist(struct net_context *c, int argc, const char **argv);
189 int net_usersidlist_usage(struct net_context *c, int argc, const char **argv);
190 int net_rpc_share(struct net_context *c, int argc, const char **argv);
191 struct rpc_sh_cmd *net_rpc_share_cmds(struct net_context *c, TALLOC_CTX *mem_ctx,
192                                       struct rpc_sh_ctx *ctx);
193 int net_rpc_file(struct net_context *c, int argc, const char **argv);
194 NTSTATUS rpc_init_shutdown_internals(struct net_context *c,
195                                      const struct dom_sid *domain_sid,
196                                      const char *domain_name,
197                                      struct cli_state *cli,
198                                      struct rpc_pipe_client *pipe_hnd,
199                                      TALLOC_CTX *mem_ctx,
200                                      int argc,
201                                      const char **argv);
202 NTSTATUS rpc_reg_shutdown_internals(struct net_context *c,
203                                     const struct dom_sid *domain_sid,
204                                     const char *domain_name,
205                                     struct cli_state *cli,
206                                     struct rpc_pipe_client *pipe_hnd,
207                                     TALLOC_CTX *mem_ctx,
208                                     int argc,
209                                     const char **argv);
210 bool net_rpc_check(struct net_context *c, unsigned flags);
211 int rpc_printer_migrate(struct net_context *c, int argc, const char **argv);
212 int rpc_printer_usage(struct net_context *c, int argc, const char **argv);
213 int net_rpc_printer(struct net_context *c, int argc, const char **argv);
214 int net_rpc(struct net_context *c, int argc, const char **argv);
215
216 /* The following definitions come from utils/net_rpc_audit.c  */
217
218 int net_rpc_audit(struct net_context *c, int argc, const char **argv);
219
220 /* The following definitions come from utils/net_rpc_join.c  */
221
222 NTSTATUS net_rpc_join_ok(struct net_context *c, const char *domain,
223                          const char *server, struct sockaddr_storage *pss);
224 int net_rpc_join_newstyle(struct net_context *c, int argc, const char **argv);
225 int net_rpc_testjoin(struct net_context *c, int argc, const char **argv);
226
227 /* The following definitions come from utils/net_rpc_printer.c  */
228
229 NTSTATUS net_copy_fileattr(struct net_context *c,
230                   TALLOC_CTX *mem_ctx,
231                   struct cli_state *cli_share_src,
232                   struct cli_state *cli_share_dst,
233                   const char *src_name, const char *dst_name,
234                   bool copy_acls, bool copy_attrs,
235                   bool copy_timestamps, bool is_file);
236 NTSTATUS net_copy_file(struct net_context *c,
237                        TALLOC_CTX *mem_ctx,
238                        struct cli_state *cli_share_src,
239                        struct cli_state *cli_share_dst,
240                        const char *src_name, const char *dst_name,
241                        bool copy_acls, bool copy_attrs,
242                        bool copy_timestamps, bool is_file);
243 NTSTATUS rpc_printer_list_internals(struct net_context *c,
244                                         const struct dom_sid *domain_sid,
245                                         const char *domain_name,
246                                         struct cli_state *cli,
247                                         struct rpc_pipe_client *pipe_hnd,
248                                         TALLOC_CTX *mem_ctx,
249                                         int argc,
250                                         const char **argv);
251 NTSTATUS rpc_printer_driver_list_internals(struct net_context *c,
252                                                 const struct dom_sid *domain_sid,
253                                                 const char *domain_name,
254                                                 struct cli_state *cli,
255                                                 struct rpc_pipe_client *pipe_hnd,
256                                                 TALLOC_CTX *mem_ctx,
257                                                 int argc,
258                                                 const char **argv);
259 NTSTATUS rpc_printer_publish_publish_internals(struct net_context *c,
260                                                 const struct dom_sid *domain_sid,
261                                                 const char *domain_name,
262                                                 struct cli_state *cli,
263                                                 struct rpc_pipe_client *pipe_hnd,
264                                                 TALLOC_CTX *mem_ctx,
265                                                 int argc,
266                                                 const char **argv);
267 NTSTATUS rpc_printer_publish_unpublish_internals(struct net_context *c,
268                                                 const struct dom_sid *domain_sid,
269                                                 const char *domain_name,
270                                                 struct cli_state *cli,
271                                                 struct rpc_pipe_client *pipe_hnd,
272                                                 TALLOC_CTX *mem_ctx,
273                                                 int argc,
274                                                 const char **argv);
275 NTSTATUS rpc_printer_publish_update_internals(struct net_context *c,
276                                                 const struct dom_sid *domain_sid,
277                                                 const char *domain_name,
278                                                 struct cli_state *cli,
279                                                 struct rpc_pipe_client *pipe_hnd,
280                                                 TALLOC_CTX *mem_ctx,
281                                                 int argc,
282                                                 const char **argv);
283 NTSTATUS rpc_printer_publish_list_internals(struct net_context *c,
284                                                 const struct dom_sid *domain_sid,
285                                                 const char *domain_name,
286                                                 struct cli_state *cli,
287                                                 struct rpc_pipe_client *pipe_hnd,
288                                                 TALLOC_CTX *mem_ctx,
289                                                 int argc,
290                                                 const char **argv);
291 NTSTATUS rpc_printer_migrate_security_internals(struct net_context *c,
292                                                 const struct dom_sid *domain_sid,
293                                                 const char *domain_name,
294                                                 struct cli_state *cli,
295                                                 struct rpc_pipe_client *pipe_hnd,
296                                                 TALLOC_CTX *mem_ctx,
297                                                 int argc,
298                                                 const char **argv);
299 NTSTATUS rpc_printer_migrate_forms_internals(struct net_context *c,
300                                                 const struct dom_sid *domain_sid,
301                                                 const char *domain_name,
302                                                 struct cli_state *cli,
303                                                 struct rpc_pipe_client *pipe_hnd,
304                                                 TALLOC_CTX *mem_ctx,
305                                                 int argc,
306                                                 const char **argv);
307 NTSTATUS rpc_printer_migrate_drivers_internals(struct net_context *c,
308                                                 const struct dom_sid *domain_sid,
309                                                 const char *domain_name,
310                                                 struct cli_state *cli,
311                                                 struct rpc_pipe_client *pipe_hnd,
312                                                 TALLOC_CTX *mem_ctx,
313                                                 int argc,
314                                                 const char **argv);
315 NTSTATUS rpc_printer_migrate_printers_internals(struct net_context *c,
316                                                 const struct dom_sid *domain_sid,
317                                                 const char *domain_name,
318                                                 struct cli_state *cli,
319                                                 struct rpc_pipe_client *pipe_hnd,
320                                                 TALLOC_CTX *mem_ctx,
321                                                 int argc,
322                                                 const char **argv);
323 NTSTATUS rpc_printer_migrate_settings_internals(struct net_context *c,
324                                                 const struct dom_sid *domain_sid,
325                                                 const char *domain_name,
326                                                 struct cli_state *cli,
327                                                 struct rpc_pipe_client *pipe_hnd,
328                                                 TALLOC_CTX *mem_ctx,
329                                                 int argc,
330                                                 const char **argv);
331
332 /* The following definitions come from utils/net_rpc_registry.c  */
333
334 int net_rpc_registry(struct net_context *c, int argc, const char **argv);
335
336 /* The following definitions come from utils/net_rpc_rights.c  */
337
338 int net_rpc_rights(struct net_context *c, int argc, const char **argv);
339 struct rpc_sh_cmd *net_rpc_rights_cmds(struct net_context *c, TALLOC_CTX *mem_ctx,
340                                        struct rpc_sh_ctx *ctx);
341
342 /* The following definitions come from utils/net_rpc_samsync.c  */
343
344 NTSTATUS rpc_samdump_internals(struct net_context *c,
345                                 const struct dom_sid *domain_sid,
346                                 const char *domain_name,
347                                 struct cli_state *cli,
348                                 struct rpc_pipe_client *pipe_hnd,
349                                 TALLOC_CTX *mem_ctx,
350                                 int argc,
351                                 const char **argv);
352 int rpc_vampire_usage(struct net_context *c, int argc, const char **argv);
353 NTSTATUS rpc_vampire_internals(struct net_context *c,
354                                 const struct dom_sid *domain_sid,
355                                 const char *domain_name,
356                                 struct cli_state *cli,
357                                 struct rpc_pipe_client *pipe_hnd,
358                                 TALLOC_CTX *mem_ctx,
359                                 int argc,
360                                 const char **argv);
361 int rpc_vampire_passdb(struct net_context *c, int argc, const char **argv);
362 int rpc_vampire_ldif(struct net_context *c, int argc, const char **argv);
363 NTSTATUS rpc_vampire_ldif_internals(struct net_context *c,
364                                     const struct dom_sid *domain_sid,
365                                     const char *domain_name,
366                                     struct cli_state *cli,
367                                     struct rpc_pipe_client *pipe_hnd,
368                                     TALLOC_CTX *mem_ctx,
369                                     int argc,
370                                     const char **argv);
371 NTSTATUS rpc_vampire_keytab_internals(struct net_context *c,
372                                       const struct dom_sid *domain_sid,
373                                       const char *domain_name,
374                                       struct cli_state *cli,
375                                       struct rpc_pipe_client *pipe_hnd,
376                                       TALLOC_CTX *mem_ctx,
377                                       int argc,
378                                       const char **argv);
379 int rpc_vampire_keytab(struct net_context *c, int argc, const char **argv);
380
381 /* The following definitions come from utils/net_rpc_service.c  */
382
383 const char *svc_status_string( uint32 state );
384 int net_rpc_service(struct net_context *c, int argc, const char **argv);
385
386 /* The following definitions come from utils/net_rpc_sh_acct.c  */
387
388 struct rpc_sh_cmd *net_rpc_acct_cmds(struct net_context *c, TALLOC_CTX *mem_ctx,
389                                      struct rpc_sh_ctx *ctx);
390
391 /* The following definitions come from utils/net_rpc_shell.c  */
392
393 int net_rpc_shell(struct net_context *c, int argc, const char **argv);
394
395 /* The following definitions come from utils/net_sam.c  */
396
397 int net_sam(struct net_context *c, int argc, const char **argv);
398
399 /* The following definitions come from utils/net_share.c  */
400
401 int net_share_usage(struct net_context *c, int argc, const char **argv);
402 int net_share(struct net_context *c, int argc, const char **argv);
403
404 /* The following definitions come from utils/net_status.c  */
405
406 int net_status_usage(struct net_context *c, int argc, const char **argv);
407 int net_status(struct net_context *c, int argc, const char **argv);
408
409 /* The following definitions come from utils/net_time.c  */
410
411 int net_time_usage(struct net_context *c, int argc, const char **argv);
412 int net_time(struct net_context *c, int argc, const char **argv);
413
414 /* The following definitions come from utils/net_user.c  */
415
416 int net_user_usage(struct net_context *c, int argc, const char **argv);
417 int net_user(struct net_context *c, int argc, const char **argv);
418
419 /* The following definitions come from utils/net_usershare.c  */
420
421 int net_usershare_usage(struct net_context *c, int argc, const char **argv);
422 int net_usershare_help(struct net_context *c, int argc, const char **argv);
423 int net_usershare(struct net_context *c, int argc, const char **argv);
424
425 /* The following definitions come from utils/net_eventlog.c  */
426
427 int net_eventlog(struct net_context *c, int argc, const char **argv);
428
429 /* The following definitions come from utils/net_printing.c  */
430
431 int net_printing(struct net_context *c, int argc, const char **argv);
432
433 /* The following definitions come from utils/net_serverid.c  */
434
435 int net_serverid(struct net_context *c, int argc, const char **argv);
436
437 /* The following definitions come from utils/net_util.c  */
438
439 NTSTATUS net_rpc_lookup_name(struct net_context *c,
440                              TALLOC_CTX *mem_ctx, struct cli_state *cli,
441                              const char *name, const char **ret_domain,
442                              const char **ret_name, struct dom_sid *ret_sid,
443                              enum lsa_SidType *ret_type);
444 NTSTATUS connect_to_service(struct net_context *c,
445                                         struct cli_state **cli_ctx,
446                                         struct sockaddr_storage *server_ss,
447                                         const char *server_name,
448                                         const char *service_name,
449                                         const char *service_type);
450 NTSTATUS connect_to_ipc(struct net_context *c,
451                         struct cli_state **cli_ctx,
452                         struct sockaddr_storage *server_ss,
453                         const char *server_name);
454 NTSTATUS connect_to_ipc_anonymous(struct net_context *c,
455                                 struct cli_state **cli_ctx,
456                                 struct sockaddr_storage *server_ss,
457                                 const char *server_name);
458 NTSTATUS connect_to_ipc_krb5(struct net_context *c,
459                         struct cli_state **cli_ctx,
460                         struct sockaddr_storage *server_ss,
461                         const char *server_name);
462 NTSTATUS connect_dst_pipe(struct net_context *c, struct cli_state **cli_dst,
463                           struct rpc_pipe_client **pp_pipe_hnd,
464                           const struct ndr_syntax_id *interface);
465 int net_use_krb_machine_account(struct net_context *c);
466 int net_use_machine_account(struct net_context *c);
467 bool net_find_server(struct net_context *c,
468                         const char *domain,
469                         unsigned flags,
470                         struct sockaddr_storage *server_ss,
471                         char **server_name);
472 bool net_find_pdc(struct sockaddr_storage *server_ss,
473                 fstring server_name,
474                 const char *domain_name);
475 NTSTATUS net_make_ipc_connection(struct net_context *c, unsigned flags,
476                                  struct cli_state **pcli);
477 NTSTATUS net_make_ipc_connection_ex(struct net_context *c ,const char *domain,
478                                     const char *server,
479                                     struct sockaddr_storage *pss,
480                                     unsigned flags, struct cli_state **pcli);
481 const char *net_prompt_pass(struct net_context *c, const char *user);
482 int net_run_function(struct net_context *c, int argc, const char **argv,
483                       const char *whoami, struct functable *table);
484 void net_display_usage_from_functable(struct functable *table);
485
486 const char *net_share_type_str(int num_type);
487
488 NTSTATUS net_scan_dc(struct net_context *c,
489                      struct cli_state *cli,
490                      struct net_dc_info *dc_info);
491
492 /* The following definitions come from utils/netlookup.c  */
493
494 NTSTATUS net_lookup_name_from_sid(struct net_context *c,
495                                 TALLOC_CTX *ctx,
496                                 struct dom_sid *psid,
497                                 const char **ppdomain,
498                                 const char **ppname);
499 NTSTATUS net_lookup_sid_from_name(struct net_context *c, TALLOC_CTX *ctx,
500                                   const char *full_name, struct dom_sid *pret_sid);
501
502 /* The following definitions come from utils/passwd_util.c  */
503
504 char *stdin_new_passwd( void);
505 char *get_pass( const char *prompt, bool stdin_get);
506
507 /* The following definitions come from utils/net_g_lock.c  */
508 int net_g_lock(struct net_context *c, int argc, const char **argv);
509
510 #endif /*  _NET_PROTO_H_  */