smbd: Use dom_sid_str_buf
authorVolker Lendecke <vl@samba.org>
Mon, 10 Dec 2018 12:04:11 +0000 (13:04 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 20 Dec 2018 22:40:24 +0000 (23:40 +0100)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
source3/smbd/ntquotas.c
source3/smbd/nttrans.c
source3/smbd/posix_acls.c
source3/smbd/service.c

index 7e2c03636968246e8f767dbe28d7068f6c61bd65..5622f1023a822073729219c6948cc885a2f733c5 100644 (file)
@@ -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"));
index e7991c051c1c8a20c1d845d90168dd31d27d29ce..7ebd802109fd0557efde396fcf0cd89a6f095ff6 100644 (file)
@@ -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;
index f1148f2af8cf53d2bf6e896d88eb25baca7618bf..59cd020dbeda9d15f748198a620038bcf59d8e78 100644 (file)
@@ -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(&current_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(&current_ace->trustee)));
+                               DBG_ERR("sids_to_unixids failed for %s "
+                                       "(allocation failure)\n",
+                                       dom_sid_str_buf(&current_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(&current_ace->trustee)));
+                               DBG_ERR("unable to map SID %s to uid or "
+                                       "gid.\n",
+                                       dom_sid_str_buf(&current_ace->trustee,
+                                                       &buf));
                                TALLOC_FREE(current_ace);
                                return false;
                        }
index a19b973424678f4e8d1b9748f9cc173328e17308..d7c85d8b6ca1a5045a3fd7c5b02658309bfe99fe 100644 (file)
@@ -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;
        }