From aed8e9aa0a887e31562ac9da38ee4a878a4dd4ba Mon Sep 17 00:00:00 2001 From: Dan Sledz Date: Tue, 10 Feb 2009 11:06:44 -0800 Subject: s3: Implement wbcGetpwsid * Adds the plumbing required to lookup users by sid into winbind, wbinfo and smbd helper lib (winbind_util.c). * Removes some double declarations of winbind_util.c functions. * Bumps the winbind protocol version to 21 and the minor version of wbclient to 3. --- source3/lib/winbind_util.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'source3/lib') diff --git a/source3/lib/winbind_util.c b/source3/lib/winbind_util.c index 14356b09cf..686e70f4ad 100644 --- a/source3/lib/winbind_util.c +++ b/source3/lib/winbind_util.c @@ -24,6 +24,43 @@ #include "nsswitch/libwbclient/wbclient.h" +struct passwd * winbind_getpwnam(const char * name) +{ + wbcErr result; + struct passwd * tmp_pwd = NULL; + struct passwd * pwd = NULL; + + result = wbcGetpwnam(name, &tmp_pwd); + if (result != WBC_ERR_SUCCESS) + return pwd; + + pwd = tcopy_passwd(talloc_tos(), tmp_pwd); + + wbcFreeMemory(tmp_pwd); + + return pwd; +} + +struct passwd * winbind_getpwsid(const DOM_SID *sid) +{ + wbcErr result; + struct passwd * tmp_pwd = NULL; + struct passwd * pwd = NULL; + struct wbcDomainSid dom_sid; + + memcpy(&dom_sid, sid, sizeof(dom_sid)); + + result = wbcGetpwsid(&dom_sid, &tmp_pwd); + if (result != WBC_ERR_SUCCESS) + return pwd; + + pwd = tcopy_passwd(talloc_tos(), tmp_pwd); + + wbcFreeMemory(tmp_pwd); + + return pwd; +} + /* Call winbindd to convert a name to a sid */ bool winbind_lookup_name(const char *dom_name, const char *name, DOM_SID *sid, @@ -236,6 +273,16 @@ bool winbind_allocate_gid(gid_t *gid) #else /* WITH_WINBIND */ +struct passwd * winbind_getpwnam(const char * name) +{ + return NULL; +} + +struct passwd * winbind_getpwsid(const DOM_SID *sid) +{ + return NULL; +} + bool winbind_lookup_name(const char *dom_name, const char *name, DOM_SID *sid, enum lsa_SidType *name_type) { -- cgit