summaryrefslogtreecommitdiff
path: root/librpc
diff options
context:
space:
mode:
authorKamen Mazdrashki <kamenim@samba.org>2010-08-19 15:52:49 +0300
committerKamen Mazdrashki <kamenim@samba.org>2010-08-21 00:33:52 +0300
commit26efea195ae3d5a26b1152923f114cd841e89b5f (patch)
treefda142f59dbbe9d494230cc7003a961006312b6e /librpc
parentf35811bfe074ec3c9c1f6b860b6d07d47b1cce92 (diff)
downloadsamba-26efea195ae3d5a26b1152923f114cd841e89b5f.tar.gz
samba-26efea195ae3d5a26b1152923f114cd841e89b5f.tar.bz2
samba-26efea195ae3d5a26b1152923f114cd841e89b5f.zip
s4-drsuapi: Implement custom printing for drsuapi protocol for
drsuapi_DsReplicaAttribute and drsuapi_DsAttributeValueCtr objects This makes tracing what data has been transferred much easier
Diffstat (limited to 'librpc')
-rw-r--r--librpc/idl/drsuapi.idl2
-rw-r--r--librpc/ndr/ndr_drsuapi.c107
2 files changed, 108 insertions, 1 deletions
diff --git a/librpc/idl/drsuapi.idl b/librpc/idl/drsuapi.idl
index 854005738e..9010efc23c 100644
--- a/librpc/idl/drsuapi.idl
+++ b/librpc/idl/drsuapi.idl
@@ -562,7 +562,7 @@ interface drsuapi
[flag(NDR_REMAINING)] DATA_BLOB binary;
} drsuapi_DsReplicaObjectIdentifier3Binary;
- typedef [public] struct {
+ typedef [public,noprint] struct {
drsuapi_DsAttributeId attid;
drsuapi_DsAttributeValueCtr value_ctr;
} drsuapi_DsReplicaAttribute;
diff --git a/librpc/ndr/ndr_drsuapi.c b/librpc/ndr/ndr_drsuapi.c
index 0cc3e5236c..9cde737b53 100644
--- a/librpc/ndr/ndr_drsuapi.c
+++ b/librpc/ndr/ndr_drsuapi.c
@@ -86,6 +86,113 @@ _PUBLIC_ void ndr_print_drsuapi_DsReplicaOID(struct ndr_print *ndr, const char *
ndr->depth--;
}
+static void _print_drsuapi_DsAttributeValue_attid(struct ndr_print *ndr, const char *name,
+ const struct drsuapi_DsAttributeValue *r)
+{
+ uint32_t v;
+
+ ndr_print_struct(ndr, name, "drsuapi_DsAttributeValue");
+ ndr->depth++;
+ v = IVAL(r->blob->data, 0);
+ ndr_print_uint32(ndr, "attid", v);
+ ndr->depth--;
+}
+
+static void _print_drsuapi_DsAttributeValue_str(struct ndr_print *ndr, const char *name,
+ const struct drsuapi_DsAttributeValue *r)
+{
+ char *str;
+
+ ndr_print_struct(ndr, name, "drsuapi_DsAttributeValue");
+ ndr->depth++;
+ if (!convert_string_talloc(ndr,
+ CH_UTF16, CH_UNIX,
+ r->blob->data,
+ r->blob->length,
+ (void **)&str, NULL, false)) {
+ ndr_print_string(ndr, "string", "INVALID CONVERSION");
+ } else {
+ ndr_print_string(ndr, "string", str);
+ talloc_free(str);
+ }
+ ndr->depth--;
+}
+
+static void _print_drsuapi_DsAttributeValueCtr(struct ndr_print *ndr,
+ const char *name,
+ const struct drsuapi_DsAttributeValueCtr *r,
+ void (*print_val_fn)(struct ndr_print *ndr, const char *name, const struct drsuapi_DsAttributeValue *r))
+{
+ uint32_t cntr_values_1;
+ ndr_print_struct(ndr, name, "drsuapi_DsAttributeValueCtr");
+ ndr->depth++;
+ ndr_print_uint32(ndr, "num_values", r->num_values);
+ ndr_print_ptr(ndr, "values", r->values);
+ ndr->depth++;
+ if (r->values) {
+ ndr->print(ndr, "%s: ARRAY(%d)", "values", (int)r->num_values);
+ ndr->depth++;
+ for (cntr_values_1=0;cntr_values_1<r->num_values;cntr_values_1++) {
+ char *idx_1=NULL;
+ if (asprintf(&idx_1, "[%d]", cntr_values_1) != -1) {
+ //ndr_print_drsuapi_DsAttributeValue(ndr, "values", &r->values[cntr_values_1]);
+ print_val_fn(ndr, "values", &r->values[cntr_values_1]);
+ free(idx_1);
+ }
+ }
+ ndr->depth--;
+ }
+ ndr->depth--;
+ ndr->depth--;
+}
+
+_PUBLIC_ void ndr_print_drsuapi_DsReplicaAttribute(struct ndr_print *ndr,
+ const char *name,
+ const struct drsuapi_DsReplicaAttribute *r)
+{
+ ndr_print_struct(ndr, name, "drsuapi_DsReplicaAttribute");
+ ndr->depth++;
+ ndr_print_drsuapi_DsAttributeId(ndr, "attid", r->attid);
+ switch (r->attid) {
+ case DRSUAPI_ATTRIBUTE_objectClass:
+ case DRSUAPI_ATTRIBUTE_possSuperiors:
+ case DRSUAPI_ATTRIBUTE_subClassOf:
+ case DRSUAPI_ATTRIBUTE_governsID:
+ case DRSUAPI_ATTRIBUTE_mustContain:
+ case DRSUAPI_ATTRIBUTE_mayContain:
+ case DRSUAPI_ATTRIBUTE_rDNAttId:
+ case DRSUAPI_ATTRIBUTE_attributeID:
+ case DRSUAPI_ATTRIBUTE_attributeSyntax:
+ case DRSUAPI_ATTRIBUTE_auxiliaryClass:
+ case DRSUAPI_ATTRIBUTE_systemPossSuperiors:
+ case DRSUAPI_ATTRIBUTE_systemMayContain:
+ case DRSUAPI_ATTRIBUTE_systemMustContain:
+ case DRSUAPI_ATTRIBUTE_systemAuxiliaryClass:
+ case DRSUAPI_ATTRIBUTE_transportAddressAttribute:
+ /* ATTIDs for classSchema and attributeSchema */
+ _print_drsuapi_DsAttributeValueCtr(ndr, "value_ctr", &r->value_ctr,
+ _print_drsuapi_DsAttributeValue_attid);
+ break;
+ case DRSUAPI_ATTRIBUTE_cn:
+ case DRSUAPI_ATTRIBUTE_ou:
+ case DRSUAPI_ATTRIBUTE_description:
+ case DRSUAPI_ATTRIBUTE_displayName:
+ case DRSUAPI_ATTRIBUTE_dMDLocation:
+ case DRSUAPI_ATTRIBUTE_adminDisplayName:
+ case DRSUAPI_ATTRIBUTE_adminDescription:
+ case DRSUAPI_ATTRIBUTE_lDAPDisplayName:
+ case DRSUAPI_ATTRIBUTE_name:
+ _print_drsuapi_DsAttributeValueCtr(ndr, "value_ctr", &r->value_ctr,
+ _print_drsuapi_DsAttributeValue_str);
+ break;
+ default:
+ _print_drsuapi_DsAttributeValueCtr(ndr, "value_ctr", &r->value_ctr,
+ ndr_print_drsuapi_DsAttributeValue);
+ break;
+ }
+ ndr->depth--;
+}
+
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) {