I am writing a Post op plugin using example from API programming
guide. Plugin works fine for ADD but when any Modification comes, I am
not able to print what data in LDAPMod structure. I am trying to print
information about MOD happen by directory

Here is code snippet

int optype,
char *dn,
void *change,
int flag
LDAPMod **mods;
Slapi_Entry *e;
char *newrdn, *tmp, *tmpsave;
int len, i, j;
FILE *fp;
char* timestr;
switch ( optype ) {
case _MOD:
/* For modify operations, log the attribute type
that has been added, replaced, or deleted. */
fprintf( fp, "changetype: modify\n" );
mods = (LDAPMod **)change;
for ( j = 0; mods[j] != NULL; j++ ) {
switch ( mods[j]->mod_op & ~LDAP_MOD_BVALUES ) {
case LDAP_MOD_ADD:
fprintf( fp, "add: %s\n", mods[j]->mod_type );
break;

case LDAP_MOD_DELETE:
fprintf( fp, "delete: %s\n", mods[j]->mod_type );
break;

case LDAP_MOD_REPLACE:
fprintf( fp, "replace: %s\n", mods[j]->mod_type );
break;
}

for ( i = 0; mods[j]->mod_bvalues != NULL &&
mods[j]->mod_bvalues != NULL; i++ ) {
/* XXX should handle binary values XXX */
fprintf( fp, "%s: %s\n", mods[j]->mod_type,
mods[j]->mod_bvalues->bv_val );
}
fprintf( fp, "-\n" );
}
break;

I have debugged Directory and I can see that the plugin is being
called but after that Directory server crashes. I am concentrating on
fprintf( fp, "replace: %s\n", mods[j]->mod_type ); line of code. Am I
printing values in mods correctly?? Please help

Kunal
_______________________________________________
mozilla-directory mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-directory

Reply via email to