librpc: Allow registration of ndr tables with a zero UUID
authorAndrew Bartlett <abartlet@samba.org>
Wed, 6 Nov 2019 22:30:52 +0000 (11:30 +1300)
committerDouglas Bagnall <dbagnall@samba.org>
Wed, 13 Nov 2019 00:32:37 +0000 (00:32 +0000)
This helps ndrdump find public structures to dump

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14191

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
librpc/ndr/ndr_table.c

index f64e5ac4d20afdfe46a68ea603f6f54eb5ac37c4..c386b8c0030ff8013fa06640f275f035dffc88a2 100644 (file)
@@ -36,12 +36,28 @@ NTSTATUS ndr_table_register(const struct ndr_interface_table *table)
        struct ndr_interface_list *l;
 
        for (l = ndr_interfaces; l; l = l->next) {
-               if (GUID_equal(&table->syntax_id.uuid, &l->table->syntax_id.uuid)) {
-                       DEBUG(0, ("Attempt to register interface %s which has the "
-                                 "same UUID as already registered interface %s\n", 
-                                 table->name, l->table->name));
-                       return NT_STATUS_OBJECT_NAME_COLLISION;
+               /*
+                * If no GUID is supplied, use the name to determine
+                * uniquness.
+                */
+               if (GUID_all_zero(&table->syntax_id.uuid)) {
+                       if (strcmp(table->name,
+                                  l->table->name) != 0) {
+                               continue;
+                       }
+                       DBG_ERR("Attempt to register interface %s which has the "
+                               "same name as already registered interface\n",
+                               table->name);
+               } else {
+                       if (!GUID_equal(&table->syntax_id.uuid,
+                                       &l->table->syntax_id.uuid)) {
+                               continue;
+                       }
+                       DBG_ERR("Attempt to register interface %s which has the "
+                               "same UUID as already registered interface %s\n",
+                               table->name, l->table->name);
                }
+               return NT_STATUS_OBJECT_NAME_COLLISION;
        }
 
        /*