diff options
Diffstat (limited to 'source4/nsswitch')
-rw-r--r-- | source4/nsswitch/wb_client.c | 201 |
1 files changed, 0 insertions, 201 deletions
diff --git a/source4/nsswitch/wb_client.c b/source4/nsswitch/wb_client.c index 62c9686960..e478a8aeac 100644 --- a/source4/nsswitch/wb_client.c +++ b/source4/nsswitch/wb_client.c @@ -34,207 +34,6 @@ NSS_STATUS winbindd_request(int req_type, struct winbindd_request *request, struct winbindd_response *response); -/* Call winbindd to convert a name to a sid */ - -BOOL winbind_lookup_name(const char *dom_name, const char *name, DOM_SID *sid, - enum SID_NAME_USE *name_type) -{ - struct winbindd_request request; - struct winbindd_response response; - NSS_STATUS result; - - if (!sid || !name_type) - return False; - - /* Send off request */ - - ZERO_STRUCT(request); - ZERO_STRUCT(response); - - fstrcpy(request.data.name.dom_name, dom_name); - fstrcpy(request.data.name.name, name); - - if ((result = winbindd_request(WINBINDD_LOOKUPNAME, &request, - &response)) == NSS_STATUS_SUCCESS) { - if (!string_to_sid(sid, response.data.sid.sid)) - return False; - *name_type = (enum SID_NAME_USE)response.data.sid.type; - } - - return result == NSS_STATUS_SUCCESS; -} - -/* Call winbindd to convert sid to name */ - -BOOL winbind_lookup_sid(const DOM_SID *sid, - fstring dom_name, fstring name, - enum SID_NAME_USE *name_type) -{ - struct winbindd_request request; - struct winbindd_response response; - NSS_STATUS result; - fstring sid_str; - - /* Initialise request */ - - ZERO_STRUCT(request); - ZERO_STRUCT(response); - - sid_to_string(sid_str, sid); - fstrcpy(request.data.sid, sid_str); - - /* Make request */ - - result = winbindd_request(WINBINDD_LOOKUPSID, &request, &response); - - /* Copy out result */ - - if (result == NSS_STATUS_SUCCESS) { - fstrcpy(dom_name, response.data.name.dom_name); - fstrcpy(name, response.data.name.name); - *name_type = (enum SID_NAME_USE)response.data.name.type; - - DEBUG(10, ("winbind_lookup_sid: SUCCESS: SID %s -> %s %s\n", - sid_str, dom_name, name)); - } - - return (result == NSS_STATUS_SUCCESS); -} - -/* Call winbindd to convert SID to uid */ - -BOOL winbind_sid_to_uid(uid_t *puid, const DOM_SID *sid) -{ - struct winbindd_request request; - struct winbindd_response response; - int result; - fstring sid_str; - - if (!puid) - return False; - - /* Initialise request */ - - ZERO_STRUCT(request); - ZERO_STRUCT(response); - - sid_to_string(sid_str, sid); - fstrcpy(request.data.sid, sid_str); - - /* Make request */ - - result = winbindd_request(WINBINDD_SID_TO_UID, &request, &response); - - /* Copy out result */ - - if (result == NSS_STATUS_SUCCESS) { - *puid = response.data.uid; - } - - return (result == NSS_STATUS_SUCCESS); -} - -/* Call winbindd to convert uid to sid */ - -BOOL winbind_uid_to_sid(DOM_SID *sid, uid_t uid) -{ - struct winbindd_request request; - struct winbindd_response response; - int result; - - if (!sid) - return False; - - /* Initialise request */ - - ZERO_STRUCT(request); - ZERO_STRUCT(response); - - request.data.uid = uid; - - /* Make request */ - - result = winbindd_request(WINBINDD_UID_TO_SID, &request, &response); - - /* Copy out result */ - - if (result == NSS_STATUS_SUCCESS) { - if (!string_to_sid(sid, response.data.sid.sid)) - return False; - } else { - sid_copy(sid, &global_sid_NULL); - } - - return (result == NSS_STATUS_SUCCESS); -} - -/* Call winbindd to convert SID to gid */ - -BOOL winbind_sid_to_gid(gid_t *pgid, const DOM_SID *sid) -{ - struct winbindd_request request; - struct winbindd_response response; - int result; - fstring sid_str; - - if (!pgid) - return False; - - /* Initialise request */ - - ZERO_STRUCT(request); - ZERO_STRUCT(response); - - sid_to_string(sid_str, sid); - fstrcpy(request.data.sid, sid_str); - - /* Make request */ - - result = winbindd_request(WINBINDD_SID_TO_GID, &request, &response); - - /* Copy out result */ - - if (result == NSS_STATUS_SUCCESS) { - *pgid = response.data.gid; - } - - return (result == NSS_STATUS_SUCCESS); -} - -/* Call winbindd to convert gid to sid */ - -BOOL winbind_gid_to_sid(DOM_SID *sid, gid_t gid) -{ - struct winbindd_request request; - struct winbindd_response response; - int result; - - if (!sid) - return False; - - /* Initialise request */ - - ZERO_STRUCT(request); - ZERO_STRUCT(response); - - request.data.gid = gid; - - /* Make request */ - - result = winbindd_request(WINBINDD_GID_TO_SID, &request, &response); - - /* Copy out result */ - - if (result == NSS_STATUS_SUCCESS) { - if (!string_to_sid(sid, response.data.sid.sid)) - return False; - } else { - sid_copy(sid, &global_sid_NULL); - } - - return (result == NSS_STATUS_SUCCESS); -} - /* Fetch the list of groups a user is a member of from winbindd. This is used by winbind_getgroups. */ |