- for( p = optarg; *p != '\0'; p++ ) {
- *p = '\0';
- }
- }
- passwd.bv_len = strlen( passwd.bv_val );
- break;
- case 'W':
- want_bindpw++;
- break;
- case 'Y':
-#ifdef HAVE_CYRUS_SASL
- if( sasl_mech != NULL ) {
- fprintf( stderr, "%s: -Y previously specified\n", prog );
- return EXIT_FAILURE;
- }
- if( version == LDAP_VERSION2 ) {
- fprintf( stderr, "%s: -Y incompatible with version %d\n",
- prog, version );
- return EXIT_FAILURE;
- }
- if( authmethod != -1 && authmethod != LDAP_AUTH_SASL ) {
- fprintf( stderr, "%s: incompatible with authentication choice\n", prog );
- return EXIT_FAILURE;
- }
- authmethod = LDAP_AUTH_SASL;
- version = LDAP_VERSION3;
- sasl_mech = strdup( optarg );
-#else
- fprintf( stderr, "%s: not compiled with SASL support\n",
- prog );
- return( EXIT_FAILURE );
-#endif
- break;
- case 'x':
- if( authmethod != -1 && authmethod != LDAP_AUTH_SIMPLE ) {
- fprintf( stderr, "%s: incompatible with previous "
- "authentication choice\n", prog );
- return EXIT_FAILURE;
- }
- authmethod = LDAP_AUTH_SIMPLE;
- break;
- case 'X':
-#ifdef HAVE_CYRUS_SASL
- if( sasl_authz_id != NULL ) {
- fprintf( stderr, "%s: -X previously specified\n", prog );
- return EXIT_FAILURE;
- }
- if( version == LDAP_VERSION2 ) {
- fprintf( stderr, "%s: -X incompatible with LDAPv%d\n",
- prog, version );
- return EXIT_FAILURE;
- }
- if( authmethod != -1 && authmethod != LDAP_AUTH_SASL ) {
- fprintf( stderr, "%s: -X incompatible with "
- "authentication choice\n", prog );
- return EXIT_FAILURE;
- }
- authmethod = LDAP_AUTH_SASL;
- version = LDAP_VERSION3;
- sasl_authz_id = strdup( optarg );
-#else
- fprintf( stderr, "%s: not compiled with SASL support\n",
- prog );
- return( EXIT_FAILURE );
-#endif
- break;
- case 'Z':
-#ifdef HAVE_TLS
- if( version == LDAP_VERSION2 ) {
- fprintf( stderr, "%s: -Z incompatible with version %d\n",
- prog, version );
- return EXIT_FAILURE;
- }
- version = LDAP_VERSION3;
- use_tls++;
-#else
- fprintf( stderr, "%s: not compiled with TLS support\n",
- prog );
- return( EXIT_FAILURE );
-#endif
- break;