summaryrefslogtreecommitdiff
path: root/source3/lib/winbind_util.c
diff options
context:
space:
mode:
authorDan Sledz <dsledz@isilon.com>2009-02-10 11:06:44 -0800
committerSteven Danneman <steven.danneman@isilon.com>2009-02-11 19:39:15 -0800
commitaed8e9aa0a887e31562ac9da38ee4a878a4dd4ba (patch)
treecc359f1206534de4b875ea06b822f0e8802908b6 /source3/lib/winbind_util.c
parent4e69f23857289bd58f4adad85602c8afc3bed03a (diff)
downloadsamba-aed8e9aa0a887e31562ac9da38ee4a878a4dd4ba.tar.gz
samba-aed8e9aa0a887e31562ac9da38ee4a878a4dd4ba.tar.bz2
samba-aed8e9aa0a887e31562ac9da38ee4a878a4dd4ba.zip
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.
Diffstat (limited to 'source3/lib/winbind_util.c')
-rw-r--r--source3/lib/winbind_util.c47
1 files changed, 47 insertions, 0 deletions
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)
{