mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
s3:winbindd: remove unused idmap_sid_to_uid()
Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
parent
b47be53a1f
commit
5f7a372003
@ -55,7 +55,6 @@ NTSTATUS idmap_tdb_init(void);
|
||||
|
||||
NTSTATUS idmap_uid_to_sid(const char *domname, struct dom_sid *sid, uid_t uid);
|
||||
NTSTATUS idmap_gid_to_sid(const char *domname, struct dom_sid *sid, gid_t gid);
|
||||
NTSTATUS idmap_sid_to_uid(const char *dom_name, struct dom_sid *sid, uid_t *uid);
|
||||
NTSTATUS idmap_sid_to_gid(const char *domname, struct dom_sid *sid, gid_t *gid);
|
||||
bool idmap_unix_id_is_in_range(uint32_t id, struct idmap_domain *dom);
|
||||
|
||||
|
@ -154,80 +154,6 @@ backend:
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
Returns the UID mapped to the given SID.
|
||||
If mapping is not possible or SID maps to a GID returns an error.
|
||||
*****************************************************************/
|
||||
|
||||
NTSTATUS idmap_sid_to_uid(const char *dom_name, struct dom_sid *sid, uid_t *uid)
|
||||
{
|
||||
NTSTATUS ret;
|
||||
struct id_map map;
|
||||
bool expired;
|
||||
|
||||
DEBUG(10,("idmap_sid_to_uid: sid = [%s], domain = '%s'\n",
|
||||
sid_string_dbg(sid), dom_name));
|
||||
|
||||
if (winbindd_use_idmap_cache()
|
||||
&& idmap_cache_find_sid2uid(sid, uid, &expired)) {
|
||||
DEBUG(10, ("idmap_cache_find_sid2uid found %d%s\n",
|
||||
(int)(*uid), expired ? " (expired)": ""));
|
||||
if (expired && idmap_is_online()) {
|
||||
DEBUG(10, ("revalidating expired entry\n"));
|
||||
goto backend;
|
||||
}
|
||||
if ((*uid) == -1) {
|
||||
DEBUG(10, ("Returning negative cache entry\n"));
|
||||
return NT_STATUS_NONE_MAPPED;
|
||||
}
|
||||
DEBUG(10, ("Returning positive cache entry\n"));
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
backend:
|
||||
ZERO_STRUCT(map);
|
||||
map.sid = sid;
|
||||
map.xid.type = ID_TYPE_UID;
|
||||
|
||||
ret = idmap_backends_sid_to_unixid(dom_name, &map);
|
||||
|
||||
if (!NT_STATUS_IS_OK(ret)) {
|
||||
DEBUG(10, ("idmap_backends_sid_to_unixid failed: %s\n",
|
||||
nt_errstr(ret)));
|
||||
if (winbindd_use_idmap_cache()) {
|
||||
idmap_cache_set_sid2uid(sid, -1);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (map.status != ID_MAPPED) {
|
||||
DEBUG(10, ("sid [%s] is not mapped\n", sid_string_dbg(sid)));
|
||||
if (winbindd_use_idmap_cache()) {
|
||||
idmap_cache_set_sid2uid(sid, -1);
|
||||
}
|
||||
return NT_STATUS_NONE_MAPPED;
|
||||
}
|
||||
|
||||
if (map.xid.type != ID_TYPE_UID) {
|
||||
DEBUG(10, ("sid [%s] not mapped to a uid "
|
||||
"[%u,%u,%u]\n",
|
||||
sid_string_dbg(sid),
|
||||
map.status,
|
||||
map.xid.type,
|
||||
map.xid.id));
|
||||
if (winbindd_use_idmap_cache()) {
|
||||
idmap_cache_set_sid2uid(sid, -1);
|
||||
}
|
||||
return NT_STATUS_NONE_MAPPED;
|
||||
}
|
||||
|
||||
*uid = (uid_t)map.xid.id;
|
||||
if (winbindd_use_idmap_cache()) {
|
||||
idmap_cache_set_sid2unixid(sid, &map.xid);
|
||||
}
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
Returns the GID mapped to the given SID.
|
||||
If mapping is not possible or SID maps to a UID returns an error.
|
||||
|
Loading…
Reference in New Issue
Block a user