dsdb:schema/schema_syntax.c - add some empty value checks on validate functions
authorMatthias Dieter Wallnöfer <mdw@samba.org>
Mon, 4 Apr 2011 19:33:11 +0000 (21:33 +0200)
committerMatthias Dieter Wallnöfer <mdw@samba.org>
Thu, 7 Apr 2011 13:53:20 +0000 (15:53 +0200)
They are needed since the check in "ldb_msg_sanity_check" will be removed.

Reviewed-by: abartlet
source4/dsdb/schema/schema_syntax.c

index 8be87df82739ccb6ceef8e0106130f8072287532..afb53377fe3ae18bb12366db3c8dd8baa6ca7ba4 100644 (file)
@@ -254,6 +254,10 @@ static WERROR dsdb_syntax_BOOL_validate_ldb(const struct dsdb_syntax_ctx *ctx,
        for (i=0; i < in->num_values; i++) {
                int t, f;
 
+               if (in->values[i].length == 0) {
+                       return WERR_DS_INVALID_ATTRIBUTE_SYNTAX;
+               }
+
                t = strncmp("TRUE",
                            (const char *)in->values[i].data,
                            in->values[i].length);
@@ -1379,6 +1383,11 @@ static WERROR _dsdb_syntax_OID_validate_numericoid(const struct dsdb_syntax_ctx
                char *oid_out;
                const char *oid = (const char*)in->values[i].data;
 
+               if (in->values[i].length == 0) {
+                       talloc_free(tmp_ctx);
+                       return WERR_DS_INVALID_ATTRIBUTE_SYNTAX;
+               }
+
                if (!ber_write_OID_String(tmp_ctx, &blob, oid)) {
                        DEBUG(0,("ber_write_OID_String() failed for %s\n", oid));
                        talloc_free(tmp_ctx);