1#include "overlayutils.h"
2
3void dump_berval( struct berval *bv )
4{
5	if (bv)
6	{
7		Debug( LDAP_DEBUG_BER, "berval len[%d] [%s]\n", bv->bv_len, bv->bv_val, 0);
8	}
9}
10
11void dump_berval_array(BerVarray bva)
12{
13	int i = 0;
14
15	if (bva)
16	{
17		for ( i = 0 ; bva[i].bv_val; i++)
18			Debug( LDAP_DEBUG_BER, "dump_berval_array[%d] len[%d] [%s]\n", i, bva[i].bv_len, bva[i].bv_val);
19	}
20}
21
22void dump_slap_attr_desc(AttributeDescription *desc)
23{
24	if (desc)
25	{
26		// dump ad_type
27		Debug( LDAP_DEBUG_BER, "#####AD_CNAME#####\n", 0, 0, 0);
28		dump_berval(&desc->ad_cname);
29		// dump ad_tags
30		// dump ad_flags
31		Debug( LDAP_DEBUG_BER, "ad_flags [%x]\n", desc->ad_flags, 0, 0);
32
33	}
34}
35
36void dump_slap_attr(Attribute *attr)
37{
38	Attribute *current_attr = NULL;
39	int i = 0;
40
41	if (attr)
42	{
43		for ( i = 1, current_attr = attr; current_attr; i++, current_attr = current_attr->a_next )
44		{
45			Debug( LDAP_DEBUG_BER, "#####A_DESC#####\n", 0, 0, 0);
46			dump_slap_attr_desc(current_attr->a_desc);
47			Debug( LDAP_DEBUG_BER, "#####A_VALS#####\n", 0, 0, 0);
48			dump_berval_array(current_attr->a_vals);
49			Debug( LDAP_DEBUG_BER, "#####A_NVALS#####\n", 0, 0, 0);
50			dump_berval_array(current_attr->a_nvals);
51		}
52		Debug( LDAP_DEBUG_BER, "dump_slap_attr count(%d)\n", i, 0, 0);
53
54	}
55}
56
57void dump_slap_entry(Entry *ent)
58{
59	if (ent)
60	{
61		dump_slap_attr(ent->e_attrs);
62	}
63
64}
65
66void dump_req_bind_s(req_bind_s *req)
67{
68#if 0
69typedef struct req_bind_s {
70	int rb_method;
71	struct berval rb_cred;
72	struct berval rb_edn;
73	slap_ssf_t rb_ssf;
74	struct berval rb_mech;	/* FIXME: temporary */
75} req_bind_s;
76#endif
77
78	if (req)
79	{
80		Debug( LDAP_DEBUG_BER, "#####RB_CRED#####\n", 0, 0, 0);
81		dump_berval( &req->rb_cred );
82		Debug( LDAP_DEBUG_BER, "#####RB_EDN#####\n", 0, 0, 0);
83		dump_berval( &req->rb_edn );
84		Debug( LDAP_DEBUG_BER, "#####RB_MECH#####\n", 0, 0, 0);
85		dump_berval( &req->rb_mech );
86	}
87}
88
89void dump_req_add_s(req_add_s *req)
90{
91	if (req)
92	{
93		dump_slap_entry(req->rs_e);
94		// dump_slap_mod_list(req->rs_modlist);
95	}
96}
97
98