+ * (char **) outvalue = LDAP_STRDUP(ld->ld_error);
+ }
+
+ return LDAP_OPT_SUCCESS;
+
+ case LDAP_OPT_MATCHED_DN:
+ if(ld == NULL) {
+ /* bad param */
+ break;
+ }
+
+ if( ld->ld_matched == NULL ) {
+ * (char **) outvalue = NULL;
+ } else {
+ * (char **) outvalue = LDAP_STRDUP(ld->ld_matched);
+ }
+
+ return LDAP_OPT_SUCCESS;
+
+ case LDAP_OPT_API_FEATURE_INFO: {
+ LDAPAPIFeatureInfo *info = (LDAPAPIFeatureInfo *) outvalue;
+ int i;
+
+ if(info == NULL) return LDAP_OPT_ERROR;
+
+ if(info->ldapaif_info_version != LDAP_FEATURE_INFO_VERSION) {
+ /* api info version mismatch */
+ info->ldapaif_info_version = LDAP_FEATURE_INFO_VERSION;
+ return LDAP_OPT_ERROR;
+ }
+
+ if(info->ldapaif_name == NULL) return LDAP_OPT_ERROR;
+
+ for(i=0; features[i].ldapaif_name != NULL; i++) {
+ if(!strcmp(info->ldapaif_name, features[i].ldapaif_name)) {
+ info->ldapaif_version =
+ features[i].ldapaif_version;
+ return LDAP_OPT_SUCCESS;
+ }
+ }