s4/dsdb: Update Schema cache with updated schemaInfo value
authorKamen Mazdrashki <kamenim@samba.org>
Thu, 22 Apr 2010 15:11:39 +0000 (18:11 +0300)
committerKamen Mazdrashki <kamenim@samba.org>
Thu, 29 Apr 2010 01:54:07 +0000 (04:54 +0300)
Error checking is simplified and my leave leeks.
I did it this way to make code more readable, and if we
get error in those lines, it will be WERR_NOMEM in which
case we are in a much deeper troubles than delayed freeing
of few bytes.

source4/dsdb/schema/schema_info_attr.c

index 44a12ad629db7a6d5d35db0f7cd6268d34f84710..51fba90ec1dfe8040163a60cc04cd53bb7ed78dd 100644 (file)
@@ -407,7 +407,9 @@ WERROR dsdb_module_schema_info_update(struct ldb_module *ldb_module,
 {
        WERROR werr;
        const struct GUID *invocation_id;
+       DATA_BLOB ndr_blob;
        struct dsdb_schema_info *schema_info;
+       const char *schema_info_str;
 
        TALLOC_CTX *temp_ctx = talloc_new(schema);
        W_ERROR_HAVE_NO_MEMORY(temp_ctx);
@@ -444,11 +446,14 @@ WERROR dsdb_module_schema_info_update(struct ldb_module *ldb_module,
        }
 
        /* finally, update schema_info in the cache */
-       /* TODO: update schema_info in dsdb_schema cache */
-/*
+       werr = dsdb_blob_from_schema_info(schema_info, temp_ctx, &ndr_blob);
+       W_ERROR_NOT_OK_RETURN(werr);
+
+       schema_info_str = hex_encode_talloc(schema, ndr_blob.data, ndr_blob.length);
+       W_ERROR_HAVE_NO_MEMORY(schema_info_str);
+
        talloc_unlink(schema, discard_const(schema->schema_info));
-       schema->schema_info = talloc_steal(schema, schema_info);
-*/
+       schema->schema_info = schema_info_str;
 
        talloc_free(temp_ctx);
        return WERR_OK;