summaryrefslogtreecommitdiff
path: root/source3/libsmb/clifsinfo.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2008-01-05 00:23:35 -0800
committerJeremy Allison <jra@samba.org>2008-01-05 00:23:35 -0800
commit9baa97a46ebb92a5968ceba0fb5c2de51e6fa8f0 (patch)
tree5a6af8ca801ef15316daf9abdd7b6dc965f4a099 /source3/libsmb/clifsinfo.c
parent4881ed00ca1d0ab156863c6821db670c70f5d0ea (diff)
downloadsamba-9baa97a46ebb92a5968ceba0fb5c2de51e6fa8f0.tar.gz
samba-9baa97a46ebb92a5968ceba0fb5c2de51e6fa8f0.tar.bz2
samba-9baa97a46ebb92a5968ceba0fb5c2de51e6fa8f0.zip
Add general '-e' option to enable smb encryption
on tools. Jeremy. (This used to be commit 757653966fc1384159bd2d57c5670cd8af0cae96)
Diffstat (limited to 'source3/libsmb/clifsinfo.c')
-rw-r--r--source3/libsmb/clifsinfo.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/source3/libsmb/clifsinfo.c b/source3/libsmb/clifsinfo.c
index 107613c618..fb923378ab 100644
--- a/source3/libsmb/clifsinfo.c
+++ b/source3/libsmb/clifsinfo.c
@@ -634,3 +634,36 @@ NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli)
return NT_STATUS_NOT_SUPPORTED;
}
#endif
+
+/********************************************************************
+ Ensure a connection is encrypted.
+********************************************************************/
+
+NTSTATUS cli_force_encryption(struct cli_state *c,
+ const char *username,
+ const char *password,
+ const char *domain)
+{
+ uint16 major, minor;
+ uint32 caplow, caphigh;
+
+ if (!SERVER_HAS_UNIX_CIFS(c)) {
+ return NT_STATUS_NOT_SUPPORTED;
+ }
+
+ if (!cli_unix_extensions_version(c, &major, &minor, &caplow, &caphigh)) {
+ return NT_STATUS_UNKNOWN_REVISION;
+ }
+
+ if (!(caplow & CIFS_UNIX_TRANSPORT_ENCRYPTION_CAP)) {
+ return NT_STATUS_UNSUPPORTED_COMPRESSION;
+ }
+
+ if (c->use_kerberos) {
+ return cli_gss_smb_encryption_start(c);
+ }
+ return cli_raw_ntlm_smb_encryption_start(c,
+ username,
+ password,
+ domain);
+}