+
+ /* Always set the GSS name in an env var */
+ maj = gss_display_name(&min, client, &name, NULL);
+ if (GSS_ERROR(maj)) {
+ ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, req,
+ mag_error(req, "gss_accept_sec_context() failed",
+ maj, min));
+ goto done;
+ }
+ clientname = apr_pstrndup(req->pool, name.value, name.length);
+ apr_table_set(req->subprocess_env, "GSS_NAME", clientname);
+
+ if (cfg->map_to_local) {
+ maj = gss_localname(&min, client, mech_type, &lname);
+ if (maj != GSS_S_COMPLETE) {
+ ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, req,
+ mag_error(req, "gss_localname() failed", maj, min));
+ goto done;
+ }
+ req->user = apr_pstrndup(req->pool, lname.value, lname.length);
+ } else {
+ req->user = clientname;
+ }
+
+ if (mc) {
+ mc->user_name = apr_pstrdup(req->connection->pool, req->user);
+ mc->gss_name = apr_pstrdup(req->connection->pool, clientname);
+ mc->established = true;
+ }
+