(don't check what we expect applications to check).
int
ldap_enable_cache( LDAP *ld, long timeout, ber_len_t maxmem )
{
+ assert( ld != NULL );
+ assert( LDAP_VALID( ld ) );
+
#ifndef LDAP_NOCACHE
if ( ld->ld_cache == NULL ) {
if (( ld->ld_cache = (LDAPCache *)LDAP_MALLOC( sizeof( LDAPCache )))
void
ldap_disable_cache( LDAP *ld )
{
+ assert( ld != NULL );
+ assert( LDAP_VALID( ld ) );
+
#ifndef LDAP_NOCACHE
if ( ld->ld_cache != NULL ) {
ld->ld_cache->lc_enabled = 0;
void
ldap_set_cache_options( LDAP *ld, unsigned long opts )
{
+ assert( ld != NULL );
+ assert( LDAP_VALID( ld ) );
+
#ifndef LDAP_NOCACHE
if ( ld->ld_cache != NULL ) {
ld->ld_cache->lc_options = opts;
void
ldap_destroy_cache( LDAP *ld )
{
+ assert( ld != NULL );
+ assert( LDAP_VALID( ld ) );
+
#ifndef LDAP_NOCACHE
if ( ld->ld_cache != NULL ) {
ldap_flush_cache( ld );
int i;
LDAPMessage *m, *next;
+ assert( ld != NULL );
+ assert( LDAP_VALID( ld ) );
+
#ifdef NEW_LOGGING
LDAP_LOG (( "cache", LDAP_LEVEL_ENTRY, "ldap_flush_cache\n" ));
#else
void
ldap_uncache_request( LDAP *ld, int msgid )
{
+ assert( ld != NULL );
+ assert( LDAP_VALID( ld ) );
+
#ifndef LDAP_NOCACHE
#ifdef NEW_LOGGING
LDAP_LOG (( "cache", LDAP_LEVEL_ARGS,
void
ldap_uncache_entry( LDAP *ld, LDAP_CONST char *dn )
{
+ assert( ld != NULL );
+ assert( LDAP_VALID( ld ) );
+ assert( dn != NULL );
+
#ifndef LDAP_NOCACHE
#ifdef NEW_LOGGING
LDAP_LOG (( "cache", LDAP_LEVEL_ARGS,
LDAPMessage *new;
ber_len_t len;
+ assert( ld != NULL );
+ assert( LDAP_VALID( ld ) );
+
#ifdef NEW_LOGGING
LDAP_LOG (( "cache", LDAP_LEVEL_ENTRY, "ldap_add_request_to_cache\n" ));
#else
LDAPMessage *m, **mp, *req, *new, *prev;
int err, keep;
+ assert( ld != NULL );
+ assert( LDAP_VALID( ld ) );
+ assert( result != NULL );
+
#ifdef NEW_LOGGING
LDAP_LOG (( "cache", LDAP_LEVEL_ARGS,
"ldap_add_result_to_cache: id %ld, type %ld\n",
int first, hash;
time_t c_time;
+ assert( ld != NULL );
+ assert( LDAP_VALID( ld ) );
+ assert( request != NULL );
+
#ifdef NEW_LOGGING
LDAP_LOG (( "cache", LDAP_LEVEL_ENTRY, "ldap_check_cache\n" ));
#else
int msgid;
struct berval bvalue;
+ assert( value != NULL );
+
bvalue.bv_val = (char *) value;
bvalue.bv_len = (value == NULL) ? 0 : strlen( value );
{
struct berval bvalue;
+ assert( value != NULL );
+
bvalue.bv_val = (char *) value;
bvalue.bv_len = (value == NULL) ? 0 : strlen( value );
LDAPControl *const *c;
assert( ld != NULL );
+ assert( LDAP_VALID(ld) );
assert( ber != NULL );
if( ctrls == NULL ) {
struct berval *bvalp;
assert( requestOID != NULL );
+ assert( ber != NULL );
assert( ctrlp != NULL );
ctrl = (LDAPControl *) LDAP_MALLOC( sizeof(LDAPControl) );
LDAPControl *const *c;
assert( ld != NULL );
+ assert( LDAP_VALID(ld) );
if( ctrls == NULL ) {
/* use default server controls */
char *domain = NULL;
char **dn;
- if( dn_in == NULL || domainp == NULL ) {
- return -1;
- }
+ assert( dn_in != NULL );
+ assert( domainp != NULL );
dn = ldap_explode_dn( dn_in, 0 );
char *domain, *s, *tok_r, *dn;
size_t loc;
- if (domain_in == NULL || dnp == NULL) {
- return LDAP_NO_MEMORY;
- }
+ assert( domain_in != NULL );
+ assert( dnp != NULL );
+
domain = LDAP_STRDUP(domain_in);
if (domain == NULL) {
- return LDAP_NO_MEMORY;
+ return LDAP_NO_MEMORY;
}
dn = NULL;
loc = 0;
assert( LDAP_VALID( ld ) );
assert( chain != NULL );
- if( ld == NULL || chain == NULL ) {
- return NULL;
- }
-
return chain->lm_msgtype == LDAP_RES_SEARCH_ENTRY
? chain
: ldap_next_entry( ld, chain );
assert( LDAP_VALID( ld ) );
assert( entry != NULL );
- if ( ld == NULL || entry == NULL ) {
- return NULL;
- }
-
- for (
+ for(
entry = entry->lm_chain;
entry != NULL;
entry = entry->lm_chain )
assert( ld != NULL );
assert( LDAP_VALID( ld ) );
- if ( ld == NULL ) {
- return -1;
- }
-
for ( i = 0; chain != NULL; chain = chain->lm_chain ) {
if( chain->lm_msgtype == LDAP_RES_SEARCH_ENTRY ) {
i++;
{
assert( ld != NULL );
assert( LDAP_VALID( ld ) );
+ assert( chain != NULL );
- if ( ld == NULL || chain == NULL ) {
- return NULL;
- }
-
return chain;
}
{
assert( ld != NULL );
assert( LDAP_VALID( ld ) );
+ assert( msg != NULL );
- if ( ld == NULL || msg == NULL || msg->lm_chain == NULL ) {
- return NULL;
- }
-
- return( msg->lm_chain );
+ return msg->lm_chain;
}
int
assert( ld != NULL );
assert( LDAP_VALID( ld ) );
- if ( ld == NULL ) {
- return -1;
- }
-
for ( i = 0; chain != NULL; chain = chain->lm_chain ) {
i++;
}
{
assert( ld != NULL );
assert( LDAP_VALID( ld ) );
- assert( chain != NULL );
+ assert( chain != NULL );
return chain->lm_msgtype == LDAP_RES_SEARCH_REFERENCE
? chain
{
assert( ld != NULL );
assert( LDAP_VALID( ld ) );
- assert( ref != NULL );
+ assert( ref != NULL );
for (
ref = ref->lm_chain;
assert( ld != NULL );
assert( LDAP_VALID( ld ) );
- assert( chain != NULL );
-
- if ( ld == NULL ) {
- return -1;
- }
-
for ( i = 0; chain != NULL; chain = chain->lm_chain ) {
if( chain->lm_msgtype == LDAP_RES_SEARCH_REFERENCE ) {
i++;