1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

passdb: Use dom_sid_str_buf

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
This commit is contained in:
Volker Lendecke 2018-12-11 16:09:41 +01:00 committed by Andrew Bartlett
parent 09efea3cb6
commit 6438819609
6 changed files with 36 additions and 17 deletions

View File

@ -608,8 +608,11 @@ bool lookup_global_sam_name(const char *name, int flags, uint32_t *rid,
if (ret) {
if (!sid_check_is_in_our_sam(&user_sid)) {
DEBUG(0, ("User %s with invalid SID %s in passdb\n",
name, sid_string_dbg(&user_sid)));
struct dom_sid_buf buf;
DBG_ERR("User %s with invalid SID %s"
" in passdb\n",
name,
dom_sid_str_buf(&user_sid, &buf));
return False;
}
@ -639,9 +642,11 @@ bool lookup_global_sam_name(const char *name, int flags, uint32_t *rid,
/* BUILTIN groups are looked up elsewhere */
if (!sid_check_is_in_our_sam(&map->sid)) {
struct dom_sid_buf buf;
DEBUG(10, ("Found group %s (%s) not in our domain -- "
"ignoring.\n",
name, sid_string_dbg(&map->sid)));
name,
dom_sid_str_buf(&map->sid, &buf)));
TALLOC_FREE(map);
return False;
}

View File

@ -52,6 +52,7 @@ uint32_t pdb_get_group_rid (struct samu *sampass)
bool pdb_set_user_sid_from_rid (struct samu *sampass, uint32_t rid, enum pdb_value_state flag)
{
struct dom_sid u_sid;
struct dom_sid_buf buf;
const struct dom_sid *global_sam_sid;
if (!sampass)
@ -70,7 +71,7 @@ bool pdb_set_user_sid_from_rid (struct samu *sampass, uint32_t rid, enum pdb_val
return False;
DEBUG(10, ("pdb_set_user_sid_from_rid:\n\tsetting user sid %s from rid %d\n",
sid_string_dbg(&u_sid),rid));
dom_sid_str_buf(&u_sid, &buf), rid));
return True;
}
@ -78,6 +79,7 @@ bool pdb_set_user_sid_from_rid (struct samu *sampass, uint32_t rid, enum pdb_val
bool pdb_set_group_sid_from_rid (struct samu *sampass, uint32_t grid, enum pdb_value_state flag)
{
struct dom_sid g_sid;
struct dom_sid_buf buf;
const struct dom_sid *global_sam_sid;
if (!sampass)
@ -96,7 +98,7 @@ bool pdb_set_group_sid_from_rid (struct samu *sampass, uint32_t grid, enum pdb_v
return False;
DEBUG(10, ("pdb_set_group_sid_from_rid:\n\tsetting group sid %s from rid %d\n",
sid_string_dbg(&g_sid), grid));
dom_sid_str_buf(&g_sid, &buf), grid));
return True;
}

View File

@ -486,13 +486,15 @@ bool pdb_set_init_flags(struct samu *sampass, enum pdb_elements element, enum pd
bool pdb_set_user_sid(struct samu *sampass, const struct dom_sid *u_sid, enum pdb_value_state flag)
{
struct dom_sid_buf buf;
if (!u_sid)
return False;
sid_copy(&sampass->user_sid, u_sid);
DEBUG(10, ("pdb_set_user_sid: setting user sid %s\n",
sid_string_dbg(&sampass->user_sid)));
dom_sid_str_buf(&sampass->user_sid, &buf)));
return pdb_set_init_flags(sampass, PDB_USERSID, flag);
}
@ -532,6 +534,7 @@ bool pdb_set_group_sid(struct samu *sampass, const struct dom_sid *g_sid, enum p
{
gid_t gid;
struct dom_sid dug_sid;
struct dom_sid_buf buf;
if (!g_sid)
return False;
@ -554,7 +557,7 @@ bool pdb_set_group_sid(struct samu *sampass, const struct dom_sid *g_sid, enum p
}
DEBUG(10, ("pdb_set_group_sid: setting group sid %s\n",
sid_string_dbg(sampass->group_sid)));
dom_sid_str_buf(sampass->group_sid, &buf)));
return pdb_set_init_flags(sampass, PDB_GROUPSID, flag);
}

