From 1f7c26e4eef5ab44f63d36efeb159d8c81aa9963 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Thu, 8 Jun 2000 18:38:17 +0000 Subject: [PATCH] First cut new schema support. Back-shell still doesn't support binary data, should use -lldif routines --- servers/slapd/back-shell/compare.c | 11 +++++++++-- servers/slapd/back-shell/external.h | 2 +- servers/slapd/back-shell/modify.c | 26 ++++++++++++++++---------- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/servers/slapd/back-shell/compare.c b/servers/slapd/back-shell/compare.c index bd46bd1b0f..c7c85f8d68 100644 --- a/servers/slapd/back-shell/compare.c +++ b/servers/slapd/back-shell/compare.c @@ -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 */ diff --git a/servers/slapd/back-shell/external.h b/servers/slapd/back-shell/external.h index a148d0368e..0ace4657f7 100644 --- a/servers/slapd/back-shell/external.h +++ b/servers/slapd/back-shell/external.h @@ -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, diff --git a/servers/slapd/back-shell/modify.c b/servers/slapd/back-shell/modify.c index 7da9c21251..4d97851eab 100644 --- a/servers/slapd/back-shell/modify.c +++ b/servers/slapd/back-shell/modify.c @@ -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 ); -- 2.39.5