summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1997-10-10 14:48:05 +0000
committerLuke Leighton <lkcl@samba.org>1997-10-10 14:48:05 +0000
commitc5e739febe5ab3bcc5d147fe791c788ec72531a3 (patch)
treecbb87b08ca03c05b27e6cf80c281ef4d1505f0a5 /source3/libsmb
parent33d8f5ecbb869edbdfe0f958c989a3fcb7a056ff (diff)
downloadsamba-c5e739febe5ab3bcc5d147fe791c788ec72531a3.tar.gz
samba-c5e739febe5ab3bcc5d147fe791c788ec72531a3.tar.bz2
samba-c5e739febe5ab3bcc5d147fe791c788ec72531a3.zip
Makefile:
added credentials.c to smbd credentials.c: using credential structures instead of char* password.c uid.c server.c: added sid and attr to user_struct. smbdes.c: smbhash and str_to_key make public instead of private. pipes.c smb.h: lsa structures, sub-functions. proto.h: usual. (This used to be commit 87a0a944855a673d693d934e446bdc231b1c7f02)
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/credentials.c30
-rw-r--r--source3/libsmb/smbdes.c4
2 files changed, 17 insertions, 17 deletions
diff --git a/source3/libsmb/credentials.c b/source3/libsmb/credentials.c
index 4c81177fb2..eb1039ddb0 100644
--- a/source3/libsmb/credentials.c
+++ b/source3/libsmb/credentials.c
@@ -30,21 +30,21 @@ Input: 8 byte challenge block
Output:
8 byte session key
****************************************************************************/
-void cred_session_key(char *challenge, char *srv_challenge, char *pass,
+void cred_session_key(DOM_CHAL *clnt_chal, DOM_CHAL *srv_chal, char *pass,
char *session_key)
{
uint32 sum[2];
char sum2[8];
char buf[8];
- sum[0] = IVAL(challenge, 0) + IVAL(srv_challenge, 0);
- sum[1] = IVAL(challenge, 4) + IVAL(srv_challenge, 4);
+ sum[0] = IVAL(clnt_chal->data, 0) + IVAL(srv_chal->data, 0);
+ sum[1] = IVAL(clnt_chal->data, 4) + IVAL(srv_chal->data, 4);
SIVAL(sum2,0,sum[0]);
SIVAL(sum2,4,sum[1]);
- E1(pass,sum2,buf);
- E1(pass+9,buf,session_key);
+ smbhash(pass, sum2, buf);
+ smbhash(pass+9,buf,session_key);
}
@@ -59,20 +59,20 @@ Input:
Output:
8 byte credential
****************************************************************************/
-void cred_create(char *session_key, char *stored_cred, UTIME timestamp,
- char *cred)
+void cred_create(char *session_key, DOM_CHAL *stored_cred, UTIME timestamp,
+ DOM_CHAL *cred)
{
char key2[7];
char buf[8];
char timecred[8];
- memcpy(timecred, stored_cred, 8);
+ memcpy(timecred, stored_cred->data, 8);
SIVAL(timecred, 0, IVAL(stored_cred, 0) + timestamp.time);
- E1(session_key, timecred, buf);
+ smbhash(session_key, timecred, buf);
memset(key2, 0, 7);
key2[0] = session_key[7];
- E1(key2, buf, cred);
+ smbhash(key2, buf, cred->data);
}
@@ -89,13 +89,13 @@ Output:
returns 1 if computed credential matches received credential
returns 0 otherwise
****************************************************************************/
-int cred_assert(char *cred, char *session_key, char *stored_cred,
- NTTIME timestamp)
+int cred_assert(DOM_CHAL *cred, char *session_key, DOM_CHAL *stored_cred,
+ UTIME timestamp)
{
- char cred2[8];
+ DOM_CHAL cred2;
- cred_create(session_key, stored_cred, timestamp, cred2);
+ cred_create(session_key, stored_cred, timestamp, &cred2);
- return memcmp(cred, cred2, 8) == 0;
+ return memcmp(cred->data, cred2.data, 8) == 0;
}
diff --git a/source3/libsmb/smbdes.c b/source3/libsmb/smbdes.c
index 1c38612b73..b62a160418 100644
--- a/source3/libsmb/smbdes.c
+++ b/source3/libsmb/smbdes.c
@@ -257,7 +257,7 @@ static void dohash(char *out, char *in, char *key)
permute(out, rl, perm6, 64);
}
-static void str_to_key(unsigned char *str,unsigned char *key)
+void str_to_key(unsigned char *str,unsigned char *key)
{
int i;
@@ -275,7 +275,7 @@ static void str_to_key(unsigned char *str,unsigned char *key)
}
-static void smbhash(unsigned char *out, unsigned char *in, unsigned char *key)
+void smbhash(unsigned char *out, unsigned char *in, unsigned char *key)
{
int i;
char outb[64];