diff options
-rw-r--r-- | librpc/gen_ndr/drsuapi.h | 24 | ||||
-rw-r--r-- | librpc/gen_ndr/ndr_drsuapi.c | 184 | ||||
-rw-r--r-- | librpc/idl/drsuapi.idl | 16 | ||||
-rw-r--r-- | source4/dsdb/kcc/kcc_drs_replica_info.c | 100 | ||||
-rw-r--r-- | source4/torture/rpc/drsuapi.c | 8 | ||||
-rw-r--r-- | source4/torture/rpc/dsgetinfo.c | 8 |
6 files changed, 208 insertions, 132 deletions
diff --git a/librpc/gen_ndr/drsuapi.h b/librpc/gen_ndr/drsuapi.h index 87a55cbc2a..e4ddc2d7af 100644 --- a/librpc/gen_ndr/drsuapi.h +++ b/librpc/gen_ndr/drsuapi.h @@ -1241,10 +1241,10 @@ enum drsuapi_DsReplicaInfoType DRSUAPI_DS_REPLICA_INFO_CURSORS3=(int)(8), DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA2=(int)(9), DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA2=(int)(10), - DRSUAPI_DS_REPLICA_INFO_NEIGHBORS02=(int)(-2), - DRSUAPI_DS_REPLICA_INFO_CONNECTIONS04=(int)(-4), - DRSUAPI_DS_REPLICA_INFO_CURSORS05=(int)(-5), - DRSUAPI_DS_REPLICA_INFO_06=(int)(-6) + DRSUAPI_DS_REPLICA_INFO_REPSTO=(int)(-2), + DRSUAPI_DS_REPLICA_INFO_CLIENT_CONTEXTS=(int)(-4), + DRSUAPI_DS_REPLICA_INFO_UPTODATE_VECTOR_V1=(int)(-5), + DRSUAPI_DS_REPLICA_INFO_SERVER_OUTGOING_CALLS=(int)(-6) } #else { __donnot_use_enum_drsuapi_DsReplicaInfoType=0x7FFFFFFF} @@ -1259,10 +1259,10 @@ enum drsuapi_DsReplicaInfoType #define DRSUAPI_DS_REPLICA_INFO_CURSORS3 ( 8 ) #define DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA2 ( 9 ) #define DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA2 ( 10 ) -#define DRSUAPI_DS_REPLICA_INFO_NEIGHBORS02 ( -2 ) -#define DRSUAPI_DS_REPLICA_INFO_CONNECTIONS04 ( -4 ) -#define DRSUAPI_DS_REPLICA_INFO_CURSORS05 ( -5 ) -#define DRSUAPI_DS_REPLICA_INFO_06 ( -6 ) +#define DRSUAPI_DS_REPLICA_INFO_REPSTO ( -2 ) +#define DRSUAPI_DS_REPLICA_INFO_CLIENT_CONTEXTS ( -4 ) +#define DRSUAPI_DS_REPLICA_INFO_UPTODATE_VECTOR_V1 ( -5 ) +#define DRSUAPI_DS_REPLICA_INFO_SERVER_OUTGOING_CALLS ( -6 ) #endif ; @@ -1506,10 +1506,10 @@ union drsuapi_DsReplicaInfo { struct drsuapi_DsReplicaCursor3Ctr *cursors3;/* [unique,case(DRSUAPI_DS_REPLICA_INFO_CURSORS3)] */ struct drsuapi_DsReplicaObjMetaData2Ctr *objmetadata2;/* [unique,case(DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA2)] */ struct drsuapi_DsReplicaAttrValMetaData2Ctr *attrvalmetadata2;/* [unique,case(DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA2)] */ - struct drsuapi_DsReplicaNeighbourCtr *neighbours02;/* [unique,case(DRSUAPI_DS_REPLICA_INFO_NEIGHBORS02)] */ - struct drsuapi_DsReplicaConnection04Ctr *connections04;/* [unique,case(DRSUAPI_DS_REPLICA_INFO_CONNECTIONS04)] */ - struct drsuapi_DsReplicaCursorCtrEx *cursors05;/* [unique,case(DRSUAPI_DS_REPLICA_INFO_CURSORS05)] */ - struct drsuapi_DsReplica06Ctr *i06;/* [unique,case(DRSUAPI_DS_REPLICA_INFO_06)] */ + struct drsuapi_DsReplicaNeighbourCtr *repsto;/* [unique,case(DRSUAPI_DS_REPLICA_INFO_REPSTO)] */ + struct drsuapi_DsReplicaConnection04Ctr *clientctx;/* [unique,case(DRSUAPI_DS_REPLICA_INFO_CLIENT_CONTEXTS)] */ + struct drsuapi_DsReplicaCursorCtrEx *udv1;/* [unique,case(DRSUAPI_DS_REPLICA_INFO_UPTODATE_VECTOR_V1)] */ + struct drsuapi_DsReplica06Ctr *srvoutgoingcalls;/* [unique,case(DRSUAPI_DS_REPLICA_INFO_SERVER_OUTGOING_CALLS)] */ }/* [switch_type(drsuapi_DsReplicaInfoType)] */; struct drsuapi_DsGetMemberships2Ctr1 { diff --git a/librpc/gen_ndr/ndr_drsuapi.c b/librpc/gen_ndr/ndr_drsuapi.c index 74ccab72c6..0fcdb4a016 100644 --- a/librpc/gen_ndr/ndr_drsuapi.c +++ b/librpc/gen_ndr/ndr_drsuapi.c @@ -9587,10 +9587,10 @@ _PUBLIC_ void ndr_print_drsuapi_DsReplicaInfoType(struct ndr_print *ndr, const c case DRSUAPI_DS_REPLICA_INFO_CURSORS3: val = "DRSUAPI_DS_REPLICA_INFO_CURSORS3"; break; case DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA2: val = "DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA2"; break; case DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA2: val = "DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA2"; break; - case DRSUAPI_DS_REPLICA_INFO_NEIGHBORS02: val = "DRSUAPI_DS_REPLICA_INFO_NEIGHBORS02"; break; - case DRSUAPI_DS_REPLICA_INFO_CONNECTIONS04: val = "DRSUAPI_DS_REPLICA_INFO_CONNECTIONS04"; break; - case DRSUAPI_DS_REPLICA_INFO_CURSORS05: val = "DRSUAPI_DS_REPLICA_INFO_CURSORS05"; break; - case DRSUAPI_DS_REPLICA_INFO_06: val = "DRSUAPI_DS_REPLICA_INFO_06"; break; + case DRSUAPI_DS_REPLICA_INFO_REPSTO: val = "DRSUAPI_DS_REPLICA_INFO_REPSTO"; break; + case DRSUAPI_DS_REPLICA_INFO_CLIENT_CONTEXTS: val = "DRSUAPI_DS_REPLICA_INFO_CLIENT_CONTEXTS"; break; + case DRSUAPI_DS_REPLICA_INFO_UPTODATE_VECTOR_V1: val = "DRSUAPI_DS_REPLICA_INFO_UPTODATE_VECTOR_V1"; break; + case DRSUAPI_DS_REPLICA_INFO_SERVER_OUTGOING_CALLS: val = "DRSUAPI_DS_REPLICA_INFO_SERVER_OUTGOING_CALLS"; break; } ndr_print_enum(ndr, name, "ENUM", val, r); } @@ -11974,20 +11974,20 @@ static enum ndr_err_code ndr_push_drsuapi_DsReplicaInfo(struct ndr_push *ndr, in NDR_CHECK(ndr_push_unique_ptr(ndr, r->attrvalmetadata2)); break; } - case DRSUAPI_DS_REPLICA_INFO_NEIGHBORS02: { - NDR_CHECK(ndr_push_unique_ptr(ndr, r->neighbours02)); + case DRSUAPI_DS_REPLICA_INFO_REPSTO: { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->repsto)); break; } - case DRSUAPI_DS_REPLICA_INFO_CONNECTIONS04: { - NDR_CHECK(ndr_push_unique_ptr(ndr, r->connections04)); + case DRSUAPI_DS_REPLICA_INFO_CLIENT_CONTEXTS: { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->clientctx)); break; } - case DRSUAPI_DS_REPLICA_INFO_CURSORS05: { - NDR_CHECK(ndr_push_unique_ptr(ndr, r->cursors05)); + case DRSUAPI_DS_REPLICA_INFO_UPTODATE_VECTOR_V1: { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->udv1)); break; } - case DRSUAPI_DS_REPLICA_INFO_06: { - NDR_CHECK(ndr_push_unique_ptr(ndr, r->i06)); + case DRSUAPI_DS_REPLICA_INFO_SERVER_OUTGOING_CALLS: { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->srvoutgoingcalls)); break; } default: @@ -12063,27 +12063,27 @@ static enum ndr_err_code ndr_push_drsuapi_DsReplicaInfo(struct ndr_push *ndr, in } break; - case DRSUAPI_DS_REPLICA_INFO_NEIGHBORS02: - if (r->neighbours02) { - NDR_CHECK(ndr_push_drsuapi_DsReplicaNeighbourCtr(ndr, NDR_SCALARS|NDR_BUFFERS, r->neighbours02)); + case DRSUAPI_DS_REPLICA_INFO_REPSTO: + if (r->repsto) { + NDR_CHECK(ndr_push_drsuapi_DsReplicaNeighbourCtr(ndr, NDR_SCALARS|NDR_BUFFERS, r->repsto)); } break; - case DRSUAPI_DS_REPLICA_INFO_CONNECTIONS04: - if (r->connections04) { - NDR_CHECK(ndr_push_drsuapi_DsReplicaConnection04Ctr(ndr, NDR_SCALARS, r->connections04)); + case DRSUAPI_DS_REPLICA_INFO_CLIENT_CONTEXTS: + if (r->clientctx) { + NDR_CHECK(ndr_push_drsuapi_DsReplicaConnection04Ctr(ndr, NDR_SCALARS, r->clientctx)); } break; - case DRSUAPI_DS_REPLICA_INFO_CURSORS05: - if (r->cursors05) { - NDR_CHECK(ndr_push_drsuapi_DsReplicaCursorCtrEx(ndr, NDR_SCALARS, r->cursors05)); + case DRSUAPI_DS_REPLICA_INFO_UPTODATE_VECTOR_V1: + if (r->udv1) { + NDR_CHECK(ndr_push_drsuapi_DsReplicaCursorCtrEx(ndr, NDR_SCALARS, r->udv1)); } break; - case DRSUAPI_DS_REPLICA_INFO_06: - if (r->i06) { - NDR_CHECK(ndr_push_drsuapi_DsReplica06Ctr(ndr, NDR_SCALARS|NDR_BUFFERS, r->i06)); + case DRSUAPI_DS_REPLICA_INFO_SERVER_OUTGOING_CALLS: + if (r->srvoutgoingcalls) { + NDR_CHECK(ndr_push_drsuapi_DsReplica06Ctr(ndr, NDR_SCALARS|NDR_BUFFERS, r->srvoutgoingcalls)); } break; @@ -12109,10 +12109,10 @@ static enum ndr_err_code ndr_pull_drsuapi_DsReplicaInfo(struct ndr_pull *ndr, in TALLOC_CTX *_mem_save_cursors3_0; TALLOC_CTX *_mem_save_objmetadata2_0; TALLOC_CTX *_mem_save_attrvalmetadata2_0; - TALLOC_CTX *_mem_save_neighbours02_0; - TALLOC_CTX *_mem_save_connections04_0; - TALLOC_CTX *_mem_save_cursors05_0; - TALLOC_CTX *_mem_save_i06_0; + TALLOC_CTX *_mem_save_repsto_0; + TALLOC_CTX *_mem_save_clientctx_0; + TALLOC_CTX *_mem_save_udv1_0; + TALLOC_CTX *_mem_save_srvoutgoingcalls_0; level = ndr_pull_get_switch_value(ndr, r); if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &_level)); @@ -12231,43 +12231,43 @@ static enum ndr_err_code ndr_pull_drsuapi_DsReplicaInfo(struct ndr_pull *ndr, in } break; } - case DRSUAPI_DS_REPLICA_INFO_NEIGHBORS02: { - uint32_t _ptr_neighbours02; - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_neighbours02)); - if (_ptr_neighbours02) { - NDR_PULL_ALLOC(ndr, r->neighbours02); + case DRSUAPI_DS_REPLICA_INFO_REPSTO: { + uint32_t _ptr_repsto; + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_repsto)); + if (_ptr_repsto) { + NDR_PULL_ALLOC(ndr, r->repsto); } else { - r->neighbours02 = NULL; + r->repsto = NULL; } break; } - case DRSUAPI_DS_REPLICA_INFO_CONNECTIONS04: { - uint32_t _ptr_connections04; - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_connections04)); - if (_ptr_connections04) { - NDR_PULL_ALLOC(ndr, r->connections04); + case DRSUAPI_DS_REPLICA_INFO_CLIENT_CONTEXTS: { + uint32_t _ptr_clientctx; + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_clientctx)); + if (_ptr_clientctx) { + NDR_PULL_ALLOC(ndr, r->clientctx); } else { - r->connections04 = NULL; + r->clientctx = NULL; } break; } - case DRSUAPI_DS_REPLICA_INFO_CURSORS05: { - uint32_t _ptr_cursors05; - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_cursors05)); - if (_ptr_cursors05) { - NDR_PULL_ALLOC(ndr, r->cursors05); + case DRSUAPI_DS_REPLICA_INFO_UPTODATE_VECTOR_V1: { + uint32_t _ptr_udv1; + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_udv1)); + if (_ptr_udv1) { + NDR_PULL_ALLOC(ndr, r->udv1); } else { - r->cursors05 = NULL; + r->udv1 = NULL; } break; } - case DRSUAPI_DS_REPLICA_INFO_06: { - uint32_t _ptr_i06; - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_i06)); - if (_ptr_i06) { - NDR_PULL_ALLOC(ndr, r->i06); + case DRSUAPI_DS_REPLICA_INFO_SERVER_OUTGOING_CALLS: { + uint32_t _ptr_srvoutgoingcalls; + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_srvoutgoingcalls)); + if (_ptr_srvoutgoingcalls) { + NDR_PULL_ALLOC(ndr, r->srvoutgoingcalls); } else { - r->i06 = NULL; + r->srvoutgoingcalls = NULL; } break; } @@ -12376,39 +12376,39 @@ static enum ndr_err_code ndr_pull_drsuapi_DsReplicaInfo(struct ndr_pull *ndr, in } break; - case DRSUAPI_DS_REPLICA_INFO_NEIGHBORS02: - if (r->neighbours02) { - _mem_save_neighbours02_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->neighbours02, 0); - NDR_CHECK(ndr_pull_drsuapi_DsReplicaNeighbourCtr(ndr, NDR_SCALARS|NDR_BUFFERS, r->neighbours02)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_neighbours02_0, 0); + case DRSUAPI_DS_REPLICA_INFO_REPSTO: + if (r->repsto) { + _mem_save_repsto_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->repsto, 0); + NDR_CHECK(ndr_pull_drsuapi_DsReplicaNeighbourCtr(ndr, NDR_SCALARS|NDR_BUFFERS, r->repsto)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_repsto_0, 0); } break; - case DRSUAPI_DS_REPLICA_INFO_CONNECTIONS04: - if (r->connections04) { - _mem_save_connections04_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->connections04, 0); - NDR_CHECK(ndr_pull_drsuapi_DsReplicaConnection04Ctr(ndr, NDR_SCALARS, r->connections04)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_connections04_0, 0); + case DRSUAPI_DS_REPLICA_INFO_CLIENT_CONTEXTS: + if (r->clientctx) { + _mem_save_clientctx_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->clientctx, 0); + NDR_CHECK(ndr_pull_drsuapi_DsReplicaConnection04Ctr(ndr, NDR_SCALARS, r->clientctx)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_clientctx_0, 0); } break; - case DRSUAPI_DS_REPLICA_INFO_CURSORS05: - if (r->cursors05) { - _mem_save_cursors05_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->cursors05, 0); - NDR_CHECK(ndr_pull_drsuapi_DsReplicaCursorCtrEx(ndr, NDR_SCALARS, r->cursors05)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_cursors05_0, 0); + case DRSUAPI_DS_REPLICA_INFO_UPTODATE_VECTOR_V1: + if (r->udv1) { + _mem_save_udv1_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->udv1, 0); + NDR_CHECK(ndr_pull_drsuapi_DsReplicaCursorCtrEx(ndr, NDR_SCALARS, r->udv1)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_udv1_0, 0); } break; - case DRSUAPI_DS_REPLICA_INFO_06: - if (r->i06) { - _mem_save_i06_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->i06, 0); - NDR_CHECK(ndr_pull_drsuapi_DsReplica06Ctr(ndr, NDR_SCALARS|NDR_BUFFERS, r->i06)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_i06_0, 0); + case DRSUAPI_DS_REPLICA_INFO_SERVER_OUTGOING_CALLS: + if (r->srvoutgoingcalls) { + _mem_save_srvoutgoingcalls_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->srvoutgoingcalls, 0); + NDR_CHECK(ndr_pull_drsuapi_DsReplica06Ctr(ndr, NDR_SCALARS|NDR_BUFFERS, r->srvoutgoingcalls)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_srvoutgoingcalls_0, 0); } break; @@ -12524,38 +12524,38 @@ _PUBLIC_ void ndr_print_drsuapi_DsReplicaInfo(struct ndr_print *ndr, const char ndr->depth--; break; - case DRSUAPI_DS_REPLICA_INFO_NEIGHBORS02: - ndr_print_ptr(ndr, "neighbours02", r->neighbours02); + case DRSUAPI_DS_REPLICA_INFO_REPSTO: + ndr_print_ptr(ndr, "repsto", r->repsto); ndr->depth++; - if (r->neighbours02) { - ndr_print_drsuapi_DsReplicaNeighbourCtr(ndr, "neighbours02", r->neighbours02); + if (r->repsto) { + ndr_print_drsuapi_DsReplicaNeighbourCtr(ndr, "repsto", r->repsto); } ndr->depth--; break; - case DRSUAPI_DS_REPLICA_INFO_CONNECTIONS04: - ndr_print_ptr(ndr, "connections04", r->connections04); + case DRSUAPI_DS_REPLICA_INFO_CLIENT_CONTEXTS: + ndr_print_ptr(ndr, "clientctx", r->clientctx); ndr->depth++; - if (r->connections04) { - ndr_print_drsuapi_DsReplicaConnection04Ctr(ndr, "connections04", r->connections04); + if (r->clientctx) { + ndr_print_drsuapi_DsReplicaConnection04Ctr(ndr, "clientctx", r->clientctx); } ndr->depth--; break; - case DRSUAPI_DS_REPLICA_INFO_CURSORS05: - ndr_print_ptr(ndr, "cursors05", r->cursors05); + case DRSUAPI_DS_REPLICA_INFO_UPTODATE_VECTOR_V1: + ndr_print_ptr(ndr, "udv1", r->udv1); ndr->depth++; - if (r->cursors05) { - ndr_print_drsuapi_DsReplicaCursorCtrEx(ndr, "cursors05", r->cursors05); + if (r->udv1) { + ndr_print_drsuapi_DsReplicaCursorCtrEx(ndr, "udv1", r->udv1); } ndr->depth--; break; - case DRSUAPI_DS_REPLICA_INFO_06: - ndr_print_ptr(ndr, "i06", r->i06); + case DRSUAPI_DS_REPLICA_INFO_SERVER_OUTGOING_CALLS: + ndr_print_ptr(ndr, "srvoutgoingcalls", r->srvoutgoingcalls); ndr->depth++; - if (r->i06) { - ndr_print_drsuapi_DsReplica06Ctr(ndr, "i06", r->i06); + if (r->srvoutgoingcalls) { + ndr_print_drsuapi_DsReplica06Ctr(ndr, "srvoutgoingcalls", r->srvoutgoingcalls); } ndr->depth--; break; diff --git a/librpc/idl/drsuapi.idl b/librpc/idl/drsuapi.idl index 00aa7bb289..4c8126ed02 100644 --- a/librpc/idl/drsuapi.idl +++ b/librpc/idl/drsuapi.idl @@ -1365,10 +1365,10 @@ interface drsuapi DRSUAPI_DS_REPLICA_INFO_CURSORS3 = 8, DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA2 = 9, DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA2 = 10, - DRSUAPI_DS_REPLICA_INFO_NEIGHBORS02 = -2, - DRSUAPI_DS_REPLICA_INFO_CONNECTIONS04 = -4, - DRSUAPI_DS_REPLICA_INFO_CURSORS05 = -5, - DRSUAPI_DS_REPLICA_INFO_06 = -6 + DRSUAPI_DS_REPLICA_INFO_REPSTO = -2, + DRSUAPI_DS_REPLICA_INFO_CLIENT_CONTEXTS = -4, + DRSUAPI_DS_REPLICA_INFO_UPTODATE_VECTOR_V1 = -5, + DRSUAPI_DS_REPLICA_INFO_SERVER_OUTGOING_CALLS = -6 } drsuapi_DsReplicaInfoType; typedef struct { @@ -1600,10 +1600,10 @@ interface drsuapi [case(DRSUAPI_DS_REPLICA_INFO_CURSORS3)] drsuapi_DsReplicaCursor3Ctr *cursors3; [case(DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA2)] drsuapi_DsReplicaObjMetaData2Ctr *objmetadata2; [case(DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA2)] drsuapi_DsReplicaAttrValMetaData2Ctr *attrvalmetadata2; - [case(DRSUAPI_DS_REPLICA_INFO_NEIGHBORS02)] drsuapi_DsReplicaNeighbourCtr *neighbours02; - [case(DRSUAPI_DS_REPLICA_INFO_CONNECTIONS04)] drsuapi_DsReplicaConnection04Ctr *connections04; - [case(DRSUAPI_DS_REPLICA_INFO_CURSORS05)] drsuapi_DsReplicaCursorCtrEx *cursors05; - [case(DRSUAPI_DS_REPLICA_INFO_06)] drsuapi_DsReplica06Ctr *i06; + [case(DRSUAPI_DS_REPLICA_INFO_REPSTO)] drsuapi_DsReplicaNeighbourCtr *repsto; + [case(DRSUAPI_DS_REPLICA_INFO_CLIENT_CONTEXTS)] drsuapi_DsReplicaConnection04Ctr *clientctx; + [case(DRSUAPI_DS_REPLICA_INFO_UPTODATE_VECTOR_V1)] drsuapi_DsReplicaCursorCtrEx *udv1; + [case(DRSUAPI_DS_REPLICA_INFO_SERVER_OUTGOING_CALLS)] drsuapi_DsReplica06Ctr *srvoutgoingcalls; } drsuapi_DsReplicaInfo; WERROR drsuapi_DsReplicaGetInfo( diff --git a/source4/dsdb/kcc/kcc_drs_replica_info.c b/source4/dsdb/kcc/kcc_drs_replica_info.c index c35664905f..e168fe5055 100644 --- a/source4/dsdb/kcc/kcc_drs_replica_info.c +++ b/source4/dsdb/kcc/kcc_drs_replica_info.c @@ -33,7 +33,80 @@ #include "librpc/gen_ndr/ndr_drsuapi.h" #include "librpc/gen_ndr/ndr_drsblobs.h" #include "param/param.h" +#include "dsdb/common/util.h" +/* + get metadata for specified object +*/ +static WERROR kccdrs_replica_get_info_obj_metadata(TALLOC_CTX *mem_ctx, + struct ldb_context *samdb, + struct drsuapi_DsReplicaGetInfo *r, + union drsuapi_DsReplicaInfo *reply, + struct ldb_dn *dn) +{ + int ret, i; + const struct ldb_val *md_value; + struct ldb_result *result; + enum ndr_err_code ndr_err; + struct replPropertyMetaDataBlob md; + const struct dsdb_schema *schema; + const char *attrs[] = { "replPropertyMetaData", NULL }; + + ret = dsdb_search_dn(samdb, mem_ctx, &result, dn, attrs, DSDB_SEARCH_SHOW_DELETED); + if (ret != LDB_SUCCESS) { + return WERR_INTERNAL_ERROR; + } else if (result->count < 1) { + DEBUG(1, (__location__": Failed to find replPropertyMetaData for: %s\n", r->in.req->req1.object_dn)); + return WERR_INTERNAL_ERROR; + } + + md_value = ldb_msg_find_ldb_val(result->msgs[0], "replPropertyMetaData"); + if (!md_value) { + return WERR_INTERNAL_ERROR; + } + + ndr_err = ndr_pull_struct_blob(md_value, mem_ctx, + lp_iconv_convenience(ldb_get_opaque(samdb, "loadparm")), + &md, + (ndr_pull_flags_fn_t)ndr_pull_replPropertyMetaDataBlob); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + return WERR_INTERNAL_ERROR; + } + + if (md.version != 1) { + return WERR_INTERNAL_ERROR; + } + + schema = dsdb_get_schema(samdb); + if (!schema) { + DEBUG(0,(__location__": Failed to get the schema\n")); + return WERR_INTERNAL_ERROR; + } + + reply->objmetadata = talloc(mem_ctx, struct drsuapi_DsReplicaObjMetaDataCtr); + W_ERROR_HAVE_NO_MEMORY(reply->objmetadata); + + reply->objmetadata->reserved = 0; + reply->objmetadata->count = md.ctr.ctr1.count; + reply->objmetadata->array = talloc_array(mem_ctx, struct drsuapi_DsReplicaObjMetaData, reply->objmetadata->count); + for (i=0; i<md.ctr.ctr1.count; i++) { + const struct dsdb_attribute *attr = dsdb_attribute_by_attributeID_id(schema, md.ctr.ctr1.array[i].attid); + char const* attribute_name = NULL; + if (!attr) { + DEBUG(0, (__location__": Failed to find attribute with id: %d", md.ctr.ctr1.array[i].attid)); + } else { + attribute_name = attr->lDAPDisplayName; + } + reply->objmetadata->array[i].originating_change_time = md.ctr.ctr1.array[i].originating_change_time; + reply->objmetadata->array[i].version = md.ctr.ctr1.array[i].version; + reply->objmetadata->array[i].originating_invocation_id = md.ctr.ctr1.array[i].originating_invocation_id; + reply->objmetadata->array[i].originating_usn = md.ctr.ctr1.array[i].originating_usn; + reply->objmetadata->array[i].local_usn = md.ctr.ctr1.array[i].local_usn; + reply->objmetadata->array[i].attribute_name = attribute_name; + } + + return WERR_OK; +} /* get cursors info for a specified DN @@ -444,10 +517,10 @@ static WERROR kccdrs_replica_get_info_repsto(TALLOC_CTX *mem_ctx, i = j = 0; - reply->neighbours02 = talloc_zero(mem_ctx, struct drsuapi_DsReplicaNeighbourCtr); - W_ERROR_HAVE_NO_MEMORY(reply->neighbours02); - reply->neighbours02->reserved = 0; - reply->neighbours02->count = 0; + reply->repsto = talloc_zero(mem_ctx, struct drsuapi_DsReplicaNeighbourCtr); + W_ERROR_HAVE_NO_MEMORY(reply->repsto); + reply->repsto->reserved = 0; + reply->repsto->count = 0; /* foreach nc in ncs */ for (p_nc_list = nc_list; p_nc_list != NULL; p_nc_list = p_nc_list->next) { @@ -478,11 +551,11 @@ static WERROR kccdrs_replica_get_info_repsto(TALLOC_CTX *mem_ctx, W_ERROR_NOT_OK_RETURN(status); /* append the neighbour to the neighbours array */ - reply->neighbours02->array = talloc_realloc(mem_ctx, - reply->neighbours02->array, + reply->repsto->array = talloc_realloc(mem_ctx, + reply->repsto->array, struct drsuapi_DsReplicaNeighbour, - reply->neighbours02->count + 1); - reply->neighbours02->array[reply->neighbours02->count++] = neigh; + reply->repsto->count + 1); + reply->repsto->array[reply->repsto->count++] = neigh; j++; } i++; @@ -562,7 +635,7 @@ NTSTATUS kccdrs_replica_get_info(struct irpc_message *msg, reply, base_index, req_src_dsa_guid, object_dn_str); break; - case DRSUAPI_DS_REPLICA_INFO_NEIGHBORS02: /* On MS-DRSR it is DS_REPL_INFO_REPSTO */ + case DRSUAPI_DS_REPLICA_INFO_REPSTO: /* On MS-DRSR it is DS_REPL_INFO_REPSTO */ status = kccdrs_replica_get_info_repsto(mem_ctx, service, samdb, req, reply, base_index, req_src_dsa_guid, object_dn_str); @@ -581,15 +654,18 @@ NTSTATUS kccdrs_replica_get_info(struct irpc_message *msg, break; case DRSUAPI_DS_REPLICA_INFO_CURSORS3: /* On MS-DRSR it is DS_REPL_INFO_CURSORS_3_FOR_NC */ - case DRSUAPI_DS_REPLICA_INFO_CURSORS05: /* On MS-DRSR it is DS_REPL_INFO_UPTODATE_VECTOR_V1 */ + case DRSUAPI_DS_REPLICA_INFO_UPTODATE_VECTOR_V1: /* On MS-DRSR it is DS_REPL_INFO_UPTODATE_VECTOR_V1 */ case DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA: /* On MS-DRSR it is DS_REPL_INFO_METADATA_FOR_OBJ */ + status = kccdrs_replica_get_info_obj_metadata(mem_ctx, samdb, req, reply, + ldb_dn_new(mem_ctx, samdb, object_dn_str)); + break; case DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA2: /* On MS-DRSR it is DS_REPL_INFO_METADATA_FOR_OBJ */ case DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA: /* On MS-DRSR it is DS_REPL_INFO_METADATA_FOR_ATTR_VALUE */ case DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA2: /* On MS-DRSR it is DS_REPL_INFO_METADATA_2_FOR_ATTR_VALUE */ case DRSUAPI_DS_REPLICA_INFO_KCC_DSA_CONNECT_FAILURES: /* On MS-DRSR it is DS_REPL_INFO_KCC_DSA_CONNECT_FAILURES */ case DRSUAPI_DS_REPLICA_INFO_KCC_DSA_LINK_FAILURES: /* On MS-DRSR it is DS_REPL_INFO_KCC_LINK_FAILURES */ - case DRSUAPI_DS_REPLICA_INFO_CONNECTIONS04: /* On MS-DRSR it is DS_REPL_INFO_CLIENT_CONTEXTS */ - case DRSUAPI_DS_REPLICA_INFO_06: /* On MS-DRSR it is DS_REPL_INFO_SERVER_OUTGOING_CALLS */ + case DRSUAPI_DS_REPLICA_INFO_CLIENT_CONTEXTS: /* On MS-DRSR it is DS_REPL_INFO_CLIENT_CONTEXTS */ + case DRSUAPI_DS_REPLICA_INFO_SERVER_OUTGOING_CALLS: /* On MS-DRSR it is DS_REPL_INFO_SERVER_OUTGOING_CALLS */ default: DEBUG(1,(__location__ ": Unsupported DsReplicaGetInfo info_type %u\n", info_type)); diff --git a/source4/torture/rpc/drsuapi.c b/source4/torture/rpc/drsuapi.c index cd28befe61..0e67d7fafc 100644 --- a/source4/torture/rpc/drsuapi.c +++ b/source4/torture/rpc/drsuapi.c @@ -322,19 +322,19 @@ static bool test_DsReplicaGetInfo(struct torture_context *tctx, NULL },{ DRSUAPI_DS_REPLICA_GET_INFO2, - DRSUAPI_DS_REPLICA_INFO_NEIGHBORS02, + DRSUAPI_DS_REPLICA_INFO_REPSTO, NULL },{ DRSUAPI_DS_REPLICA_GET_INFO2, - DRSUAPI_DS_REPLICA_INFO_CONNECTIONS04, + DRSUAPI_DS_REPLICA_INFO_CLIENT_CONTEXTS, "__IGNORED__" },{ DRSUAPI_DS_REPLICA_GET_INFO2, - DRSUAPI_DS_REPLICA_INFO_CURSORS05, + DRSUAPI_DS_REPLICA_INFO_UPTODATE_VECTOR_V1, NULL },{ DRSUAPI_DS_REPLICA_GET_INFO2, - DRSUAPI_DS_REPLICA_INFO_06, + DRSUAPI_DS_REPLICA_INFO_SERVER_OUTGOING_CALLS, NULL } }; diff --git a/source4/torture/rpc/dsgetinfo.c b/source4/torture/rpc/dsgetinfo.c index 03bda7e70e..418f5b4530 100644 --- a/source4/torture/rpc/dsgetinfo.c +++ b/source4/torture/rpc/dsgetinfo.c @@ -224,19 +224,19 @@ static bool test_getinfo(struct torture_context *tctx, NULL },{ DRSUAPI_DS_REPLICA_GET_INFO2, - DRSUAPI_DS_REPLICA_INFO_NEIGHBORS02, + DRSUAPI_DS_REPLICA_INFO_REPSTO, NULL },{ DRSUAPI_DS_REPLICA_GET_INFO2, - DRSUAPI_DS_REPLICA_INFO_CONNECTIONS04, + DRSUAPI_DS_REPLICA_INFO_CLIENT_CONTEXTS, "__IGNORED__" },{ DRSUAPI_DS_REPLICA_GET_INFO2, - DRSUAPI_DS_REPLICA_INFO_CURSORS05, + DRSUAPI_DS_REPLICA_INFO_UPTODATE_VECTOR_V1, NULL },{ DRSUAPI_DS_REPLICA_GET_INFO2, - DRSUAPI_DS_REPLICA_INFO_06, + DRSUAPI_DS_REPLICA_INFO_SERVER_OUTGOING_CALLS, NULL } }; |