diff options
author | Günther Deschner <gd@samba.org> | 2008-05-06 17:09:44 +0200 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2008-05-07 10:42:29 +0200 |
commit | f847929c2c25159fef7c1c419ce1819f2afe558f (patch) | |
tree | b5abe627931f6f53bef33b587bf0320900abff52 /source3/lib/netapi | |
parent | 8ce3f6b840a259133e2b2cfdb97578e96c94b629 (diff) | |
download | samba-f847929c2c25159fef7c1c419ce1819f2afe558f.tar.gz samba-f847929c2c25159fef7c1c419ce1819f2afe558f.tar.bz2 samba-f847929c2c25159fef7c1c419ce1819f2afe558f.zip |
netapi: add -f switch for DsGetDCName() example and be more verbose on output.
Guenther
(This used to be commit 3feaa9829cc5bdeb7a5401c3c24b3811816396ce)
Diffstat (limited to 'source3/lib/netapi')
-rw-r--r-- | source3/lib/netapi/examples/dsgetdc/dsgetdc.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/source3/lib/netapi/examples/dsgetdc/dsgetdc.c b/source3/lib/netapi/examples/dsgetdc/dsgetdc.c index 7c0ec4d57d..6265e66a25 100644 --- a/source3/lib/netapi/examples/dsgetdc/dsgetdc.c +++ b/source3/lib/netapi/examples/dsgetdc/dsgetdc.c @@ -34,6 +34,7 @@ int main(int argc, const char **argv) const char *hostname = NULL; const char *domain = NULL; + uint32_t flags = 0; struct DOMAIN_CONTROLLER_INFO *info = NULL; poptContext pc; @@ -42,6 +43,7 @@ int main(int argc, const char **argv) struct poptOption long_options[] = { POPT_AUTOHELP POPT_COMMON_LIBNETAPI_EXAMPLES + { "flags", 0, POPT_ARG_INT, NULL, 'f', "Query flags", "FLAGS" }, POPT_TABLEEND }; @@ -54,6 +56,10 @@ int main(int argc, const char **argv) poptSetOtherOptionHelp(pc, "hostname domainname"); while((opt = poptGetNextOpt(pc)) != -1) { + switch (opt) { + case 'f': + sscanf(poptGetOptArg(pc), "%x", &flags); + } } if (!poptPeekArg(pc)) { @@ -70,15 +76,21 @@ int main(int argc, const char **argv) /* DsGetDcName */ - status = DsGetDcName(hostname, domain, NULL, NULL, 0, &info); + status = DsGetDcName(hostname, domain, NULL, NULL, flags, &info); if (status != 0) { printf("DsGetDcName failed with: %s\n", libnetapi_errstr(status)); return status; } - printf("domain %s has name: %s\n", - info->domain_name, info->domain_controller_name); + printf("DC Name:\t\t%s\n", info->domain_controller_name); + printf("DC Address:\t\t%s\n", info->domain_controller_address); + printf("DC Address Type:\t%d\n", info->domain_controller_address_type); + printf("Domain Name:\t\t%s\n", info->domain_name); + printf("DNS Forest Name:\t%s\n", info->dns_forest_name); + printf("DC flags:\t\t0x%08x\n", info->flags); + printf("DC Sitename:\t\t%s\n", info->dc_site_name); + printf("Client Sitename:\t%s\n", info->client_site_name); out: NetApiBufferFree(info); |