Skip to content

Commit 8e0da73

Browse files
authored
Merge pull request #233 from codido/spnego
Add support for enabling SPNEGO when building curl
2 parents a6393c9 + d3289b0 commit 8e0da73

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ with various Cargo features:
136136
- `http2`: Enable HTTP/2 support via libnghttp2. Disabled by default.
137137
- `static-curl`: Use a bundled libcurl version and statically link to it. Disabled by default.
138138
- `static-ssl`: Use a bundled OpenSSL version and statically link to it. Only applies on platforms that use OpenSSL. Disabled by default.
139+
- `spengo`: Enable SPENGO support. Disabled by default.
139140

140141
## Version Support
141142

curl-sys/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,4 @@ ssl = ["openssl-sys"]
4343
http2 = ["libnghttp2-sys"]
4444
static-curl = []
4545
static-ssl = ["openssl-sys/vendored"]
46+
spnego = []

curl-sys/build.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,12 @@ fn main() {
179179
cfg.include(path);
180180
}
181181

182+
if cfg!(feature = "spnego") {
183+
cfg.define("USE_SPNEGO", None)
184+
.file("curl/lib/http_negotiate.c")
185+
.file("curl/lib/vauth/vauth.c");
186+
}
187+
182188
if windows {
183189
cfg.define("USE_THREADS_WIN32", None)
184190
.define("HAVE_IOCTLSOCKET_FIONBIO", None)
@@ -194,6 +200,10 @@ fn main() {
194200
.file("curl/lib/vtls/schannel.c")
195201
.file("curl/lib/vtls/schannel_verify.c");
196202
}
203+
204+
if cfg!(feature = "spnego") {
205+
cfg.file("curl/lib/vauth/spnego_sspi.c");
206+
}
197207
} else {
198208
cfg.define("RECV_TYPE_ARG1", "int")
199209
.define("HAVE_PTHREAD_H", None)
@@ -243,6 +253,17 @@ fn main() {
243253
}
244254
}
245255

256+
if cfg!(feature = "spnego") {
257+
cfg.define("HAVE_GSSAPI", None)
258+
.file("curl/lib/curl_gssapi.c")
259+
.file("curl/lib/socks_gssapi.c")
260+
.file("curl/lib/vauth/spnego_gssapi.c");
261+
262+
// Link against the MIT gssapi library. It might be desirable to add support for
263+
// choosing between MIT and Heimdal libraries in the future.
264+
println!("cargo:rustc-link-lib=gssapi_krb5");
265+
}
266+
246267
let width = env::var("CARGO_CFG_TARGET_POINTER_WIDTH")
247268
.unwrap()
248269
.parse::<usize>()

0 commit comments

Comments
 (0)