X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libraries%2Flibldap%2Fcontrols.c;h=7511f94f5dd33cd30e1113639f6afbfe75289dcb;hb=b8e48e95fb2c7aae6b3d50e42fb52f252faeb5fd;hp=059dc5266f268d434d1369dda5f3fcbec5a05a71;hpb=b9e2fd0dd6d8ad614a6c595f168058cd2ebc4bca;p=openldap diff --git a/libraries/libldap/controls.c b/libraries/libldap/controls.c index 059dc5266f..7511f94f5d 100644 --- a/libraries/libldap/controls.c +++ b/libraries/libldap/controls.c @@ -1,7 +1,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * - * 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 @@ -337,7 +337,7 @@ ldap_control_dup( const LDAPControl *c ) { LDAPControl *new; - if ( c == NULL ) { + if ( c == NULL || c->ldctl_oid == NULL ) { return NULL; } @@ -347,17 +347,11 @@ ldap_control_dup( const LDAPControl *c ) 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 ) { @@ -539,7 +533,7 @@ int ldap_int_client_controls( LDAP *ld, LDAPControl **ctrls ) assert( LDAP_VALID( ld ) ); if( ctrls == NULL ) { - /* use default server controls */ + /* use default client controls */ ctrls = ld->ld_cctrls; }