/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 1998-2007 The OpenLDAP Foundation.
+ * Copyright 1998-2012 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
{
LDAPControl *new;
- if ( c == NULL ) {
+ if ( c == NULL || c->ldctl_oid == NULL ) {
return NULL;
}
return NULL;
}
- if( c->ldctl_oid != NULL ) {
- new->ldctl_oid = LDAP_STRDUP( c->ldctl_oid );
+ new->ldctl_oid = LDAP_STRDUP( c->ldctl_oid );
- if(new->ldctl_oid == NULL) {
- LDAP_FREE( new );
- return NULL;
- }
-
- } else {
- /* FIXME: how can a control have null OID? */
- new->ldctl_oid = NULL;
+ if(new->ldctl_oid == NULL) {
+ LDAP_FREE( new );
+ return NULL;
}
if( c->ldctl_value.bv_val != NULL ) {
assert( LDAP_VALID( ld ) );
if( ctrls == NULL ) {
- /* use default server controls */
+ /* use default client controls */
ctrls = ld->ld_cctrls;
}