@@ -255,26 +255,14 @@ static int mag_auth(request_rec *req)
255255 input .value = apr_pcalloc (req -> pool , input .length );
256256 if (!input .value ) goto done ;
257257 input .length = apr_base64_decode (input .value , auth_header_value );
258- } else if (strcasecmp (auth_header_type , "Basic" ) == 0 ) {
258+ } else if ((strcasecmp (auth_header_type , "Basic" ) == 0 ) &&
259+ (cfg -> use_basic_auth == true)) {
259260 auth_type = "Basic" ;
260261 is_basic = true;
261262
262263 gss_buffer_desc ba_user ;
263264 gss_buffer_desc ba_pwd ;
264265
265- switch (cfg -> basic_auth ) {
266- case BA_ON :
267- /* handle directly */
268- break ;
269- case BA_FORWARD :
270- /* decline to handle ourselves, let other modules do it */
271- ret = DECLINED ;
272- goto done ;
273- case BA_OFF :
274- goto done ;
275- default :
276- goto done ;
277- }
278266 ba_pwd .value = ap_pbase64decode (req -> pool , auth_header );
279267 if (!ba_pwd .value ) goto done ;
280268 ba_user .value = ap_getword_nulls_nc (req -> pool ,
@@ -483,7 +471,7 @@ static int mag_auth(request_rec *req)
483471 } else {
484472 apr_table_add (req -> err_headers_out ,
485473 "WWW-Authenticate" , "Negotiate" );
486- if (cfg -> basic_auth != BA_OFF ) {
474+ if (cfg -> use_basic_auth ) {
487475 apr_table_add (req -> err_headers_out ,
488476 "WWW-Authenticate" ,
489477 apr_psprintf (req -> pool , "Basic realm=\"%s\"" ,
@@ -674,19 +662,11 @@ static const char *mag_deleg_ccache_dir(cmd_parms *parms, void *mconfig,
674662 return NULL ;
675663}
676664
677- static const char * mag_use_basic_auth (cmd_parms * parms , void * mconfig ,
678- const char * value )
665+ static const char * mag_use_basic_auth (cmd_parms * parms , void * mconfig , int on )
679666{
680667 struct mag_config * cfg = (struct mag_config * )mconfig ;
681668
682- if (strcasecmp (value , "on" ) == 0 ) {
683- cfg -> basic_auth = BA_ON ;
684- } else if (strcasecmp (value , "forward" ) == 0 ) {
685- cfg -> basic_auth = BA_FORWARD ;
686- } else {
687- cfg -> basic_auth = BA_OFF ;
688- }
689-
669+ cfg -> use_basic_auth = on ? true : false;
690670 return NULL ;
691671}
692672
@@ -712,7 +692,7 @@ static const command_rec mag_commands[] = {
712692 OR_AUTHCFG , "Directory to store delegated credentials" ),
713693#endif
714694#ifdef HAVE_GSS_ACQUIRE_CRED_WITH_PASSWORD
715- AP_INIT_TAKE1 ("GssapiBasicAuth" , mag_use_basic_auth , NULL , OR_AUTHCFG ,
695+ AP_INIT_FLAG ("GssapiBasicAuth" , mag_use_basic_auth , NULL , OR_AUTHCFG ,
716696 "Allows use of Basic Auth for authentication" ),
717697#endif
718698 { NULL }
0 commit comments