+ if (strcasecmp(control, "sasl") == 0) {
+#if defined(LDAP_API_FEATURES_VERIFY_CREDENTIALS_INTERACTIVE) && defined(HAVE_CYRUS_SASL)
+ if (vc_sasl != LDAP_SASL_NONE) {
+ fprintf(stderr,
+ _("SASL option previously specified\n"));
+ exit(EXIT_FAILURE);
+ }
+ if (cvalue == NULL) {
+ fprintf(stderr,
+ _("missing mode in SASL option\n"));
+ exit(EXIT_FAILURE);
+ }
+
+ switch (*cvalue) {
+ case 'a':
+ case 'A':
+ vc_sasl = LDAP_SASL_AUTOMATIC;
+ break;
+ case 'i':
+ case 'I':
+ vc_sasl = LDAP_SASL_INTERACTIVE;
+ break;
+ case 'q':
+ case 'Q':
+ vc_sasl = LDAP_SASL_QUIET;
+ break;
+ default:
+ fprintf(stderr,
+ _("unknown mode %s in SASL option\n"), cvalue);
+ exit(EXIT_FAILURE);
+ }
+#else
+ fprintf(stderr,
+ _("%s: not compiled with SASL support\n"), prog);
+ exit(EXIT_FAILURE);
+#endif
+
+ } else if (strcasecmp(control, "mech") == 0) {
+#if defined(LDAP_API_FEATURES_VERIFY_CREDENTIALS_INTERACTIVE) && defined(HAVE_CYRUS_SASL)
+ if (vc_sasl_mech) {
+ fprintf(stderr,
+ _("SASL mech previously specified\n"));
+ exit(EXIT_FAILURE);
+ }
+ if (cvalue == NULL) {
+ fprintf(stderr,
+ _("missing mech in SASL option\n"));
+ exit(EXIT_FAILURE);
+ }
+
+ vc_sasl_mech = ber_strdup(cvalue);
+#else
+#endif
+
+ } else if (strcasecmp(control, "realm") == 0) {
+#if defined(LDAP_API_FEATURES_VERIFY_CREDENTIALS_INTERACTIVE) && defined(HAVE_CYRUS_SASL)
+ if (vc_sasl_realm) {
+ fprintf(stderr,
+ _("SASL realm previously specified\n"));
+ exit(EXIT_FAILURE);
+ }
+ if (cvalue == NULL) {
+ fprintf(stderr,
+ _("missing realm in SASL option\n"));
+ exit(EXIT_FAILURE);
+ }
+
+ vc_sasl_realm = ber_strdup(cvalue);
+#else
+ fprintf(stderr,
+ _("%s: not compiled with SASL support\n"), prog);
+ exit(EXIT_FAILURE);
+#endif
+
+ } else if (strcasecmp(control, "authcid") == 0) {
+#if defined(LDAP_API_FEATURES_VERIFY_CREDENTIALS_INTERACTIVE) && defined(HAVE_CYRUS_SASL)
+ if (vc_sasl_authcid) {
+ fprintf(stderr,
+ _("SASL authcid previously specified\n"));
+ exit(EXIT_FAILURE);
+ }
+ if (cvalue == NULL) {
+ fprintf(stderr,
+ _("missing authcid in SASL option\n"));
+ exit(EXIT_FAILURE);
+ }
+
+ vc_sasl_authcid = ber_strdup(cvalue);
+#else
+ fprintf(stderr,
+ _("%s: not compiled with SASL support\n"), prog);
+ exit(EXIT_FAILURE);
+#endif
+
+ } else if (strcasecmp(control, "authzid") == 0) {
+#if defined(LDAP_API_FEATURES_VERIFY_CREDENTIALS_INTERACTIVE) && defined(HAVE_CYRUS_SASL)
+ if (vc_sasl_authzid) {
+ fprintf(stderr,
+ _("SASL authzid previously specified\n"));
+ exit(EXIT_FAILURE);
+ }
+ if (cvalue == NULL) {
+ fprintf(stderr,
+ _("missing authzid in SASL option\n"));
+ exit(EXIT_FAILURE);
+ }
+
+ vc_sasl_authzid = ber_strdup(cvalue);
+#else
+ fprintf(stderr,
+ _("%s: not compiled with SASL support\n"), prog);
+ exit(EXIT_FAILURE);
+#endif
+
+ } else if (strcasecmp(control, "secprops") == 0) {
+#if defined(LDAP_API_FEATURES_VERIFY_CREDENTIALS_INTERACTIVE) && defined(HAVE_CYRUS_SASL)
+ if (vc_sasl_secprops) {
+ fprintf(stderr,
+ _("SASL secprops previously specified\n"));
+ exit(EXIT_FAILURE);
+ }
+ if (cvalue == NULL) {
+ fprintf(stderr,
+ _("missing secprops in SASL option\n"));
+ exit(EXIT_FAILURE);
+ }
+
+ vc_sasl_secprops = ber_strdup(cvalue);
+#else
+ fprintf(stderr,
+ _("%s: not compiled with SASL support\n"), prog);
+ exit(EXIT_FAILURE);