summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-12-11 17:04:43 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:29:08 -0500
commitd23f3119a94acc8ff24dd55cd8918df77465b914 (patch)
treecbbf2f25bf7bdb271582c74b1165f7f423fdf798
parent78ea6370bffbd31b198e17cfcc826a54eb82387e (diff)
downloadsamba-d23f3119a94acc8ff24dd55cd8918df77465b914.tar.gz
samba-d23f3119a94acc8ff24dd55cd8918df77465b914.tar.bz2
samba-d23f3119a94acc8ff24dd55cd8918df77465b914.zip
r20109: let libnet_BecomeDC() work against w2k servers
metze (This used to be commit d295239861a282d06a9a93cdafa4e4d7616928b8)
-rw-r--r--source4/libnet/libnet_become_dc.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/source4/libnet/libnet_become_dc.c b/source4/libnet/libnet_become_dc.c
index 73ab93c078..92874dbf05 100644
--- a/source4/libnet/libnet_become_dc.c
+++ b/source4/libnet/libnet_become_dc.c
@@ -355,7 +355,11 @@ static NTSTATUS becomeDC_ldap1_w2k3_update_revision(struct libnet_BecomeDC_state
ret = ldb_search(s->ldap1.ldb, basedn, LDB_SCOPE_BASE,
"(objectClass=*)", attrs, &r);
talloc_free(basedn);
- if (ret != LDB_SUCCESS) {
+ if (ret == LDB_ERR_NO_SUCH_OBJECT) {
+ /* w2k doesn't have this object */
+ s->ads_options.w2k3_update_revision = 0;
+ return NT_STATUS_OK;
+ } else if (ret != LDB_SUCCESS) {
return NT_STATUS_LDAP(ret);
} else if (r->count != 1) {
talloc_free(r);
@@ -1053,10 +1057,21 @@ static void becomeDC_drsuapi1_add_entry_send(struct libnet_BecomeDC_state *s)
struct drsuapi_DsReplicaObjectIdentifier *identifier;
uint32_t num_attrs, i = 0;
struct drsuapi_DsReplicaAttribute *attrs;
+ bool w2k3;
/* choose a random invocationId */
s->dest_dsa.invocation_id = GUID_random();
+ /*
+ * if the schema version indicates w2k3, then
+ * also send some w2k3 specific attributes
+ */
+ if (s->ads_options.schema_object_version >= 30) {
+ w2k3 = true;
+ } else {
+ w2k3 = false;
+ }
+
r = talloc_zero(s, struct drsuapi_DsAddEntry);
if (composite_nomem(r, c)) return;
@@ -1249,7 +1264,7 @@ static void becomeDC_drsuapi1_add_entry_send(struct libnet_BecomeDC_state *s)
}
/* msDS-hasMasterNCs: ... */
- {
+ if (w2k3) {
struct drsuapi_DsAttributeValueDNString *vs;
struct drsuapi_DsReplicaObjectIdentifier3 *v;
@@ -1307,7 +1322,7 @@ static void becomeDC_drsuapi1_add_entry_send(struct libnet_BecomeDC_state *s)
}
/* msDS-HasDomainNCs: <domain_partition> */
- {
+ if (w2k3) {
struct drsuapi_DsAttributeValueDNString *vs;
struct drsuapi_DsReplicaObjectIdentifier3 *v;
@@ -1331,7 +1346,7 @@ static void becomeDC_drsuapi1_add_entry_send(struct libnet_BecomeDC_state *s)
}
/* msDS-Behavior-Version */
- {
+ if (w2k3) {
struct drsuapi_DsAttributeValueUINT32 *vs;
uint32_t *v;