@@ -189,11 +189,11 @@ static bool mag_acquire_creds(request_rec *req,
189189#ifdef HAVE_CRED_STORE
190190 gss_const_key_value_set_t store = cfg -> cred_store ;
191191
192- maj = gss_acquire_cred_from (& min , GSS_C_NO_NAME , GSS_C_INDEFINITE ,
192+ maj = gss_acquire_cred_from (& min , cfg -> acceptor_name , GSS_C_INDEFINITE ,
193193 desired_mechs , cred_usage , store , creds ,
194194 actual_mechs , NULL );
195195#else
196- maj = gss_acquire_cred (& min , GSS_C_NO_NAME , GSS_C_INDEFINITE ,
196+ maj = gss_acquire_cred (& min , cfg -> acceptor_name , GSS_C_INDEFINITE ,
197197 desired_mechs , cred_usage , creds ,
198198 actual_mechs , NULL );
199199#endif
@@ -1706,6 +1706,23 @@ static const char *mag_basic_auth_mechs(cmd_parms *parms, void *mconfig,
17061706}
17071707#endif
17081708
1709+ static const char * mag_acceptor_name (cmd_parms * parms , void * mconfig ,
1710+ const char * w )
1711+ {
1712+ struct mag_config * cfg = (struct mag_config * )mconfig ;
1713+ gss_buffer_desc bufnam = { strlen (w ), (void * )w };
1714+ uint32_t maj , min ;
1715+
1716+ maj = gss_import_name (& min , & bufnam , GSS_C_NT_HOSTBASED_SERVICE ,
1717+ & cfg -> acceptor_name );
1718+ if (GSS_ERROR (maj )) {
1719+ ap_log_error (APLOG_MARK , APLOG_WARNING , 0 , parms -> server ,
1720+ "gss_import_name([%s]) failed" , w );
1721+ }
1722+
1723+ return NULL ;
1724+ }
1725+
17091726static void * mag_create_server_config (apr_pool_t * p , server_rec * s )
17101727{
17111728 struct mag_server_config * scfg ;
@@ -1780,6 +1797,8 @@ static const command_rec mag_commands[] = {
17801797 AP_INIT_FLAG ("GssapiPublishErrors" , ap_set_flag_slot ,
17811798 (void * )APR_OFFSETOF (struct mag_config , enverrs ), OR_AUTHCFG ,
17821799 "Publish GSSAPI Errors in Envionment Variables" ),
1800+ AP_INIT_RAW_ARGS ("GssapiAcceptorName" , mag_acceptor_name , NULL , OR_AUTHCFG ,
1801+ "Name of the acceptor credentials." ),
17831802 { NULL }
17841803};
17851804
0 commit comments