View File

@ -1497,6 +1497,8 @@ static bool pdb_default_sid_to_id(struct pdb_methods *methods,
TALLOC_CTX *mem_ctx;
bool ret = False;
uint32_t rid;
struct dom_sid_buf buf;
id->id = -1;
mem_ctx = talloc_new(NULL);
@ -1529,13 +1531,14 @@ static bool pdb_default_sid_to_id(struct pdb_methods *methods,
"an object exists in the database, "
"but it is neither a user nor a "
"group (got type %d).\n",
sid_string_dbg(sid), type));
dom_sid_str_buf(sid, &buf),
type));
ret = false;
}
} else {
DEBUG(5, ("SID %s belongs to our domain, but there is "
"no corresponding object in the database.\n",
sid_string_dbg(sid)));
dom_sid_str_buf(sid, &buf)));
}
goto done;
}
@ -1563,13 +1566,14 @@ static bool pdb_default_sid_to_id(struct pdb_methods *methods,
if (!NT_STATUS_IS_OK(methods->getgrsid(methods, map, *sid))) {
DEBUG(10, ("Could not find map for sid %s\n",
sid_string_dbg(sid)));
dom_sid_str_buf(sid, &buf)));
goto done;
}
if ((map->sid_name_use != SID_NAME_ALIAS) &&
(map->sid_name_use != SID_NAME_WKN_GRP)) {
DEBUG(10, ("Map for sid %s is a %s, expected an "
"alias\n", sid_string_dbg(sid),
"alias\n",
dom_sid_str_buf(sid, &buf),
sid_type_lookup(map->sid_name_use)));
goto done;
}
@ -1581,7 +1585,7 @@ static bool pdb_default_sid_to_id(struct pdb_methods *methods,
}
DEBUG(5, ("Sid %s is neither ours, a Unix SID, nor builtin\n",
sid_string_dbg(sid)));
dom_sid_str_buf(sid, &buf)));
done:

View File

@ -75,9 +75,10 @@ static int list_trusted_domain(struct db_record *rec, void *private_data)
}
if (pass.domain_sid.num_auths != 4) {
struct dom_sid_buf buf;
DEBUG(0, ("SID %s is not a domain sid, has %d "
"auths instead of 4\n",
sid_string_dbg(&pass.domain_sid),
dom_sid_str_buf(&pass.domain_sid, &buf),
pass.domain_sid.num_auths));
return 0;
}

View File

@ -47,16 +47,20 @@ static NTSTATUS add_sid_to_builtin(const struct dom_sid *builtin_sid,
status = pdb_add_aliasmem(builtin_sid, dom_sid);
if (NT_STATUS_EQUAL(status, NT_STATUS_MEMBER_IN_ALIAS)) {
struct dom_sid_buf buf1, buf2;
DEBUG(5, ("add_sid_to_builtin %s is already a member of %s\n",
sid_string_dbg(dom_sid),
sid_string_dbg(builtin_sid)));
dom_sid_str_buf(dom_sid, &buf1),
dom_sid_str_buf(builtin_sid, &buf2)));
return NT_STATUS_OK;
}
if (!NT_STATUS_IS_OK(status)) {
struct dom_sid_buf buf1, buf2;
DEBUG(4, ("add_sid_to_builtin %s could not be added to %s: "
"%s\n", sid_string_dbg(dom_sid),
sid_string_dbg(builtin_sid), nt_errstr(status)));
"%s\n",
dom_sid_str_buf(dom_sid, &buf1),
dom_sid_str_buf(builtin_sid, &buf2),
nt_errstr(status)));
}
return status;
}