1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-27 22:50:26 +03:00

drsuapi: share drsuapi idl and helper code.

Guenther
This commit is contained in:
Günther Deschner 2008-10-17 21:10:33 +02:00
parent dd49f7483b
commit d413e1f40a
6 changed files with 14 additions and 2002 deletions

View File

@ -2,7 +2,7 @@
import "security.idl", "misc.idl", "samr.idl";
[
[
uuid("e3514235-4b06-11d1-ab04-00c04fc2dcd2"),
version(4.0),
endpoint("ncacn_np:[\\pipe\\lsass]","ncacn_np:[\\pipe\\protected_storage]", "ncacn_ip_tcp:", "ncalrpc:"),
@ -115,11 +115,11 @@ interface drsuapi
} drsuapi_DsBindInfoCtr;
/* this is a magic guid you need to pass to DsBind to make drsuapi_DsWriteAccountSpn() work
*
*
* maybe the bind_guid could also be the invocation_id see drsuapi_DsReplicaConnection04
*/
const char *DRSUAPI_DS_BIND_GUID = "e24d201a-4fd6-11d1-a3da-0000f875ae0d";
/*
/*
* this magic guid are needed to fetch the whole tree with drsuapi_DsGetNCChanges()
* as administrator and this values are also used in the destination_dsa_guid field
* of drsuapi_DsGetNCChangesReq5/8 and the source_dsa_guid is zero.
@ -232,7 +232,7 @@ interface drsuapi
DRSUAPI_DS_REPLICA_NEIGHBOUR_PREEMPTED = 0x01000000,
DRSUAPI_DS_REPLICA_NEIGHBOUR_IGNORE_CHANGE_NOTIFICATIONS = 0x04000000,
DRSUAPI_DS_REPLICA_NEIGHBOUR_DISABLE_SCHEDULED_SYNC = 0x08000000,
/*
/*
* the following NOTE applies to DsGetNCChangesRequest5:
* - the data is only compressed when 10 or more objects are replicated
* - but there could also be a size limit of 35 KBytes or something like that
@ -454,7 +454,7 @@ interface drsuapi
DRSUAPI_ATTRIBUTE_objectCategory = 0x0009030e,
DRSUAPI_ATTRIBUTE_gPLink = 0x0009037b,
DRSUAPI_ATTRIBUTE_msDS_Behavior_Version = 0x000905b3,
DRSUAPI_ATTRIBUTE_msDS_KeyVersionNumber = 0x000906f6,
DRSUAPI_ATTRIBUTE_msDS_KeyVersionNumber = 0x000906f6,
DRSUAPI_ATTRIBUTE_msDS_HasDomainNCs = 0x0009071c,
DRSUAPI_ATTRIBUTE_msDS_hasMasterNCs = 0x0009072c
} drsuapi_DsAttributeId;
@ -1144,7 +1144,7 @@ interface drsuapi
/*
* please note the the current idl
* for DsAddEntry does only parse
* for DsAddEntry does only parse
* what I saw between 2 w2k3 boxes
* in my dssync experiments I got some other replies
* so all I want to say is that this is very incomplete yet...

View File

@ -1,4 +1,4 @@
/*
/*
Unix SMB/CIFS implementation.
routines for printing some linked list structs in DRSUAPI
@ -9,12 +9,12 @@
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@ -26,7 +26,7 @@
#include "../lib/util/asn1.h"
#include "librpc/ndr/ndr_compression.h"
void ndr_print_drsuapi_DsReplicaObjectListItem(struct ndr_print *ndr, const char *name,
void ndr_print_drsuapi_DsReplicaObjectListItem(struct ndr_print *ndr, const char *name,
const struct drsuapi_DsReplicaObjectListItem *r)
{
ndr_print_struct(ndr, name, "drsuapi_DsReplicaObjectListItem");

View File

@ -1,4 +1,4 @@
/*
/*
Unix SMB/CIFS implementation.
routines for printing some linked list structs in DRSUAPI
@ -9,12 +9,12 @@
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@ -22,7 +22,7 @@
#ifndef _LIBRPC_NDR_NDR_DRSUAPI_H
#define _LIBRPC_NDR_NDR_DRSUAPI_H
void ndr_print_drsuapi_DsReplicaObjectListItem(struct ndr_print *ndr, const char *name,
void ndr_print_drsuapi_DsReplicaObjectListItem(struct ndr_print *ndr, const char *name,
const struct drsuapi_DsReplicaObjectListItem *r);
void ndr_print_drsuapi_DsReplicaObjectListItemEx(struct ndr_print *ndr, const char *name,

View File

@ -1,351 +0,0 @@
/*
Unix SMB/CIFS implementation.
routines for printing some linked list structs in DRSUAPI
Copyright (C) Stefan (metze) Metzmacher 2005
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "includes.h"
#include "librpc/gen_ndr/ndr_drsuapi.h"
#include "librpc/gen_ndr/ndr_misc.h"
#include "../lib/util/asn1.h"
#include "librpc/ndr/ndr_compression.h"
void ndr_print_drsuapi_DsReplicaObjectListItem(struct ndr_print *ndr, const char *name,
const struct drsuapi_DsReplicaObjectListItem *r)
{
ndr_print_struct(ndr, name, "drsuapi_DsReplicaObjectListItem");
ndr->depth++;
ndr_print_ptr(ndr, "next_object", r->next_object);
ndr_print_drsuapi_DsReplicaObject(ndr, "object", &r->object);
ndr->depth--;
if (r->next_object) {
ndr_print_drsuapi_DsReplicaObjectListItem(ndr, "next_object", r->next_object);
}
}
void ndr_print_drsuapi_DsReplicaObjectListItemEx(struct ndr_print *ndr, const char *name, const struct drsuapi_DsReplicaObjectListItemEx *r)
{
ndr_print_struct(ndr, name, "drsuapi_DsReplicaObjectListItemEx");
ndr->depth++;
ndr_print_ptr(ndr, "next_object", r->next_object);
ndr_print_drsuapi_DsReplicaObject(ndr, "object", &r->object);
ndr_print_uint32(ndr, "is_nc_prefix", r->is_nc_prefix);
ndr_print_ptr(ndr, "parent_object_guid", r->parent_object_guid);
ndr->depth++;
if (r->parent_object_guid) {
ndr_print_GUID(ndr, "parent_object_guid", r->parent_object_guid);
}
ndr->depth--;
ndr_print_ptr(ndr, "meta_data_ctr", r->meta_data_ctr);
ndr->depth++;
if (r->meta_data_ctr) {
ndr_print_drsuapi_DsReplicaMetaDataCtr(ndr, "meta_data_ctr", r->meta_data_ctr);
}
ndr->depth--;
ndr->depth--;
if (r->next_object) {
ndr_print_drsuapi_DsReplicaObjectListItemEx(ndr, "next_object", r->next_object);
}
}
#define _OID_PUSH_CHECK(call) do { \
bool _status; \
_status = call; \
if (_status != true) { \
return ndr_push_error(ndr, NDR_ERR_SUBCONTEXT, "OID Conversion Error: %s\n", __location__); \
} \
} while (0)
#define _OID_PULL_CHECK(call) do { \
bool _status; \
_status = call; \
if (_status != true) { \
return ndr_pull_error(ndr, NDR_ERR_SUBCONTEXT, "OID Conversion Error: %s\n", __location__); \
} \
} while (0)
enum ndr_err_code ndr_push_drsuapi_DsReplicaOID(struct ndr_push *ndr, int ndr_flags, const struct drsuapi_DsReplicaOID *r)
{
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_push_align(ndr, 4));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_size_drsuapi_DsReplicaOID_oid(r->oid, 0)));
NDR_CHECK(ndr_push_unique_ptr(ndr, r->oid));
}
if (ndr_flags & NDR_BUFFERS) {
if (r->oid) {
DATA_BLOB blob;
if (StrnCaseCmp("ff", r->oid, 2) == 0) {
blob = strhex_to_data_blob(NULL, r->oid);
if (!blob.data) {
return ndr_push_error(ndr, NDR_ERR_SUBCONTEXT,
"HEX String Conversion Error: %s\n",
__location__);
}
} else {
_OID_PUSH_CHECK(ber_write_OID_String(&blob, r->oid));
}
talloc_steal(ndr, blob.data);
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, blob.length));
NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, blob.data, blob.length));
}
}
return NDR_ERR_SUCCESS;
}
enum ndr_err_code ndr_pull_drsuapi_DsReplicaOID(struct ndr_pull *ndr, int ndr_flags, struct drsuapi_DsReplicaOID *r)
{
uint32_t _ptr_oid;
TALLOC_CTX *_mem_save_oid_0;
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_pull_align(ndr, 4));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->__ndr_size));
if (r->__ndr_size < 0 || r->__ndr_size > 10000) {
return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
}
NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_oid));
if (_ptr_oid) {
NDR_PULL_ALLOC(ndr, r->oid);
} else {
r->oid = NULL;
}
}
if (ndr_flags & NDR_BUFFERS) {
if (r->oid) {
DATA_BLOB _oid_array;
const char *_oid;
_mem_save_oid_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, ndr, 0);
NDR_CHECK(ndr_pull_array_size(ndr, &r->oid));
_oid_array.length = ndr_get_array_size(ndr, &r->oid);
NDR_PULL_ALLOC_N(ndr, _oid_array.data, _oid_array.length);
NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, _oid_array.data, _oid_array.length));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_oid_0, 0);
if (_oid_array.length && _oid_array.data[0] == 0xFF) {
_oid = data_blob_hex_string(ndr, &_oid_array);
NDR_ERR_HAVE_NO_MEMORY(_oid);
} else {
_OID_PULL_CHECK(ber_read_OID_String(ndr, _oid_array, &_oid));
}
data_blob_free(&_oid_array);
talloc_steal(r->oid, _oid);
r->oid = _oid;
}
if (r->oid) {
NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->oid, r->__ndr_size));
}
}
return NDR_ERR_SUCCESS;
}
size_t ndr_size_drsuapi_DsReplicaOID_oid(const char *oid, int flags)
{
DATA_BLOB _blob;
size_t ret = 0;
if (!oid) return 0;
if (StrnCaseCmp("ff", oid, 2) == 0) {
_blob = strhex_to_data_blob(NULL, oid);
if (_blob.data) {
ret = _blob.length;
}
} else {
if (ber_write_OID_String(&_blob, oid)) {
ret = _blob.length;
}
}
data_blob_free(&_blob);
return ret;
}
enum ndr_err_code ndr_push_drsuapi_DsGetNCChangesMSZIPCtr1(struct ndr_push *ndr, int ndr_flags, const struct drsuapi_DsGetNCChangesMSZIPCtr1 *r)
{
if (ndr_flags & NDR_SCALARS) {
uint32_t decompressed_length = 0;
uint32_t compressed_length = 0;
if (r->ts) {
{
struct ndr_push *_ndr_ts;
NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ts, 4, -1));
{
struct ndr_push *_ndr_ts_compressed;
NDR_CHECK(ndr_push_compression_start(_ndr_ts, &_ndr_ts_compressed, NDR_COMPRESSION_MSZIP, -1));
NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr1TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts));
decompressed_length = _ndr_ts_compressed->offset;
NDR_CHECK(ndr_push_compression_end(_ndr_ts, _ndr_ts_compressed, NDR_COMPRESSION_MSZIP, -1));
}
compressed_length = _ndr_ts->offset;
talloc_free(_ndr_ts);
}
}
NDR_CHECK(ndr_push_align(ndr, 4));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, decompressed_length));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, compressed_length));
NDR_CHECK(ndr_push_unique_ptr(ndr, r->ts));
}
if (ndr_flags & NDR_BUFFERS) {
if (r->ts) {
{
struct ndr_push *_ndr_ts;
NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ts, 4, -1));
{
struct ndr_push *_ndr_ts_compressed;
NDR_CHECK(ndr_push_compression_start(_ndr_ts, &_ndr_ts_compressed, NDR_COMPRESSION_MSZIP, -1));
NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr1TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts));
NDR_CHECK(ndr_push_compression_end(_ndr_ts, _ndr_ts_compressed, NDR_COMPRESSION_MSZIP, -1));
}
NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_ts, 4, -1));
}
}
}
return NDR_ERR_SUCCESS;
}
enum ndr_err_code ndr_push_drsuapi_DsGetNCChangesMSZIPCtr6(struct ndr_push *ndr, int ndr_flags, const struct drsuapi_DsGetNCChangesMSZIPCtr6 *r)
{
if (ndr_flags & NDR_SCALARS) {
uint32_t decompressed_length = 0;
uint32_t compressed_length = 0;
if (r->ts) {
{
struct ndr_push *_ndr_ts;
NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ts, 4, -1));
{
struct ndr_push *_ndr_ts_compressed;
NDR_CHECK(ndr_push_compression_start(_ndr_ts, &_ndr_ts_compressed, NDR_COMPRESSION_MSZIP, -1));
NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr6TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts));
decompressed_length = _ndr_ts_compressed->offset;
NDR_CHECK(ndr_push_compression_end(_ndr_ts, _ndr_ts_compressed, NDR_COMPRESSION_MSZIP, -1));
}
compressed_length = _ndr_ts->offset;
talloc_free(_ndr_ts);
}
}
NDR_CHECK(ndr_push_align(ndr, 4));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, decompressed_length));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, compressed_length));
NDR_CHECK(ndr_push_unique_ptr(ndr, r->ts));
}
if (ndr_flags & NDR_BUFFERS) {
if (r->ts) {
{
struct ndr_push *_ndr_ts;
NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ts, 4, -1));
{
struct ndr_push *_ndr_ts_compressed;
NDR_CHECK(ndr_push_compression_start(_ndr_ts, &_ndr_ts_compressed, NDR_COMPRESSION_MSZIP, -1));
NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr6TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts));
NDR_CHECK(ndr_push_compression_end(_ndr_ts, _ndr_ts_compressed, NDR_COMPRESSION_MSZIP, -1));
}
NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_ts, 4, -1));
}
}
}
return NDR_ERR_SUCCESS;
}
enum ndr_err_code ndr_push_drsuapi_DsGetNCChangesXPRESSCtr1(struct ndr_push *ndr, int ndr_flags, const struct drsuapi_DsGetNCChangesXPRESSCtr1 *r)
{
if (ndr_flags & NDR_SCALARS) {
uint32_t decompressed_length = 0;
uint32_t compressed_length = 0;
if (r->ts) {
{
struct ndr_push *_ndr_ts;
NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ts, 4, -1));
{
struct ndr_push *_ndr_ts_compressed;
NDR_CHECK(ndr_push_compression_start(_ndr_ts, &_ndr_ts_compressed, NDR_COMPRESSION_XPRESS, -1));
NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr1TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts));
decompressed_length = _ndr_ts_compressed->offset;
NDR_CHECK(ndr_push_compression_end(_ndr_ts, _ndr_ts_compressed, NDR_COMPRESSION_XPRESS, -1));
}
compressed_length = _ndr_ts->offset;
talloc_free(_ndr_ts);
}
}
NDR_CHECK(ndr_push_align(ndr, 4));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, decompressed_length));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, compressed_length));
NDR_CHECK(ndr_push_unique_ptr(ndr, r->ts));
}
if (ndr_flags & NDR_BUFFERS) {
if (r->ts) {
{
struct ndr_push *_ndr_ts;
NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ts, 4, -1));
{
struct ndr_push *_ndr_ts_compressed;
NDR_CHECK(ndr_push_compression_start(_ndr_ts, &_ndr_ts_compressed, NDR_COMPRESSION_XPRESS, -1));
NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr1TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts));
NDR_CHECK(ndr_push_compression_end(_ndr_ts, _ndr_ts_compressed, NDR_COMPRESSION_XPRESS, -1));
}
NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_ts, 4, -1));
}
}
}
return NDR_ERR_SUCCESS;
}
enum ndr_err_code ndr_push_drsuapi_DsGetNCChangesXPRESSCtr6(struct ndr_push *ndr, int ndr_flags, const struct drsuapi_DsGetNCChangesXPRESSCtr6 *r)
{
if (ndr_flags & NDR_SCALARS) {
uint32_t decompressed_length = 0;
uint32_t compressed_length = 0;
if (r->ts) {
{
struct ndr_push *_ndr_ts;
NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ts, 4, -1));
{
struct ndr_push *_ndr_ts_compressed;
NDR_CHECK(ndr_push_compression_start(_ndr_ts, &_ndr_ts_compressed, NDR_COMPRESSION_XPRESS, -1));
NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr6TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts));
decompressed_length = _ndr_ts_compressed->offset;
NDR_CHECK(ndr_push_compression_end(_ndr_ts, _ndr_ts_compressed, NDR_COMPRESSION_XPRESS, -1));
}
compressed_length = _ndr_ts->offset;
talloc_free(_ndr_ts);
}
}
NDR_CHECK(ndr_push_align(ndr, 4));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, decompressed_length));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, compressed_length));
NDR_CHECK(ndr_push_unique_ptr(ndr, r->ts));
}
if (ndr_flags & NDR_BUFFERS) {
if (r->ts) {
{
struct ndr_push *_ndr_ts;
NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ts, 4, -1));
{
struct ndr_push *_ndr_ts_compressed;
NDR_CHECK(ndr_push_compression_start(_ndr_ts, &_ndr_ts_compressed, NDR_COMPRESSION_XPRESS, -1));
NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr6TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts));
NDR_CHECK(ndr_push_compression_end(_ndr_ts, _ndr_ts_compressed, NDR_COMPRESSION_XPRESS, -1));
}
NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_ts, 4, -1));
}
}
}
return NDR_ERR_SUCCESS;
}

View File

@ -1,35 +0,0 @@
/*
Unix SMB/CIFS implementation.
routines for printing some linked list structs in DRSUAPI
Copyright (C) Stefan (metze) Metzmacher 2005-2006
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _LIBRPC_NDR_NDR_DRSUAPI_H
#define _LIBRPC_NDR_NDR_DRSUAPI_H
void ndr_print_drsuapi_DsReplicaObjectListItem(struct ndr_print *ndr, const char *name,
const struct drsuapi_DsReplicaObjectListItem *r);
void ndr_print_drsuapi_DsReplicaObjectListItemEx(struct ndr_print *ndr, const char *name,
const struct drsuapi_DsReplicaObjectListItemEx *r);
enum ndr_err_code ndr_push_drsuapi_DsReplicaOID(struct ndr_push *ndr, int ndr_flags, const struct drsuapi_DsReplicaOID *r);
enum ndr_err_code ndr_pull_drsuapi_DsReplicaOID(struct ndr_pull *ndr, int ndr_flags, struct drsuapi_DsReplicaOID *r);
size_t ndr_size_drsuapi_DsReplicaOID_oid(const char *oid, int flags);
#endif /* _LIBRPC_NDR_NDR_DRSUAPI_H */

File diff suppressed because it is too large Load Diff