X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fslapacl.c;h=cc49b215256d48a07534dbd634c5deedd2d89da9;hb=447f3f746e59fc5b724b8dd8bfb1ec0e02cc8d9f;hp=c7b6c274cf5b170ebea4027cb5fa47e71b8063a1;hpb=d79fd46f336db99743c436a2bc6ab27b8a26ffdd;p=openldap diff --git a/servers/slapd/slapacl.c b/servers/slapd/slapacl.c index c7b6c274cf..cc49b21525 100644 --- a/servers/slapd/slapacl.c +++ b/servers/slapd/slapacl.c @@ -1,6 +1,7 @@ +/* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * - * Copyright 2004-2006 The OpenLDAP Foundation. + * Copyright 2004-2009 The OpenLDAP Foundation. * Portions Copyright 2004 Pierangelo Masarati. * All rights reserved. * @@ -52,7 +53,8 @@ print_access( desc->ad_cname.bv_val, ( val && !BER_BVISNULL( val ) ) ? "=" : "", ( val && !BER_BVISNULL( val ) ) ? - ( desc == slap_schema.si_ad_userPassword ? "****" : val->bv_val ) : "", + ( desc == slap_schema.si_ad_userPassword ? + "****" : val->bv_val ) : "", accessmask2str( mask, accessmaskbuf, 1 ) ); return rc; @@ -94,8 +96,9 @@ slapacl( int argc, char **argv ) argv = &argv[ optind ]; argc -= optind; - op = (Operation *) &opbuf; - connection_fake_init( &conn, op, &conn ); + connection_fake_init( &conn, &opbuf, &conn ); + op = &opbuf.ob_op; + op->o_tmpmemctx = NULL; conn.c_listener = &listener; conn.c_listener_url = listener_url; @@ -237,7 +240,7 @@ slapacl( int argc, char **argv ) if ( !be->be_entry_open || !be->be_entry_close || !be->be_dn2id_get || - !be->be_id2entry_get ) + !be->be_entry_get ) { fprintf( stderr, "%s: target database " "doesn't support necessary operations; " @@ -263,7 +266,8 @@ slapacl( int argc, char **argv ) rc = 1; goto destroy; } - if ( be->be_id2entry_get( be, id, &ep ) != 0 ) { + ep = be->be_entry_get( be, id ); + if ( ep == NULL ) { fprintf( stderr, "%s: unable to fetch entry \"%s\" (%lu)\n", progname, e.e_nname.bv_val, id ); rc = 1; @@ -330,6 +334,9 @@ slapacl( int argc, char **argv ) attr ); invalid = 1; break; + + default: + break; } if ( invalid ) { @@ -380,7 +387,7 @@ destroy:; ber_memfree( e.e_nname.bv_val ); } if ( !dryrun && be ) { - if ( ep != &e ) { + if ( ep && ep != &e ) { be_entry_release_r( op, ep ); } if ( doclose ) { @@ -394,7 +401,8 @@ destroy:; } } - slap_tool_destroy(); + if ( slap_tool_destroy()) + rc = EXIT_FAILURE; return rc; }