Application is responsible for providing valid session pointers.
LDAPControl *ctrl;
struct berval *bvalp;
- if ( requestOID == NULL || ctrlp == NULL ) {
- return LDAP_PARAM_ERROR;
- }
+ assert( requestOID != NULL );
+ assert( ctrlp != NULL );
ctrl = (LDAPControl *) LDAP_MALLOC( sizeof(LDAPControl) );
if ( ctrl == NULL ) {
int rc, len, cur = 0;
unsigned char reply[1024];
- if( domain == NULL || *domain == '\0' ) {
- return LDAP_PARAM_ERROR;
- }
+ assert( domain != NULL );
+ assert( list != NULL );
- if( list == NULL ) {
+ if( *domain == '\0' ) {
return LDAP_PARAM_ERROR;
}
assert( LDAP_VALID( ld ) );
assert( str );
- if ( ld == NULL ) {
- fprintf( stderr, "ldap_perror: invalid session handle\n" );
- return;
- }
-
e = ldap_int_error( ld->ld_errno );
fprintf( stderr, "%s: %s (%d)\n",
assert( LDAP_VALID( ld ) );
assert( r != NULL );
- if ( ld == NULL || r == NULL ) {
- return LDAP_PARAM_ERROR;
- }
-
if(errcodep != NULL) *errcodep = LDAP_SUCCESS;
if(matcheddnp != NULL) *matcheddnp = NULL;
if(errmsgp != NULL) *errmsgp = NULL;
return( ld->ld_errno );
}
- if( reqoid == NULL || *reqoid == '\0' || msgidp == NULL ) {
- ld->ld_errno = LDAP_PARAM_ERROR;
- return( ld->ld_errno );
- }
-
/* create a message to send */
if ( (ber = ldap_alloc_ber_with_options( ld )) == NULL ) {
ld->ld_errno = LDAP_NO_MEMORY;
assert( reqoid != NULL || *reqoid == '\0' );
assert( retoidp != NULL || retdatap != NULL );
- if( retoidp == NULL || retdatap == NULL ) {
- ld->ld_errno = LDAP_PARAM_ERROR;
- return( ld->ld_errno );
- }
-
rc = ldap_extended_operation( ld, reqoid, reqdata,
sctrls, cctrls, &msgid );
Debug( LDAP_DEBUG_TRACE, "ldap_get_dn\n", 0, 0, 0 );
#endif
- if ( entry == NULL ) {
- ld->ld_errno = LDAP_PARAM_ERROR;
- return( NULL );
- }
+ assert( entry != NULL );
tmp = *entry->lm_ber; /* struct copy */
if ( ber_scanf( &tmp, "{a" /*}*/, &dn ) == LBER_ERROR ) {
break;
default:
- return( LDAP_PARAM_ERROR );
+ return LDAP_PARAM_ERROR;
}
bv->bv_val = LDAP_MALLOC( l + 1 );
assert( entry != NULL );
assert( sctrls != NULL );
- if ( ld == NULL || sctrls == NULL ||
- entry == NULL || entry->lm_msgtype != LDAP_RES_SEARCH_ENTRY )
- {
+ if ( entry->lm_msgtype != LDAP_RES_SEARCH_ENTRY ) {
return LDAP_PARAM_ERROR;
}
assert( LDAP_VALID( ld ) );
assert( chain != NULL );
- if ( ld == NULL || chain == NULL ) {
- return NULL;
- }
-
return chain->lm_msgtype == LDAP_RES_SEARCH_REFERENCE
? chain
: ldap_next_reference( ld, chain );
assert( LDAP_VALID( ld ) );
assert( ref != NULL );
- if ( ld == NULL || ref == NULL ) {
- return NULL;
- }
-
for (
ref = ref->lm_chain;
ref != NULL;
assert( LDAP_VALID( ld ) );
assert( ref != NULL );
- if( ld == NULL || ref == NULL ||
- ref->lm_msgtype != LDAP_RES_SEARCH_REFERENCE )
- {
+ if( ref->lm_msgtype != LDAP_RES_SEARCH_REFERENCE ) {
return LDAP_PARAM_ERROR;
}
Debug( LDAP_DEBUG_TRACE, "ldap_result msgid %d\n", msgid, 0, 0 );
#endif
- if( ld == NULL ) {
- return -1;
- }
-
- if( result == NULL ) {
- ld->ld_errno = LDAP_PARAM_ERROR;
- return -1;
- }
-
lm = chkResponseList(ld, msgid, all);
if ( lm == NULL ) {
rc = ldap_int_client_controls( ld, cctrls );
if( rc != LDAP_SUCCESS ) return rc;
- if( msgidp == NULL ) {
- ld->ld_errno = LDAP_PARAM_ERROR;
- return ld->ld_errno;
- }
-
if( mechanism == LDAP_SASL_SIMPLE ) {
if( dn == NULL && cred != NULL ) {
/* use default binddn */
assert( LDAP_VALID( ld ) );
assert( res != NULL );
- if ( ld == NULL || res == NULL ) {
- return LDAP_PARAM_ERROR;
- }
-
if( servercredp != NULL ) {
if( ld->ld_version < LDAP_VERSION2 ) {
return LDAP_NOT_SUPPORTED;
LDAPMessage *e, *last;
LDAPMessage **ep;
- count = ldap_count_entries( ld, *chain );
+ assert( ld != NULL );
+ count = ldap_count_entries( ld, *chain );
if ( count < 0 ) {
- if( ld != NULL ) {
- ld->ld_errno = LDAP_PARAM_ERROR;
- }
return -1;
} else if ( count < 2 ) {
char *nextKey;
LDAPSortKey **keyList = NULL;
- if (( sortKeyList == NULL ) || ( keyString == NULL )) {
- return LDAP_PARAM_ERROR;
- }
+ assert( sortKeyList != NULL );
+ assert( keyString != NULL );
+
*sortKeyList = NULL;
/* Determine the number of sort keys so we can allocate memory. */
LDAPURLDesc *ludp;
char **urls;
- *ludlist = NULL;
+ assert( ludlist != NULL );
+ assert( url != NULL );
- if (url == NULL)
- return LDAP_PARAM_ERROR;
+ *ludlist = NULL;
urls = ldap_str2charray(url, ", ");
if (urls == NULL)
LDAPURLDesc *ludp;
char **specs, *p;
- *ludlist = NULL;
+ assert( ludlist != NULL );
+ assert( url != NULL );
- if (hosts == NULL)
- return LDAP_PARAM_ERROR;
+ *ludlist = NULL;
specs = ldap_str2charray(hosts, ", ");
if (specs == NULL)
ber_tag_t tag;
BerElement *ber;
- if ( (ld==NULL) || (vlvinfop==NULL) || (ctrlp == NULL) ) {
- ld->ld_errno = LDAP_PARAM_ERROR;
- return(ld->ld_errno);
- }
+ assert( ld != NULL );
+ assert( vlvinfop != NULL );
+ assert( ctrlp != NULL );
if ((ber = ldap_alloc_ber_with_options(ld)) == NULL) {
ld->ld_errno = LDAP_NO_MEMORY;
ber_tag_t tag, berTag;
ber_len_t berLen;
+ assert( ld != NULL );
+
if (contextp) {
*contextp = NULL; /* Make sure we return a NULL if error occurs. */
}
- if (ld == NULL) {
- ld->ld_errno = LDAP_PARAM_ERROR;
- return(ld->ld_errno);
- }
-
if (ctrls == NULL) {
ld->ld_errno = LDAP_CONTROL_NOT_FOUND;
return(ld->ld_errno);