diff options
author | Andrew Tridgell <tridge@samba.org> | 2009-09-09 12:29:01 +1000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2009-09-09 12:36:51 +1000 |
commit | dca7afb799477a34f704c04397a6afa1ee6b9973 (patch) | |
tree | d091f9089b3ffb5518958a8b920a9526f34e6e0d /librpc | |
parent | 3cb1caf0ef9fa7b3e96f2ff1d878357bef3a60d3 (diff) | |
download | samba-dca7afb799477a34f704c04397a6afa1ee6b9973.tar.gz samba-dca7afb799477a34f704c04397a6afa1ee6b9973.tar.bz2 samba-dca7afb799477a34f704c04397a6afa1ee6b9973.zip |
s4: fixed format of repsTo in samdb
Metze pointed out what the windows tool ldp.exe will examine repsTo
attributes on remote DCs, so we do in fact need to use the same format
that windows uses. This patch changes the server side implementation
of UpdateRefs to use the windows format
Diffstat (limited to 'librpc')
-rw-r--r-- | librpc/gen_ndr/drsblobs.h | 31 | ||||
-rw-r--r-- | librpc/gen_ndr/ndr_drsblobs.c | 232 | ||||
-rw-r--r-- | librpc/gen_ndr/ndr_drsblobs.h | 7 | ||||
-rw-r--r-- | librpc/idl/drsblobs.idl | 31 |
4 files changed, 0 insertions, 301 deletions
diff --git a/librpc/gen_ndr/drsblobs.h b/librpc/gen_ndr/drsblobs.h index e2781d4a8e..190e012cb5 100644 --- a/librpc/gen_ndr/drsblobs.h +++ b/librpc/gen_ndr/drsblobs.h @@ -128,37 +128,6 @@ struct prefixMapBlob { union prefixMapCtr ctr;/* [switch_is(version)] */ }/* [public] */; -enum repsToVersion -#ifndef USE_UINT_ENUMS - { - REPSTO_VERSION1=1 -} -#else - { __donnot_use_enum_repsToVersion=0x7FFFFFFF} -#define REPSTO_VERSION1 ( 1 ) -#endif -; - -struct repsToDest { - const char * dest_dsa_dns_name;/* [flag(LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM)] */ - struct GUID dest_guid; - uint32_t options; -}; - -struct repsTov1 { - uint32_t count; - struct repsToDest *reps;/* [size_is(count)] */ -}; - -union repsToCtr { - struct repsTov1 r;/* [case(REPSTO_VERSION1)] */ -}/* [nodiscriminant] */; - -struct repsTo { - enum repsToVersion version; - union repsToCtr ctr;/* [switch_is(version)] */ -}/* [public] */; - union ldapControlDirSyncExtra { struct replUpToDateVectorBlob uptodateness_vector;/* [default] */ }/* [gensize,nodiscriminant] */; diff --git a/librpc/gen_ndr/ndr_drsblobs.c b/librpc/gen_ndr/ndr_drsblobs.c index 497140fe42..020d5b3376 100644 --- a/librpc/gen_ndr/ndr_drsblobs.c +++ b/librpc/gen_ndr/ndr_drsblobs.c @@ -1012,238 +1012,6 @@ _PUBLIC_ void ndr_print_prefixMapBlob(struct ndr_print *ndr, const char *name, c ndr->depth--; } -static enum ndr_err_code ndr_push_repsToVersion(struct ndr_push *ndr, int ndr_flags, enum repsToVersion r) -{ - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r)); - return NDR_ERR_SUCCESS; -} - -static enum ndr_err_code ndr_pull_repsToVersion(struct ndr_pull *ndr, int ndr_flags, enum repsToVersion *r) -{ - uint32_t v; - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v)); - *r = v; - return NDR_ERR_SUCCESS; -} - -_PUBLIC_ void ndr_print_repsToVersion(struct ndr_print *ndr, const char *name, enum repsToVersion r) -{ - const char *val = NULL; - - switch (r) { - case REPSTO_VERSION1: val = "REPSTO_VERSION1"; break; - } - ndr_print_enum(ndr, name, "ENUM", val, r); -} - -static enum ndr_err_code ndr_push_repsToDest(struct ndr_push *ndr, int ndr_flags, const struct repsToDest *r) -{ - if (ndr_flags & NDR_SCALARS) { - NDR_CHECK(ndr_push_align(ndr, 4)); - { - uint32_t _flags_save_string = ndr->flags; - ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM); - NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->dest_dsa_dns_name)); - ndr->flags = _flags_save_string; - } - NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->dest_guid)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->options)); - } - if (ndr_flags & NDR_BUFFERS) { - } - return NDR_ERR_SUCCESS; -} - -static enum ndr_err_code ndr_pull_repsToDest(struct ndr_pull *ndr, int ndr_flags, struct repsToDest *r) -{ - if (ndr_flags & NDR_SCALARS) { - NDR_CHECK(ndr_pull_align(ndr, 4)); - { - uint32_t _flags_save_string = ndr->flags; - ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM); - NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->dest_dsa_dns_name)); - ndr->flags = _flags_save_string; - } - NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->dest_guid)); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->options)); - } - if (ndr_flags & NDR_BUFFERS) { - } - return NDR_ERR_SUCCESS; -} - -_PUBLIC_ void ndr_print_repsToDest(struct ndr_print *ndr, const char *name, const struct repsToDest *r) -{ - ndr_print_struct(ndr, name, "repsToDest"); - ndr->depth++; - ndr_print_string(ndr, "dest_dsa_dns_name", r->dest_dsa_dns_name); - ndr_print_GUID(ndr, "dest_guid", &r->dest_guid); - ndr_print_uint32(ndr, "options", r->options); - ndr->depth--; -} - -static enum ndr_err_code ndr_push_repsTov1(struct ndr_push *ndr, int ndr_flags, const struct repsTov1 *r) -{ - uint32_t cntr_reps_0; - if (ndr_flags & NDR_SCALARS) { - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count)); - NDR_CHECK(ndr_push_align(ndr, 4)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count)); - for (cntr_reps_0 = 0; cntr_reps_0 < r->count; cntr_reps_0++) { - NDR_CHECK(ndr_push_repsToDest(ndr, NDR_SCALARS, &r->reps[cntr_reps_0])); - } - } - if (ndr_flags & NDR_BUFFERS) { - } - return NDR_ERR_SUCCESS; -} - -static enum ndr_err_code ndr_pull_repsTov1(struct ndr_pull *ndr, int ndr_flags, struct repsTov1 *r) -{ - uint32_t cntr_reps_0; - TALLOC_CTX *_mem_save_reps_0; - if (ndr_flags & NDR_SCALARS) { - NDR_CHECK(ndr_pull_array_size(ndr, &r->reps)); - NDR_CHECK(ndr_pull_align(ndr, 4)); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count)); - NDR_PULL_ALLOC_N(ndr, r->reps, ndr_get_array_size(ndr, &r->reps)); - _mem_save_reps_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->reps, 0); - for (cntr_reps_0 = 0; cntr_reps_0 < r->count; cntr_reps_0++) { - NDR_CHECK(ndr_pull_repsToDest(ndr, NDR_SCALARS, &r->reps[cntr_reps_0])); - } - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_reps_0, 0); - if (r->reps) { - NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->reps, r->count)); - } - } - if (ndr_flags & NDR_BUFFERS) { - } - return NDR_ERR_SUCCESS; -} - -_PUBLIC_ void ndr_print_repsTov1(struct ndr_print *ndr, const char *name, const struct repsTov1 *r) -{ - uint32_t cntr_reps_0; - ndr_print_struct(ndr, name, "repsTov1"); - ndr->depth++; - ndr_print_uint32(ndr, "count", r->count); - ndr->print(ndr, "%s: ARRAY(%d)", "reps", (int)r->count); - ndr->depth++; - for (cntr_reps_0=0;cntr_reps_0<r->count;cntr_reps_0++) { - char *idx_0=NULL; - if (asprintf(&idx_0, "[%d]", cntr_reps_0) != -1) { - ndr_print_repsToDest(ndr, "reps", &r->reps[cntr_reps_0]); - free(idx_0); - } - } - ndr->depth--; - ndr->depth--; -} - -static enum ndr_err_code ndr_push_repsToCtr(struct ndr_push *ndr, int ndr_flags, const union repsToCtr *r) -{ - if (ndr_flags & NDR_SCALARS) { - int level = ndr_push_get_switch_value(ndr, r); - switch (level) { - case REPSTO_VERSION1: { - NDR_CHECK(ndr_push_repsTov1(ndr, NDR_SCALARS, &r->r)); - break; } - - default: - return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u at %s", level, __location__); - } - } - if (ndr_flags & NDR_BUFFERS) { - int level = ndr_push_get_switch_value(ndr, r); - switch (level) { - case REPSTO_VERSION1: - break; - - default: - return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u at %s", level, __location__); - } - } - return NDR_ERR_SUCCESS; -} - -static enum ndr_err_code ndr_pull_repsToCtr(struct ndr_pull *ndr, int ndr_flags, union repsToCtr *r) -{ - int level; - level = ndr_pull_get_switch_value(ndr, r); - if (ndr_flags & NDR_SCALARS) { - switch (level) { - case REPSTO_VERSION1: { - NDR_CHECK(ndr_pull_repsTov1(ndr, NDR_SCALARS, &r->r)); - break; } - - default: - return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u at %s", level, __location__); - } - } - if (ndr_flags & NDR_BUFFERS) { - switch (level) { - case REPSTO_VERSION1: - break; - - default: - return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u at %s", level, __location__); - } - } - return NDR_ERR_SUCCESS; -} - -_PUBLIC_ void ndr_print_repsToCtr(struct ndr_print *ndr, const char *name, const union repsToCtr *r) -{ - int level; - level = ndr_print_get_switch_value(ndr, r); - ndr_print_union(ndr, name, level, "repsToCtr"); - switch (level) { - case REPSTO_VERSION1: - ndr_print_repsTov1(ndr, "r", &r->r); - break; - - default: - ndr_print_bad_level(ndr, name, level); - } -} - -_PUBLIC_ enum ndr_err_code ndr_push_repsTo(struct ndr_push *ndr, int ndr_flags, const struct repsTo *r) -{ - if (ndr_flags & NDR_SCALARS) { - NDR_CHECK(ndr_push_align(ndr, 4)); - NDR_CHECK(ndr_push_repsToVersion(ndr, NDR_SCALARS, r->version)); - NDR_CHECK(ndr_push_set_switch_value(ndr, &r->ctr, r->version)); - NDR_CHECK(ndr_push_repsToCtr(ndr, NDR_SCALARS, &r->ctr)); - } - if (ndr_flags & NDR_BUFFERS) { - } - return NDR_ERR_SUCCESS; -} - -_PUBLIC_ enum ndr_err_code ndr_pull_repsTo(struct ndr_pull *ndr, int ndr_flags, struct repsTo *r) -{ - if (ndr_flags & NDR_SCALARS) { - NDR_CHECK(ndr_pull_align(ndr, 4)); - NDR_CHECK(ndr_pull_repsToVersion(ndr, NDR_SCALARS, &r->version)); - NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->ctr, r->version)); - NDR_CHECK(ndr_pull_repsToCtr(ndr, NDR_SCALARS, &r->ctr)); - } - if (ndr_flags & NDR_BUFFERS) { - } - return NDR_ERR_SUCCESS; -} - -_PUBLIC_ void ndr_print_repsTo(struct ndr_print *ndr, const char *name, const struct repsTo *r) -{ - ndr_print_struct(ndr, name, "repsTo"); - ndr->depth++; - ndr_print_repsToVersion(ndr, "version", r->version); - ndr_print_set_switch_value(ndr, &r->ctr, r->version); - ndr_print_repsToCtr(ndr, "ctr", &r->ctr); - ndr->depth--; -} - static enum ndr_err_code ndr_push_ldapControlDirSyncExtra(struct ndr_push *ndr, int ndr_flags, const union ldapControlDirSyncExtra *r) { if (ndr_flags & NDR_SCALARS) { diff --git a/librpc/gen_ndr/ndr_drsblobs.h b/librpc/gen_ndr/ndr_drsblobs.h index e890e2cfb2..27c13c8397 100644 --- a/librpc/gen_ndr/ndr_drsblobs.h +++ b/librpc/gen_ndr/ndr_drsblobs.h @@ -75,13 +75,6 @@ void ndr_print_prefixMapCtr(struct ndr_print *ndr, const char *name, const union enum ndr_err_code ndr_push_prefixMapBlob(struct ndr_push *ndr, int ndr_flags, const struct prefixMapBlob *r); enum ndr_err_code ndr_pull_prefixMapBlob(struct ndr_pull *ndr, int ndr_flags, struct prefixMapBlob *r); void ndr_print_prefixMapBlob(struct ndr_print *ndr, const char *name, const struct prefixMapBlob *r); -void ndr_print_repsToVersion(struct ndr_print *ndr, const char *name, enum repsToVersion r); -void ndr_print_repsToDest(struct ndr_print *ndr, const char *name, const struct repsToDest *r); -void ndr_print_repsTov1(struct ndr_print *ndr, const char *name, const struct repsTov1 *r); -void ndr_print_repsToCtr(struct ndr_print *ndr, const char *name, const union repsToCtr *r); -enum ndr_err_code ndr_push_repsTo(struct ndr_push *ndr, int ndr_flags, const struct repsTo *r); -enum ndr_err_code ndr_pull_repsTo(struct ndr_pull *ndr, int ndr_flags, struct repsTo *r); -void ndr_print_repsTo(struct ndr_print *ndr, const char *name, const struct repsTo *r); void ndr_print_ldapControlDirSyncExtra(struct ndr_print *ndr, const char *name, const union ldapControlDirSyncExtra *r); void ndr_print_ldapControlDirSyncBlob(struct ndr_print *ndr, const char *name, const struct ldapControlDirSyncBlob *r); enum ndr_err_code ndr_push_ldapControlDirSyncCookie(struct ndr_push *ndr, int ndr_flags, const struct ldapControlDirSyncCookie *r); diff --git a/librpc/idl/drsblobs.idl b/librpc/idl/drsblobs.idl index 8ec8458f6b..f20d648133 100644 --- a/librpc/idl/drsblobs.idl +++ b/librpc/idl/drsblobs.idl @@ -176,37 +176,6 @@ interface drsblobs { /* - * repsTo structure. This is not sent over the wire so we are - * free to choose our own format. It is updated by the - * DRSUpdateRefs DRSUAPI call. This is stored in NDR format - * in the root of each partition in the repsTo attribute - */ - typedef [v1_enum] enum { - REPSTO_VERSION1 = 1 - } repsToVersion; - - typedef struct { - utf8string dest_dsa_dns_name; - GUID dest_guid; - uint32 options; - } repsToDest; - - typedef struct { - uint32 count; - [size_is(count)] repsToDest reps[]; - } repsTov1; - - typedef [nodiscriminant] union { - [case(REPSTO_VERSION1)] repsTov1 r; - } repsToCtr; - - typedef [public] struct { - repsToVersion version; - [switch_is(version)] repsToCtr ctr; - } repsTo; - - - /* * the cookie for the LDAP dirsync control */ typedef [nodiscriminant,gensize] union { |