mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
smbd: 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:
parent
69a3b899f1
commit
444fc0bfcc
@ -23,6 +23,7 @@
|
||||
#include "system/passwd.h"
|
||||
#include "passdb/lookup_sid.h"
|
||||
#include "libsmb/libsmb.h"
|
||||
#include "libcli/security/dom_sid.h"
|
||||
|
||||
#undef DBGC_CLASS
|
||||
#define DBGC_CLASS DBGC_QUOTA
|
||||
@ -88,8 +89,9 @@ NTSTATUS vfs_get_ntquota(files_struct *fsp, enum SMB_QUOTA_TYPE qtype,
|
||||
id.uid = -1;
|
||||
|
||||
if (psid && !sid_to_uid(psid, &id.uid)) {
|
||||
struct dom_sid_buf buf;
|
||||
DEBUG(0,("sid_to_uid: failed, SID[%s]\n",
|
||||
sid_string_dbg(psid)));
|
||||
dom_sid_str_buf(psid, &buf)));
|
||||
return NT_STATUS_NO_SUCH_USER;
|
||||
}
|
||||
|
||||
@ -148,8 +150,9 @@ int vfs_set_ntquota(files_struct *fsp, enum SMB_QUOTA_TYPE qtype, struct dom_sid
|
||||
D.ihardlimit = limit_blk2inodes(D.hardlimit);
|
||||
|
||||
if (psid && !sid_to_uid(psid, &id.uid)) {
|
||||
struct dom_sid_buf buf;
|
||||
DEBUG(0,("sid_to_uid: failed, SID[%s]\n",
|
||||
sid_string_dbg(psid)));
|
||||
dom_sid_str_buf(psid, &buf)));
|
||||
}
|
||||
|
||||
ret = SMB_VFS_SET_QUOTA(fsp->conn, qtype, id, &D);
|
||||
@ -193,6 +196,7 @@ int vfs_get_user_ntquota_list(files_struct *fsp, SMB_NTQUOTA_LIST **qt_list)
|
||||
SMB_NTQUOTA_STRUCT tmp_qt;
|
||||
SMB_NTQUOTA_LIST *tmp_list_ent;
|
||||
struct dom_sid sid;
|
||||
struct dom_sid_buf buf;
|
||||
NTSTATUS status;
|
||||
|
||||
ZERO_STRUCT(tmp_qt);
|
||||
@ -213,13 +217,14 @@ int vfs_get_user_ntquota_list(files_struct *fsp, SMB_NTQUOTA_LIST **qt_list)
|
||||
}
|
||||
if (tmp_qt.softlim == 0 && tmp_qt.hardlim == 0) {
|
||||
DEBUG(5,("no quota entry for sid[%s] path[%s]\n",
|
||||
sid_string_dbg(&sid),
|
||||
dom_sid_str_buf(&sid, &buf),
|
||||
fsp->conn->connectpath));
|
||||
continue;
|
||||
}
|
||||
|
||||
DEBUG(15,("quota entry for id[%s] path[%s]\n",
|
||||
sid_string_dbg(&sid), fsp->conn->connectpath));
|
||||
dom_sid_str_buf(&sid, &buf),
|
||||
fsp->conn->connectpath));
|
||||
|
||||
if ((tmp_list_ent=talloc_zero(mem_ctx,SMB_NTQUOTA_LIST))==NULL) {
|
||||
DEBUG(0,("TALLOC_ZERO() failed\n"));
|
||||
|
@ -2472,10 +2472,11 @@ static enum ndr_err_code extract_sids_from_buf(TALLOC_CTX *mem_ctx,
|
||||
*num = i;
|
||||
|
||||
for (iter = sid_list, i = 0; iter; iter = iter->next, i++) {
|
||||
struct dom_sid_buf buf;
|
||||
(*sids)[i] = iter->sid;
|
||||
DBG_DEBUG("quota SID[%u] %s\n",
|
||||
(unsigned int)i,
|
||||
sid_string_dbg(&iter->sid));
|
||||
dom_sid_str_buf(&iter->sid, &buf));
|
||||
}
|
||||
}
|
||||
err = NDR_ERR_SUCCESS;
|
||||
|
@ -800,8 +800,9 @@ static canon_ace *dup_canon_ace( canon_ace *src_ace)
|
||||
|
||||
static void print_canon_ace(canon_ace *pace, int num)
|
||||
{
|
||||
struct dom_sid_buf buf;
|
||||
dbgtext( "canon_ace index %d. Type = %s ", num, pace->attr == ALLOW_ACE ? "allow" : "deny" );
|
||||
dbgtext( "SID = %s ", sid_string_dbg(&pace->trustee));
|
||||
dbgtext( "SID = %s ", dom_sid_str_buf(&pace->trustee, &buf));
|
||||
if (pace->owner_type == UID_ACE) {
|
||||
dbgtext( "uid %u ", (unsigned int)pace->unix_ug.id);
|
||||
} else if (pace->owner_type == GID_ACE) {
|
||||
@ -1193,9 +1194,11 @@ NTSTATUS unpack_nt_owners(struct connection_struct *conn,
|
||||
* reasonably */
|
||||
*puser = get_current_uid(conn);
|
||||
} else {
|
||||
DEBUG(3,("unpack_nt_owners: unable to validate"
|
||||
" owner sid for %s\n",
|
||||
sid_string_dbg(psd->owner_sid)));
|
||||
struct dom_sid_buf buf;
|
||||
DBG_NOTICE("unable to validate"
|
||||
" owner sid for %s\n",
|
||||
dom_sid_str_buf(psd->owner_sid,
|
||||
&buf));
|
||||
return NT_STATUS_INVALID_OWNER;
|
||||
}
|
||||
}
|
||||
@ -1990,12 +1993,14 @@ static bool create_canon_ace_lists(files_struct *fsp,
|
||||
struct unixid unixid;
|
||||
|
||||
if (!sids_to_unixids(¤t_ace->trustee, 1, &unixid)) {
|
||||
struct dom_sid_buf buf;
|
||||
free_canon_ace_list(file_ace);
|
||||
free_canon_ace_list(dir_ace);
|
||||
TALLOC_FREE(current_ace);
|
||||
DEBUG(0, ("create_canon_ace_lists: sids_to_unixids "
|
||||
"failed for %s (allocation failure)\n",
|
||||
sid_string_dbg(¤t_ace->trustee)));
|
||||
DBG_ERR("sids_to_unixids failed for %s "
|
||||
"(allocation failure)\n",
|
||||
dom_sid_str_buf(¤t_ace->trustee,
|
||||
&buf));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -2080,31 +2085,37 @@ static bool create_canon_ace_lists(files_struct *fsp,
|
||||
current_ace->type = SMB_ACL_GROUP;
|
||||
}
|
||||
} else {
|
||||
struct dom_sid_buf buf;
|
||||
/*
|
||||
* Silently ignore map failures in non-mappable SIDs (NT Authority, BUILTIN etc).
|
||||
*/
|
||||
|
||||
if (non_mappable_sid(&psa->trustee)) {
|
||||
DEBUG(10, ("create_canon_ace_lists: ignoring "
|
||||
"non-mappable SID %s\n",
|
||||
sid_string_dbg(&psa->trustee)));
|
||||
DBG_DEBUG("ignoring "
|
||||
"non-mappable SID %s\n",
|
||||
dom_sid_str_buf(
|
||||
&psa->trustee,
|
||||
&buf));
|
||||
TALLOC_FREE(current_ace);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (lp_force_unknown_acl_user(SNUM(fsp->conn))) {
|
||||
DEBUG(10, ("create_canon_ace_lists: ignoring "
|
||||
"unknown or foreign SID %s\n",
|
||||
sid_string_dbg(&psa->trustee)));
|
||||
DBG_DEBUG("ignoring unknown or "
|
||||
"foreign SID %s\n",
|
||||
dom_sid_str_buf(
|
||||
&psa->trustee,
|
||||
&buf));
|
||||
TALLOC_FREE(current_ace);
|
||||
continue;
|
||||
}
|
||||
|
||||
free_canon_ace_list(file_ace);
|
||||
free_canon_ace_list(dir_ace);
|
||||
DEBUG(0, ("create_canon_ace_lists: unable to map SID "
|
||||
"%s to uid or gid.\n",
|
||||
sid_string_dbg(¤t_ace->trustee)));
|
||||
DBG_ERR("unable to map SID %s to uid or "
|
||||
"gid.\n",
|
||||
dom_sid_str_buf(¤t_ace->trustee,
|
||||
&buf));
|
||||
TALLOC_FREE(current_ace);
|
||||
return false;
|
||||
}
|
||||
|
@ -284,8 +284,9 @@ static NTSTATUS find_forced_group(bool force_user,
|
||||
}
|
||||
|
||||
if (!sid_to_gid(&group_sid, &gid)) {
|
||||
struct dom_sid_buf buf;
|
||||
DEBUG(10, ("sid_to_gid(%s) for %s failed\n",
|
||||
sid_string_dbg(&group_sid), groupname));
|
||||
dom_sid_str_buf(&group_sid, &buf), groupname));
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user