int i = 0, j, crit = 0, err;
LDAPControl c[10], **ctrls;
+ if ( ! ( assertctl
+ || authzid
+ || manageDIT
+ || manageDSAit
+ || noop
+ || preread
+ || postread
+#ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR
+ || chaining
+#endif /* LDAP_CONTROL_X_CHAINING_BEHAVIOR */
+ || count ) )
+ {
+ return;
+ }
+
ctrls = (LDAPControl**) malloc(sizeof(c) + (count+1)*sizeof(LDAPControl*));
if ( ctrls == NULL ) {
fprintf( stderr, "No memory\n" );
int
main( int argc, char **argv )
{
- char *compdn = NULL, *attrs = NULL;
- char *sep;
+ char *compdn = NULL, *attrs = NULL;
+ char *sep;
int rc;
- LDAP *ld = NULL;
- struct berval bvalue = { 0, NULL };
+ LDAP *ld = NULL;
+ struct berval bvalue = { 0, NULL };
+ int i = 0;
+ LDAPControl c[1];
+
tool_init( TOOL_COMPARE );
prog = lutil_progname( "ldapcompare", argc, argv );
tool_bind( ld );
- if ( assertion || authzid || manageDSAit || noop
+ if ( 0
#ifdef LDAP_CONTROL_DONTUSECOPY
|| dontUseCopy
#endif
)
{
- int err;
- int i = 0;
- LDAPControl c[1];
-
#ifdef LDAP_CONTROL_DONTUSECOPY
if ( dontUseCopy ) {
c[i].ldctl_oid = LDAP_CONTROL_DONTUSECOPY;
i++;
}
#endif
-
- tool_server_controls( ld, c, i );
}
+ tool_server_controls( ld, c, i );
+
if ( verbose ) {
fprintf( stderr, _("DN:%s, attr:%s, value:%s\n"),
compdn, attrs, sep );
tool_bind( ld );
- if ( assertion || authzid || manageDIT || manageDSAit || noop ) {
- tool_server_controls( ld, NULL, 0 );
- }
+ tool_server_controls( ld, NULL, 0 );
retval = rc = 0;
- if ( fp == NULL ) {
+ if ( fp == NULL ) {
for ( ; optind < argc; ++optind ) {
rc = dodelete( ld, argv[ optind ] );
usage();
}
- if ( assertion || manageDSAit || noop ) {
- fprintf( stderr, _("controls incompatible with WhoAmI exop\n\n") );
- usage();
- }
-
- if ( authzid ) {
- tool_server_controls( ld, NULL, 0 );
- }
+ tool_server_controls( ld, NULL, 0 );
rc = ldap_whoami( ld, NULL, NULL, &id );
if ( rc != LDAP_SUCCESS ) {
}
} else if ( strcasecmp( argv[ 0 ], "passwd" ) == 0 ) {
- /* do we need this? */
+ fprintf( stderr, "use ldappasswd(1) instead.\n\n", argv[ 0 ] );
+ usage();
+ /* TODO? */
} else if ( strcasecmp( argv[ 0 ], "refresh" ) == 0 ) {
int ttl = 3600;
usage();
}
- if ( assertion || manageDSAit || noop || authzid ) {
- tool_server_controls( ld, NULL, 0 );
- }
+ tool_server_controls( ld, NULL, 0 );
rc = ldap_refresh( ld, &dn, ttl, NULL, NULL, &id );
if ( rc != LDAP_SUCCESS ) {
}
} else if ( tool_is_oid( argv[ 0 ] ) ) {
+ /* TODO */
+ fprintf( stderr, "exop \"%s\" not implemented yet.\n\n", argv[ 0 ] );
+ usage();
} else {
fprintf( stderr, "unknown exop \"%s\"\n\n", argv[ 0 ] );
assert( 0 );
} else if ( strcasecmp( argv[ 0 ], "passwd" ) == 0 ) {
+ /* TODO */
} else if ( strcasecmp( argv[ 0 ], "refresh" ) == 0 ) {
int newttl;
main( int argc, char **argv )
{
#ifdef LDAP_GROUP_TRANSACTION
- BerElement *txnber;
- struct berval txnCookie = { 0, NULL };
+ BerElement *txnber;
+ struct berval txnCookie = { 0, NULL };
#endif
char *rbuf, *start, *rejbuf = NULL;
FILE *fp, *rejfp;
char *matched_msg, *error_msg;
int rc, retval;
- int count, len;
+ int count, len;
+ int i = 0;
+ LDAPControl c[1];
+
prog = lutil_progname( "ldapmodify", argc, argv );
}
#endif
- if ( assertion || authzid || manageDIT || manageDSAit || noop
+ if ( 0
#ifdef LDAP_GROUP_TRANSACTION
|| txn
#endif
- || preread || postread )
+ )
{
- int i = 0;
- LDAPControl c[1];
-
#ifdef LDAP_GROUP_TRANSACTION
if( txn ) {
int err;
i++;
}
#endif
-
- tool_server_controls( ld, c, i );
}
+ tool_server_controls( ld, c, i );
+
rc = 0;
count = 0;
retval = 0;
tool_bind( ld );
- if ( assertion || authzid || manageDSAit || noop ) {
- tool_server_controls( ld, NULL, 0 );
- }
+ tool_server_controls( ld, NULL, 0 );
retval = rc = 0;
if (havedn)
{
char *filtpattern, **attrs = NULL, line[BUFSIZ];
FILE *fp = NULL;
- int rc, i, first;
+ int rc, i, first;
LDAP *ld = NULL;
BerElement *seber = NULL, *vrber = NULL;
BerElement *syncber = NULL;
struct berval *syncbvalp = NULL;
+ int err;
tool_init( TOOL_SEARCH );
tool_bind( ld );
getNextPage:
- if ( nctrls > 0 || assertion || authzid || manageDSAit || noop
+ save_nctrls = nctrls;
+ i = nctrls;
+ if ( nctrls > 0
#ifdef LDAP_CONTROL_DONTUSECOPY
|| dontUseCopy
#endif
- || domainScope || pagedResults
-#ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR
- || chaining
-#endif /* LDAP_CONTROL_X_CHAINING_BEHAVIOR */
+ || domainScope
+ || pagedResults
|| ldapsync
- || subentries || valuesReturnFilter )
+ || subentries
+ || valuesReturnFilter )
{
- int err;
- int i = nctrls;
- save_nctrls = nctrls;
#ifdef LDAP_CONTROL_DONTUSECOPY
if ( dontUseCopy ) {
c[i].ldctl_iscritical = pagedResults > 1;
i++;
}
+ }
- tool_server_controls( ld, c, i );
+ tool_server_controls( ld, c, i );
- /* step back to the original number of controls, so that
- * those set while parsing args are preserved */
- nctrls = save_nctrls;
+ ber_free( seber, 1 );
+ ber_free( vrber, 1 );
+
+ /* step back to the original number of controls, so that
+ * those set while parsing args are preserved */
+ nctrls = save_nctrls;
- ber_free( seber, 1 );
- ber_free( vrber, 1 );
- }
-
if ( verbose ) {
fprintf( stderr, _("filter%s: %s\nrequesting: "),
infile != NULL ? _(" pattern") : "",
goto skip;
}
- if ( assertion || authzid || manageDSAit || noop ) {
- tool_server_controls( ld, NULL, 0 );
- }
+ tool_server_controls( ld, NULL, 0 );
rc = ldap_whoami( ld, NULL, NULL, &id );