s3-libsmbclient: Add OptionUseNTHash
authorVolker Lendecke <vl@samba.org>
Mon, 11 Jun 2012 11:29:10 +0000 (13:29 +0200)
committerStefan Metzmacher <metze@samba.org>
Tue, 12 Jun 2012 08:48:15 +0000 (10:48 +0200)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
source3/include/libsmb_internal.h
source3/include/libsmbclient.h
source3/libsmb/libsmb_server.c
source3/libsmb/libsmb_setget.c

index 92694f35c8daf77f23acd97e9812b6fa894f2b0b..aba159ada248beec687e04a1d2f9eca4f2e41281 100644 (file)
@@ -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
index ccf80da72d06d120591eb3353880bee6233c3ea1..61ff6a3b3bdc627ba89cb546eb54fd93cceea39c 100644 (file)
@@ -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);
+
 
 
 /*************************************
index 7ec3eb52108b276145387a81604b52b1543556c1..99aa74c67b9a525eaecac5f5e7b5d87a26d5f417 100644 (file)
@@ -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$
index 0a0234675251da4dce58143512e5c934cc41c374..60bbc8bc5efdb36888be3cae595f1a73935cc636 100644 (file)
@@ -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)