diff options
author | Volker Lendecke <vl@samba.org> | 2012-06-11 13:29:10 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2012-06-12 10:48:15 +0200 |
commit | 6c13a46732f61b596273e2bd7ff3c78a4b953195 (patch) | |
tree | 3518af45b568a286cff6e242ef5732ddb62043c6 | |
parent | 4fb283e70e26c3328f1ab86276a5728601cc3432 (diff) | |
download | samba-6c13a46732f61b596273e2bd7ff3c78a4b953195.tar.gz samba-6c13a46732f61b596273e2bd7ff3c78a4b953195.tar.bz2 samba-6c13a46732f61b596273e2bd7ff3c78a4b953195.zip |
s3-libsmbclient: Add OptionUseNTHash
Signed-off-by: Stefan Metzmacher <metze@samba.org>
-rw-r--r-- | source3/include/libsmb_internal.h | 4 | ||||
-rw-r--r-- | source3/include/libsmbclient.h | 8 | ||||
-rw-r--r-- | source3/libsmb/libsmb_server.c | 4 | ||||
-rw-r--r-- | source3/libsmb/libsmb_setget.c | 18 |
4 files changed, 34 insertions, 0 deletions
diff --git a/source3/include/libsmb_internal.h b/source3/include/libsmb_internal.h index 92694f35c8..aba159ada2 100644 --- a/source3/include/libsmb_internal.h +++ b/source3/include/libsmb_internal.h @@ -48,6 +48,10 @@ typedef struct DOS_ATTR_DESC { SMB_INO_T inode; } DOS_ATTR_DESC; +/* + * Extension of libsmbclient.h's #defines + */ +#define SMB_CTX_FLAG_USE_NT_HASH (1 << 4) /* * Internal flags for extended attributes diff --git a/source3/include/libsmbclient.h b/source3/include/libsmbclient.h index ccf80da72d..61ff6a3b3b 100644 --- a/source3/include/libsmbclient.h +++ b/source3/include/libsmbclient.h @@ -743,6 +743,14 @@ smbc_getOptionUseCCache(SMBCCTX *c); void smbc_setOptionUseCCache(SMBCCTX *c, smbc_bool b); +/** Get indication that the password supplied is the NT hash */ +smbc_bool +smbc_getOptionUseNTHash(SMBCCTX *c); + +/** Set indication that the password supplied is the NT hash */ +void +smbc_setOptionUseNTHash(SMBCCTX *c, smbc_bool b); + /************************************* diff --git a/source3/libsmb/libsmb_server.c b/source3/libsmb/libsmb_server.c index 7ec3eb5210..99aa74c67b 100644 --- a/source3/libsmb/libsmb_server.c +++ b/source3/libsmb/libsmb_server.c @@ -417,6 +417,10 @@ SMBC_server_internal(TALLOC_CTX *ctx, flags |= CLI_FULL_CONNECTION_USE_CCACHE; } + if (smbc_getOptionUseNTHash(context)) { + flags |= CLI_FULL_CONNECTION_USE_NT_HASH; + } + if (share == NULL || *share == '\0' || is_ipc) { /* * Try 139 first for IPC$ diff --git a/source3/libsmb/libsmb_setget.c b/source3/libsmb/libsmb_setget.c index 0a02346752..60bbc8bc5e 100644 --- a/source3/libsmb/libsmb_setget.c +++ b/source3/libsmb/libsmb_setget.c @@ -457,6 +457,24 @@ smbc_setOptionUseCCache(SMBCCTX *c, smbc_bool b) } } +/** Get whether to enable use of the winbind ccache */ +smbc_bool +smbc_getOptionUseNTHash(SMBCCTX *c) +{ + return (c->flags & SMB_CTX_FLAG_USE_NT_HASH) != 0; +} + +/** Set indication that the password supplied is the NT hash */ +void +smbc_setOptionUseNTHash(SMBCCTX *c, smbc_bool b) +{ + if (b) { + c->flags |= SMB_CTX_FLAG_USE_NT_HASH; + } else { + c->flags &= ~SMB_CTX_FLAG_USE_NT_HASH; + } +} + /** Get the function for obtaining authentication data */ smbc_get_auth_data_fn smbc_getFunctionAuthData(SMBCCTX *c) |