diff options
author | Andrew Bartlett <abartlet@samba.org> | 2003-11-22 23:38:41 +0000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2003-11-22 23:38:41 +0000 |
commit | 9ecf9408d98639186b283f1acf0fac46417547d0 (patch) | |
tree | 8f9d6596e25e570fd3689965b4b2fd8ef8bbf0a9 /source/libsmb | |
parent | f3bbc87b0dac63426cda6fac7a295d3aad810ecc (diff) | |
download | samba-9ecf9408d98639186b283f1acf0fac46417547d0.tar.gz samba-9ecf9408d98639186b283f1acf0fac46417547d0.tar.xz samba-9ecf9408d98639186b283f1acf0fac46417547d0.zip |
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.
(server-side support to follow shortly)
Andrew Bartlett
Diffstat (limited to 'source/libsmb')
-rw-r--r-- | source/libsmb/smbdes.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/source/libsmb/smbdes.c b/source/libsmb/smbdes.c index cde77f94a36..ae946b4a660 100644 --- a/source/libsmb/smbdes.c +++ b/source/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. */ |