From 22c6a14ae4f3e9545e14f542e14111106cc74daf Mon Sep 17 00:00:00 2001 From: "Gerald W. Carter" Date: Thu, 17 Apr 2008 18:07:18 +0200 Subject: Convert "wbinfo -m" to use wbcListTrusts() API call. (This used to be commit 2fbe8437efe232b6f53af6fafed5995fe7e26820) --- source3/nsswitch/wbinfo.c | 134 +++++++++++++++++----------------------------- 1 file changed, 50 insertions(+), 84 deletions(-) (limited to 'source3') diff --git a/source3/nsswitch/wbinfo.c b/source3/nsswitch/wbinfo.c index 1e943a5eee..ed49be7431 100644 --- a/source3/nsswitch/wbinfo.c +++ b/source3/nsswitch/wbinfo.c @@ -341,101 +341,67 @@ static bool wbinfo_wins_byip(const char *ip) static bool wbinfo_list_domains(bool list_all_domains, bool verbose) { - struct winbindd_request request; - struct winbindd_response response; - + struct wbcDomainInfo *domain_list = NULL; + size_t num_domains; + wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE; bool print_all = !list_all_domains && verbose; + int i; - ZERO_STRUCT(request); - ZERO_STRUCT(response); - - /* Send request */ - - request.data.list_all_domains = list_all_domains; - - if (winbindd_request_response(WINBINDD_LIST_TRUSTDOM, &request, &response) != - NSS_STATUS_SUCCESS) + wbc_status = wbcListTrusts(&domain_list, &num_domains); + if (!WBC_ERROR_IS_OK(wbc_status)) { return false; + } - /* Display response */ + if (print_all) { + d_printf("%-16s%-24s%-12s%-12s%-5s%-5s\n", + "Domain Name", "DNS Domain", "Trust Type", + "Transitive", "In", "Out"); + } - if (response.extra_data.data) { - const char *extra_data = (char *)response.extra_data.data; - char *name; - char *beg, *end; - TALLOC_CTX *frame = talloc_stackframe(); + for (i=0; iflags & WBC_DOMINFO_AD) ? "Yes" : "No"); + (dinfo->domain_flags & WBC_DOMINFO_AD) ? "Yes" : "No"); d_printf("Native : %s\n", - (dinfo->flags & WBC_DOMINFO_NATIVE) ? "Yes" : "No"); + (dinfo->domain_flags & WBC_DOMINFO_NATIVE) ? "Yes" : "No"); d_printf("Primary : %s\n", - (dinfo->flags & WBC_DOMINFO_PRIMARY) ? "Yes" : "No"); + (dinfo->domain_flags & WBC_DOMINFO_PRIMARY) ? "Yes" : "No"); wbcFreeMemory(sid_str); wbcFreeMemory(dinfo); -- cgit