mirror of
https://github.com/samba-team/samba.git
synced 2025-02-02 09:47:23 +03:00
r943: change samba4 to use 'uint8_t' instead of 'unsigned char'
metze (This used to be commit b5378803fdcb3b3afe7c2932a38828e83470f61a)
This commit is contained in:
parent
d9538e7412
commit
45e93c19ef
@ -124,7 +124,7 @@ static NTSTATUS connect_to_domain_password_server(struct cli_state **cli,
|
|||||||
const char *server,
|
const char *server,
|
||||||
const char *setup_creds_as,
|
const char *setup_creds_as,
|
||||||
uint16_t sec_chan,
|
uint16_t sec_chan,
|
||||||
const unsigned char *trust_passwd,
|
const uint8_t *trust_passwd,
|
||||||
BOOL *retry)
|
BOOL *retry)
|
||||||
{
|
{
|
||||||
struct in_addr dest_ip;
|
struct in_addr dest_ip;
|
||||||
@ -235,7 +235,7 @@ static NTSTATUS attempt_connect_to_dc(struct cli_state **cli,
|
|||||||
struct in_addr *ip,
|
struct in_addr *ip,
|
||||||
const char *setup_creds_as,
|
const char *setup_creds_as,
|
||||||
uint16_t sec_chan,
|
uint16_t sec_chan,
|
||||||
const unsigned char *trust_passwd)
|
const uint8_t *trust_passwd)
|
||||||
{
|
{
|
||||||
NTSTATUS ret = NT_STATUS_UNSUCCESSFUL;
|
NTSTATUS ret = NT_STATUS_UNSUCCESSFUL;
|
||||||
BOOL retry = True;
|
BOOL retry = True;
|
||||||
@ -266,7 +266,7 @@ static NTSTATUS find_connect_dc(struct cli_state **cli,
|
|||||||
const char *domain,
|
const char *domain,
|
||||||
const char *setup_creds_as,
|
const char *setup_creds_as,
|
||||||
uint16_t sec_chan,
|
uint16_t sec_chan,
|
||||||
unsigned char *trust_passwd,
|
uint8_t *trust_passwd,
|
||||||
time_t last_change_time)
|
time_t last_change_time)
|
||||||
{
|
{
|
||||||
struct in_addr dc_ip;
|
struct in_addr dc_ip;
|
||||||
@ -294,7 +294,7 @@ static NTSTATUS domain_client_validate(TALLOC_CTX *mem_ctx,
|
|||||||
auth_serversupplied_info **server_info,
|
auth_serversupplied_info **server_info,
|
||||||
const char *server, const char *setup_creds_as,
|
const char *server, const char *setup_creds_as,
|
||||||
uint16_t sec_chan,
|
uint16_t sec_chan,
|
||||||
unsigned char trust_passwd[16],
|
uint8_t trust_passwd[16],
|
||||||
time_t last_change_time)
|
time_t last_change_time)
|
||||||
{
|
{
|
||||||
fstring remote_machine;
|
fstring remote_machine;
|
||||||
@ -399,7 +399,7 @@ static NTSTATUS check_ntdomain_security(const struct auth_context *auth_context,
|
|||||||
{
|
{
|
||||||
NTSTATUS nt_status = NT_STATUS_LOGON_FAILURE;
|
NTSTATUS nt_status = NT_STATUS_LOGON_FAILURE;
|
||||||
char *password_server;
|
char *password_server;
|
||||||
unsigned char trust_passwd[16];
|
uint8_t trust_passwd[16];
|
||||||
time_t last_change_time;
|
time_t last_change_time;
|
||||||
const char *domain = lp_workgroup();
|
const char *domain = lp_workgroup();
|
||||||
|
|
||||||
@ -477,7 +477,7 @@ static NTSTATUS check_trustdomain_security(const struct auth_context *auth_conte
|
|||||||
auth_serversupplied_info **server_info)
|
auth_serversupplied_info **server_info)
|
||||||
{
|
{
|
||||||
NTSTATUS nt_status = NT_STATUS_LOGON_FAILURE;
|
NTSTATUS nt_status = NT_STATUS_LOGON_FAILURE;
|
||||||
unsigned char trust_md4_password[16];
|
uint8_t trust_md4_password[16];
|
||||||
char *trust_password;
|
char *trust_password;
|
||||||
time_t last_change_time;
|
time_t last_change_time;
|
||||||
DOM_SID sid;
|
DOM_SID sid;
|
||||||
|
@ -218,7 +218,7 @@ static NTSTATUS check_smbserver_security(const struct auth_context *auth_context
|
|||||||
auth_serversupplied_info **server_info)
|
auth_serversupplied_info **server_info)
|
||||||
{
|
{
|
||||||
struct cli_state *cli;
|
struct cli_state *cli;
|
||||||
static unsigned char badpass[24];
|
static uint8_t badpass[24];
|
||||||
static fstring baduser;
|
static fstring baduser;
|
||||||
static BOOL tested_password_server = False;
|
static BOOL tested_password_server = False;
|
||||||
static BOOL bad_password_server = False;
|
static BOOL bad_password_server = False;
|
||||||
|
@ -200,9 +200,9 @@ BOOL make_user_info_netlogon_interactive(auth_usersupplied_info **user_info,
|
|||||||
{
|
{
|
||||||
char lm_pwd[16];
|
char lm_pwd[16];
|
||||||
char nt_pwd[16];
|
char nt_pwd[16];
|
||||||
unsigned char local_lm_response[24];
|
uint8_t local_lm_response[24];
|
||||||
unsigned char local_nt_response[24];
|
uint8_t local_nt_response[24];
|
||||||
unsigned char key[16];
|
uint8_t key[16];
|
||||||
|
|
||||||
ZERO_STRUCT(key);
|
ZERO_STRUCT(key);
|
||||||
memcpy(key, dc_sess_key, 8);
|
memcpy(key, dc_sess_key, 8);
|
||||||
@ -236,10 +236,10 @@ BOOL make_user_info_netlogon_interactive(auth_usersupplied_info **user_info,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (lm_interactive_pwd)
|
if (lm_interactive_pwd)
|
||||||
SMBOWFencrypt((const unsigned char *)lm_pwd, chal, local_lm_response);
|
SMBOWFencrypt((const uint8_t *)lm_pwd, chal, local_lm_response);
|
||||||
|
|
||||||
if (nt_interactive_pwd)
|
if (nt_interactive_pwd)
|
||||||
SMBOWFencrypt((const unsigned char *)nt_pwd, chal, local_nt_response);
|
SMBOWFencrypt((const uint8_t *)nt_pwd, chal, local_nt_response);
|
||||||
|
|
||||||
/* Password info paranoia */
|
/* Password info paranoia */
|
||||||
ZERO_STRUCT(key);
|
ZERO_STRUCT(key);
|
||||||
@ -307,7 +307,7 @@ BOOL make_user_info_for_reply(auth_usersupplied_info **user_info,
|
|||||||
DEBUG(5,("make_user_info_for_reply: User passwords not in encrypted format.\n"));
|
DEBUG(5,("make_user_info_for_reply: User passwords not in encrypted format.\n"));
|
||||||
|
|
||||||
if (plaintext_password.data) {
|
if (plaintext_password.data) {
|
||||||
unsigned char local_lm_response[24];
|
uint8_t local_lm_response[24];
|
||||||
|
|
||||||
#ifdef DEBUG_PASSWORD
|
#ifdef DEBUG_PASSWORD
|
||||||
DEBUG(10,("Unencrypted password (len %d):\n",plaintext_password.length));
|
DEBUG(10,("Unencrypted password (len %d):\n",plaintext_password.length));
|
||||||
|
@ -100,7 +100,7 @@ static BOOL dfs_auth(char *user, char *password)
|
|||||||
struct passwd *pw;
|
struct passwd *pw;
|
||||||
sec_passwd_rec_t passwd_rec;
|
sec_passwd_rec_t passwd_rec;
|
||||||
sec_login_auth_src_t auth_src = sec_login_auth_src_network;
|
sec_login_auth_src_t auth_src = sec_login_auth_src_network;
|
||||||
unsigned char dce_errstr[dce_c_error_string_len];
|
uint8_t dce_errstr[dce_c_error_string_len];
|
||||||
gid_t egid;
|
gid_t egid;
|
||||||
|
|
||||||
if (dcelogin_atmost_once)
|
if (dcelogin_atmost_once)
|
||||||
@ -174,7 +174,7 @@ static BOOL dfs_auth(char *user, char *password)
|
|||||||
}
|
}
|
||||||
|
|
||||||
sec_key_mgmt_get_key(rpc_c_authn_dce_secret, NULL,
|
sec_key_mgmt_get_key(rpc_c_authn_dce_secret, NULL,
|
||||||
(unsigned char *)pw->pw_name,
|
(uint8_t *)pw->pw_name,
|
||||||
sec_c_key_version_none,
|
sec_c_key_version_none,
|
||||||
(void **)&key, &err);
|
(void **)&key, &err);
|
||||||
if (err != error_status_ok)
|
if (err != error_status_ok)
|
||||||
@ -205,7 +205,7 @@ static BOOL dfs_auth(char *user, char *password)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sec_login_setup_identity((unsigned char *)user,
|
if (sec_login_setup_identity((uint8_t *)user,
|
||||||
sec_login_no_flags,
|
sec_login_no_flags,
|
||||||
&my_dce_sec_context, &err) == 0)
|
&my_dce_sec_context, &err) == 0)
|
||||||
{
|
{
|
||||||
@ -248,7 +248,7 @@ static BOOL dfs_auth(char *user, char *password)
|
|||||||
set_effective_gid(pw->pw_gid);
|
set_effective_gid(pw->pw_gid);
|
||||||
set_effective_uid(pw->pw_uid);
|
set_effective_uid(pw->pw_uid);
|
||||||
|
|
||||||
if (sec_login_setup_identity((unsigned char *)user,
|
if (sec_login_setup_identity((uint8_t *)user,
|
||||||
sec_login_no_flags,
|
sec_login_no_flags,
|
||||||
&my_dce_sec_context, &err) == 0)
|
&my_dce_sec_context, &err) == 0)
|
||||||
{
|
{
|
||||||
@ -359,7 +359,7 @@ void dfs_unlogin(void)
|
|||||||
{
|
{
|
||||||
error_status_t err;
|
error_status_t err;
|
||||||
int err2;
|
int err2;
|
||||||
unsigned char dce_errstr[dce_c_error_string_len];
|
uint8_t dce_errstr[dce_c_error_string_len];
|
||||||
|
|
||||||
sec_login_purge_context(&my_dce_sec_context, &err);
|
sec_login_purge_context(&my_dce_sec_context, &err);
|
||||||
if (err != error_status_ok)
|
if (err != error_status_ok)
|
||||||
|
@ -121,7 +121,7 @@ static int blocksize=20;
|
|||||||
static int tarhandle;
|
static int tarhandle;
|
||||||
|
|
||||||
static void writetarheader(int f, const char *aname, uint64_t size, time_t mtime,
|
static void writetarheader(int f, const char *aname, uint64_t size, time_t mtime,
|
||||||
const char *amode, unsigned char ftype);
|
const char *amode, uint8_t ftype);
|
||||||
static void do_atar(char *rname,char *lname,file_info *finfo1);
|
static void do_atar(char *rname,char *lname,file_info *finfo1);
|
||||||
static void do_tar(file_info *finfo);
|
static void do_tar(file_info *finfo);
|
||||||
static void oct_it(uint64_t value, int ndgs, char *p);
|
static void oct_it(uint64_t value, int ndgs, char *p);
|
||||||
@ -164,7 +164,7 @@ static char *string_create_s(int size)
|
|||||||
Write a tar header to buffer
|
Write a tar header to buffer
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static void writetarheader(int f, const char *aname, uint64_t size, time_t mtime,
|
static void writetarheader(int f, const char *aname, uint64_t size, time_t mtime,
|
||||||
const char *amode, unsigned char ftype)
|
const char *amode, uint8_t ftype)
|
||||||
{
|
{
|
||||||
union hblock hb;
|
union hblock hb;
|
||||||
int i, chk, l;
|
int i, chk, l;
|
||||||
|
@ -57,9 +57,9 @@ typedef struct _AfpInfo
|
|||||||
uint32_t afpi_Version; /* Must be 0x00010000 */
|
uint32_t afpi_Version; /* Must be 0x00010000 */
|
||||||
uint32_t afpi_Reserved1;
|
uint32_t afpi_Reserved1;
|
||||||
uint32_t afpi_BackupTime; /* Backup time for the file/dir */
|
uint32_t afpi_BackupTime; /* Backup time for the file/dir */
|
||||||
unsigned char afpi_FinderInfo[AFP_FinderSize]; /* Finder Info (32 bytes) */
|
uint8_t afpi_FinderInfo[AFP_FinderSize]; /* Finder Info (32 bytes) */
|
||||||
unsigned char afpi_ProDosInfo[6]; /* ProDos Info (6 bytes) # */
|
uint8_t afpi_ProDosInfo[6]; /* ProDos Info (6 bytes) # */
|
||||||
unsigned char afpi_Reserved2[6];
|
uint8_t afpi_Reserved2[6];
|
||||||
} AfpInfo;
|
} AfpInfo;
|
||||||
|
|
||||||
typedef struct _SambaAfpInfo
|
typedef struct _SambaAfpInfo
|
||||||
|
@ -54,7 +54,7 @@ that don't have any int types that are 2 bytes long)
|
|||||||
|
|
||||||
You do this:
|
You do this:
|
||||||
|
|
||||||
#define CVAL(buf,pos) (((unsigned char *)(buf))[pos])
|
#define CVAL(buf,pos) (((uint8_t *)(buf))[pos])
|
||||||
#define PVAL(buf,pos) ((unsigned)CVAL(buf,pos))
|
#define PVAL(buf,pos) ((unsigned)CVAL(buf,pos))
|
||||||
#define SVAL(buf,pos) (PVAL(buf,pos)|PVAL(buf,(pos)+1)<<8)
|
#define SVAL(buf,pos) (PVAL(buf,pos)|PVAL(buf,(pos)+1)<<8)
|
||||||
|
|
||||||
@ -105,8 +105,8 @@ it also defines lots of intermediate macros, just ignore those :-)
|
|||||||
#define CAREFUL_ALIGNMENT 1
|
#define CAREFUL_ALIGNMENT 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define CVAL(buf,pos) ((unsigned)(((const unsigned char *)(buf))[pos]))
|
#define CVAL(buf,pos) ((unsigned)(((const uint8_t *)(buf))[pos]))
|
||||||
#define CVAL_NC(buf,pos) (((unsigned char *)(buf))[pos]) /* Non-const version of CVAL */
|
#define CVAL_NC(buf,pos) (((uint8_t *)(buf))[pos]) /* Non-const version of CVAL */
|
||||||
#define PVAL(buf,pos) (CVAL(buf,pos))
|
#define PVAL(buf,pos) (CVAL(buf,pos))
|
||||||
#define SCVAL(buf,pos,val) (CVAL_NC(buf,pos) = (val))
|
#define SCVAL(buf,pos,val) (CVAL_NC(buf,pos) = (val))
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ it also defines lots of intermediate macros, just ignore those :-)
|
|||||||
|
|
||||||
#define SVAL(buf,pos) (PVAL(buf,pos)|PVAL(buf,(pos)+1)<<8)
|
#define SVAL(buf,pos) (PVAL(buf,pos)|PVAL(buf,(pos)+1)<<8)
|
||||||
#define IVAL(buf,pos) (SVAL(buf,pos)|SVAL(buf,(pos)+2)<<16)
|
#define IVAL(buf,pos) (SVAL(buf,pos)|SVAL(buf,(pos)+2)<<16)
|
||||||
#define SSVALX(buf,pos,val) (CVAL_NC(buf,pos)=(unsigned char)((val)&0xFF),CVAL_NC(buf,pos+1)=(unsigned char)((val)>>8))
|
#define SSVALX(buf,pos,val) (CVAL_NC(buf,pos)=(uint8_t)((val)&0xFF),CVAL_NC(buf,pos+1)=(uint8_t)((val)>>8))
|
||||||
#define SIVALX(buf,pos,val) (SSVALX(buf,pos,val&0xFFFF),SSVALX(buf,pos+2,val>>16))
|
#define SIVALX(buf,pos,val) (SSVALX(buf,pos,val&0xFFFF),SSVALX(buf,pos+2,val>>16))
|
||||||
#define SVALS(buf,pos) ((int16_t)SVAL(buf,pos))
|
#define SVALS(buf,pos) ((int16_t)SVAL(buf,pos))
|
||||||
#define IVALS(buf,pos) ((int32_t)IVAL(buf,pos))
|
#define IVALS(buf,pos) ((int32_t)IVAL(buf,pos))
|
||||||
|
@ -8,13 +8,13 @@
|
|||||||
struct MD5Context {
|
struct MD5Context {
|
||||||
uint32_t buf[4];
|
uint32_t buf[4];
|
||||||
uint32_t bits[2];
|
uint32_t bits[2];
|
||||||
unsigned char in[64];
|
uint8_t in[64];
|
||||||
};
|
};
|
||||||
|
|
||||||
void MD5Init(struct MD5Context *context);
|
void MD5Init(struct MD5Context *context);
|
||||||
void MD5Update(struct MD5Context *context, unsigned char const *buf,
|
void MD5Update(struct MD5Context *context, uint8_t const *buf,
|
||||||
unsigned len);
|
unsigned len);
|
||||||
void MD5Final(unsigned char digest[16], struct MD5Context *context);
|
void MD5Final(uint8_t digest[16], struct MD5Context *context);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is needed to make RSAREF happy on some MS-DOS compilers.
|
* This is needed to make RSAREF happy on some MS-DOS compilers.
|
||||||
|
@ -51,7 +51,7 @@ typedef struct reg_ops_s REG_OPS;
|
|||||||
#if 0
|
#if 0
|
||||||
//FIXME
|
//FIXME
|
||||||
typedef struct ace_struct_s {
|
typedef struct ace_struct_s {
|
||||||
unsigned char type, flags;
|
uint8_t type, flags;
|
||||||
unsigned int perms; /* Perhaps a better def is in order */
|
unsigned int perms; /* Perhaps a better def is in order */
|
||||||
DOM_SID *trustee;
|
DOM_SID *trustee;
|
||||||
} ACE;
|
} ACE;
|
||||||
|
@ -862,8 +862,8 @@ struct nmb_name {
|
|||||||
/* A netbios node status array element. */
|
/* A netbios node status array element. */
|
||||||
struct node_status {
|
struct node_status {
|
||||||
char name[16];
|
char name[16];
|
||||||
unsigned char type;
|
uint8_t type;
|
||||||
unsigned char flags;
|
uint8_t flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
#include "rpc_secdes.h"
|
#include "rpc_secdes.h"
|
||||||
|
@ -107,7 +107,7 @@ static void mdfour64(struct mdfour_state *s, uint32_t *M)
|
|||||||
X[j] = 0;
|
X[j] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void copy64(uint32_t *M, const unsigned char *in)
|
static void copy64(uint32_t *M, const uint8_t *in)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ static void copy64(uint32_t *M, const unsigned char *in)
|
|||||||
(in[i*4+1]<<8) | (in[i*4+0]<<0);
|
(in[i*4+1]<<8) | (in[i*4+0]<<0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void copy4(unsigned char *out, uint32_t x)
|
static void copy4(uint8_t *out, uint32_t x)
|
||||||
{
|
{
|
||||||
out[0] = x&0xFF;
|
out[0] = x&0xFF;
|
||||||
out[1] = (x>>8)&0xFF;
|
out[1] = (x>>8)&0xFF;
|
||||||
@ -125,9 +125,9 @@ static void copy4(unsigned char *out, uint32_t x)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* produce a md4 message digest from data of length n bytes */
|
/* produce a md4 message digest from data of length n bytes */
|
||||||
void mdfour(unsigned char *out, const unsigned char *in, int n)
|
void mdfour(uint8_t *out, const uint8_t *in, int n)
|
||||||
{
|
{
|
||||||
unsigned char buf[128];
|
uint8_t buf[128];
|
||||||
uint32_t M[16];
|
uint32_t M[16];
|
||||||
uint32_t b = n * 8;
|
uint32_t b = n * 8;
|
||||||
int i;
|
int i;
|
||||||
|
@ -27,7 +27,7 @@ static void MD5Transform(uint32_t buf[4], uint32_t const in[16]);
|
|||||||
/*
|
/*
|
||||||
* Note: this code is harmless on little-endian machines.
|
* Note: this code is harmless on little-endian machines.
|
||||||
*/
|
*/
|
||||||
static void byteReverse(unsigned char *buf, unsigned longs)
|
static void byteReverse(uint8_t *buf, unsigned longs)
|
||||||
{
|
{
|
||||||
uint32_t t;
|
uint32_t t;
|
||||||
do {
|
do {
|
||||||
@ -57,7 +57,7 @@ void MD5Init(struct MD5Context *ctx)
|
|||||||
* Update context to reflect the concatenation of another buffer full
|
* Update context to reflect the concatenation of another buffer full
|
||||||
* of bytes.
|
* of bytes.
|
||||||
*/
|
*/
|
||||||
void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len)
|
void MD5Update(struct MD5Context *ctx, uint8_t const *buf, unsigned len)
|
||||||
{
|
{
|
||||||
register uint32_t t;
|
register uint32_t t;
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len)
|
|||||||
/* Handle any leading odd-sized chunks */
|
/* Handle any leading odd-sized chunks */
|
||||||
|
|
||||||
if (t) {
|
if (t) {
|
||||||
unsigned char *p = (unsigned char *) ctx->in + t;
|
uint8_t *p = (uint8_t *) ctx->in + t;
|
||||||
|
|
||||||
t = 64 - t;
|
t = 64 - t;
|
||||||
if (len < t) {
|
if (len < t) {
|
||||||
@ -105,10 +105,10 @@ void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len)
|
|||||||
* Final wrapup - pad to 64-byte boundary with the bit pattern
|
* Final wrapup - pad to 64-byte boundary with the bit pattern
|
||||||
* 1 0* (64-bit count of bits processed, MSB-first)
|
* 1 0* (64-bit count of bits processed, MSB-first)
|
||||||
*/
|
*/
|
||||||
void MD5Final(unsigned char digest[16], struct MD5Context *ctx)
|
void MD5Final(uint8_t digest[16], struct MD5Context *ctx)
|
||||||
{
|
{
|
||||||
unsigned int count;
|
unsigned int count;
|
||||||
unsigned char *p;
|
uint8_t *p;
|
||||||
|
|
||||||
/* Compute number of bytes mod 64 */
|
/* Compute number of bytes mod 64 */
|
||||||
count = (ctx->bits[0] >> 3) & 0x3F;
|
count = (ctx->bits[0] >> 3) & 0x3F;
|
||||||
@ -141,7 +141,7 @@ void MD5Final(unsigned char digest[16], struct MD5Context *ctx)
|
|||||||
((uint32_t *) ctx->in)[15] = ctx->bits[1];
|
((uint32_t *) ctx->in)[15] = ctx->bits[1];
|
||||||
|
|
||||||
MD5Transform(ctx->buf, (uint32_t *) ctx->in);
|
MD5Transform(ctx->buf, (uint32_t *) ctx->in);
|
||||||
byteReverse((unsigned char *) ctx->buf, 4);
|
byteReverse((uint8_t *) ctx->buf, 4);
|
||||||
memmove(digest, ctx->buf, 16);
|
memmove(digest, ctx->buf, 16);
|
||||||
memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
|
memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
|
||||||
}
|
}
|
||||||
|
@ -22,21 +22,21 @@
|
|||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
|
|
||||||
static unsigned char hash[258];
|
static uint8_t hash[258];
|
||||||
static uint32_t counter;
|
static uint32_t counter;
|
||||||
static unsigned char *reseed_data;
|
static uint8_t *reseed_data;
|
||||||
static size_t reseed_data_size;
|
static size_t reseed_data_size;
|
||||||
|
|
||||||
/****************************************************************
|
/****************************************************************
|
||||||
Copy any user given reseed data.
|
Copy any user given reseed data.
|
||||||
*****************************************************************/
|
*****************************************************************/
|
||||||
|
|
||||||
void set_rand_reseed_data(unsigned char *data, size_t len)
|
void set_rand_reseed_data(uint8_t *data, size_t len)
|
||||||
{
|
{
|
||||||
SAFE_FREE(reseed_data);
|
SAFE_FREE(reseed_data);
|
||||||
reseed_data_size = 0;
|
reseed_data_size = 0;
|
||||||
|
|
||||||
reseed_data = (unsigned char *)memdup(data, len);
|
reseed_data = (uint8_t *)memdup(data, len);
|
||||||
if (reseed_data)
|
if (reseed_data)
|
||||||
reseed_data_size = len;
|
reseed_data_size = len;
|
||||||
}
|
}
|
||||||
@ -45,16 +45,16 @@ void set_rand_reseed_data(unsigned char *data, size_t len)
|
|||||||
Setup the seed.
|
Setup the seed.
|
||||||
*****************************************************************/
|
*****************************************************************/
|
||||||
|
|
||||||
static void seed_random_stream(unsigned char *seedval, size_t seedlen)
|
static void seed_random_stream(uint8_t *seedval, size_t seedlen)
|
||||||
{
|
{
|
||||||
unsigned char j = 0;
|
uint8_t j = 0;
|
||||||
size_t ind;
|
size_t ind;
|
||||||
|
|
||||||
for (ind = 0; ind < 256; ind++)
|
for (ind = 0; ind < 256; ind++)
|
||||||
hash[ind] = (unsigned char)ind;
|
hash[ind] = (uint8_t)ind;
|
||||||
|
|
||||||
for( ind = 0; ind < 256; ind++) {
|
for( ind = 0; ind < 256; ind++) {
|
||||||
unsigned char tc;
|
uint8_t tc;
|
||||||
|
|
||||||
j += (hash[ind] + seedval[ind%seedlen]);
|
j += (hash[ind] + seedval[ind%seedlen]);
|
||||||
|
|
||||||
@ -71,15 +71,15 @@ static void seed_random_stream(unsigned char *seedval, size_t seedlen)
|
|||||||
Get datasize bytes worth of random data.
|
Get datasize bytes worth of random data.
|
||||||
*****************************************************************/
|
*****************************************************************/
|
||||||
|
|
||||||
static void get_random_stream(unsigned char *data, size_t datasize)
|
static void get_random_stream(uint8_t *data, size_t datasize)
|
||||||
{
|
{
|
||||||
unsigned char index_i = hash[256];
|
uint8_t index_i = hash[256];
|
||||||
unsigned char index_j = hash[257];
|
uint8_t index_j = hash[257];
|
||||||
size_t ind;
|
size_t ind;
|
||||||
|
|
||||||
for( ind = 0; ind < datasize; ind++) {
|
for( ind = 0; ind < datasize; ind++) {
|
||||||
unsigned char tc;
|
uint8_t tc;
|
||||||
unsigned char t;
|
uint8_t t;
|
||||||
|
|
||||||
index_i++;
|
index_i++;
|
||||||
index_j += hash[index_i];
|
index_j += hash[index_i];
|
||||||
@ -101,10 +101,10 @@ static void get_random_stream(unsigned char *data, size_t datasize)
|
|||||||
Note that the hash is not initialised.
|
Note that the hash is not initialised.
|
||||||
*****************************************************************/
|
*****************************************************************/
|
||||||
|
|
||||||
static void do_filehash(const char *fname, unsigned char *the_hash)
|
static void do_filehash(const char *fname, uint8_t *the_hash)
|
||||||
{
|
{
|
||||||
unsigned char buf[1011]; /* deliberate weird size */
|
uint8_t buf[1011]; /* deliberate weird size */
|
||||||
unsigned char tmp_md4[16];
|
uint8_t tmp_md4[16];
|
||||||
int fd, n;
|
int fd, n;
|
||||||
|
|
||||||
fd = sys_open(fname,O_RDONLY,0);
|
fd = sys_open(fname,O_RDONLY,0);
|
||||||
@ -133,7 +133,7 @@ static void do_filehash(const char *fname, unsigned char *the_hash)
|
|||||||
|
|
||||||
static int do_reseed(BOOL use_fd, int fd)
|
static int do_reseed(BOOL use_fd, int fd)
|
||||||
{
|
{
|
||||||
unsigned char seed_inbuf[40];
|
uint8_t seed_inbuf[40];
|
||||||
uint32_t v1, v2; struct timeval tval; pid_t mypid;
|
uint32_t v1, v2; struct timeval tval; pid_t mypid;
|
||||||
|
|
||||||
if (use_fd) {
|
if (use_fd) {
|
||||||
@ -181,13 +181,13 @@ static int do_reseed(BOOL use_fd, int fd)
|
|||||||
Interface to the (hopefully) good crypto random number generator.
|
Interface to the (hopefully) good crypto random number generator.
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
void generate_random_buffer( unsigned char *out, int len, BOOL do_reseed_now)
|
void generate_random_buffer( uint8_t *out, int len, BOOL do_reseed_now)
|
||||||
{
|
{
|
||||||
static BOOL done_reseed = False;
|
static BOOL done_reseed = False;
|
||||||
static int urand_fd = -1;
|
static int urand_fd = -1;
|
||||||
unsigned char md4_buf[64];
|
uint8_t md4_buf[64];
|
||||||
unsigned char tmp_buf[16];
|
uint8_t tmp_buf[16];
|
||||||
unsigned char *p;
|
uint8_t *p;
|
||||||
|
|
||||||
if(!done_reseed || do_reseed_now) {
|
if(!done_reseed || do_reseed_now) {
|
||||||
urand_fd = do_reseed(True, urand_fd);
|
urand_fd = do_reseed(True, urand_fd);
|
||||||
|
@ -458,8 +458,8 @@ static size_t utf8_pull(void *cd, const char **inbuf, size_t *inbytesleft,
|
|||||||
char **outbuf, size_t *outbytesleft)
|
char **outbuf, size_t *outbytesleft)
|
||||||
{
|
{
|
||||||
while (*inbytesleft >= 1 && *outbytesleft >= 2) {
|
while (*inbytesleft >= 1 && *outbytesleft >= 2) {
|
||||||
const unsigned char *c = (const unsigned char *)*inbuf;
|
const uint8_t *c = (const uint8_t *)*inbuf;
|
||||||
unsigned char *uc = (unsigned char *)*outbuf;
|
uint8_t *uc = (uint8_t *)*outbuf;
|
||||||
int len = 1;
|
int len = 1;
|
||||||
|
|
||||||
if ((c[0] & 0x80) == 0) {
|
if ((c[0] & 0x80) == 0) {
|
||||||
@ -505,8 +505,8 @@ static size_t utf8_push(void *cd, const char **inbuf, size_t *inbytesleft,
|
|||||||
char **outbuf, size_t *outbytesleft)
|
char **outbuf, size_t *outbytesleft)
|
||||||
{
|
{
|
||||||
while (*inbytesleft >= 2 && *outbytesleft >= 1) {
|
while (*inbytesleft >= 2 && *outbytesleft >= 1) {
|
||||||
unsigned char *c = (unsigned char *)*outbuf;
|
uint8_t *c = (uint8_t *)*outbuf;
|
||||||
const unsigned char *uc = (const unsigned char *)*inbuf;
|
const uint8_t *uc = (const uint8_t *)*inbuf;
|
||||||
int len=1;
|
int len=1;
|
||||||
|
|
||||||
if (uc[1] & 0xf8) {
|
if (uc[1] & 0xf8) {
|
||||||
|
@ -47,7 +47,7 @@ static int base64_decode(char *s)
|
|||||||
{
|
{
|
||||||
const char *b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
const char *b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||||
int bit_offset, byte_offset, idx, i, n;
|
int bit_offset, byte_offset, idx, i, n;
|
||||||
unsigned char *d = (unsigned char *)s;
|
uint8_t *d = (uint8_t *)s;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
n=i=0;
|
n=i=0;
|
||||||
@ -90,7 +90,7 @@ char *ldb_base64_encode(struct ldb_context *ldb, const char *buf, int len)
|
|||||||
{
|
{
|
||||||
const char *b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
const char *b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||||
int bit_offset, byte_offset, idx, i;
|
int bit_offset, byte_offset, idx, i;
|
||||||
const unsigned char *d = (const unsigned char *)buf;
|
const uint8_t *d = (const uint8_t *)buf;
|
||||||
int bytes = (len*8 + 5)/6;
|
int bytes = (len*8 + 5)/6;
|
||||||
char *out;
|
char *out;
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ char *ldb_base64_encode(struct ldb_context *ldb, const char *buf, int len)
|
|||||||
int ldb_should_b64_encode(const struct ldb_val *val)
|
int ldb_should_b64_encode(const struct ldb_val *val)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
unsigned char *p = val->data;
|
uint8_t *p = val->data;
|
||||||
|
|
||||||
if (val->length == 0 || p[0] == ' ' || p[0] == ':') {
|
if (val->length == 0 || p[0] == ' ' || p[0] == ':') {
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
#define LTDB_PACKING_FORMAT_NODN 0x26011966
|
#define LTDB_PACKING_FORMAT_NODN 0x26011966
|
||||||
|
|
||||||
/* use a portable integer format */
|
/* use a portable integer format */
|
||||||
static void put_uint32(unsigned char *p, int ofs, unsigned int val)
|
static void put_uint32(uint8_t *p, int ofs, unsigned int val)
|
||||||
{
|
{
|
||||||
p += ofs;
|
p += ofs;
|
||||||
p[0] = val&0xFF;
|
p[0] = val&0xFF;
|
||||||
@ -51,7 +51,7 @@ static void put_uint32(unsigned char *p, int ofs, unsigned int val)
|
|||||||
p[3] = (val>>24) & 0xFF;
|
p[3] = (val>>24) & 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int pull_uint32(unsigned char *p, int ofs)
|
static unsigned int pull_uint32(uint8_t *p, int ofs)
|
||||||
{
|
{
|
||||||
p += ofs;
|
p += ofs;
|
||||||
return p[0] | (p[1]<<8) | (p[2]<<16) | (p[3]<<24);
|
return p[0] | (p[1]<<8) | (p[2]<<16) | (p[3]<<24);
|
||||||
|
@ -55,7 +55,7 @@ char *reg_val_data_string(REG_VAL *v)
|
|||||||
asciip = ret;
|
asciip = ret;
|
||||||
for (i=0; i<reg_val_size(v); i++) {
|
for (i=0; i<reg_val_size(v); i++) {
|
||||||
int str_rem = reg_val_size(v) * 3 - (asciip - ret);
|
int str_rem = reg_val_size(v) * 3 - (asciip - ret);
|
||||||
asciip += snprintf(asciip, str_rem, "%02x", *(unsigned char *)(reg_val_data_blk(v)+i));
|
asciip += snprintf(asciip, str_rem, "%02x", *(uint8_t *)(reg_val_data_blk(v)+i));
|
||||||
if (i < reg_val_size(v) && str_rem > 0)
|
if (i < reg_val_size(v) && str_rem > 0)
|
||||||
*asciip = ' '; asciip++;
|
*asciip = ' '; asciip++;
|
||||||
}
|
}
|
||||||
|
@ -1268,10 +1268,10 @@ static void *nt_alloc_regf_space(REG_HANDLE *h, int size, unsigned int *off)
|
|||||||
/*
|
/*
|
||||||
* Store a SID at the location provided
|
* Store a SID at the location provided
|
||||||
*/
|
*/
|
||||||
static int nt_store_SID(REG_HANDLE *regf, DOM_SID *sid, unsigned char *locn)
|
static int nt_store_SID(REG_HANDLE *regf, DOM_SID *sid, uint8_t *locn)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
unsigned char *p = locn;
|
uint8_t *p = locn;
|
||||||
|
|
||||||
if (!regf || !sid || !locn) return 0;
|
if (!regf || !sid || !locn) return 0;
|
||||||
|
|
||||||
@ -1290,11 +1290,11 @@ static int nt_store_SID(REG_HANDLE *regf, DOM_SID *sid, unsigned char *locn)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nt_store_ace(REG_HANDLE *regf, SEC_ACE *ace, unsigned char *locn)
|
static int nt_store_ace(REG_HANDLE *regf, SEC_ACE *ace, uint8_t *locn)
|
||||||
{
|
{
|
||||||
int size = 0;
|
int size = 0;
|
||||||
SEC_ACE *reg_ace = (SEC_ACE *)locn;
|
SEC_ACE *reg_ace = (SEC_ACE *)locn;
|
||||||
unsigned char *p;
|
uint8_t *p;
|
||||||
|
|
||||||
if (!regf || !ace || !locn) return 0;
|
if (!regf || !ace || !locn) return 0;
|
||||||
|
|
||||||
@ -1303,7 +1303,7 @@ static int nt_store_ace(REG_HANDLE *regf, SEC_ACE *ace, unsigned char *locn)
|
|||||||
|
|
||||||
/* Deal with the length when we have stored the SID */
|
/* Deal with the length when we have stored the SID */
|
||||||
|
|
||||||
p = (unsigned char *)®_ace->info.mask;
|
p = (uint8_t *)®_ace->info.mask;
|
||||||
|
|
||||||
SIVAL(p, 0, ace->info.mask); p += 4;
|
SIVAL(p, 0, ace->info.mask); p += 4;
|
||||||
|
|
||||||
@ -1311,7 +1311,7 @@ static int nt_store_ace(REG_HANDLE *regf, SEC_ACE *ace, unsigned char *locn)
|
|||||||
|
|
||||||
size += 8; /* Size of the fixed header */
|
size += 8; /* Size of the fixed header */
|
||||||
|
|
||||||
p = (unsigned char *)®_ace->size;
|
p = (uint8_t *)®_ace->size;
|
||||||
|
|
||||||
SSVAL(p, 0, size);
|
SSVAL(p, 0, size);
|
||||||
|
|
||||||
@ -1321,9 +1321,9 @@ static int nt_store_ace(REG_HANDLE *regf, SEC_ACE *ace, unsigned char *locn)
|
|||||||
/*
|
/*
|
||||||
* Store an ACL at the location provided
|
* Store an ACL at the location provided
|
||||||
*/
|
*/
|
||||||
static int nt_store_acl(REG_HANDLE *regf, SEC_ACL *acl, unsigned char *locn) {
|
static int nt_store_acl(REG_HANDLE *regf, SEC_ACL *acl, uint8_t *locn) {
|
||||||
int size = 0, i;
|
int size = 0, i;
|
||||||
unsigned char *p = locn, *s;
|
uint8_t *p = locn, *s;
|
||||||
|
|
||||||
if (!regf || !acl || !locn) return 0;
|
if (!regf || !acl || !locn) return 0;
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ static struct cmd_line *get_cmd_line(int fd)
|
|||||||
{
|
{
|
||||||
struct cmd_line *cl = (CMD_LINE *)smb_xmalloc(sizeof(CMD_LINE));
|
struct cmd_line *cl = (CMD_LINE *)smb_xmalloc(sizeof(CMD_LINE));
|
||||||
int i = 0, rc;
|
int i = 0, rc;
|
||||||
unsigned char ch;
|
uint8_t ch;
|
||||||
|
|
||||||
cl->len = INIT_ALLOC;
|
cl->len = INIT_ALLOC;
|
||||||
|
|
||||||
@ -662,7 +662,7 @@ static CMD_FILE *cmd_file_create(const char *file)
|
|||||||
* Sec Desc print functions
|
* Sec Desc print functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char *str_type(unsigned char type);
|
char *str_type(uint8_t type);
|
||||||
|
|
||||||
static int nt_apply_reg_command_file(REG_HANDLE *r, const char *cmd_file_name)
|
static int nt_apply_reg_command_file(REG_HANDLE *r, const char *cmd_file_name)
|
||||||
{
|
{
|
||||||
|
@ -328,7 +328,7 @@ duplicate a string
|
|||||||
#ifdef REPLACE_INET_NTOA
|
#ifdef REPLACE_INET_NTOA
|
||||||
char *rep_inet_ntoa(struct in_addr ip)
|
char *rep_inet_ntoa(struct in_addr ip)
|
||||||
{
|
{
|
||||||
unsigned char *p = (unsigned char *)&ip.s_addr;
|
uint8_t *p = (uint8_t *)&ip.s_addr;
|
||||||
static char buf[18];
|
static char buf[18];
|
||||||
slprintf(buf, 17, "%d.%d.%d.%d",
|
slprintf(buf, 17, "%d.%d.%d.%d",
|
||||||
(int)p[0], (int)p[1], (int)p[2], (int)p[3]);
|
(int)p[0], (int)p[1], (int)p[2], (int)p[3]);
|
||||||
|
@ -219,7 +219,7 @@ static size_t dopr(char *buffer, size_t maxlen, const char *format, va_list args
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DP_S_MIN:
|
case DP_S_MIN:
|
||||||
if (isdigit((unsigned char)ch)) {
|
if (isdigit((uint8_t)ch)) {
|
||||||
min = 10*min + char_to_int (ch);
|
min = 10*min + char_to_int (ch);
|
||||||
ch = *format++;
|
ch = *format++;
|
||||||
} else if (ch == '*') {
|
} else if (ch == '*') {
|
||||||
@ -239,7 +239,7 @@ static size_t dopr(char *buffer, size_t maxlen, const char *format, va_list args
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DP_S_MAX:
|
case DP_S_MAX:
|
||||||
if (isdigit((unsigned char)ch)) {
|
if (isdigit((uint8_t)ch)) {
|
||||||
if (max < 0)
|
if (max < 0)
|
||||||
max = 0;
|
max = 0;
|
||||||
max = 10*max + char_to_int (ch);
|
max = 10*max + char_to_int (ch);
|
||||||
|
@ -1762,7 +1762,7 @@ TDB_CONTEXT *tdb_open_ex(const char *name, int hash_size, int tdb_flags,
|
|||||||
TDB_CONTEXT *tdb;
|
TDB_CONTEXT *tdb;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
int rev = 0, locked = 0;
|
int rev = 0, locked = 0;
|
||||||
unsigned char *vp;
|
uint8_t *vp;
|
||||||
u32 vertest;
|
u32 vertest;
|
||||||
|
|
||||||
if (!(tdb = calloc(1, sizeof *tdb))) {
|
if (!(tdb = calloc(1, sizeof *tdb))) {
|
||||||
@ -1841,7 +1841,7 @@ TDB_CONTEXT *tdb_open_ex(const char *name, int hash_size, int tdb_flags,
|
|||||||
}
|
}
|
||||||
rev = (tdb->flags & TDB_CONVERT);
|
rev = (tdb->flags & TDB_CONVERT);
|
||||||
}
|
}
|
||||||
vp = (unsigned char *)&tdb->header.version;
|
vp = (uint8_t *)&tdb->header.version;
|
||||||
vertest = (((u32)vp[0]) << 24) | (((u32)vp[1]) << 16) |
|
vertest = (((u32)vp[0]) << 24) | (((u32)vp[1]) << 16) |
|
||||||
(((u32)vp[2]) << 8) | (u32)vp[3];
|
(((u32)vp[2]) << 8) | (u32)vp[3];
|
||||||
tdb->flags |= (vertest==TDB_VERSION) ? TDB_BIGENDIAN : 0;
|
tdb->flags |= (vertest==TDB_VERSION) ? TDB_BIGENDIAN : 0;
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
static void print_data(TDB_DATA d)
|
static void print_data(TDB_DATA d)
|
||||||
{
|
{
|
||||||
unsigned char *p = d.dptr;
|
uint8_t *p = d.dptr;
|
||||||
int len = d.dsize;
|
int len = d.dsize;
|
||||||
while (len--) {
|
while (len--) {
|
||||||
if (isprint(*p) && !strchr("\"\\", *p)) {
|
if (isprint(*p) && !strchr("\"\\", *p)) {
|
||||||
|
@ -63,7 +63,7 @@ static TDB_CONTEXT *tdb;
|
|||||||
|
|
||||||
static int print_rec(TDB_CONTEXT *the_tdb, TDB_DATA key, TDB_DATA dbuf, void *state);
|
static int print_rec(TDB_CONTEXT *the_tdb, TDB_DATA key, TDB_DATA dbuf, void *state);
|
||||||
|
|
||||||
static void print_asc(unsigned char *buf,int len)
|
static void print_asc(uint8_t *buf,int len)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ static void print_asc(unsigned char *buf,int len)
|
|||||||
printf("%c",isprint(buf[i])?buf[i]:'.');
|
printf("%c",isprint(buf[i])?buf[i]:'.');
|
||||||
}
|
}
|
||||||
|
|
||||||
static void print_data(unsigned char *buf,int len)
|
static void print_data(uint8_t *buf,int len)
|
||||||
{
|
{
|
||||||
int i=0;
|
int i=0;
|
||||||
if (len<=0) return;
|
if (len<=0) return;
|
||||||
|
@ -677,7 +677,7 @@ void set_remote_arch(struct server_context *smb, enum remote_arch_types type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void print_asc(int level, const unsigned char *buf,int len)
|
void print_asc(int level, const uint8_t *buf,int len)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i=0;i<len;i++)
|
for (i=0;i<len;i++)
|
||||||
@ -686,7 +686,7 @@ void print_asc(int level, const unsigned char *buf,int len)
|
|||||||
|
|
||||||
void dump_data(int level, const char *buf1,int len)
|
void dump_data(int level, const char *buf1,int len)
|
||||||
{
|
{
|
||||||
const unsigned char *buf = (const unsigned char *)buf1;
|
const uint8_t *buf = (const uint8_t *)buf1;
|
||||||
int i=0;
|
int i=0;
|
||||||
if (len<=0) return;
|
if (len<=0) return;
|
||||||
|
|
||||||
|
@ -119,8 +119,8 @@ int getfileline(void *vp, char *linebuf, int linebuf_size)
|
|||||||
{
|
{
|
||||||
/* Static buffers we will return. */
|
/* Static buffers we will return. */
|
||||||
FILE *fp = (FILE *)vp;
|
FILE *fp = (FILE *)vp;
|
||||||
unsigned char c;
|
uint8_t c;
|
||||||
unsigned char *p;
|
uint8_t *p;
|
||||||
size_t linebuf_len;
|
size_t linebuf_len;
|
||||||
|
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
@ -186,7 +186,7 @@ int getfileline(void *vp, char *linebuf, int linebuf_size)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
p = (unsigned char *) strchr_m(linebuf, ':');
|
p = (uint8_t *) strchr_m(linebuf, ':');
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
{
|
{
|
||||||
DEBUG(0, ("getfileline: malformed line entry (no :)\n"));
|
DEBUG(0, ("getfileline: malformed line entry (no :)\n"));
|
||||||
|
@ -238,7 +238,7 @@ send a keepalive packet (rfc1002)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
BOOL send_nbt_keepalive(int sock_fd)
|
BOOL send_nbt_keepalive(int sock_fd)
|
||||||
{
|
{
|
||||||
unsigned char buf[4];
|
uint8_t buf[4];
|
||||||
|
|
||||||
buf[0] = SMBkeepalive;
|
buf[0] = SMBkeepalive;
|
||||||
buf[1] = buf[2] = buf[3] = 0;
|
buf[1] = buf[2] = buf[3] = 0;
|
||||||
|
@ -735,8 +735,8 @@ void strlower_m(char *s)
|
|||||||
supported multi-byte character sets are ascii-compatible
|
supported multi-byte character sets are ascii-compatible
|
||||||
(ie. they match for the first 128 chars) */
|
(ie. they match for the first 128 chars) */
|
||||||
|
|
||||||
while (*s && !(((unsigned char)s[0]) & 0x7F)) {
|
while (*s && !(((uint8_t)s[0]) & 0x7F)) {
|
||||||
*s = tolower((unsigned char)*s);
|
*s = tolower((uint8_t)*s);
|
||||||
s++;
|
s++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -759,8 +759,8 @@ void strupper_m(char *s)
|
|||||||
supported multi-byte character sets are ascii-compatible
|
supported multi-byte character sets are ascii-compatible
|
||||||
(ie. they match for the first 128 chars) */
|
(ie. they match for the first 128 chars) */
|
||||||
|
|
||||||
while (*s && !(((unsigned char)s[0]) & 0x7F)) {
|
while (*s && !(((uint8_t)s[0]) & 0x7F)) {
|
||||||
*s = toupper((unsigned char)*s);
|
*s = toupper((uint8_t)*s);
|
||||||
s++;
|
s++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -784,7 +784,7 @@ size_t strlen_m(const char *s)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (*s && !(((unsigned char)s[0]) & 0x7F)) {
|
while (*s && !(((uint8_t)s[0]) & 0x7F)) {
|
||||||
s++;
|
s++;
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
@ -841,8 +841,8 @@ char *binary_string(char *buf, int len)
|
|||||||
return NULL;
|
return NULL;
|
||||||
for (j=i=0;i<len;i++) {
|
for (j=i=0;i<len;i++) {
|
||||||
s[j] = '\\';
|
s[j] = '\\';
|
||||||
s[j+1] = hex[((unsigned char)buf[i]) >> 4];
|
s[j+1] = hex[((uint8_t)buf[i]) >> 4];
|
||||||
s[j+2] = hex[((unsigned char)buf[i]) & 0xF];
|
s[j+2] = hex[((uint8_t)buf[i]) & 0xF];
|
||||||
j += 3;
|
j += 3;
|
||||||
}
|
}
|
||||||
s[j] = 0;
|
s[j] = 0;
|
||||||
@ -1210,7 +1210,7 @@ size_t strhex_to_str(char *p, size_t len, const char *strhex)
|
|||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
size_t num_chars = 0;
|
size_t num_chars = 0;
|
||||||
unsigned char lonybble, hinybble;
|
uint8_t lonybble, hinybble;
|
||||||
const char *hexchars = "0123456789ABCDEF";
|
const char *hexchars = "0123456789ABCDEF";
|
||||||
char *p1 = NULL, *p2 = NULL;
|
char *p1 = NULL, *p2 = NULL;
|
||||||
|
|
||||||
@ -1302,7 +1302,7 @@ DATA_BLOB base64_decode_data_blob(const char *s)
|
|||||||
{
|
{
|
||||||
int bit_offset, byte_offset, idx, i, n;
|
int bit_offset, byte_offset, idx, i, n;
|
||||||
DATA_BLOB decoded = data_blob(s, strlen(s)+1);
|
DATA_BLOB decoded = data_blob(s, strlen(s)+1);
|
||||||
unsigned char *d = decoded.data;
|
uint8_t *d = decoded.data;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
n=i=0;
|
n=i=0;
|
||||||
@ -1357,7 +1357,7 @@ char * base64_encode_data_blob(DATA_BLOB data)
|
|||||||
char *result = malloc(output_len); /* get us plenty of space */
|
char *result = malloc(output_len); /* get us plenty of space */
|
||||||
|
|
||||||
while (len-- && out_cnt < (data.length * 2) - 5) {
|
while (len-- && out_cnt < (data.length * 2) - 5) {
|
||||||
int c = (unsigned char) *(data.data++);
|
int c = (uint8_t) *(data.data++);
|
||||||
bits += c;
|
bits += c;
|
||||||
char_count++;
|
char_count++;
|
||||||
if (char_count == 3) {
|
if (char_count == 3) {
|
||||||
|
@ -306,7 +306,7 @@ int x_fgetc(XFILE *f)
|
|||||||
return EOF;
|
return EOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = *(unsigned char *)(f->next);
|
ret = *(uint8_t *)(f->next);
|
||||||
f->next++;
|
f->next++;
|
||||||
f->bufused--;
|
f->bufused--;
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -1100,7 +1100,7 @@ static void dump_binary(const char *field, struct berval **values)
|
|||||||
for (i=0; values[i]; i++) {
|
for (i=0; values[i]; i++) {
|
||||||
printf("%s: ", field);
|
printf("%s: ", field);
|
||||||
for (j=0; j<values[i]->bv_len; j++) {
|
for (j=0; j<values[i]->bv_len; j++) {
|
||||||
printf("%02X", (unsigned char)values[i]->bv_val[j]);
|
printf("%02X", (uint8_t)values[i]->bv_val[j]);
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
@ -178,7 +178,7 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx,
|
|||||||
DATA_BLOB *user_sess_key,
|
DATA_BLOB *user_sess_key,
|
||||||
DATA_BLOB *lm_sess_key)
|
DATA_BLOB *lm_sess_key)
|
||||||
{
|
{
|
||||||
static const unsigned char zeros[8];
|
static const uint8_t zeros[8];
|
||||||
if (nt_pw == NULL) {
|
if (nt_pw == NULL) {
|
||||||
DEBUG(3,("ntlm_password_check: NO NT password stored for user %s.\n",
|
DEBUG(3,("ntlm_password_check: NO NT password stored for user %s.\n",
|
||||||
username));
|
username));
|
||||||
@ -232,7 +232,7 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx,
|
|||||||
DEBUG(4,("ntlm_password_check: checking plaintext passwords for user %s\n",
|
DEBUG(4,("ntlm_password_check: checking plaintext passwords for user %s\n",
|
||||||
username));
|
username));
|
||||||
if (nt_pw && nt_response->length) {
|
if (nt_pw && nt_response->length) {
|
||||||
unsigned char pwhash[16];
|
uint8_t pwhash[16];
|
||||||
mdfour(pwhash, nt_response->data, nt_response->length);
|
mdfour(pwhash, nt_response->data, nt_response->length);
|
||||||
if (memcmp(pwhash, nt_pw, sizeof(pwhash)) == 0) {
|
if (memcmp(pwhash, nt_pw, sizeof(pwhash)) == 0) {
|
||||||
return NT_STATUS_OK;
|
return NT_STATUS_OK;
|
||||||
@ -255,7 +255,7 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx,
|
|||||||
/* Only the fisrt 14 chars are considered, password need not be null terminated. */
|
/* Only the fisrt 14 chars are considered, password need not be null terminated. */
|
||||||
|
|
||||||
/* we *might* need to upper-case the string here */
|
/* we *might* need to upper-case the string here */
|
||||||
E_P16((const unsigned char *)dospwd, p16);
|
E_P16((const uint8_t *)dospwd, p16);
|
||||||
|
|
||||||
if (memcmp(p16, lm_pw, sizeof(p16)) == 0) {
|
if (memcmp(p16, lm_pw, sizeof(p16)) == 0) {
|
||||||
return NT_STATUS_OK;
|
return NT_STATUS_OK;
|
||||||
|
@ -171,13 +171,13 @@ typedef struct ntlmssp_state
|
|||||||
char recv_sign_key[16];
|
char recv_sign_key[16];
|
||||||
char recv_seal_key[16];
|
char recv_seal_key[16];
|
||||||
|
|
||||||
unsigned char send_sign_hash[258];
|
uint8_t send_sign_hash[258];
|
||||||
unsigned char send_seal_hash[258];
|
uint8_t send_seal_hash[258];
|
||||||
unsigned char recv_sign_hash[258];
|
uint8_t recv_sign_hash[258];
|
||||||
unsigned char recv_seal_hash[258];
|
uint8_t recv_seal_hash[258];
|
||||||
|
|
||||||
/* ntlmv1 */
|
/* ntlmv1 */
|
||||||
unsigned char ntlmssp_hash[258];
|
uint8_t ntlmssp_hash[258];
|
||||||
|
|
||||||
/* it turns out that we don't always get the
|
/* it turns out that we don't always get the
|
||||||
response in at the time we want to process it.
|
response in at the time we want to process it.
|
||||||
|
@ -27,16 +27,16 @@
|
|||||||
#define SRV_SIGN "session key to server-to-client signing key magic constant"
|
#define SRV_SIGN "session key to server-to-client signing key magic constant"
|
||||||
#define SRV_SEAL "session key to server-to-client sealing key magic constant"
|
#define SRV_SEAL "session key to server-to-client sealing key magic constant"
|
||||||
|
|
||||||
static void NTLMSSPcalc_ap( unsigned char *hash, unsigned char *data, int len)
|
static void NTLMSSPcalc_ap( uint8_t *hash, uint8_t *data, int len)
|
||||||
{
|
{
|
||||||
unsigned char index_i = hash[256];
|
uint8_t index_i = hash[256];
|
||||||
unsigned char index_j = hash[257];
|
uint8_t index_j = hash[257];
|
||||||
int ind;
|
int ind;
|
||||||
|
|
||||||
for (ind = 0; ind < len; ind++)
|
for (ind = 0; ind < len; ind++)
|
||||||
{
|
{
|
||||||
unsigned char tc;
|
uint8_t tc;
|
||||||
unsigned char t;
|
uint8_t t;
|
||||||
|
|
||||||
index_i++;
|
index_i++;
|
||||||
index_j += hash[index_i];
|
index_j += hash[index_i];
|
||||||
@ -53,19 +53,19 @@ static void NTLMSSPcalc_ap( unsigned char *hash, unsigned char *data, int len)
|
|||||||
hash[257] = index_j;
|
hash[257] = index_j;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void calc_hash(unsigned char hash[258], const char *key, size_t key_len)
|
static void calc_hash(uint8_t hash[258], const char *key, size_t key_len)
|
||||||
{
|
{
|
||||||
unsigned char j = 0;
|
uint8_t j = 0;
|
||||||
int ind;
|
int ind;
|
||||||
|
|
||||||
for (ind = 0; ind < 256; ind++)
|
for (ind = 0; ind < 256; ind++)
|
||||||
{
|
{
|
||||||
hash[ind] = (unsigned char)ind;
|
hash[ind] = (uint8_t)ind;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ind = 0; ind < 256; ind++)
|
for (ind = 0; ind < 256; ind++)
|
||||||
{
|
{
|
||||||
unsigned char tc;
|
uint8_t tc;
|
||||||
|
|
||||||
j += (hash[ind] + key[ind%key_len]);
|
j += (hash[ind] + key[ind%key_len]);
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ static void calc_hash(unsigned char hash[258], const char *key, size_t key_len)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void calc_ntlmv2_hash(unsigned char hash[258], unsigned char subkey[16],
|
static void calc_ntlmv2_hash(uint8_t hash[258], uint8_t subkey[16],
|
||||||
DATA_BLOB session_key,
|
DATA_BLOB session_key,
|
||||||
const char *constant)
|
const char *constant)
|
||||||
{
|
{
|
||||||
@ -365,7 +365,7 @@ NTSTATUS ntlmssp_unseal_packet(NTLMSSP_STATE *ntlmssp_state,
|
|||||||
*/
|
*/
|
||||||
NTSTATUS ntlmssp_sign_init(NTLMSSP_STATE *ntlmssp_state)
|
NTSTATUS ntlmssp_sign_init(NTLMSSP_STATE *ntlmssp_state)
|
||||||
{
|
{
|
||||||
unsigned char p24[24];
|
uint8_t p24[24];
|
||||||
ZERO_STRUCT(p24);
|
ZERO_STRUCT(p24);
|
||||||
|
|
||||||
DEBUG(3, ("NTLMSSP Sign/Seal - Initialising with flags:\n"));
|
DEBUG(3, ("NTLMSSP Sign/Seal - Initialising with flags:\n"));
|
||||||
|
@ -348,7 +348,7 @@ NTSTATUS cli_close(struct cli_tree *tree, int fnum)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
NTSTATUS cli_locktype(struct cli_tree *tree, int fnum,
|
NTSTATUS cli_locktype(struct cli_tree *tree, int fnum,
|
||||||
uint32_t offset, uint32_t len, int timeout,
|
uint32_t offset, uint32_t len, int timeout,
|
||||||
unsigned char locktype)
|
uint8_t locktype)
|
||||||
{
|
{
|
||||||
union smb_lock parms;
|
union smb_lock parms;
|
||||||
struct smb_lock_entry lock[1];
|
struct smb_lock_entry lock[1];
|
||||||
|
@ -98,7 +98,7 @@ static BOOL signing_good(struct cli_request *req, BOOL good)
|
|||||||
************************************************************/
|
************************************************************/
|
||||||
static void cli_request_simple_sign_outgoing_message(struct cli_request *req)
|
static void cli_request_simple_sign_outgoing_message(struct cli_request *req)
|
||||||
{
|
{
|
||||||
unsigned char calc_md5_mac[16];
|
uint8_t calc_md5_mac[16];
|
||||||
struct MD5Context md5_ctx;
|
struct MD5Context md5_ctx;
|
||||||
struct smb_basic_signing_context *data = req->transport->negotiate.sign_info.signing_context;
|
struct smb_basic_signing_context *data = req->transport->negotiate.sign_info.signing_context;
|
||||||
|
|
||||||
@ -150,9 +150,9 @@ static void cli_request_simple_sign_outgoing_message(struct cli_request *req)
|
|||||||
static BOOL cli_request_simple_check_incoming_message(struct cli_request *req)
|
static BOOL cli_request_simple_check_incoming_message(struct cli_request *req)
|
||||||
{
|
{
|
||||||
BOOL good;
|
BOOL good;
|
||||||
unsigned char calc_md5_mac[16];
|
uint8_t calc_md5_mac[16];
|
||||||
unsigned char server_sent_mac[8];
|
uint8_t server_sent_mac[8];
|
||||||
unsigned char sequence_buf[8];
|
uint8_t sequence_buf[8];
|
||||||
struct MD5Context md5_ctx;
|
struct MD5Context md5_ctx;
|
||||||
struct smb_basic_signing_context *data = req->transport->negotiate.sign_info.signing_context;
|
struct smb_basic_signing_context *data = req->transport->negotiate.sign_info.signing_context;
|
||||||
const size_t offset_end_of_sig = (HDR_SS_FIELD + 8);
|
const size_t offset_end_of_sig = (HDR_SS_FIELD + 8);
|
||||||
|
@ -258,7 +258,7 @@ static void dohash(char *out, char *in, char *key, int forw)
|
|||||||
permute(out, rl, perm6, 64);
|
permute(out, rl, perm6, 64);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void str_to_key(const unsigned char *str,unsigned char *key)
|
static void str_to_key(const uint8_t *str,uint8_t *key)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -276,13 +276,13 @@ static void str_to_key(const unsigned char *str,unsigned char *key)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void smbhash(unsigned char *out, const unsigned char *in, const unsigned char *key, int forw)
|
void smbhash(uint8_t *out, const uint8_t *in, const uint8_t *key, int forw)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char outb[64];
|
char outb[64];
|
||||||
char inb[64];
|
char inb[64];
|
||||||
char keyb[64];
|
char keyb[64];
|
||||||
unsigned char key2[8];
|
uint8_t key2[8];
|
||||||
|
|
||||||
str_to_key(key, key2);
|
str_to_key(key, key2);
|
||||||
|
|
||||||
@ -304,53 +304,53 @@ void smbhash(unsigned char *out, const unsigned char *in, const unsigned char *k
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void E_P16(const unsigned char *p14,unsigned char *p16)
|
void E_P16(const uint8_t *p14,uint8_t *p16)
|
||||||
{
|
{
|
||||||
unsigned const char sp8[8] = {0x4b, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25};
|
unsigned const char sp8[8] = {0x4b, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25};
|
||||||
smbhash(p16, sp8, p14, 1);
|
smbhash(p16, sp8, p14, 1);
|
||||||
smbhash(p16+8, sp8, p14+7, 1);
|
smbhash(p16+8, sp8, p14+7, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void E_P24(const unsigned char *p21, const unsigned char *c8, unsigned char *p24)
|
void E_P24(const uint8_t *p21, const uint8_t *c8, uint8_t *p24)
|
||||||
{
|
{
|
||||||
smbhash(p24, c8, p21, 1);
|
smbhash(p24, c8, p21, 1);
|
||||||
smbhash(p24+8, c8, p21+7, 1);
|
smbhash(p24+8, c8, p21+7, 1);
|
||||||
smbhash(p24+16, c8, p21+14, 1);
|
smbhash(p24+16, c8, p21+14, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void D_P16(const unsigned char *p14, const unsigned char *in, unsigned char *out)
|
void D_P16(const uint8_t *p14, const uint8_t *in, uint8_t *out)
|
||||||
{
|
{
|
||||||
smbhash(out, in, p14, 0);
|
smbhash(out, in, p14, 0);
|
||||||
smbhash(out+8, in+8, p14+7, 0);
|
smbhash(out+8, in+8, p14+7, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void E_old_pw_hash( unsigned char *p14, const unsigned char *in, unsigned char *out)
|
void E_old_pw_hash( uint8_t *p14, const uint8_t *in, uint8_t *out)
|
||||||
{
|
{
|
||||||
smbhash(out, in, p14, 1);
|
smbhash(out, in, p14, 1);
|
||||||
smbhash(out+8, in+8, p14+7, 1);
|
smbhash(out+8, in+8, p14+7, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cred_hash1(unsigned char *out, const unsigned char *in, const unsigned char *key)
|
void cred_hash1(uint8_t *out, const uint8_t *in, const uint8_t *key)
|
||||||
{
|
{
|
||||||
unsigned char buf[8];
|
uint8_t buf[8];
|
||||||
|
|
||||||
smbhash(buf, in, key, 1);
|
smbhash(buf, in, key, 1);
|
||||||
smbhash(out, buf, key+9, 1);
|
smbhash(out, buf, key+9, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cred_hash2(unsigned char *out, const unsigned char *in, const unsigned char *key, int forw)
|
void cred_hash2(uint8_t *out, const uint8_t *in, const uint8_t *key, int forw)
|
||||||
{
|
{
|
||||||
unsigned char buf[8];
|
uint8_t buf[8];
|
||||||
unsigned char key2[8];
|
uint8_t key2[8];
|
||||||
ZERO_STRUCT(key2);
|
ZERO_STRUCT(key2);
|
||||||
smbhash(buf, in, key, forw);
|
smbhash(buf, in, key, forw);
|
||||||
key2[0] = key[7];
|
key2[0] = key[7];
|
||||||
smbhash(out, buf, key2, forw);
|
smbhash(out, buf, key2, forw);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cred_hash3(unsigned char *out, unsigned char *in, const unsigned char *key, int forw)
|
void cred_hash3(uint8_t *out, uint8_t *in, const uint8_t *key, int forw)
|
||||||
{
|
{
|
||||||
unsigned char key2[8];
|
uint8_t key2[8];
|
||||||
ZERO_STRUCT(key2);
|
ZERO_STRUCT(key2);
|
||||||
smbhash(out, in, key, forw);
|
smbhash(out, in, key, forw);
|
||||||
key2[0] = key[7];
|
key2[0] = key[7];
|
||||||
@ -358,20 +358,20 @@ void cred_hash3(unsigned char *out, unsigned char *in, const unsigned char *key,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SamOEMhashBlob(unsigned char *data, int len, const DATA_BLOB *key)
|
void SamOEMhashBlob(uint8_t *data, int len, const DATA_BLOB *key)
|
||||||
{
|
{
|
||||||
unsigned char s_box[256];
|
uint8_t s_box[256];
|
||||||
unsigned char index_i = 0;
|
uint8_t index_i = 0;
|
||||||
unsigned char index_j = 0;
|
uint8_t index_j = 0;
|
||||||
unsigned char j = 0;
|
uint8_t j = 0;
|
||||||
int ind;
|
int ind;
|
||||||
|
|
||||||
for (ind = 0; ind < 256; ind++) {
|
for (ind = 0; ind < 256; ind++) {
|
||||||
s_box[ind] = (unsigned char)ind;
|
s_box[ind] = (uint8_t)ind;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ind = 0; ind < 256; ind++) {
|
for (ind = 0; ind < 256; ind++) {
|
||||||
unsigned char tc;
|
uint8_t tc;
|
||||||
|
|
||||||
j += (s_box[ind] + key->data[ind%key->length]);
|
j += (s_box[ind] + key->data[ind%key->length]);
|
||||||
|
|
||||||
@ -380,8 +380,8 @@ void SamOEMhashBlob(unsigned char *data, int len, const DATA_BLOB *key)
|
|||||||
s_box[j] = tc;
|
s_box[j] = tc;
|
||||||
}
|
}
|
||||||
for (ind = 0; ind < len; ind++) {
|
for (ind = 0; ind < len; ind++) {
|
||||||
unsigned char tc;
|
uint8_t tc;
|
||||||
unsigned char t;
|
uint8_t t;
|
||||||
|
|
||||||
index_i++;
|
index_i++;
|
||||||
index_j += s_box[index_i];
|
index_j += s_box[index_i];
|
||||||
@ -399,7 +399,7 @@ void SamOEMhashBlob(unsigned char *data, int len, const DATA_BLOB *key)
|
|||||||
a varient that assumes a 16 byte key. This should be removed
|
a varient that assumes a 16 byte key. This should be removed
|
||||||
when the last user is gone
|
when the last user is gone
|
||||||
*/
|
*/
|
||||||
void SamOEMhash(unsigned char *data, const unsigned char keystr[16], int len)
|
void SamOEMhash(uint8_t *data, const uint8_t keystr[16], int len)
|
||||||
{
|
{
|
||||||
DATA_BLOB key = data_blob(keystr, 16);
|
DATA_BLOB key = data_blob(keystr, 16);
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ void E_md4hash(const char *passwd, uchar p16[16])
|
|||||||
/* Calculate length in bytes */
|
/* Calculate length in bytes */
|
||||||
len = strlen_w(wpwd) * sizeof(int16_t);
|
len = strlen_w(wpwd) * sizeof(int16_t);
|
||||||
|
|
||||||
mdfour(p16, (unsigned char *)wpwd, len);
|
mdfour(p16, (uint8_t *)wpwd, len);
|
||||||
ZERO_STRUCT(wpwd);
|
ZERO_STRUCT(wpwd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ BOOL E_deshash(const char *passwd, uchar p16[16])
|
|||||||
push_ascii(dospwd, passwd, sizeof(dospwd), STR_UPPER|STR_TERMINATE);
|
push_ascii(dospwd, passwd, sizeof(dospwd), STR_UPPER|STR_TERMINATE);
|
||||||
|
|
||||||
/* Only the fisrt 14 chars are considered, password need not be null terminated. */
|
/* Only the fisrt 14 chars are considered, password need not be null terminated. */
|
||||||
E_P16((const unsigned char *)dospwd, p16);
|
E_P16((const uint8_t *)dospwd, p16);
|
||||||
|
|
||||||
if (strlen(dospwd) > 14) {
|
if (strlen(dospwd) > 14) {
|
||||||
ret = False;
|
ret = False;
|
||||||
@ -170,8 +170,8 @@ BOOL ntv2_owf_gen(const uchar owf[16],
|
|||||||
domain_byte_len = domain_byte_len - 2;
|
domain_byte_len = domain_byte_len - 2;
|
||||||
|
|
||||||
hmac_md5_init_limK_to_64(owf, 16, &ctx);
|
hmac_md5_init_limK_to_64(owf, 16, &ctx);
|
||||||
hmac_md5_update((const unsigned char *)user, user_byte_len, &ctx);
|
hmac_md5_update((const uint8_t *)user, user_byte_len, &ctx);
|
||||||
hmac_md5_update((const unsigned char *)domain, domain_byte_len, &ctx);
|
hmac_md5_update((const uint8_t *)domain, domain_byte_len, &ctx);
|
||||||
hmac_md5_final(kr_buf, &ctx);
|
hmac_md5_final(kr_buf, &ctx);
|
||||||
|
|
||||||
#ifdef DEBUG_PASSWORD
|
#ifdef DEBUG_PASSWORD
|
||||||
@ -247,7 +247,7 @@ void SMBsesskeygen_ntv2(const uchar kr[16],
|
|||||||
|
|
||||||
hmac_md5_init_limK_to_64(kr, 16, &ctx);
|
hmac_md5_init_limK_to_64(kr, 16, &ctx);
|
||||||
hmac_md5_update(nt_resp, 16, &ctx);
|
hmac_md5_update(nt_resp, 16, &ctx);
|
||||||
hmac_md5_final((unsigned char *)sess_key, &ctx);
|
hmac_md5_final((uint8_t *)sess_key, &ctx);
|
||||||
|
|
||||||
#ifdef DEBUG_PASSWORD
|
#ifdef DEBUG_PASSWORD
|
||||||
DEBUG(100, ("SMBsesskeygen_ntv2:\n"));
|
DEBUG(100, ("SMBsesskeygen_ntv2:\n"));
|
||||||
@ -260,7 +260,7 @@ void SMBsesskeygen_ntv1(const uchar kr[16], uint8_t sess_key[16])
|
|||||||
/* yes, this session key does not change - yes, this
|
/* yes, this session key does not change - yes, this
|
||||||
is a problem - but it is 128 bits */
|
is a problem - but it is 128 bits */
|
||||||
|
|
||||||
mdfour((unsigned char *)sess_key, kr, 16);
|
mdfour((uint8_t *)sess_key, kr, 16);
|
||||||
|
|
||||||
#ifdef DEBUG_PASSWORD
|
#ifdef DEBUG_PASSWORD
|
||||||
DEBUG(100, ("SMBsesskeygen_ntv1:\n"));
|
DEBUG(100, ("SMBsesskeygen_ntv1:\n"));
|
||||||
@ -443,7 +443,7 @@ BOOL encode_pw_buffer(char buffer[516], const char *password, int string_flags)
|
|||||||
|
|
||||||
memcpy(&buffer[512 - new_pw_len], new_pw, new_pw_len);
|
memcpy(&buffer[512 - new_pw_len], new_pw, new_pw_len);
|
||||||
|
|
||||||
generate_random_buffer((unsigned char *)buffer, 512 - new_pw_len, False);
|
generate_random_buffer((uint8_t *)buffer, 512 - new_pw_len, False);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The length of the new password is in the last 4 bytes of
|
* The length of the new password is in the last 4 bytes of
|
||||||
|
@ -37,7 +37,7 @@ static void mark_packet_signed(struct request_context *req)
|
|||||||
static void calc_signature(uint8_t *buffer, size_t length,
|
static void calc_signature(uint8_t *buffer, size_t length,
|
||||||
DATA_BLOB *mac_key, uint8_t signature[8])
|
DATA_BLOB *mac_key, uint8_t signature[8])
|
||||||
{
|
{
|
||||||
unsigned char calc_md5_mac[16];
|
uint8_t calc_md5_mac[16];
|
||||||
struct MD5Context md5_ctx;
|
struct MD5Context md5_ctx;
|
||||||
|
|
||||||
MD5Init(&md5_ctx);
|
MD5Init(&md5_ctx);
|
||||||
@ -106,7 +106,7 @@ static void req_signing_alloc_seq_num(struct request_context *req)
|
|||||||
*/
|
*/
|
||||||
BOOL req_signing_check_incoming(struct request_context *req)
|
BOOL req_signing_check_incoming(struct request_context *req)
|
||||||
{
|
{
|
||||||
unsigned char client_md5_mac[8], signature[8];
|
uint8_t client_md5_mac[8], signature[8];
|
||||||
|
|
||||||
switch (req->smb->signing.signing_state) {
|
switch (req->smb->signing.signing_state) {
|
||||||
case SMB_SIGNING_OFF:
|
case SMB_SIGNING_OFF:
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
int fnum;
|
int fnum;
|
||||||
unsigned char level;
|
uint8_t level;
|
||||||
int count;
|
int count;
|
||||||
} break_info;
|
} break_info;
|
||||||
|
|
||||||
|
@ -120,9 +120,9 @@ static BOOL test_sourcedata(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i=0;i<len;i++) {
|
for (i=0;i<len;i++) {
|
||||||
unsigned char *v = (unsigned char *)data_out;
|
uint8_t *v = (uint8_t *)data_out;
|
||||||
if (v[i] != (i & 0xFF)) {
|
if (v[i] != (i & 0xFF)) {
|
||||||
printf("bad data 0x%x at %d\n", (unsigned char)data_out[i], i);
|
printf("bad data 0x%x at %d\n", (uint8_t)data_out[i], i);
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -688,11 +688,11 @@ static BOOL test_ntlm_in_both(struct samlogon_state *samlogon_state, char **erro
|
|||||||
|
|
||||||
SMBNTencrypt(samlogon_state->password, samlogon_state->chall.data,
|
SMBNTencrypt(samlogon_state->password, samlogon_state->chall.data,
|
||||||
nt_response.data);
|
nt_response.data);
|
||||||
E_md4hash(samlogon_state->password, (unsigned char *)nt_hash);
|
E_md4hash(samlogon_state->password, (uint8_t *)nt_hash);
|
||||||
SMBsesskeygen_ntv1((const unsigned char *)nt_hash,
|
SMBsesskeygen_ntv1((const uint8_t *)nt_hash,
|
||||||
session_key.data);
|
session_key.data);
|
||||||
|
|
||||||
E_deshash(samlogon_state->password, (unsigned char *)lm_hash);
|
E_deshash(samlogon_state->password, (uint8_t *)lm_hash);
|
||||||
|
|
||||||
nt_status = check_samlogon(samlogon_state,
|
nt_status = check_samlogon(samlogon_state,
|
||||||
BREAK_NONE,
|
BREAK_NONE,
|
||||||
|
@ -452,7 +452,7 @@ static BOOL test_SetUserPassEx(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
|
|||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
generate_random_buffer((unsigned char *)confounder, 16, False);
|
generate_random_buffer((uint8_t *)confounder, 16, False);
|
||||||
|
|
||||||
MD5Init(&ctx);
|
MD5Init(&ctx);
|
||||||
MD5Update(&ctx, confounder, 16);
|
MD5Update(&ctx, confounder, 16);
|
||||||
@ -506,7 +506,7 @@ static BOOL test_SetUserPass_25(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
|
|||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
generate_random_buffer((unsigned char *)confounder, 16, False);
|
generate_random_buffer((uint8_t *)confounder, 16, False);
|
||||||
|
|
||||||
MD5Init(&ctx);
|
MD5Init(&ctx);
|
||||||
MD5Update(&ctx, confounder, 16);
|
MD5Update(&ctx, confounder, 16);
|
||||||
|
@ -64,7 +64,7 @@ static unsigned pull_netlogon_string(struct netlogon_string *ret,const char *d)
|
|||||||
ZERO_STRUCTP(ret);
|
ZERO_STRUCTP(ret);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
unsigned len = (unsigned char)*p;
|
unsigned len = (uint8_t)*p;
|
||||||
p++;
|
p++;
|
||||||
|
|
||||||
if (len > 0 && len != 0xc0) {
|
if (len > 0 && len != 0xc0) {
|
||||||
|
@ -239,7 +239,7 @@ static NTSTATUS rpc_join_oldstyle_internals(const DOM_SID *domain_sid, struct cl
|
|||||||
int argc, const char **argv) {
|
int argc, const char **argv) {
|
||||||
|
|
||||||
fstring trust_passwd;
|
fstring trust_passwd;
|
||||||
unsigned char orig_trust_passwd_hash[16];
|
uint8_t orig_trust_passwd_hash[16];
|
||||||
NTSTATUS result;
|
NTSTATUS result;
|
||||||
|
|
||||||
fstrcpy(trust_passwd, lp_netbios_name());
|
fstrcpy(trust_passwd, lp_netbios_name());
|
||||||
|
@ -80,7 +80,7 @@ static void usage(void)
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
turn a node status flags field into a string
|
turn a node status flags field into a string
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static char *node_status_flags(unsigned char flags)
|
static char *node_status_flags(uint8_t flags)
|
||||||
{
|
{
|
||||||
static fstring ret;
|
static fstring ret;
|
||||||
fstrcpy(ret,"");
|
fstrcpy(ret,"");
|
||||||
|
@ -45,11 +45,11 @@ static const char *workstation;
|
|||||||
static const char *hex_challenge;
|
static const char *hex_challenge;
|
||||||
static const char *hex_lm_response;
|
static const char *hex_lm_response;
|
||||||
static const char *hex_nt_response;
|
static const char *hex_nt_response;
|
||||||
static unsigned char *challenge;
|
static uint8_t *challenge;
|
||||||
static size_t challenge_len;
|
static size_t challenge_len;
|
||||||
static unsigned char *lm_response;
|
static uint8_t *lm_response;
|
||||||
static size_t lm_response_len;
|
static size_t lm_response_len;
|
||||||
static unsigned char *nt_response;
|
static uint8_t *nt_response;
|
||||||
static size_t nt_response_len;
|
static size_t nt_response_len;
|
||||||
|
|
||||||
static char *password;
|
static char *password;
|
||||||
@ -393,7 +393,7 @@ enum {
|
|||||||
Routine to set hex password characters into an allocated array.
|
Routine to set hex password characters into an allocated array.
|
||||||
**************************************************************/
|
**************************************************************/
|
||||||
|
|
||||||
static void hex_encode(const unsigned char *buff_in, size_t len, char **out_hex_buffer)
|
static void hex_encode(const uint8_t *buff_in, size_t len, char **out_hex_buffer)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *hex_buffer;
|
char *hex_buffer;
|
||||||
@ -410,12 +410,12 @@ static void hex_encode(const unsigned char *buff_in, size_t len, char **out_hex_
|
|||||||
into a 16 byte array.
|
into a 16 byte array.
|
||||||
**************************************************************/
|
**************************************************************/
|
||||||
|
|
||||||
static BOOL hex_decode(const char *hex_buf_in, unsigned char **out_buffer, size_t *size)
|
static BOOL hex_decode(const char *hex_buf_in, uint8_t **out_buffer, size_t *size)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
size_t hex_buf_in_len = strlen(hex_buf_in);
|
size_t hex_buf_in_len = strlen(hex_buf_in);
|
||||||
unsigned char partial_byte_hex;
|
uint8_t partial_byte_hex;
|
||||||
unsigned char partial_byte;
|
uint8_t partial_byte;
|
||||||
const char *hexchars = "0123456789ABCDEF";
|
const char *hexchars = "0123456789ABCDEF";
|
||||||
char *p;
|
char *p;
|
||||||
BOOL high = True;
|
BOOL high = True;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user