summaryrefslogtreecommitdiff
path: root/source3/winbindd/winbindd_sid.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-08-04 13:33:56 -0400
committerVolker Lendecke <vl@samba.org>2009-08-05 03:21:21 -0400
commitfb7150f23b154fe53a91f3433ea33cf680d4fa93 (patch)
tree5045b6da6e9268e4e4ae96f72c00962dbb3421a8 /source3/winbindd/winbindd_sid.c
parentea286fed7adf93311b0ca14c3ff1e7bac74a0b9b (diff)
downloadsamba-fb7150f23b154fe53a91f3433ea33cf680d4fa93.tar.gz
samba-fb7150f23b154fe53a91f3433ea33cf680d4fa93.tar.bz2
samba-fb7150f23b154fe53a91f3433ea33cf680d4fa93.zip
s3:winbind: Convert WINBINDD_SID_TO_UID to the new API
Diffstat (limited to 'source3/winbindd/winbindd_sid.c')
-rw-r--r--source3/winbindd/winbindd_sid.c109
1 files changed, 0 insertions, 109 deletions
diff --git a/source3/winbindd/winbindd_sid.c b/source3/winbindd/winbindd_sid.c
index ee1ee2b6bb..ae3d369846 100644
--- a/source3/winbindd/winbindd_sid.c
+++ b/source3/winbindd/winbindd_sid.c
@@ -55,115 +55,6 @@ void winbindd_lookuprids(struct winbindd_cli_state *state)
sendto_domain(state, domain);
}
-/* Convert a sid to a uid. We assume we only have one rid attached to the
- sid. */
-
-static void sid2uid_recv(void *private_data, bool success, uid_t uid)
-{
- struct winbindd_cli_state *state =
- talloc_get_type_abort(private_data, struct winbindd_cli_state);
- struct dom_sid sid;
-
- string_to_sid(&sid, state->request->data.sid);
-
- if (!success) {
- DEBUG(5, ("Could not convert sid %s\n",
- state->request->data.sid));
- request_error(state);
- return;
- }
-
- state->response->data.uid = uid;
- request_ok(state);
-}
-
-static void sid2uid_lookupsid_recv( void *private_data, bool success,
- const char *domain_name,
- const char *name,
- enum lsa_SidType type)
-{
- struct winbindd_cli_state *state =
- talloc_get_type_abort(private_data, struct winbindd_cli_state);
- DOM_SID sid;
-
- if (!string_to_sid(&sid, state->request->data.sid)) {
- DEBUG(1, ("sid2uid_lookupsid_recv: Could not get convert sid "
- "%s from string\n", state->request->data.sid));
- request_error(state);
- return;
- }
-
- if (!success) {
- DEBUG(5, ("sid2uid_lookupsid_recv Could not convert get sid type for %s\n",
- state->request->data.sid));
- goto fail;
- }
-
- if ( (type!=SID_NAME_USER) && (type!=SID_NAME_COMPUTER) ) {
- DEBUG(5,("sid2uid_lookupsid_recv: Sid %s is not a user or a computer.\n",
- state->request->data.sid));
- goto fail;
- }
-
- /* always use the async interface (may block) */
- winbindd_sid2uid_async(state->mem_ctx, &sid, sid2uid_recv, state);
- return;
-
- fail:
- /*
- * We have to set the cache ourselves here, the child which is
- * normally responsible was not queried yet.
- */
- idmap_cache_set_sid2uid(&sid, -1);
- request_error(state);
- return;
-}
-
-void winbindd_sid_to_uid(struct winbindd_cli_state *state)
-{
- DOM_SID sid;
- uid_t uid;
- bool expired;
-
- /* Ensure null termination */
- state->request->data.sid[sizeof(state->request->data.sid)-1]='\0';
-
- DEBUG(3, ("[%5lu]: sid to uid %s\n", (unsigned long)state->pid,
- state->request->data.sid));
-
- if (!string_to_sid(&sid, state->request->data.sid)) {
- DEBUG(1, ("Could not get convert sid %s from string\n",
- state->request->data.sid));
- request_error(state);
- return;
- }
-
- if (idmap_cache_find_sid2uid(&sid, &uid, &expired)) {
- DEBUG(10, ("idmap_cache_find_sid2uid found %d%s\n",
- (int)uid, expired ? " (expired)": ""));
- if (expired && IS_DOMAIN_ONLINE(find_our_domain())) {
- DEBUG(10, ("revalidating expired entry\n"));
- goto backend;
- }
- if (uid == -1) {
- DEBUG(10, ("Returning negative cache entry\n"));
- request_error(state);
- return;
- }
- DEBUG(10, ("Returning positive cache entry\n"));
- state->response->data.uid = uid;
- request_ok(state);
- return;
- }
-
- /* Validate the SID as a user. Hopefully this will hit cache.
- Needed to prevent DoS by exhausting the uid allocation
- range from random SIDs. */
-
- backend:
- winbindd_lookupsid_async( state->mem_ctx, &sid, sid2uid_lookupsid_recv, state );
-}
-
/* Convert a sid to a gid. We assume we only have one rid attached to the
sid.*/