Skip to content

Commit f0bbf37

Browse files
pbert519Philipp Engelbertpbert
authored
Enable NTLM support (#428)
* Enable NTLM support * fix formating and mssing curl_des.c * use feature flag for ntlm Co-authored-by: Philipp Engelbert <pengelbert@slashwhy.de> Co-authored-by: pbert <p.engelbert@posteo.net>
1 parent 5b9b5ff commit f0bbf37

File tree

5 files changed

+18
-2
lines changed

5 files changed

+18
-2
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ protocol-ftp = ["curl-sys/protocol-ftp"]
5151
zlib-ng-compat = ["curl-sys/zlib-ng-compat", "static-curl"]
5252
upkeep_7_62_0 = ["curl-sys/upkeep_7_62_0"]
5353
poll_7_68_0 = ["curl-sys/poll_7_68_0"]
54+
ntlm = ["curl-sys/ntlm"]
5455

5556
[[test]]
5657
name = "atexit"

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ with various Cargo features:
130130
- `spnego`: Enable SPNEGO support. Disabled by default.
131131
- `upkeep_7_62_0`: Enable curl_easy_upkeep() support, introduced in curl 7.62.0. Disabled by default.
132132
- `poll_7_68_0`: Enable curl_multi_poll()/curl_multi_wakeup() support, requires curl 7.68.0 or later. Disabled by default.
133+
- `ntlm`: Enable NTLM support in curl. Disabled by default.
133134

134135
## Version Support
135136

ci/run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ cargo test --target $TARGET --no-run
66
# First test with no extra protocols enabled.
77
cargo test --target $TARGET --no-run --features static-curl
88
# Then with all extra protocols enabled.
9-
cargo test --target $TARGET --no-run --features static-curl,protocol-ftp
9+
cargo test --target $TARGET --no-run --features static-curl,protocol-ftp,ntlm
1010
if [ -z "$NO_RUN" ]; then
1111
cargo test --target $TARGET
1212
cargo test --target $TARGET --features static-curl

curl-sys/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,4 @@ protocol-ftp = []
5555
zlib-ng-compat = ["libz-sys/zlib-ng", "static-curl"]
5656
upkeep_7_62_0 = []
5757
poll_7_68_0 = []
58+
ntlm = []

curl-sys/build.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ fn main() {
116116
.define("CURL_DISABLE_IMAP", None)
117117
.define("CURL_DISABLE_LDAP", None)
118118
.define("CURL_DISABLE_LDAPS", None)
119-
.define("CURL_DISABLE_NTLM", None)
120119
.define("CURL_DISABLE_POP3", None)
121120
.define("CURL_DISABLE_RTSP", None)
122121
.define("CURL_DISABLE_SMB", None)
@@ -215,6 +214,20 @@ fn main() {
215214
.define("HAVE_GETSOCKNAME", None)
216215
.warnings(false);
217216

217+
if cfg!(feature = "ntlm") {
218+
cfg.file("curl/lib/curl_des.c")
219+
.file("curl/lib/curl_endian.c")
220+
.file("curl/lib/curl_gethostname.c")
221+
.file("curl/lib/curl_ntlm_core.c")
222+
.file("curl/lib/curl_ntlm_wb.c")
223+
.file("curl/lib/http_ntlm.c")
224+
.file("curl/lib/md4.c")
225+
.file("curl/lib/vauth/ntlm.c")
226+
.file("curl/lib/vauth/ntlm_sspi.c");
227+
} else {
228+
cfg.define("CURL_DISABLE_NTLM", None);
229+
}
230+
218231
if cfg!(feature = "protocol-ftp") {
219232
cfg.file("curl/lib/curl_fnmatch.c")
220233
.file("curl/lib/ftp.c")

0 commit comments

Comments
 (0)