First cut new schema support.

Back-shell still doesn't support binary data, should use -lldif routines
This commit is contained in:
Kurt Zeilenga 2000-06-08 18:38:17 +00:00
parent fad62c5d1d
commit 1f7c26e4ee
3 changed files with 26 additions and 13 deletions

View File

@ -22,7 +22,7 @@ shell_back_compare(
Operation *op,
const char *dn,
const char *ndn,
Ava *ava
AttributeAssertion *ava
)
{
struct shellinfo *si = (struct shellinfo *) be->be_private;
@ -41,12 +41,19 @@ shell_back_compare(
return( -1 );
}
/*
* FIX ME: This should use LDIF routines so that binary
* values are properly dealt with
*/
/* write out the request to the compare process */
fprintf( wfp, "COMPARE\n" );
fprintf( wfp, "msgid: %ld\n", (long) op->o_msgid );
print_suffixes( wfp, be );
fprintf( wfp, "dn: %s\n", dn );
fprintf( wfp, "%s: %s\n", ava->ava_type, ava->ava_value.bv_val );
fprintf( wfp, "%s: %s\n",
ava->aa_desc->ad_cname->bv_val,
ava->aa_value->bv_val /* could be binary! */ );
fclose( wfp );
/* read in the result and send it along */

View File

@ -37,7 +37,7 @@ extern int shell_back_search LDAP_P(( BackendDB *bd,
extern int shell_back_compare LDAP_P((BackendDB *bd,
Connection *conn, Operation *op,
const char *dn, const char *ndn,
Ava *ava ));
AttributeAssertion *ava ));
extern int shell_back_modify LDAP_P(( BackendDB *bd,
Connection *conn, Operation *op,

View File

@ -22,9 +22,10 @@ shell_back_modify(
Operation *op,
const char *dn,
const char *ndn,
LDAPModList *ml
Modifications *ml
)
{
Modification *mod;
struct shellinfo *si = (struct shellinfo *) be->be_private;
FILE *rfp, *wfp;
int i;
@ -47,25 +48,30 @@ shell_back_modify(
fprintf( wfp, "msgid: %ld\n", (long) op->o_msgid );
print_suffixes( wfp, be );
fprintf( wfp, "dn: %s\n", dn );
for ( ; ml != NULL; ml = ml->ml_next ) {
switch ( ml->ml_op ) {
for ( ; ml != NULL; ml = ml->sml_next ) {
mod = &ml->sml_mod;
/* FIXME: should use LDIF routines to deal with binary data */
switch ( mod->sm_op ) {
case LDAP_MOD_ADD:
fprintf( wfp, "add: %s\n", ml->ml_type );
fprintf( wfp, "add: %s\n", mod->sm_desc->ad_cname->bv_val );
break;
case LDAP_MOD_DELETE:
fprintf( wfp, "delete: %s\n", ml->ml_type );
fprintf( wfp, "delete: %s\n", mod->sm_desc->ad_cname->bv_val );
break;
case LDAP_MOD_REPLACE:
fprintf( wfp, "replace: %s\n", ml->ml_type );
fprintf( wfp, "replace: %s\n", mod->sm_desc->ad_cname->bv_val );
break;
}
for ( i = 0; ml->ml_bvalues != NULL && ml->ml_bvalues[i]
!= NULL; i++ ) {
fprintf( wfp, "%s: %s\n", ml->ml_type,
ml->ml_bvalues[i]->bv_val );
if( mod->sm_bvalues != NULL ) {
for ( i = 0; mod->sm_bvalues[i] != NULL; i++ ) {
fprintf( wfp, "%s: %s\n", mod->sm_desc->ad_cname->bv_val,
mod->sm_bvalues[i]->bv_val /* binary! */ );
}
}
}
fclose( wfp );