summaryrefslogtreecommitdiff
path: root/source3/nsswitch
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2008-03-24 21:05:30 +0100
committerStefan Metzmacher <metze@samba.org>2008-03-28 15:11:42 +0100
commit0f4446d6b2a6e26be9a6a00867f41f559333416e (patch)
tree279cdbbdb4e2e54f30b342d9d9620b1d6602fc42 /source3/nsswitch
parentb6e3a9b8e5fe3d3d1dd4b04631e7f32ccf33153d (diff)
downloadsamba-0f4446d6b2a6e26be9a6a00867f41f559333416e.tar.gz
samba-0f4446d6b2a6e26be9a6a00867f41f559333416e.tar.bz2
samba-0f4446d6b2a6e26be9a6a00867f41f559333416e.zip
wbinfo: use wbcDomainInfo()
metze (This used to be commit 7714f9232110b2ee50e6ba8371f0bc23b83717a6)
Diffstat (limited to 'source3/nsswitch')
-rw-r--r--source3/nsswitch/wbinfo.c43
1 files changed, 25 insertions, 18 deletions
diff --git a/source3/nsswitch/wbinfo.c b/source3/nsswitch/wbinfo.c
index fad13d292b..15d6ae2dab 100644
--- a/source3/nsswitch/wbinfo.c
+++ b/source3/nsswitch/wbinfo.c
@@ -439,39 +439,46 @@ static bool wbinfo_show_sequence(const char *domain)
/* Show domain info */
-static bool wbinfo_domain_info(const char *domain_name)
+static bool wbinfo_domain_info(const char *domain)
{
- struct winbindd_request request;
- struct winbindd_response response;
-
- ZERO_STRUCT(request);
- ZERO_STRUCT(response);
+ wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+ struct wbcDomainInfo *dinfo = NULL;
+ char *sid_str = NULL;
- if ((strequal(domain_name, ".")) || (domain_name[0] == '\0'))
- fstrcpy(request.domain_name, get_winbind_domain());
- else
- fstrcpy(request.domain_name, domain_name);
+ if (strcmp(domain, ".") == 0 || domain[0] == '\0') {
+ domain = get_winbind_domain();
+ }
/* Send request */
- if (winbindd_request_response(WINBINDD_DOMAIN_INFO, &request, &response) !=
- NSS_STATUS_SUCCESS)
+ wbc_status = wbcDomainInfo(domain, &dinfo);
+ if (!WBC_ERROR_IS_OK(wbc_status)) {
+ return false;
+ }
+
+ wbc_status = wbcSidToString(&dinfo->sid, &sid_str);
+ if (!WBC_ERROR_IS_OK(wbc_status)) {
+ wbcFreeMemory(dinfo);
return false;
+ }
/* Display response */
- d_printf("Name : %s\n", response.data.domain_info.name);
- d_printf("Alt_Name : %s\n", response.data.domain_info.alt_name);
+ d_printf("Name : %s\n", dinfo->short_name);
+ d_printf("Alt_Name : %s\n", dinfo->dns_name);
- d_printf("SID : %s\n", response.data.domain_info.sid);
+ d_printf("SID : %s\n", sid_str);
d_printf("Active Directory : %s\n",
- response.data.domain_info.active_directory ? "Yes" : "No");
+ (dinfo->flags & WBC_DOMINFO_AD) ? "Yes" : "No");
d_printf("Native : %s\n",
- response.data.domain_info.native_mode ? "Yes" : "No");
+ (dinfo->flags & WBC_DOMINFO_NATIVE) ? "Yes" : "No");
d_printf("Primary : %s\n",
- response.data.domain_info.primary ? "Yes" : "No");
+ (dinfo->flags & WBC_DOMINFO_PRIMARY) ? "Yes" : "No");
+
+ wbcFreeMemory(sid_str);
+ wbcFreeMemory(dinfo);
return true;
}