librpc: Do not return an NDR table for a zero GUID
authorAndrew Bartlett <abartlet@samba.org>
Wed, 13 Nov 2019 02:51:08 +0000 (15:51 +1300)
committerAndreas Schneider <asn@cryptomilk.org>
Thu, 14 Nov 2019 08:01:43 +0000 (08:01 +0000)
The source3 RPC server will do a lookup by GUID and should
not be returned a table for a zero GUID.

Thankfully such a pipe would also need to have been registered
but regardless this is not a determinsitic result so should
be avoided.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
librpc/ndr/ndr_table.c

index c386b8c0030ff8013fa06640f275f035dffc88a2..bc44fd38e3372813b3cfa52ee05037c5ff0662c2 100644 (file)
@@ -129,6 +129,10 @@ const struct ndr_interface_table *ndr_table_by_name(const char *name)
 const struct ndr_interface_table *ndr_table_by_syntax(const struct ndr_syntax_id *syntax)
 {
        const struct ndr_interface_list *l;
+       if (GUID_all_zero(&syntax->uuid)) {
+               /* These are not unique */
+               return NULL;
+       }
        for (l=ndr_table_list();l;l=l->next) {
                if (ndr_syntax_id_equal(&l->table->syntax_id, syntax)) {
                        return l->table;
@@ -143,6 +147,10 @@ const struct ndr_interface_table *ndr_table_by_syntax(const struct ndr_syntax_id
 const struct ndr_interface_table *ndr_table_by_uuid(const struct GUID *uuid)
 {
        const struct ndr_interface_list *l;
+       if (GUID_all_zero(uuid)) {
+               /* These are not unique */
+               return NULL;
+       }
        for (l=ndr_table_list();l;l=l->next) {
                if (GUID_equal(&l->table->syntax_id.uuid, uuid)) {
                        return l->table;