diff options
author | Andrew Tridgell <tridge@samba.org> | 1997-10-20 01:00:08 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 1997-10-20 01:00:08 +0000 |
commit | 9dfab27da3634539e99eb48c85dd5a64212e7005 (patch) | |
tree | 30206afbc89d3c0d896603af27962aee21a9fa8d /source | |
parent | 38c07fa932488542dbb687f8e0eca192d5f38a8e (diff) | |
download | samba-9dfab27da3634539e99eb48c85dd5a64212e7005.tar.gz samba-9dfab27da3634539e99eb48c85dd5a64212e7005.tar.xz samba-9dfab27da3634539e99eb48c85dd5a64212e7005.zip |
move calls to smbhash() inside smbdes.c (for legal reasons)
Diffstat (limited to 'source')
-rw-r--r-- | source/include/proto.h | 7 | ||||
-rw-r--r-- | source/libsmb/credentials.c | 11 | ||||
-rw-r--r-- | source/libsmb/smbdes.c | 19 |
3 files changed, 25 insertions, 12 deletions
diff --git a/source/include/proto.h b/source/include/proto.h index aee8a86d05a..29252f16e37 100644 --- a/source/include/proto.h +++ b/source/include/proto.h @@ -834,9 +834,10 @@ BOOL smb_shm_get_usage(int *bytes_free, /*The following definitions come from smbdes.c */ void str_to_key(unsigned char *str,unsigned char *key); -void smbhash(unsigned char *out, unsigned char *in, unsigned char *key); void E_P16(unsigned char *p14,unsigned char *p16); void E_P24(unsigned char *p21, unsigned char *c8, unsigned char *p24); +void cred_hash1(char *out, char *in, char *key); +void cred_hash2(char *out, char *in, char *key); /*The following definitions come from smbencrypt.c */ @@ -889,9 +890,11 @@ struct smb_passwd *get_smbpwnam(char *name); /*The following definitions come from srvparse.c */ +char* srv_io_share_info1_str(BOOL io, SH_INFO_1_STR *sh1, char *q, char *base, int align, int depth); +char* srv_io_share_info1(BOOL io, SH_INFO_1 *sh1, char *q, char *base, int align, int depth); +char* srv_io_share_1_ctr(BOOL io, SHARE_INFO_1_CTR *ctr, char *q, char *base, int align, int depth); char* srv_io_q_net_share_enum(BOOL io, SRV_Q_NET_SHARE_ENUM *q_n, char *q, char *base, int align, int depth); char* srv_io_r_net_share_enum(BOOL io, SRV_R_NET_SHARE_ENUM *r_n, char *q, char *base, int align, int depth); -char* srv_io_q_net_share_enum(BOOL io, SRV_Q_NET_SHARE_ENUM *q_n, char *q, char *base, int align, int depth); /*The following definitions come from status.c */ diff --git a/source/libsmb/credentials.c b/source/libsmb/credentials.c index 8881704a7a8..f1a41b0b3b6 100644 --- a/source/libsmb/credentials.c +++ b/source/libsmb/credentials.c @@ -35,7 +35,6 @@ void cred_session_key(DOM_CHAL *clnt_chal, DOM_CHAL *srv_chal, char *pass, { uint32 sum[2]; char sum2[8]; - char buf[8]; char netsesskey[8]; sum[0] = IVAL(clnt_chal->data, 0) + IVAL(srv_chal->data, 0); @@ -44,8 +43,7 @@ void cred_session_key(DOM_CHAL *clnt_chal, DOM_CHAL *srv_chal, char *pass, SIVAL(sum2,0,sum[0]); SIVAL(sum2,4,sum[1]); - smbhash(buf, sum2, pass); - smbhash(netsesskey, buf, pass+9); + cred_hash1(netsesskey, sum2, pass); session_key[0] = IVAL(netsesskey, 0); session_key[1] = IVAL(netsesskey, 4); @@ -74,8 +72,6 @@ Output: void cred_create(uint32 session_key[2], DOM_CHAL *stor_cred, UTIME timestamp, DOM_CHAL *cred) { - char key2[7]; - char buf[8]; char calc_cred[8]; char timecred[8]; char netsesskey[8]; @@ -86,10 +82,7 @@ void cred_create(uint32 session_key[2], DOM_CHAL *stor_cred, UTIME timestamp, SIVAL(timecred, 0, IVAL(stor_cred, 0) + timestamp.time); SIVAL(timecred, 4, IVAL(stor_cred, 4)); - smbhash(buf, timecred, netsesskey); - memset(key2, 0, 7); - key2[0] = netsesskey[7]; - smbhash(calc_cred, buf, key2); + cred_hash2(calc_cred, timecred, netsesskey); cred->data[0] = IVAL(calc_cred, 0); cred->data[1] = IVAL(calc_cred, 4); diff --git a/source/libsmb/smbdes.c b/source/libsmb/smbdes.c index b62a160418d..90bad778c5a 100644 --- a/source/libsmb/smbdes.c +++ b/source/libsmb/smbdes.c @@ -275,7 +275,7 @@ void str_to_key(unsigned char *str,unsigned char *key) } -void smbhash(unsigned char *out, unsigned char *in, unsigned char *key) +static void smbhash(unsigned char *out, unsigned char *in, unsigned char *key) { int i; char outb[64]; @@ -317,4 +317,21 @@ void E_P24(unsigned char *p21, unsigned char *c8, unsigned char *p24) smbhash(p24+16, c8, p21+14); } +void cred_hash1(char *out, char *in, char *key) +{ + char buf[8]; + + smbhash(buf, in, key); + smbhash(out, buf, key+9); +} + +void cred_hash2(char *out, char *in, char *key) +{ + char buf[8]; + static char key2[8]; + + smbhash(buf, in, key); + key2[0] = key[7]; + smbhash(out, buf, key2); +} |