[SCM] Samba Shared Repository - branch master updated
Kamen Mazdrashki
kamenim at samba.org
Sat Sep 18 08:34:42 MDT 2010
The branch, master has been updated
via d76bb4a s4-drs: Check for schema changes only in case we are *not* applying Schema replica
via 1fac1f0 werror: Add W_ERROR_HAVE_NO_MEMORY_AND_FREE() macro
via c3489a7 s4-ldapcmp: Fix options parsing for common Samba options
from 78b6265 s3:rpc_client: remove unused rpc_pipe_set_hnd_state()
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit d76bb4ac409ff7f95776302bb436c7dec55adb26
Author: Kamen Mazdrashki <kamenim at samba.org>
Date: Sat Sep 18 15:09:22 2010 +0300
s4-drs: Check for schema changes only in case we are *not* applying Schema replica
This fixes the problem when we fail to replicate with
a partner DC that has a newer Schema with attributeSchema
objects with OIDs that we don't have in our local prefixMap.
commit 1fac1f0d2882ae9ac81a02fa6d9957f6cb3fb88d
Author: Kamen Mazdrashki <kamenim at samba.org>
Date: Sat Sep 18 02:28:29 2010 +0300
werror: Add W_ERROR_HAVE_NO_MEMORY_AND_FREE() macro
commit c3489a7918758848953f00cee6a36519cd059daf
Author: Kamen Mazdrashki <kamenim at samba.org>
Date: Sat Sep 18 00:44:17 2010 +0300
s4-ldapcmp: Fix options parsing for common Samba options
And also set 'creds2' to be equal to 'creds' in case
username2 paramater is not supplied on cmd line
-----------------------------------------------------------------------
Summary of changes:
libcli/util/werror.h | 7 +++++++
source4/dsdb/repl/replicated_objects.c | 27 +++++++++++++++++++--------
source4/scripting/devel/ldapcmp | 14 ++++++++++----
3 files changed, 36 insertions(+), 12 deletions(-)
Changeset truncated at 500 lines:
diff --git a/libcli/util/werror.h b/libcli/util/werror.h
index 3b717d2..d89cd9c 100644
--- a/libcli/util/werror.h
+++ b/libcli/util/werror.h
@@ -48,6 +48,13 @@ typedef uint32_t WERROR;
}\
} while (0)
+#define W_ERROR_HAVE_NO_MEMORY_AND_FREE(x, ctx) do { \
+ if (!(x)) {\
+ talloc_free(ctx); \
+ return WERR_NOMEM;\
+ }\
+} while (0)
+
#define W_ERROR_IS_OK_RETURN(x) do { \
if (W_ERROR_IS_OK(x)) {\
return x;\
diff --git a/source4/dsdb/repl/replicated_objects.c b/source4/dsdb/repl/replicated_objects.c
index 838dc84..0beb53c 100644
--- a/source4/dsdb/repl/replicated_objects.c
+++ b/source4/dsdb/repl/replicated_objects.c
@@ -197,7 +197,7 @@ WERROR dsdb_convert_object_ex(struct ldb_context *ldb,
}
WERROR dsdb_extended_replicated_objects_convert(struct ldb_context *ldb,
- const char *partition_dn,
+ const char *partition_dn_str,
const struct drsuapi_DsReplicaOIDMapping_Ctr *mapping_ctr,
uint32_t object_count,
const struct drsuapi_DsReplicaObjectListItemEx *first_object,
@@ -210,6 +210,7 @@ WERROR dsdb_extended_replicated_objects_convert(struct ldb_context *ldb,
struct dsdb_extended_replicated_objects **objects)
{
WERROR status;
+ struct ldb_dn *partition_dn;
const struct dsdb_schema *schema;
struct dsdb_extended_replicated_objects *out;
const struct drsuapi_DsReplicaObjectListItemEx *cur;
@@ -226,14 +227,24 @@ WERROR dsdb_extended_replicated_objects_convert(struct ldb_context *ldb,
return WERR_DS_SCHEMA_NOT_LOADED;
}
- status = dsdb_schema_pfm_contains_drsuapi_pfm(schema->prefixmap, mapping_ctr);
- if (!W_ERROR_IS_OK(status)) {
- talloc_free(out);
- return status;
+ partition_dn = ldb_dn_new(out, ldb, partition_dn_str);
+ W_ERROR_HAVE_NO_MEMORY_AND_FREE(partition_dn, out);
+
+ if (ldb_dn_compare(partition_dn, ldb_get_schema_basedn(ldb)) != 0) {
+ /*
+ * check for schema changes in case
+ * we are not replicating Schema NC
+ */
+ status = dsdb_schema_info_cmp(schema, mapping_ctr);
+ if (!W_ERROR_IS_OK(status)) {
+ DEBUG(1,("Remote schema has changed while replicating %s\n",
+ partition_dn_str));
+ talloc_free(out);
+ return status;
+ }
}
- out->partition_dn = ldb_dn_new(out, ldb, partition_dn);
- W_ERROR_HAVE_NO_MEMORY(out->partition_dn);
+ out->partition_dn = partition_dn;
out->source_dsa = source_dsa;
out->uptodateness_vector= uptodateness_vector;
@@ -242,7 +253,7 @@ WERROR dsdb_extended_replicated_objects_convert(struct ldb_context *ldb,
out->objects = talloc_array(out,
struct dsdb_extended_replicated_object,
out->num_objects);
- W_ERROR_HAVE_NO_MEMORY(out->objects);
+ W_ERROR_HAVE_NO_MEMORY_AND_FREE(out->objects, out);
/* pass the linked attributes down to the repl_meta_data
module */
diff --git a/source4/scripting/devel/ldapcmp b/source4/scripting/devel/ldapcmp
index 76b4e8e..edf37d3 100755
--- a/source4/scripting/devel/ldapcmp
+++ b/source4/scripting/devel/ldapcmp
@@ -518,13 +518,10 @@ class LDAPBundel(object):
if __name__ == "__main__":
parser = OptionParser("ldapcmp [options] domain|configuration|schema")
sambaopts = options.SambaOptions(parser)
+ parser.add_option_group(sambaopts)
credopts = options.CredentialsOptionsDouble(parser)
parser.add_option_group(credopts)
- lp = sambaopts.get_loadparm()
- creds = credopts.get_credentials(lp)
- creds2 = credopts.get_credentials2(lp)
-
parser.add_option("", "--host", dest="host",
help="IP of the first LDAP server",)
parser.add_option("", "--host2", dest="host2",
@@ -537,6 +534,15 @@ if __name__ == "__main__":
help="Print all DN pairs that have been compared",)
(opts, args) = parser.parse_args()
+ lp = sambaopts.get_loadparm()
+ creds = credopts.get_credentials(lp)
+ creds2 = credopts.get_credentials2(lp)
+ if creds2.is_anonymous():
+ creds2 = creds
+
+ if creds.is_anonymous():
+ parser.error("You must supply at least one username/password pair")
+
if not (len(args) == 1 and args[0].upper() in ["DOMAIN", "CONFIGURATION", "SCHEMA"]):
parser.error("Incorrect arguments")
--
Samba Shared Repository
More information about the samba-cvs
mailing list