- case LDAP_OPT_SERVER_CONTROLS:
- case LDAP_OPT_CLIENT_CONTROLS:
- /* not yet supported */
- break;
+ case LDAP_OPT_SERVER_CONTROLS: {
+ LDAPControl **controls = (LDAPControl **) invalue;
+
+ ldap_controls_free( lo->ldo_sctrls );
+
+ if( controls == NULL || *controls == NULL ) {
+ lo->ldo_sctrls = NULL;
+ return LDAP_OPT_SUCCESS;
+ }
+
+ lo->ldo_sctrls =
+ ldap_controls_dup( (LDAPControl **) invalue );
+
+ if(lo->ldo_sctrls == NULL) {
+ /* memory allocation error ? */
+ break;
+ }
+ } return LDAP_OPT_SUCCESS;
+
+ case LDAP_OPT_CLIENT_CONTROLS: {
+ LDAPControl **controls = (LDAPControl **) invalue;
+
+ ldap_controls_free( lo->ldo_cctrls );
+
+ if( controls == NULL || *controls == NULL ) {
+ lo->ldo_cctrls = NULL;
+ return LDAP_OPT_SUCCESS;
+ }
+
+ lo->ldo_cctrls =
+ ldap_controls_dup( (LDAPControl **) invalue );
+
+ if(lo->ldo_cctrls == NULL) {
+ /* memory allocation error ? */
+ break;
+ }
+ } return LDAP_OPT_SUCCESS;