svn commit: samba r12358 - in trunk/source/utils: .
jra at samba.org
jra at samba.org
Mon Dec 19 05:42:58 GMT 2005
Author: jra
Date: 2005-12-19 05:42:58 +0000 (Mon, 19 Dec 2005)
New Revision: 12358
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=12358
Log:
Added fallback to winbindd lookup if we can't resolve
locally.
Jeremy.
Modified:
trunk/source/utils/netlookup.c
Changeset:
Modified: trunk/source/utils/netlookup.c
===================================================================
--- trunk/source/utils/netlookup.c 2005-12-19 04:50:47 UTC (rev 12357)
+++ trunk/source/utils/netlookup.c 2005-12-19 05:42:58 UTC (rev 12358)
@@ -108,8 +108,11 @@
return cs;
}
-static BOOL lookup_name_from_sid_via_localhost(TALLOC_CTX *ctx, DOM_SID *psid,
- const char **ppdomain, const char **ppname, uint32 *ptype)
+static BOOL lookup_name_from_sid_via_localhost(TALLOC_CTX *ctx,
+ DOM_SID *psid,
+ const char **ppdomain,
+ const char **ppname,
+ uint32 *ptype)
{
NTSTATUS nt_status;
struct con_struct *csp = NULL;
@@ -145,9 +148,28 @@
return True;
}
-static BOOL lookup_name_from_sid_via_winbind(TALLOC_CTX *ctx, DOM_SID *psid, const char **ppdomain, const char **ppname)
+static BOOL lookup_name_from_sid_via_winbind(TALLOC_CTX *ctx,
+ DOM_SID *psid,
+ const char **ppdomain,
+ const char **ppname)
{
- return False;
+ struct winbindd_request request;
+ struct winbindd_response response;
+
+ ZERO_STRUCT(request);
+ ZERO_STRUCT(response);
+
+ sid_to_string(request.data.sid, psid);
+
+ if (winbindd_request_response(WINBINDD_LOOKUPSID, &request, &response) != NSS_STATUS_SUCCESS) {
+ DEBUG(2, ("lookup_name_from_sid_via_winbind could not resolve %s\n", request.data.sid));
+ return False;
+ }
+
+ *ppdomain = talloc_strdup(ctx, response.data.name.dom_name);
+ *ppname = talloc_strdup(ctx, response.data.name.name);
+
+ return True;
}
BOOL net_lookup_name_from_sid(TALLOC_CTX *ctx, DOM_SID *psid, const char **ppdomain, const char **ppname)
More information about the samba-cvs
mailing list