git.samba.org
/
metze
/
samba
/
wip.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
546a727
)
s4/samldb: Create initial schemaInfo value if it doesn't exists yet
author
Kamen Mazdrashki
<kamenim@samba.org>
Thu, 22 Apr 2010 14:59:22 +0000
(17:59 +0300)
committer
Kamen Mazdrashki
<kamenim@samba.org>
Thu, 29 Apr 2010 01:54:06 +0000
(
04:54
+0300)
source4/dsdb/schema/schema_info_attr.c
patch
|
blob
|
history
diff --git
a/source4/dsdb/schema/schema_info_attr.c
b/source4/dsdb/schema/schema_info_attr.c
index 60722eea52faf674dbb97dd5cdec989b214b9d15..44a12ad629db7a6d5d35db0f7cd6268d34f84710 100644
(file)
--- a/
source4/dsdb/schema/schema_info_attr.c
+++ b/
source4/dsdb/schema/schema_info_attr.c
@@
-29,6
+29,24
@@
#include "param/param.h"
#include "param/param.h"
+/**
+ * Creates and initializes new dsdb_schema_info value.
+ * Initial schemaInfo values is with:
+ * revision = 0
+ * invocationId = GUID_ZERO
+ */
+WERROR dsdb_schema_info_new(TALLOC_CTX *mem_ctx, struct dsdb_schema_info **_schema_info)
+{
+ struct dsdb_schema_info *schema_info;
+
+ schema_info = talloc_zero(mem_ctx, struct dsdb_schema_info);
+ W_ERROR_HAVE_NO_MEMORY(schema_info);
+
+ *_schema_info = schema_info;
+
+ return WERR_OK;
+}
+
/**
* Creates and initializes new dsdb_schema_info blob value.
* Initial schemaInfo values is with:
/**
* Creates and initializes new dsdb_schema_info blob value.
* Initial schemaInfo values is with:
@@
-391,20
+409,25
@@
WERROR dsdb_module_schema_info_update(struct ldb_module *ldb_module,
const struct GUID *invocation_id;
struct dsdb_schema_info *schema_info;
const struct GUID *invocation_id;
struct dsdb_schema_info *schema_info;
- TALLOC_CTX *
mem
_ctx = talloc_new(schema);
- W_ERROR_HAVE_NO_MEMORY(
mem
_ctx);
+ TALLOC_CTX *
temp
_ctx = talloc_new(schema);
+ W_ERROR_HAVE_NO_MEMORY(
temp
_ctx);
invocation_id = samdb_ntds_invocation_id(ldb_module_get_ctx(ldb_module));
if (!invocation_id) {
return WERR_INTERNAL_DB_CORRUPTION;
}
invocation_id = samdb_ntds_invocation_id(ldb_module_get_ctx(ldb_module));
if (!invocation_id) {
return WERR_INTERNAL_DB_CORRUPTION;
}
- werr = dsdb_module_schema_info_read(ldb_module, dsdb_flags,
- mem_ctx, &schema_info);
+ /* read serialized schemaInfo from LDB */
+ werr = dsdb_module_schema_info_read(ldb_module, dsdb_flags, temp_ctx, &schema_info);
+ if (W_ERROR_EQUAL(werr, WERR_DS_NO_ATTRIBUTE_OR_VALUE)) {
+ /* make default value in case
+ * we have no schemaInfo value yet */
+ werr = dsdb_schema_info_new(temp_ctx, &schema_info);
+ }
if (!W_ERROR_IS_OK(werr)) {
DEBUG(0,("dsdb_module_schema_info_update: failed to reload schemaInfo - %s\n",
win_errstr(werr)));
if (!W_ERROR_IS_OK(werr)) {
DEBUG(0,("dsdb_module_schema_info_update: failed to reload schemaInfo - %s\n",
win_errstr(werr)));
- talloc_free(
mem
_ctx);
+ talloc_free(
temp
_ctx);
return werr;
}
return werr;
}
@@
-416,7
+439,7
@@
WERROR dsdb_module_schema_info_update(struct ldb_module *ldb_module,
if (!W_ERROR_IS_OK(werr)) {
DEBUG(0,("dsdb_module_schema_info_update: failed to save schemaInfo - %s\n",
win_errstr(werr)));
if (!W_ERROR_IS_OK(werr)) {
DEBUG(0,("dsdb_module_schema_info_update: failed to save schemaInfo - %s\n",
win_errstr(werr)));
- talloc_free(
mem
_ctx);
+ talloc_free(
temp
_ctx);
return werr;
}
return werr;
}
@@
-427,6
+450,6
@@
WERROR dsdb_module_schema_info_update(struct ldb_module *ldb_module,
schema->schema_info = talloc_steal(schema, schema_info);
*/
schema->schema_info = talloc_steal(schema, schema_info);
*/
- talloc_free(
mem
_ctx);
+ talloc_free(
temp
_ctx);
return WERR_OK;
}
return WERR_OK;
}