summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2003-11-23 00:22:17 +0000
committerAndrew Bartlett <abartlet@samba.org>2003-11-23 00:22:17 +0000
commit13a6b9833e7fdd5e4624ccf844e0f9932d9597c1 (patch)
treeeb0a49f275dd09d09c13d6f08e2aa12517f71ce2 /source3/libsmb
parent354c0fbc91c49f71c4760f88c0fb9e7fba11413c (diff)
downloadsamba-13a6b9833e7fdd5e4624ccf844e0f9932d9597c1.tar.gz
samba-13a6b9833e7fdd5e4624ccf844e0f9932d9597c1.tar.bz2
samba-13a6b9833e7fdd5e4624ccf844e0f9932d9597c1.zip
Merge from 3.0:
Add support for variable-length session keys in our client code. This means that we now support 'net rpc join' with KRB5 (des based) logins. Now, you need to hack 'net' to do that, but the principal is important... When we add kerberos to 'net rpc', it should be possible to still do user management and the like over RPC. - Add server-side support for variable-length session keys (as used by DES based krb5 logins). Andrew Bartlett (This used to be commit 1287cf5f921327c9ea758de46220c4e2dedc485c)
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/smbdes.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/source3/libsmb/smbdes.c b/source3/libsmb/smbdes.c
index cde77f94a3..ae946b4a66 100644
--- a/source3/libsmb/smbdes.c
+++ b/source3/libsmb/smbdes.c
@@ -397,6 +397,46 @@ void SamOEMhash( unsigned char *data, const unsigned char *key, int val)
}
}
+void SamOEMhashBlob( unsigned char *data, int len, DATA_BLOB *key)
+{
+ unsigned char s_box[256];
+ unsigned char index_i = 0;
+ unsigned char index_j = 0;
+ unsigned char j = 0;
+ int ind;
+
+ for (ind = 0; ind < 256; ind++)
+ {
+ s_box[ind] = (unsigned char)ind;
+ }
+
+ for( ind = 0; ind < 256; ind++)
+ {
+ unsigned char tc;
+
+ j += (s_box[ind] + key->data[ind%key->length]);
+
+ tc = s_box[ind];
+ s_box[ind] = s_box[j];
+ s_box[j] = tc;
+ }
+ for( ind = 0; ind < len; ind++)
+ {
+ unsigned char tc;
+ unsigned char t;
+
+ index_i++;
+ index_j += s_box[index_i];
+
+ tc = s_box[index_i];
+ s_box[index_i] = s_box[index_j];
+ s_box[index_j] = tc;
+
+ t = s_box[index_i] + s_box[index_j];
+ data[ind] = data[ind] ^ s_box[t];
+ }
+}
+
/* Decode a sam password hash into a password. The password hash is the
same method used to store passwords in the NT registry. The DES key
used is based on the RID of the user. */