From 9f126139046700b235e4fe13b5b7c853e862f546 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 11 Jul 2000 01:04:09 +0000 Subject: Add local fallback for name lookup if no winbindd running... Jeremy. (This used to be commit d85deb9e4e9c9784006292d3cb5a6b7b408ff972) --- source3/nsswitch/wb_client.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) (limited to 'source3/nsswitch') diff --git a/source3/nsswitch/wb_client.c b/source3/nsswitch/wb_client.c index 0fe8b977f2..78de466636 100644 --- a/source3/nsswitch/wb_client.c +++ b/source3/nsswitch/wb_client.c @@ -29,25 +29,35 @@ BOOL winbind_lookup_name(char *name, DOM_SID *sid, uint8 *name_type) { + extern pstring global_myname; struct winbindd_request request; - struct winbindd_response response; + struct winbindd_response response; enum nss_status result; - if (!sid || !name_type) return False; + if (!sid || !name_type) + return False; - /* Send off request */ + /* Send off request */ - ZERO_STRUCT(request); - ZERO_STRUCT(response); + ZERO_STRUCT(request); + ZERO_STRUCT(response); - fstrcpy(request.data.name, name); - if ((result = winbindd_request(WINBINDD_LOOKUPNAME, &request, + fstrcpy(request.data.name, name); + if ((result = winbindd_request(WINBINDD_LOOKUPNAME, &request, &response)) == NSS_STATUS_SUCCESS) { string_to_sid(sid, response.data.sid.sid); *name_type = response.data.sid.type; + } else { + + /* + * Try a local lookup - winbindd may not + * be running. + */ + + return lookup_local_name(global_myname, name, sid, name_type); } - return result == NSS_STATUS_SUCCESS; + return result == NSS_STATUS_SUCCESS; } /* Call winbindd to convert sid to name */ @@ -62,7 +72,8 @@ BOOL winbind_lookup_sid(DOM_SID *sid, fstring dom_name, fstring name, uint32 rid; fstring sid_str; - if (!name_type) return False; + if (!name_type) + return False; /* Check if this is our own sid. This should perhaps be done by winbind? For the moment handle it here. */ -- cgit