Skip to content

Commit

Permalink
Merge pull request #15914 from iterate-ch/feature/GH-15872-environment
Browse files Browse the repository at this point in the history
Do not set NTLM domain from environment by default
  • Loading branch information
dkocher committed May 7, 2024
2 parents e581666 + f92d80f commit be6dc08
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,6 @@ protected override void setDefaults()
// Enable Integrated Windows Authentication
this.setDefault("connection.proxy.windows.authentication.enable", true.ToString());

this.setDefault("webdav.ntlm.environment", true.ToString());
if (getBoolean("webdav.ntlm.environment"))
{
// NTLM Windows Domain
Expand Down
2 changes: 2 additions & 0 deletions defaults/src/main/resources/default.properties
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,8 @@ dropbox.delete.poll.interval.ms=500
dropbox.limit.requests.enable=false
dropbox.limit.requests.second=100

# Read NTLM domain from environment
webdav.ntlm.environment=false
# NTLM Windows Domain
webdav.ntlm.domain=
webdav.ntlm.workstation=
Expand Down
32 changes: 13 additions & 19 deletions webdav/src/main/java/ch/cyberduck/core/dav/DAVSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
import java.net.URL;
import java.nio.charset.Charset;
import java.text.MessageFormat;
import java.util.Arrays;

import com.github.sardine.impl.SardineException;
import com.github.sardine.impl.handler.ValidatingResponseHandler;
Expand Down Expand Up @@ -134,25 +135,18 @@ public void login(final Proxy proxy, final LoginCallback prompt, final CancelCal
username = credentials.getUsername();
domain = new HostPreferences(host).getProperty("webdav.ntlm.domain");
}
client.setCredentials(
new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT, AuthScope.ANY_REALM, AuthSchemes.NTLM),
new NTCredentials(username, credentials.getPassword(),
preferences.getProperty("webdav.ntlm.workstation"), domain)
);
client.setCredentials(
new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT, AuthScope.ANY_REALM, AuthSchemes.SPNEGO),
new NTCredentials(username, credentials.getPassword(),
preferences.getProperty("webdav.ntlm.workstation"), domain)
);
client.setCredentials(
new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT, AuthScope.ANY_REALM, AuthSchemes.BASIC),
new UsernamePasswordCredentials(username, credentials.getPassword()));
client.setCredentials(
new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT, AuthScope.ANY_REALM, AuthSchemes.DIGEST),
new UsernamePasswordCredentials(username, credentials.getPassword()));
client.setCredentials(
new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT, AuthScope.ANY_REALM, AuthSchemes.KERBEROS),
new UsernamePasswordCredentials(username, credentials.getPassword()));
for(String scheme : Arrays.asList(AuthSchemes.NTLM, AuthSchemes.SPNEGO)) {
client.setCredentials(
new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT, AuthScope.ANY_REALM, scheme),
new NTCredentials(username, credentials.getPassword(),
preferences.getProperty("webdav.ntlm.workstation"), domain)
);
}
for(String scheme : Arrays.asList(AuthSchemes.BASIC, AuthSchemes.DIGEST, AuthSchemes.KERBEROS)) {
client.setCredentials(
new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT, AuthScope.ANY_REALM, scheme),
new UsernamePasswordCredentials(username, credentials.getPassword()));
}
if(preferences.getBoolean("webdav.basic.preemptive")) {
client.enablePreemptiveAuthentication(host.getHostname(),
host.getPort(),
Expand Down

0 comments on commit be6dc08

Please sign in to comment.