Skip to content

Commit f277744

Browse files
committed
http: delete ntlm_program_helper config directive
Having `gss_program` is enough.
1 parent 77f3f12 commit f277744

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed

doc/http.8gx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,11 @@ Default: \fI10 minutes\fP
109109
\fBgss_program\fP
110110
The helper program to use for authenticating HTTP requests when
111111
Negotiate-SPNEGO headers are presented. The value is rudimentarily tokenized at
112-
whitespaces, so no special characters may be used. If necessary write your own
113-
wrapper. The special value "internal-gss" uses libgssapi directly.
112+
whitespaces, and no special characters may be used. If necessary, write your
113+
own wrapper. The special value "internal-gss" uses libgssapi directly.
114114
.br
115115
Default: \fIinternal\-gss\fP
116116
.br
117-
Example: \fI/usr/lib/squid/negotiate_kerberos_auth \-s GSS_C_NO_NAME\fP
118-
.br
119117
Example: \fI/usr/lib/squid/negotiate_wrapper_auth \-\-ntlm /usr/bin/ntlm_auth
120118
\-\-helper\-protocol=squid\-2.5\-ntlmssp \-\-kerberos
121119
/usr/lib/squid/negotiate_kerberos_auth \-s GSS_C_NO_NAME\fP
@@ -175,7 +173,10 @@ Default: \fIno\fP
175173
\fBhttp_krb_service_principal\fP
176174
Kerberos service principal to use when gss_program=internal-gss. The form is
177175
often something like \fIHTTP\fP\fB/\fP\fIfqdn\fP\fB@\fP\fIREALM\fP, but may
178-
vary.
176+
vary. When using an external GSS authentication helper,
177+
http_krb_service_principal has no effect, and any principal you want to use
178+
needs to be passed via the \fBgss_program\fP directive in some way.
179+
be
179180
.br
180181
Default: (empty)
181182
.TP

exch/http/http_parser.cpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ struct http_parser {
104104

105105
int auth_finalize(http_context &, const char *);
106106
int auth_krb(http_context &ctx, const char *input, size_t isize, std::string &output);
107-
int auth_exthelper(http_context &, const char *proc, const char *input, std::string &output);
107+
int auth_exthelper(http_context &, const std::string &proc, const char *input, std::string &output);
108108
tproc_status auth_spnego(http_context &ctx, const char *past_method);
109109
tproc_status auth_basic(http_context *, const char *);
110110
tproc_status auth(http_context &ctx);
@@ -138,7 +138,7 @@ struct http_parser {
138138
std::unique_ptr<std::mutex[]> g_ssl_mutex_buf;
139139
std::mutex g_vconnection_lock; /* protects g_vconnection_hash */
140140
std::unordered_map<std::string, VIRTUAL_CONNECTION> g_vconnection_hash;
141-
std::string gss_helper_program, ntlm_helper_program;
141+
std::string gss_helper_program;
142142
};
143143

144144
class VCONN_REF {
@@ -230,7 +230,6 @@ http_parser::http_parser(size_t context_num, time_duration timeout,
230230
g_certificate_passwd.clear();
231231
g_private_key_path = key_path;
232232
gss_helper_program = g_config_file->get_value("gss_program");
233-
ntlm_helper_program = g_config_file->get_value("ntlmssp_program");
234233
}
235234

236235
#ifdef OLD_SSL
@@ -901,16 +900,14 @@ int http_parser::auth_finalize(http_context &ctx, const char *user)
901900
return 1;
902901
}
903902

904-
int http_parser::auth_exthelper(http_context &ctx, const char *prog,
903+
int http_parser::auth_exthelper(http_context &ctx, const std::string_view &prog,
905904
const char *encinput, std::string &gss_output)
906905
{
907906
auto encsize = strlen(encinput);
908907
auto &pinfo = ctx.ntlm_proc;
909908
gss_output.clear();
910909

911910
if (pinfo.p_pid <= 0) {
912-
if (prog == nullptr || *prog == '\0')
913-
prog = "/usr/bin/ntlm_auth --helper-protocol=squid-2.5-ntlmssp";
914911
auto args = HX_split(prog, " ", nullptr, 0);
915912
auto cl_0 = HX::make_scope_exit([=]() { HX_zvecfree(args); });
916913
pinfo.p_flags = HXPROC_STDIN | HXPROC_STDOUT | HXPROC_STDERR;
@@ -1121,11 +1118,8 @@ int http_parser::auth_krb(http_context &ctx, const char *input, size_t isize,
11211118

11221119
tproc_status http_parser::auth_spnego(http_context &ctx, const char *past_method)
11231120
{
1124-
bool rq_ntlmssp = strncmp(past_method, "TlRMTVNT", 8) == 0;
1125-
const auto &the_helper = rq_ntlmssp ? ntlm_helper_program : gss_helper_program;
1126-
11271121
if (the_helper != "internal-gss") {
1128-
auto ret = auth_exthelper(ctx, the_helper.c_str(), past_method, ctx.last_gss_output);
1122+
auto ret = auth_exthelper(ctx, gss_helper_program, past_method, ctx.last_gss_output);
11291123
ctx.auth_status = ret <= 0 ? http_status::unauthorized : http_status::ok;
11301124
ctx.auth_method = auth_method::negotiate_b64;
11311125
if (ret <= 0 && ret != -99)

0 commit comments

Comments
 (0)