summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2008-04-02 06:10:04 +0200
committerStefan Metzmacher <metze@samba.org>2008-04-03 15:49:19 +0200
commit4124c7b7a3ba0a7f63f1ad23bdae643c9a2435b3 (patch)
treec1790e8c525058f3f4c4369039af071d27c10182
parentf963e50de71ce7a5859b59f90685f880c37293f4 (diff)
downloadsamba-4124c7b7a3ba0a7f63f1ad23bdae643c9a2435b3.tar.gz
samba-4124c7b7a3ba0a7f63f1ad23bdae643c9a2435b3.tar.bz2
samba-4124c7b7a3ba0a7f63f1ad23bdae643c9a2435b3.zip
wbinfo: use wbcLookupNames()
metze (This used to be commit 9d0e5a13215d4904084e81fde6098c70ee4d4636)
-rw-r--r--source3/nsswitch/wbinfo.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/source3/nsswitch/wbinfo.c b/source3/nsswitch/wbinfo.c
index f43d54a744..d3988ca6a5 100644
--- a/source3/nsswitch/wbinfo.c
+++ b/source3/nsswitch/wbinfo.c
@@ -886,26 +886,36 @@ done:
/* Convert string to sid */
-static bool wbinfo_lookupname(char *name)
+static bool wbinfo_lookupname(const char *full_name)
{
- struct winbindd_request request;
- struct winbindd_response response;
+ wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+ struct wbcDomainSid sid;
+ char *sid_str;
+ enum wbcSidType type;
+ fstring domain_name;
+ fstring account_name;
/* Send off request */
- ZERO_STRUCT(request);
- ZERO_STRUCT(response);
+ parse_wbinfo_domain_user(full_name, domain_name,
+ account_name);
- parse_wbinfo_domain_user(name, request.data.name.dom_name,
- request.data.name.name);
+ wbc_status = wbcLookupName(domain_name, account_name,
+ &sid, &type);
+ if (!WBC_ERROR_IS_OK(wbc_status)) {
+ return false;
+ }
- if (winbindd_request_response(WINBINDD_LOOKUPNAME, &request, &response) !=
- NSS_STATUS_SUCCESS)
+ wbc_status = wbcSidToString(&sid, &sid_str);
+ if (!WBC_ERROR_IS_OK(wbc_status)) {
return false;
+ }
/* Display response */
- d_printf("%s %s (%d)\n", response.data.sid.sid, sid_type_lookup(response.data.sid.type), response.data.sid.type);
+ d_printf("%s %s (%d)\n", sid_str, sid_type_lookup(type), type);
+
+ wbcFreeMemory(sid_str);
return true;
}