1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-12 09:18:10 +03:00

s4:libnet: passdown the DsGetNCChangesReq* to the libnet_BecomeDC_StoreChunk handler

metze

Signed-off-by: Andrew Tridgell <tridge@samba.org>
This commit is contained in:
Stefan Metzmacher 2011-08-08 10:29:05 +02:00
parent da7d22dade
commit 47fcbd71ae
3 changed files with 72 additions and 4 deletions

View File

@ -2615,6 +2615,10 @@ static WERROR becomeDC_drsuapi_pull_partition_recv(struct libnet_BecomeDC_state
struct libnet_BecomeDC_Partition *partition,
struct drsuapi_DsGetNCChanges *r)
{
uint32_t req_level = 0;
struct drsuapi_DsGetNCChangesRequest5 *req5 = NULL;
struct drsuapi_DsGetNCChangesRequest8 *req8 = NULL;
struct drsuapi_DsGetNCChangesRequest10 *req10 = NULL;
uint32_t ctr_level = 0;
struct drsuapi_DsGetNCChangesCtr1 *ctr1 = NULL;
struct drsuapi_DsGetNCChangesCtr6 *ctr6 = NULL;
@ -2628,6 +2632,23 @@ static WERROR becomeDC_drsuapi_pull_partition_recv(struct libnet_BecomeDC_state
return r->out.result;
}
switch (r->in.level) {
case 0:
/* none */
break;
case 5:
req5 = &r->in.req->req5;
break;
case 8:
req8 = &r->in.req->req8;
break;
case 10:
req10 = &r->in.req->req10;
break;
default:
return WERR_INVALID_PARAMETER;
}
if (*r->out.level_out == 1) {
ctr_level = 1;
ctr1 = &r->out.ctr->ctr1;
@ -2691,6 +2712,10 @@ static WERROR becomeDC_drsuapi_pull_partition_recv(struct libnet_BecomeDC_state
s->_sc.source_dsa = &s->source_dsa;
s->_sc.dest_dsa = &s->dest_dsa;
s->_sc.partition = partition;
s->_sc.req_level = req_level;
s->_sc.req5 = req5;
s->_sc.req8 = req8;
s->_sc.req10 = req10;
s->_sc.ctr_level = ctr_level;
s->_sc.ctr1 = ctr1;
s->_sc.ctr6 = ctr6;

View File

@ -107,6 +107,10 @@ struct libnet_BecomeDC_StoreChunk {
const struct libnet_BecomeDC_SourceDSA *source_dsa;
const struct libnet_BecomeDC_DestDSA *dest_dsa;
const struct libnet_BecomeDC_Partition *partition;
uint32_t req_level;
const struct drsuapi_DsGetNCChangesRequest5 *req5;
const struct drsuapi_DsGetNCChangesRequest8 *req8;
const struct drsuapi_DsGetNCChangesRequest10 *req10;
uint32_t ctr_level;
const struct drsuapi_DsGetNCChangesCtr1 *ctr1;
const struct drsuapi_DsGetNCChangesCtr6 *ctr6;

View File

@ -463,16 +463,20 @@ static PyObject *py_net_replicate_init(py_net_Object *self, PyObject *args, PyOb
*/
static PyObject *py_net_replicate_chunk(py_net_Object *self, PyObject *args, PyObject *kwargs)
{
const char *kwnames[] = { "state", "level", "ctr", "schema", NULL };
PyObject *py_state, *py_ctr, *py_schema;
const char *kwnames[] = { "state", "level", "ctr",
"schema", "req_level", "req",
NULL };
PyObject *py_state, *py_ctr, *py_schema, *py_req;
struct replicate_state *s;
unsigned level;
unsigned req_level = 0;
NTSTATUS (*chunk_handler)(void *private_data, const struct libnet_BecomeDC_StoreChunk *c);
NTSTATUS status;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OIO|O",
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OIO|OIO",
discard_const_p(char *, kwnames),
&py_state, &level, &py_ctr, &py_schema)) {
&py_state, &level, &py_ctr,
&py_schema, &req_level, &py_req)) {
return NULL;
}
@ -510,6 +514,41 @@ static PyObject *py_net_replicate_chunk(py_net_Object *self, PyObject *args, PyO
return NULL;
}
s->chunk.req5 = NULL;
s->chunk.req8 = NULL;
s->chunk.req10 = NULL;
if (py_req) {
switch (req_level) {
case 0:
break;
case 5:
if (!py_check_dcerpc_type(py_req, "samba.dcerpc.drsuapi", "DsGetNCChangesRequest5")) {
return NULL;
}
s->chunk.req5 = pytalloc_get_ptr(py_req);
break;
case 8:
if (!py_check_dcerpc_type(py_req, "samba.dcerpc.drsuapi", "DsGetNCChangesRequest8")) {
return NULL;
}
s->chunk.req8 = pytalloc_get_ptr(py_req);
break;
case 10:
if (!py_check_dcerpc_type(py_req, "samba.dcerpc.drsuapi", "DsGetNCChangesRequest10")) {
return NULL;
}
s->chunk.req10 = pytalloc_get_ptr(py_req);
break;
default:
PyErr_Format(PyExc_TypeError, "Bad req_level %u in replicate_chunk", req_level);
return NULL;
}
}
s->chunk.req_level = req_level;
chunk_handler = libnet_vampire_cb_store_chunk;
if (py_schema) {
if (!PyBool_Check(py_schema)) {