while ( ber_scanf( ber, "{m" /*}*/, &bv ) != LBER_ERROR ) {
int i;
BerVarray vals = NULL;
+ char *str = NULL;
if ( ber_scanf( ber, "[W]", &vals ) == LBER_ERROR ||
vals == NULL )
/* error? */
return 1;
}
+
+ if ( ldif ) {
+ char *ptr;
+
+ str = malloc( bv.bv_len + STRLENOF(": ") + 1 );
+
+ ptr = str;
+ ptr = lutil_strncopy( ptr, bv.bv_val, bv.bv_len );
+ ptr = lutil_strcopy( ptr, ": " );
+ }
for ( i = 0; vals[ i ].bv_val != NULL; i++ ) {
tool_write_ldif(
ldif ? LDIF_PUT_COMMENT : LDIF_PUT_VALUE,
- bv.bv_val, vals[ i ].bv_val, vals[ i ].bv_len );
+ ldif ? str : bv.bv_val, vals[ i ].bv_val, vals[ i ].bv_len );
}
ber_bvarray_free( vals );
+ if ( str ) free( str );
}
}
}
tool_write_ldif( ldif ? LDIF_PUT_COMMENT : LDIF_PUT_VALUE,
- "pagedresults", buf, ptr - buf );
+ ldif ? "pagedresults: " : "pagedresults",
+ buf, ptr - buf );
}
return 0;
err, ldap_err2string(err), attr ? " " : "", attr ? attr : "" );
tool_write_ldif( ldif ? LDIF_PUT_COMMENT : LDIF_PUT_VALUE,
- "sortResult", buf, rc );
+ ldif ? "sortResult: " : "sortResult", buf, rc );
}
return rc;
ber_memfree( bv.bv_val );
tool_write_ldif( ldif ? LDIF_PUT_COMMENT : LDIF_PUT_VALUE,
- "vlvResult", buf, rc );
+ ldif ? "vlvResult" : "vlvResult", buf, rc );
}
return rc;
static int
print_authzid( LDAP *ld, LDAPControl *ctrl )
{
- if (ctrl->ldctl_value.bv_len) {
- tool_write_ldif( ldif ? LDIF_PUT_COMMENT : LDIF_PUT_VALUE,
- "authzid", ctrl->ldctl_value.bv_val, ctrl->ldctl_value.bv_len );
+ if ( ctrl->ldctl_value.bv_len ) {
+ tool_write_ldif( ldif ? LDIF_PUT_COMMENT : LDIF_PUT_VALUE,
+ ldif ? "authzid: " : "authzid",
+ ctrl->ldctl_value.bv_val, ctrl->ldctl_value.bv_len );
} else {
- tool_write_ldif( ldif ? LDIF_PUT_COMMENT : LDIF_PUT_VALUE,
- "authzid", "anonymous", sizeof("anonymous")-1);
+ tool_write_ldif( ldif ? LDIF_PUT_COMMENT : LDIF_PUT_VALUE,
+ ldif ? "authzid: " : "authzid",
+ "anonymous", STRLENOF("anonymous") );
}
+
+ return 0;
}
#endif
}
tool_write_ldif( ldif ? LDIF_PUT_COMMENT : LDIF_PUT_VALUE,
- "ppolicy", buf, ptr - buf );
+ ldif ? "ppolicy: " : "ppolicy", buf, ptr - buf );
}
return rc;