s3-libads: Print a message if no realm has been specified.
[Samba.git] / source3 / libads / ndr.c
blobc6b1121396117e70ecb2142f569cf6e6aa96f567
1 /*
2 Unix SMB/CIFS implementation.
4 debug print helpers
6 Copyright (C) Guenther Deschner 2008
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #include "includes.h"
23 #include "ads.h"
24 #include "../librpc/gen_ndr/ndr_netlogon.h"
25 #include "librpc/ndr/util.h"
27 static void ndr_print_ads_auth_flags(struct ndr_print *ndr, const char *name, uint32_t r)
29 ndr_print_uint32(ndr, name, r);
30 ndr->depth++;
31 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ADS_AUTH_DISABLE_KERBEROS", ADS_AUTH_DISABLE_KERBEROS, r);
32 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ADS_AUTH_NO_BIND", ADS_AUTH_NO_BIND, r);
33 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ADS_AUTH_ANON_BIND", ADS_AUTH_ANON_BIND, r);
34 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ADS_AUTH_SIMPLE_BIND", ADS_AUTH_SIMPLE_BIND, r);
35 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ADS_AUTH_ALLOW_NTLMSSP", ADS_AUTH_ALLOW_NTLMSSP, r);
36 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ADS_AUTH_SASL_SIGN", ADS_AUTH_SASL_SIGN, r);
37 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ADS_AUTH_SASL_SEAL", ADS_AUTH_SASL_SEAL, r);
38 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ADS_AUTH_SASL_FORCE", ADS_AUTH_SASL_FORCE, r);
39 ndr->depth--;
42 void ndr_print_ads_struct(struct ndr_print *ndr, const char *name, const struct ads_struct *r)
44 ndr_print_struct(ndr, name, "ads_struct");
45 ndr->depth++;
46 ndr_print_bool(ndr, "is_mine", r->is_mine);
47 ndr_print_struct(ndr, name, "server");
48 ndr->depth++;
49 ndr_print_string(ndr, "realm", r->server.realm);
50 ndr_print_string(ndr, "workgroup", r->server.workgroup);
51 ndr_print_string(ndr, "ldap_server", r->server.ldap_server);
52 ndr_print_bool(ndr, "foreign", r->server.foreign);
53 ndr->depth--;
54 ndr_print_struct(ndr, name, "auth");
55 ndr->depth++;
56 ndr_print_string(ndr, "realm", r->auth.realm);
57 #ifdef DEBUG_PASSWORD
58 ndr_print_string(ndr, "password", r->auth.password);
59 #else
60 ndr_print_string(ndr, "password", "(PASSWORD ommited)");
61 #endif
62 ndr_print_string(ndr, "user_name", r->auth.user_name);
63 ndr_print_string(ndr, "kdc_server", r->auth.kdc_server);
64 ndr_print_ads_auth_flags(ndr, "flags", r->auth.flags);
65 ndr_print_uint32(ndr, "time_offset", r->auth.time_offset);
66 ndr_print_time_t(ndr, "tgt_expire", r->auth.tgt_expire);
67 ndr_print_time_t(ndr, "tgs_expire", r->auth.tgs_expire);
68 ndr_print_time_t(ndr, "renewable", r->auth.renewable);
69 ndr->depth--;
70 ndr_print_struct(ndr, name, "config");
71 ndr->depth++;
72 ndr_print_netr_DsR_DcFlags(ndr, "flags", r->config.flags);
73 ndr_print_string(ndr, "realm", r->config.realm);
74 ndr_print_string(ndr, "bind_path", r->config.bind_path);
75 ndr_print_string(ndr, "ldap_server_name", r->config.ldap_server_name);
76 ndr_print_string(ndr, "server_site_name", r->config.server_site_name);
77 ndr_print_string(ndr, "client_site_name", r->config.client_site_name);
78 ndr_print_time_t(ndr, "current_time", r->config.current_time);
79 ndr_print_string(ndr, "schema_path", r->config.schema_path);
80 ndr_print_string(ndr, "config_path", r->config.config_path);
81 ndr->depth--;
82 #ifdef HAVE_LDAP
83 ndr_print_struct(ndr, name, "ldap");
84 ndr->depth++;
85 ndr_print_ptr(ndr, "ld", r->ldap.ld);
86 ndr_print_sockaddr_storage(ndr, "ss", &r->ldap.ss);
87 ndr_print_time_t(ndr, "last_attempt", r->ldap.last_attempt);
88 ndr_print_uint32(ndr, "port", r->ldap.port);
89 ndr_print_uint16(ndr, "wrap_type", r->ldap.wrap_type);
90 #ifdef HAVE_LDAP_SASL_WRAPPING
91 ndr_print_ptr(ndr, "sbiod", r->ldap.sbiod);
92 #endif /* HAVE_LDAP_SASL_WRAPPING */
93 ndr_print_ptr(ndr, "mem_ctx", r->ldap.mem_ctx);
94 ndr_print_ptr(ndr, "wrap_ops", r->ldap.wrap_ops);
95 ndr_print_ptr(ndr, "wrap_private_data", r->ldap.wrap_private_data);
96 ndr_print_struct(ndr, name, "in");
97 ndr->depth++;
98 ndr_print_uint32(ndr, "ofs", r->ldap.in.ofs);
99 ndr_print_uint32(ndr, "needed", r->ldap.in.needed);
100 ndr_print_uint32(ndr, "left", r->ldap.in.left);
101 ndr_print_uint32(ndr, "max_wrapped", r->ldap.in.max_wrapped);
102 ndr_print_uint32(ndr, "min_wrapped", r->ldap.in.min_wrapped);
103 ndr_print_uint32(ndr, "size", r->ldap.in.size);
104 ndr_print_array_uint8(ndr, "buf", r->ldap.in.buf, r->ldap.in.size);
105 ndr->depth--;
106 ndr_print_struct(ndr, name, "out");
107 ndr->depth++;
108 ndr_print_uint32(ndr, "ofs", r->ldap.out.ofs);
109 ndr_print_uint32(ndr, "left", r->ldap.out.left);
110 ndr_print_uint32(ndr, "max_unwrapped", r->ldap.out.max_unwrapped);
111 ndr_print_uint32(ndr, "sig_size", r->ldap.out.sig_size);
112 ndr_print_uint32(ndr, "size", r->ldap.out.size);
113 ndr_print_array_uint8(ndr, "buf", r->ldap.out.buf, r->ldap.out.size);
114 ndr->depth--;
115 ndr->depth--;
116 #endif /* HAVE_LDAP */
117 ndr->depth--;