@@ -568,25 +568,23 @@ static int mag_auth(request_rec *req)
568568 ret = OK ;
569569
570570done :
571- if (ret == HTTP_UNAUTHORIZED ) {
572- if (output .length != 0 ) {
573- replen = apr_base64_encode_len (output .length ) + 1 ;
574- reply = apr_pcalloc (req -> pool , 10 + replen );
575- if (reply ) {
576- memcpy (reply , "Negotiate " , 10 );
577- apr_base64_encode (& reply [10 ], output .value , output .length );
578- apr_table_add (req -> err_headers_out ,
579- "WWW-Authenticate" , reply );
580- }
581- } else {
571+ if ((!is_basic ) && (output .length != 0 )) {
572+ replen = apr_base64_encode_len (output .length ) + 1 ;
573+ reply = apr_pcalloc (req -> pool , 10 + replen );
574+ if (reply ) {
575+ memcpy (reply , "Negotiate " , 10 );
576+ apr_base64_encode (& reply [10 ], output .value , output .length );
582577 apr_table_add (req -> err_headers_out ,
583- "WWW-Authenticate" , "Negotiate" );
584- if (cfg -> use_basic_auth ) {
585- apr_table_add (req -> err_headers_out ,
586- "WWW-Authenticate" ,
587- apr_psprintf (req -> pool , "Basic realm=\"%s\"" ,
588- ap_auth_name (req )));
589- }
578+ "WWW-Authenticate" , reply );
579+ }
580+ } else if (ret == HTTP_UNAUTHORIZED ) {
581+ apr_table_add (req -> err_headers_out ,
582+ "WWW-Authenticate" , "Negotiate" );
583+ if (cfg -> use_basic_auth ) {
584+ apr_table_add (req -> err_headers_out ,
585+ "WWW-Authenticate" ,
586+ apr_psprintf (req -> pool , "Basic realm=\"%s\"" ,
587+ ap_auth_name (req )));
590588 }
591589 }
592590#ifdef HAVE_GSS_KRB5_CCACHE_NAME
0 commit comments