version 1.25, 2006/05/10 20:23:24
|
version 1.37, 2010/04/13 20:18:09
|
Line 1
|
Line 1
|
|
/* $OpenLDAP: pkg/ldap/servers/slapd/slapacl.c,v 1.36 2009/07/22 02:39:57 hyc Exp $ */ |
/* This work is part of OpenLDAP Software <http://www.openldap.org/>. |
/* This work is part of OpenLDAP Software <http://www.openldap.org/>. |
* |
* |
* Copyright 2004-2006 The OpenLDAP Foundation. |
* Copyright 2004-2010 The OpenLDAP Foundation. |
* Portions Copyright 2004 Pierangelo Masarati. |
* Portions Copyright 2004 Pierangelo Masarati. |
* All rights reserved. |
* All rights reserved. |
* |
* |
Line 52 print_access(
|
Line 53 print_access(
|
desc->ad_cname.bv_val, |
desc->ad_cname.bv_val, |
( val && !BER_BVISNULL( val ) ) ? "=" : "", |
( val && !BER_BVISNULL( 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 ) ); |
accessmask2str( mask, accessmaskbuf, 1 ) ); |
|
|
return rc; |
return rc; |
Line 71 slapacl( int argc, char **argv )
|
Line 73 slapacl( int argc, char **argv )
|
char *attr = NULL; |
char *attr = NULL; |
int doclose = 0; |
int doclose = 0; |
BackendDB *bd; |
BackendDB *bd; |
|
void *thrctx; |
|
|
slap_tool_init( progname, SLAPACL, argc, argv ); |
slap_tool_init( progname, SLAPACL, argc, argv ); |
|
|
Line 94 slapacl( int argc, char **argv )
|
Line 97 slapacl( int argc, char **argv )
|
argv = &argv[ optind ]; |
argv = &argv[ optind ]; |
argc -= optind; |
argc -= optind; |
|
|
op = (Operation *) &opbuf; |
thrctx = ldap_pvt_thread_pool_context(); |
connection_fake_init( &conn, op, &conn ); |
connection_fake_init( &conn, &opbuf, thrctx ); |
|
op = &opbuf.ob_op; |
|
op->o_tmpmemctx = NULL; |
|
|
conn.c_listener = &listener; |
conn.c_listener = &listener; |
conn.c_listener_url = listener_url; |
conn.c_listener_url = listener_url; |
Line 237 slapacl( int argc, char **argv )
|
Line 242 slapacl( int argc, char **argv )
|
if ( !be->be_entry_open || |
if ( !be->be_entry_open || |
!be->be_entry_close || |
!be->be_entry_close || |
!be->be_dn2id_get || |
!be->be_dn2id_get || |
!be->be_id2entry_get ) |
!be->be_entry_get ) |
{ |
{ |
fprintf( stderr, "%s: target database " |
fprintf( stderr, "%s: target database " |
"doesn't support necessary operations; " |
"doesn't support necessary operations; " |
Line 263 slapacl( int argc, char **argv )
|
Line 268 slapacl( int argc, char **argv )
|
rc = 1; |
rc = 1; |
goto destroy; |
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", |
fprintf( stderr, "%s: unable to fetch entry \"%s\" (%lu)\n", |
progname, e.e_nname.bv_val, id ); |
progname, e.e_nname.bv_val, id ); |
rc = 1; |
rc = 1; |
Line 330 slapacl( int argc, char **argv )
|
Line 336 slapacl( int argc, char **argv )
|
attr ); |
attr ); |
invalid = 1; |
invalid = 1; |
break; |
break; |
|
|
|
default: |
|
break; |
} |
} |
|
|
if ( invalid ) { |
if ( invalid ) { |
Line 380 destroy:;
|
Line 389 destroy:;
|
ber_memfree( e.e_nname.bv_val ); |
ber_memfree( e.e_nname.bv_val ); |
} |
} |
if ( !dryrun && be ) { |
if ( !dryrun && be ) { |
if ( ep != &e ) { |
if ( ep && ep != &e ) { |
be_entry_release_r( op, ep ); |
be_entry_release_r( op, ep ); |
} |
} |
if ( doclose ) { |
if ( doclose ) { |
Line 394 destroy:;
|
Line 403 destroy:;
|
} |
} |
} |
} |
|
|
slap_tool_destroy(); |
if ( slap_tool_destroy()) |
|
rc = EXIT_FAILURE; |
|
|
return rc; |
return rc; |
} |
} |