libgpo: Use dom_sid_str_buf
authorVolker Lendecke <vl@samba.org>
Fri, 2 Nov 2018 20:28:59 +0000 (21:28 +0100)
committerJeremy Allison <jra@samba.org>
Fri, 9 Nov 2018 21:42:29 +0000 (22:42 +0100)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
libgpo/gpo_sec.c

index 98ee8eb3cc9c307d78298709b44cca41e9c2474f..82887bc7e1909fed2a2dacb06945f2759bf1f823 100644 (file)
@@ -103,16 +103,13 @@ static bool gpo_sd_check_read_access_bits(uint32_t access_mask)
 static NTSTATUS gpo_sd_check_ace_denied_object(const struct security_ace *ace,
                                               const struct security_token *token)
 {
-       char *sid_str;
-
        if (gpo_sd_check_agp_object(ace) &&
            gpo_sd_check_agp_access_bits(ace->access_mask) &&
            security_token_has_sid(token, &ace->trustee)) {
-               sid_str = dom_sid_string(NULL, &ace->trustee);
+               struct dom_sid_buf sid_str;
                DEBUG(10,("gpo_sd_check_ace_denied_object: "
                        "Access denied as of ace for %s\n",
-                       sid_str));
-               talloc_free(sid_str);
+                       dom_sid_str_buf(&ace->trustee, &sid_str)));
                return NT_STATUS_ACCESS_DENIED;
        }
 
@@ -125,17 +122,13 @@ static NTSTATUS gpo_sd_check_ace_denied_object(const struct security_ace *ace,
 static NTSTATUS gpo_sd_check_ace_allowed_object(const struct security_ace *ace,
                                                const struct security_token *token)
 {
-       char *sid_str;
-
        if (gpo_sd_check_agp_object(ace) &&
            gpo_sd_check_agp_access_bits(ace->access_mask) &&
            security_token_has_sid(token, &ace->trustee)) {
-               sid_str = dom_sid_string(NULL, &ace->trustee);
+               struct dom_sid_buf sid_str;
                DEBUG(10,("gpo_sd_check_ace_allowed_object: "
                        "Access granted as of ace for %s\n",
-                       sid_str));
-               talloc_free(sid_str);
-
+                       dom_sid_str_buf(&ace->trustee, &sid_str)));
                return NT_STATUS_OK;
        }