]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3/rpc_client: fix handling of NT_STATUS_SOME_NOT_MAPPED
authorRalph Boehme <slow@samba.org>
Wed, 6 Mar 2024 13:23:45 +0000 (14:23 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 26 Jul 2024 10:06:31 +0000 (10:06 +0000)
In this case names that couldn't be resolved will be have a NULL sid pointer
which would trigger a crash in sid_copy().

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
source3/rpc_client/cli_lsarpc.c

index 73b4872a2c4af4e575d5365ddc589dda4689ac90..cf2572ed61cff09d7c0a8fb4559c3068de5985e7 100644 (file)
@@ -751,12 +751,23 @@ NTSTATUS dcerpc_lsa_lookup_names_generic(struct dcerpc_binding_handle *h,
                }
 
                if (use_lookupnames4) {
-                       sid_copy(sid, sid_array3.sids[i].sid);
+                       if (sid_array3.sids[i].sid != NULL) {
+                               sid_copy(sid, sid_array3.sids[i].sid);
+                       } else {
+                               ZERO_STRUCTP(sid);
+                               (*types)[i] = SID_NAME_UNKNOWN;
+                       }
                } else {
-                       sid_copy(sid, domains->domains[dom_idx].sid);
+                       if (domains->domains[dom_idx].sid != NULL) {
+                               sid_copy(sid, domains->domains[dom_idx].sid);
 
-                       if (sid_array.sids[i].rid != 0xffffffff) {
-                               sid_append_rid(sid, sid_array.sids[i].rid);
+                               if (sid_array.sids[i].rid != 0xffffffff) {
+                                       sid_append_rid(sid,
+                                                      sid_array.sids[i].rid);
+                               }
+                       } else {
+                               ZERO_STRUCTP(sid);
+                               (*types)[i] = SID_NAME_UNKNOWN;
                        }
                }