summaryrefslogtreecommitdiff
path: root/nsswitch/libwbclient/wbc_pwd.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 /nsswitch/libwbclient/wbc_pwd.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 'nsswitch/libwbclient/wbc_pwd.c')
-rw-r--r--nsswitch/libwbclient/wbc_pwd.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/nsswitch/libwbclient/wbc_pwd.c b/nsswitch/libwbclient/wbc_pwd.c
index cd945996c8..dacd9499dd 100644
--- a/nsswitch/libwbclient/wbc_pwd.c
+++ b/nsswitch/libwbclient/wbc_pwd.c
@@ -190,6 +190,45 @@ wbcErr wbcGetpwuid(uid_t uid, struct passwd **pwd)
return wbc_status;
}
+/* Fill in a struct passwd* for a domain user based on sid */
+wbcErr wbcGetpwsid(struct wbcDomainSid *sid, struct passwd **pwd)
+{
+ wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+ struct winbindd_request request;
+ struct winbindd_response response;
+ char * sid_string = NULL;
+
+ if (!pwd) {
+ wbc_status = WBC_ERR_INVALID_PARAM;
+ BAIL_ON_WBC_ERROR(wbc_status);
+ }
+
+ wbc_status = wbcSidToString(sid, &sid_string);
+ BAIL_ON_WBC_ERROR(wbc_status);
+
+ /* Initialize request */
+
+ ZERO_STRUCT(request);
+ ZERO_STRUCT(response);
+
+ strncpy(request.data.sid, sid_string, sizeof(request.data.sid));
+
+ wbc_status = wbcRequestResponse(WINBINDD_GETPWSID,
+ &request,
+ &response);
+ BAIL_ON_WBC_ERROR(wbc_status);
+
+ *pwd = copy_passwd_entry(&response.data.pw);
+ BAIL_ON_PTR_ERROR(*pwd, wbc_status);
+
+ done:
+ if (sid_string) {
+ wbcFreeMemory(sid_string);
+ }
+
+ return wbc_status;
+}
+
/* Fill in a struct passwd* for a domain user based on username */
wbcErr wbcGetgrnam(const char *name, struct group **grp)
{