- version = LDAP_VERSION3;
- break;
- default:
- fprintf( stderr, "%s: protocol version should be 2 or 3\n",
- prog );
- usage( prog );
- return( EXIT_FAILURE );
- } break;
- case 'Q':
-#ifdef HAVE_CYRUS_SASL
- if( version == LDAP_VERSION2 ) {
- fprintf( stderr, "%s: -Q incompatible with version %d\n",
- prog, version );
- return EXIT_FAILURE;
- }
- if( authmethod != -1 && authmethod != LDAP_AUTH_SASL ) {
- fprintf( stderr, "%s: incompatible previous "
- "authentication choice\n",
- prog );
- return EXIT_FAILURE;
- }
- authmethod = LDAP_AUTH_SASL;
- version = LDAP_VERSION3;
- sasl_flags = LDAP_SASL_QUIET;
- break;
-#else
- fprintf( stderr, "%s: not compiled with SASL support\n",
- prog );
- return( EXIT_FAILURE );
-#endif
- case 'R':
-#ifdef HAVE_CYRUS_SASL
- if( sasl_realm != NULL ) {
- fprintf( stderr, "%s: -R previously specified\n" );
- return EXIT_FAILURE;
- }
- if( version == LDAP_VERSION2 ) {
- fprintf( stderr, "%s: -R incompatible with version %d\n",
- prog, version );
- return EXIT_FAILURE;
- }
- if( authmethod != -1 && authmethod != LDAP_AUTH_SASL ) {
- fprintf( stderr, "%s: incompatible previous "
- "authentication choice\n",
- prog );
- return EXIT_FAILURE;
- }
- authmethod = LDAP_AUTH_SASL;
- version = LDAP_VERSION3;
- sasl_realm = strdup( optarg );
-#else
- fprintf( stderr, "%s: not compiled with SASL support\n",
- prog );
- return( EXIT_FAILURE );
-#endif
- break;
- case 'U':
-#ifdef HAVE_CYRUS_SASL
- if( sasl_authc_id != NULL ) {
- fprintf( stderr, "%s: -U previously specified\n" );
- return EXIT_FAILURE;
- }
- if( version == LDAP_VERSION2 ) {
- fprintf( stderr, "%s: -U incompatible with version %d\n",
- prog, version );
- return EXIT_FAILURE;
- }
- if( authmethod != -1 && authmethod != LDAP_AUTH_SASL ) {
- fprintf( stderr, "%s: incompatible previous "
- "authentication choice\n",
- prog );
- return EXIT_FAILURE;
- }
- authmethod = LDAP_AUTH_SASL;
- version = LDAP_VERSION3;
- sasl_authc_id = strdup( optarg );
-#else
- fprintf( stderr, "%s: not compiled with SASL support\n",
- prog );
- return( EXIT_FAILURE );