s4-repl: fill in GUID and SID from partition information
authorAndrew Tridgell <tridge@samba.org>
Wed, 21 Sep 2011 23:50:57 +0000 (09:50 +1000)
committerAndrew Tridgell <tridge@samba.org>
Thu, 22 Sep 2011 00:00:49 +0000 (10:00 +1000)
when we find a NC via a DN string, fill in the GUID and SID so the
caller can properly report them

source4/dsdb/repl/drepl_partitions.c

index bc4ba9eeee8bf0c055400577b0b600066ee7a4f4..f9bb3f0df49c2f090e22d6e113dad412d730d4ca 100644 (file)
@@ -333,8 +333,8 @@ static WERROR dreplsrv_partition_add_source_dsa(struct dreplsrv_service *s,
 }
 
 WERROR dreplsrv_partition_find_for_nc(struct dreplsrv_service *s,
-                                     const struct GUID *nc_guid,
-                                     const struct dom_sid *nc_sid,
+                                     struct GUID *nc_guid,
+                                     struct dom_sid *nc_sid,
                                      const char *nc_dn_str,
                                      struct dreplsrv_partition **_p)
 {
@@ -357,6 +357,13 @@ WERROR dreplsrv_partition_find_for_nc(struct dreplsrv_service *s,
                    || strequal(p->nc.dn, nc_dn_str)
                    || (valid_sid && dom_sid_equal(&p->nc.sid, nc_sid)))
                {
+                       /* fill in he right guid and sid if possible */
+                       if (nc_guid && !valid_guid) {
+                               dsdb_get_extended_dn_guid(p->dn, nc_guid, "GUID");
+                       }
+                       if (nc_sid && !valid_sid) {
+                               dsdb_get_extended_dn_sid(p->dn, nc_sid, "SID");
+                       }
                        *_p = p;
                        return WERR_OK;
                }