]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
Fix lsa_QueryInfoPolicy: make proper talloc copies of the sids.
authorGünther Deschner <gd@samba.org>
Tue, 4 Mar 2008 11:46:15 +0000 (12:46 +0100)
committerGünther Deschner <gd@samba.org>
Tue, 4 Mar 2008 11:52:37 +0000 (12:52 +0100)
Guenther

source/rpc_server/srv_lsa_nt.c

index c2502141e548a3b24f1da830fc2f9d4298502f2a..c03630d6f9e05582ae33d5431588e4cb3b6d73d9 100644 (file)
@@ -603,15 +603,22 @@ NTSTATUS _lsa_QueryInfoPolicy(pipes_struct *p,
                        case ROLE_DOMAIN_PDC:
                        case ROLE_DOMAIN_BDC:
                                name = get_global_sam_name();
-                               sid = get_global_sam_sid();
+                               sid = sid_dup_talloc(p->mem_ctx, get_global_sam_sid());
+                               if (!sid) {
+                                       return NT_STATUS_NO_MEMORY;
+                               }
                                break;
                        case ROLE_DOMAIN_MEMBER:
                                name = lp_workgroup();
                                /* We need to return the Domain SID here. */
-                               if (secrets_fetch_domain_sid(lp_workgroup(), &domain_sid))
-                                       sid = &domain_sid;
-                               else
+                               if (secrets_fetch_domain_sid(lp_workgroup(), &domain_sid)) {
+                                       sid = sid_dup_talloc(p->mem_ctx, &domain_sid);
+                                       if (!sid) {
+                                               return NT_STATUS_NO_MEMORY;
+                                       }
+                               } else {
                                        return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
+                               }
                                break;
                        case ROLE_STANDALONE:
                                name = lp_workgroup();