handle NULL fields in blob comparison
authorAndrew Tridgell <tridge@samba.org>
Fri, 6 Jun 2008 17:54:17 +0000 (10:54 -0700)
committerAndrew Tridgell <tridge@samba.org>
Fri, 6 Jun 2008 17:54:17 +0000 (10:54 -0700)
(This used to be commit 0643b5a2bfc401d8318964241ad522eb427a170e)

source4/torture/gentest.c

index 60243a5d1b8f961e07bc2309381016225dbef004..15cf32196533e7f0bcda9c27a8c43b089165ed24 100644 (file)
@@ -1459,7 +1459,9 @@ again:
 } while(0)
 
 #define CHECK_BLOB_EQUAL(field) do { \
 } while(0)
 
 #define CHECK_BLOB_EQUAL(field) do { \
-       if (memcmp(parm[0].field.data, parm[1].field.data, parm[0].field.length) != 0 && !ignore_pattern(#field)) { \
+       if (((parm[0].field.data == NULL && parm[1].field.data != NULL) || \
+           (parm[1].field.data == NULL && parm[0].field.data != NULL) || \
+           (memcmp(parm[0].field.data, parm[1].field.data, parm[0].field.length) != 0)) && !ignore_pattern(#field)) { \
                current_op.mismatch = #field; \
                printf("Mismatch in %s\n", #field); \
                return false; \
                current_op.mismatch = #field; \
                printf("Mismatch in %s\n", #field); \
                return false; \