Returns a const char of length 8 bytes.
****************************************************************************/
-static const uint8 *get_ntlm_challenge(struct auth_context *auth_context)
+static const uint8_t *get_ntlm_challenge(struct auth_context *auth_context)
{
DATA_BLOB challenge = data_blob(NULL, 0);
const char *challenge_set_by = NULL;
struct auth_methods *auth_method_list;
TALLOC_CTX *mem_ctx;
- const uint8 *(*get_ntlm_challenge)(struct auth_context *auth_context);
+ const uint8_t *(*get_ntlm_challenge)(struct auth_context *auth_context);
NTSTATUS (*check_ntlm_password)(const struct auth_context *auth_context,
const struct auth_usersupplied_info *user_info,
struct auth_serversupplied_info **server_info);
* @return an 8 byte random challenge
*/
-static const uint8 *auth_ntlmssp_get_challenge(const struct ntlmssp_state *ntlmssp_state)
+static const uint8_t *auth_ntlmssp_get_challenge(const struct ntlmssp_state *ntlmssp_state)
{
AUTH_NTLMSSP_STATE *auth_ntlmssp_state = ntlmssp_state->auth_context;
return auth_ntlmssp_state->auth_context->get_ntlm_challenge(auth_ntlmssp_state->auth_context);
TALLOC_CTX *mem_ctx,
const char *username,
uint16_t acct_flags,
- const uint8 lm_pw[16], const uint8 nt_pw[16],
+ const uint8_t lm_pw[16], const uint8_t nt_pw[16],
const auth_usersupplied_info *user_info,
DATA_BLOB *user_sess_key,
DATA_BLOB *lm_sess_key)
NTSTATUS nt_status;
DATA_BLOB user_sess_key = data_blob(NULL, 0);
DATA_BLOB lm_sess_key = data_blob(NULL, 0);
- uint8 *lm_pwd, *nt_pwd;
+ uint8_t *lm_pwd, *nt_pwd;
const char *attrs[] = {"unicodePwd", "lmPwdHash", "ntPwdHash",
"userAccountControl",
BOOL make_user_info_for_reply(auth_usersupplied_info **user_info,
const char *smb_name,
const char *client_domain,
- const uint8 chal[8],
+ const uint8_t chal[8],
DATA_BLOB plaintext_password)
{
static NTSTATUS get_info3_from_ndr(TALLOC_CTX *mem_ctx, struct winbindd_response *response, NET_USER_INFO_3 *info3)
{
- uint8 *info3_ndr;
+ uint8_t *info3_ndr;
size_t len = response->length - sizeof(response);
prs_struct ps;
if (len > 0) {
AC_CHECK_TYPE(ssize_t, int)
AC_CHECK_TYPE(wchar_t, unsigned short)
AC_CHECK_TYPE(uint_t, unsigned int)
+AC_CHECK_TYPE(int8_t, signed char)
+AC_CHECK_TYPE(uint8_t, unsigned char)
AC_CHECK_TYPE(int16_t, short)
AC_CHECK_TYPE(uint16_t, unsigned short)
AC_CHECK_TYPE(int32_t, long)
};
typedef struct {
- uint8 *data;
+ uint8_t *data;
size_t length;
off_t ofs;
struct nesting *nesting;
enum {ETYPE_NONE, ETYPE_DOS, ETYPE_NT, ETYPE_SOCKET, ETYPE_NBT} etype;
union {
struct {
- uint8 eclass;
+ uint8_t eclass;
uint16_t ecode;
} dos;
NTSTATUS nt_status;
struct {
/* a oplock break request handler */
BOOL (*handler)(struct cli_transport *transport,
- uint16_t tid, uint16_t fnum, uint8 level, void *private);
+ uint16_t tid, uint16_t fnum, uint8_t level, void *private);
/* private data passed to the oplock handler */
void *private;
} oplock;
as signed and unsigned int will work.
*/
-#ifndef uint8
-#define uint8 unsigned char
+#if !defined(int8)
+#define int8 int8_t
+#endif
+
+#if !defined(uint8)
+#define uint8 uint8_t
#endif
#if !defined(int16)
/* structure for storing machine account password
(ie. when samba server is member of a domain */
struct machine_acct_pass {
- uint8 hash[16];
+ uint8_t hash[16];
time_t mod_time;
};
/* used to hold an arbitrary blob of data */
typedef struct data_blob {
- uint8 *data;
+ uint8_t *data;
size_t length;
void (*free)(struct data_blob *data_blob);
} DATA_BLOB;
uint32_t ea_size;
uint_t num_eas;
struct ea_struct {
- uint8 flags;
+ uint8_t flags;
WIRE_STRING name;
DATA_BLOB value;
} *eas;
uint32_t nlink;
WIRE_STRING fname;
WIRE_STRING alt_fname;
- uint8 delete_pending;
- uint8 directory;
+ uint8_t delete_pending;
+ uint8_t directory;
uint64_t compressed_size;
uint16_t format;
- uint8 unit_shift;
- uint8 chunk_shift;
- uint8 cluster_shift;
+ uint8_t unit_shift;
+ uint8_t chunk_shift;
+ uint8_t cluster_shift;
uint64_t file_id;
uint32_t access_flags; /* seen 0x001f01ff from w2k3 */
uint64_t position;
uint64_t alloc_size;
uint64_t size;
uint32_t nlink;
- uint8 delete_pending;
- uint8 directory;
+ uint8_t delete_pending;
+ uint8_t directory;
uint32_t ea_size;
WIRE_STRING fname;
} out;
struct {
uint64_t compressed_size;
uint16_t format;
- uint8 unit_shift;
- uint8 chunk_shift;
- uint8 cluster_shift;
+ uint8_t unit_shift;
+ uint8_t chunk_shift;
+ uint8_t cluster_shift;
} out;
} compression_info;
union setfileinfo_file file;
struct {
- uint8 overwrite;
+ uint8_t overwrite;
uint32_t root_fid;
const char *new_name;
} in;
uint32_t open_disposition;
uint32_t create_options;
uint32_t impersonation;
- uint8 security_flags;
+ uint8_t security_flags;
const char *fname;
} in;
struct {
- uint8 oplock_level;
+ uint8_t oplock_level;
uint16_t fnum;
uint32_t create_action;
NTTIME create_time;
uint64_t size;
uint16_t file_type;
uint16_t ipc_state;
- uint8 is_directory;
+ uint8_t is_directory;
} out;
} ntcreatex, generic;
uint16_t restart_idx;
struct {
time_t time;
- uint8 status;
+ uint8_t status;
uint16_t job;
uint32_t size;
char *user;
uint32_t function;
uint16_t fnum;
BOOL fsctl;
- uint8 filter;
+ uint8_t filter;
} in;
struct {
DATA_BLOB blob;
struct {
uint16_t max_param;
uint16_t max_data;
- uint8 max_setup;
+ uint8_t max_setup;
uint16_t flags;
uint32_t timeout;
- uint8 setup_count;
+ uint8_t setup_count;
uint16_t *setup;
const char *trans_name; /* SMBtrans only */
DATA_BLOB params;
} in;
struct {
- uint8 setup_count;
+ uint8_t setup_count;
uint16_t *setup;
DATA_BLOB params;
DATA_BLOB data;
/* struct for nttransact2 call */
struct smb_nttrans {
struct {
- uint8 max_setup;
+ uint8_t max_setup;
uint32_t max_param;
uint32_t max_data;
uint32_t setup_count;
} in;
struct {
- uint8 setup_count;
+ uint8_t setup_count;
uint16_t *setup;
DATA_BLOB params;
DATA_BLOB data;
return reg_key_get_value_by_name(k, valname, val);
}
-WERROR reg_key_set_subkey_val(REG_KEY *key, const char *subname, const char *valname, uint32_t type, uint8 *data, int real_len)
+WERROR reg_key_set_subkey_val(REG_KEY *key, const char *subname, const char *valname, uint32_t type, uint8_t *data, int real_len)
{
REG_KEY *k;
REG_VAL *v;
size_t tdb_pack(TDB_CONTEXT *tdb, char *buf, int bufsize, const char *fmt, ...)
{
va_list ap;
- uint8 bt;
+ uint8_t bt;
uint16_t w;
uint32_t d;
int i;
switch ((c = *fmt++)) {
case 'b': /* unsigned 8-bit integer */
len = 1;
- bt = (uint8)va_arg(ap, int);
+ bt = (uint8_t)va_arg(ap, int);
if (bufsize && bufsize >= len)
SSVAL(buf, 0, bt);
break;
int tdb_unpack(TDB_CONTEXT *tdb, char *buf, int bufsize, const char *fmt, ...)
{
va_list ap;
- uint8 *bt;
+ uint8_t *bt;
uint16_t *w;
uint32_t *d;
int len;
switch ((c=*fmt++)) {
case 'b':
len = 1;
- bt = va_arg(ap, uint8 *);
+ bt = va_arg(ap, uint8_t *);
if (bufsize < len)
goto no_space;
*bt = SVAL(buf, 0);
create a unix date (int GMT) from a dos date (which is actually in
localtime)
********************************************************************/
-time_t pull_dos_date(const uint8 *date_ptr, int zone_offset)
+time_t pull_dos_date(const uint8_t *date_ptr, int zone_offset)
{
uint32_t dos_date=0;
struct tm t;
/*******************************************************************
like make_unix_date() but the words are reversed
********************************************************************/
-time_t pull_dos_date2(const uint8 *date_ptr, int zone_offset)
+time_t pull_dos_date2(const uint8_t *date_ptr, int zone_offset)
{
uint32_t x,x2;
create a unix GMT date from a dos date in 32 bit "unix like" format
these generally arrive as localtimes, with corresponding DST
******************************************************************/
-time_t pull_dos_date3(const uint8 *date_ptr, int zone_offset)
+time_t pull_dos_date3(const uint8_t *date_ptr, int zone_offset)
{
time_t t = (time_t)IVAL(date_ptr,0);
if (!null_mtime(t)) {
/*******************************************************************
Check if ACE has OBJECT type.
********************************************************************/
-BOOL sec_ace_object(uint8 type)
+BOOL sec_ace_object(uint8_t type)
{
if (type == SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT ||
type == SEC_ACE_TYPE_ACCESS_DENIED_OBJECT ||
at startup either via mmap() or read() from the lib directory */
static smb_ucs2_t *upcase_table;
static smb_ucs2_t *lowcase_table;
-static uint8 *valid_table;
+static uint8_t *valid_table;
/*******************************************************************
static int mapped_file;
int i;
const char *allowed = ".!#$%&'()_-@^`~";
- uint8 *valid_file;
+ uint8_t *valid_file;
TALLOC_CTX *mem_ctx;
if (mapped_file) {
uint32_t i1;
uint16_t i2;
uint16_t i3;
- uint8 s[8];
+ uint8_t s[8];
};
static void dump_guid(const char *field, struct berval **values)
const char *mechs[] = {OID_NTLMSSP, NULL};
DATA_BLOB msg1;
DATA_BLOB blob, chal1, chal2, auth;
- uint8 challenge[8];
- uint8 nthash[24], lmhash[24], sess_key[16];
+ uint8_t challenge[8];
+ uint8_t nthash[24], lmhash[24], sess_key[16];
uint32_t neg_flags;
struct berval cred, *scred;
ADS_STATUS status;
struct berval *scred;
int i=0;
int gss_rc, rc;
- uint8 *p;
+ uint8_t *p;
uint32_t max_msg_size;
char *sname;
unsigned sec_layer;
gss_release_buffer(&minor_status, &input_token);
- p = (uint8 *)output_token.value;
+ p = (uint8_t *)output_token.value;
file_save("sasl_gssapi.dat", output_token.value, output_token.length);
static void creds_init(struct creds_CredentialState *creds,
const struct netr_Credential *client_challenge,
const struct netr_Credential *server_challenge,
- const uint8 machine_password[16])
+ const uint8_t machine_password[16])
{
struct netr_Credential time_cred;
uint32_t sum[2];
- uint8 sum2[8];
+ uint8_t sum2[8];
dump_data_pw("Client chall", client_challenge->data, sizeof(client_challenge->data));
dump_data_pw("Server chall", server_challenge->data, sizeof(server_challenge->data));
void creds_client_init(struct creds_CredentialState *creds,
const struct netr_Credential *client_challenge,
const struct netr_Credential *server_challenge,
- const uint8 machine_password[16],
+ const uint8_t machine_password[16],
struct netr_Credential *initial_credential)
{
creds->sequence = time(NULL);
void creds_server_init(struct creds_CredentialState *creds,
const struct netr_Credential *client_challenge,
const struct netr_Credential *server_challenge,
- const uint8 machine_password[16],
+ const uint8_t machine_password[16],
struct netr_Credential *initial_credential)
{
creds_init(creds, client_challenge, server_challenge, machine_password);
*/
struct creds_CredentialState {
- uint8 session_key[8];
+ uint8_t session_key[8];
uint32_t sequence;
struct netr_Credential seed;
struct netr_Credential client;
const char *username,
const char *client_username,
const char *client_domain,
- const uint8 *lm_pw, const uint8 *nt_pw,
+ const uint8_t *lm_pw, const uint8_t *nt_pw,
DATA_BLOB *user_sess_key,
DATA_BLOB *lm_sess_key)
{
so use it only if we otherwise allow LM authentication */
if (lp_lanman_auth() && lm_pw) {
- uint8 first_8_lm_hash[16];
+ uint8_t first_8_lm_hash[16];
memcpy(first_8_lm_hash, lm_pw, 8);
memset(first_8_lm_hash + 8, '\0', 8);
*lm_sess_key = data_blob(first_8_lm_hash, 16);
if (smb_pwd_check_ntlmv1(lm_response,
lm_pw, challenge,
NULL)) {
- uint8 first_8_lm_hash[16];
+ uint8_t first_8_lm_hash[16];
memcpy(first_8_lm_hash, lm_pw, 8);
memset(first_8_lm_hash + 8, '\0', 8);
*user_sess_key = data_blob(first_8_lm_hash, 16);
allow LM authentication */
if (lp_lanman_auth() && lm_pw) {
- uint8 first_8_lm_hash[16];
+ uint8_t first_8_lm_hash[16];
memcpy(first_8_lm_hash, lm_pw, 8);
memset(first_8_lm_hash + 8, '\0', 8);
*user_sess_key = data_blob(first_8_lm_hash, 16);
*
*/
-static const uint8 *get_challenge(const struct ntlmssp_state *ntlmssp_state)
+static const uint8_t *get_challenge(const struct ntlmssp_state *ntlmssp_state)
{
static uchar chal[8];
generate_random_buffer(chal, sizeof(chal), False);
uint32_t neg_flags = 0;
uint32_t ntlmssp_command, chal_flags;
char *cliname=NULL, *domname=NULL;
- const uint8 *cryptkey;
+ const uint8_t *cryptkey;
const char *target_name;
/* parse the NTLMSSP packet */
the password-derived key */
if (ntlmssp_state->neg_flags & NTLMSSP_NEGOTIATE_KEY_EXCH) {
/* Make up a new session key */
- uint8 client_session_key[16];
+ uint8_t client_session_key[16];
generate_random_buffer(client_session_key, sizeof(client_session_key), False);
/* Encrypt the new session key with the old one */
* @return 8 bytes of challnege data, determined by the server to be the challenge for NTLM authentication
*
*/
- const uint8 *(*get_challenge)(const struct ntlmssp_state *ntlmssp_state);
+ const uint8_t *(*get_challenge)(const struct ntlmssp_state *ntlmssp_state);
/**
* Callback to find if the challenge used by NTLM authentication may be modified
int i, n;
va_list ap;
char *s;
- uint8 *b;
+ uint8_t *b;
int head_size=0, data_size=0;
int head_ofs, data_ofs;
data_size += (str_charnum(s) * 2) + 4;
break;
case 'B':
- b = va_arg(ap, uint8 *);
+ b = va_arg(ap, uint8_t *);
head_size += 8;
data_size += va_arg(ap, int);
break;
case 'b':
- b = va_arg(ap, uint8 *);
+ b = va_arg(ap, uint8_t *);
head_size += va_arg(ap, int);
break;
case 'd':
break;
case 'B':
- b = va_arg(ap, uint8 *);
+ b = va_arg(ap, uint8_t *);
n = va_arg(ap, int);
SSVAL(blob->data, head_ofs, n); head_ofs += 2;
SSVAL(blob->data, head_ofs, n); head_ofs += 2;
SIVAL(blob->data, head_ofs, n); head_ofs += 4;
break;
case 'b':
- b = va_arg(ap, uint8 *);
+ b = va_arg(ap, uint8_t *);
n = va_arg(ap, int);
memcpy(blob->data + head_ofs, b, n);
head_ofs += n;
/* if odd length and unicode */
return False;
}
- if (blob->data + ptr < (uint8 *)ptr || blob->data + ptr < blob->data)
+ if (blob->data + ptr < (uint8_t *)ptr || blob->data + ptr < blob->data)
return False;
if (0 < len1) {
return False;
}
- if (blob->data + ptr < (uint8 *)ptr || blob->data + ptr < blob->data)
+ if (blob->data + ptr < (uint8_t *)ptr || blob->data + ptr < blob->data)
return False;
if (0 < len1) {
return False;
}
- if (blob->data + ptr < (uint8 *)ptr || blob->data + ptr < blob->data)
+ if (blob->data + ptr < (uint8_t *)ptr || blob->data + ptr < blob->data)
return False;
*b = data_blob_talloc(mem_ctx, blob->data + ptr, len1);
len1 = va_arg(ap, unsigned);
/* make sure its in the right format - be strict */
NEED_DATA(len1);
- if (blob->data + head_ofs < (uint8 *)head_ofs || blob->data + head_ofs < blob->data)
+ if (blob->data + head_ofs < (uint8_t *)head_ofs || blob->data + head_ofs < blob->data)
return False;
*b = data_blob_talloc(mem_ctx, blob->data + head_ofs, len1);
case 'C':
s = va_arg(ap, char *);
- if (blob->data + head_ofs < (uint8 *)head_ofs || blob->data + head_ofs < blob->data)
+ if (blob->data + head_ofs < (uint8_t *)head_ofs || blob->data + head_ofs < blob->data)
return False;
head_ofs += pull_string(NULL, p, blob->data+head_ofs, sizeof(p),
create an schannel context state
*/
NTSTATUS schannel_start(struct schannel_state **state,
- uint8 session_key[16],
+ uint8_t session_key[16],
BOOL initiator)
{
TALLOC_CTX *mem_ctx;
struct schannel_state {
TALLOC_CTX *mem_ctx;
- uint8 session_key[16];
+ uint8_t session_key[16];
uint32_t seq_num;
BOOL initiator;
DATA_BLOB signature;
for (i=0,k=0;
i<in->length;
i += 8, k += 7) {
- uint8 bin[8], bout[8], key[7];
+ uint8_t bin[8], bout[8], key[7];
memset(bin, 0, 8);
memcpy(bin, &in->data[i], MIN(8, in->length-i));
uint32_t CreatFlags, uint32_t DesiredAccess,
uint32_t FileAttributes, uint32_t ShareAccess,
uint32_t CreateDisposition, uint32_t CreateOptions,
- uint8 SecurityFlags)
+ uint8_t SecurityFlags)
{
union smb_open open_parms;
TALLOC_CTX *mem_ctx;
generate a negTokenInit packet given a GUID, a list of supported
OIDs (the mechanisms) and a principal name string
*/
-DATA_BLOB spnego_gen_negTokenInit(uint8 guid[16],
+DATA_BLOB spnego_gen_negTokenInit(uint8_t guid[16],
const char *OIDs[],
const char *principal)
{
/*
generate a krb5 GSS-API wrapper packet given a ticket
*/
-DATA_BLOB spnego_gen_krb5_wrap(DATA_BLOB ticket, const uint8 tok_id[2])
+DATA_BLOB spnego_gen_krb5_wrap(DATA_BLOB ticket, const uint8_t tok_id[2])
{
ASN1_DATA data;
DATA_BLOB ret;
/*
parse a krb5 GSS-API wrapper packet giving a ticket
*/
-BOOL spnego_parse_krb5_wrap(DATA_BLOB blob, DATA_BLOB *ticket, uint8 tok_id[2])
+BOOL spnego_parse_krb5_wrap(DATA_BLOB blob, DATA_BLOB *ticket, uint8_t tok_id[2])
{
BOOL ret;
ASN1_DATA data;
{
ASN1_DATA data;
DATA_BLOB ret;
- uint8 negResult;
+ uint8_t negResult;
if (NT_STATUS_IS_OK(nt_status)) {
negResult = SPNEGO_NEG_RESULT_ACCEPT;
DATA_BLOB *auth)
{
ASN1_DATA data;
- uint8 negResult;
+ uint8_t negResult;
if (NT_STATUS_IS_OK(nt_status)) {
negResult = SPNEGO_NEG_RESULT_ACCEPT;
struct smb_query_secdesc *query)
{
struct smb_nttrans nt;
- uint8 params[8];
+ uint8_t params[8];
nt.in.max_setup = 0;
nt.in.max_param = 4;
struct smb_set_secdesc *set)
{
struct smb_nttrans nt;
- uint8 params[8];
+ uint8_t params[8];
struct ndr_push *ndr;
struct cli_request *req;
NTSTATUS status;
This takes GMT time and puts local time for zone_offset in the buffer
********************************************************************/
void raw_push_dos_date(struct cli_transport *transport,
- uint8 *buf, int offset, time_t unixdate)
+ uint8_t *buf, int offset, time_t unixdate)
{
push_dos_date(buf, offset, unixdate, transport->negotiate.server_zone);
}
convert a dos date
********************************************************************/
time_t raw_pull_dos_date(struct cli_transport *transport,
- const uint8 *date_ptr)
+ const uint8_t *date_ptr)
{
return pull_dos_date(date_ptr, transport->negotiate.server_zone);
}
like raw_pull_dos_date() but the words are reversed
********************************************************************/
time_t raw_pull_dos_date2(struct cli_transport *transport,
- const uint8 *date_ptr)
+ const uint8_t *date_ptr)
{
return pull_dos_date2(date_ptr, transport->negotiate.server_zone);
}
these arrive in server zone, with corresponding DST
******************************************************************/
time_t raw_pull_dos_date3(struct cli_transport *transport,
- const uint8 *date_ptr)
+ const uint8_t *date_ptr)
{
return pull_dos_date3(date_ptr, transport->negotiate.server_zone);
}
TALLOC_CTX *mem_ctx,
struct ea_struct *ea)
{
- uint8 nlen;
+ uint8_t nlen;
uint16_t vlen;
if (blob->length < 6) {
setup a SMB packet at transport level
*/
struct cli_request *cli_request_setup_transport(struct cli_transport *transport,
- uint8 command, unsigned wct, unsigned buflen)
+ uint8_t command, unsigned wct, unsigned buflen)
{
struct cli_request *req;
way. This interface is used before a session is setup.
*/
struct cli_request *cli_request_setup_session(struct cli_session *session,
- uint8 command, unsigned wct, unsigned buflen)
+ uint8_t command, unsigned wct, unsigned buflen)
{
struct cli_request *req;
uint16_t flags2;
setup a request for tree based commands
*/
struct cli_request *cli_request_setup(struct cli_tree *tree,
- uint8 command,
+ uint8_t command,
unsigned wct, unsigned buflen)
{
struct cli_request *req;
if (transport->oplock.handler) {
uint16_t tid = SVAL(hdr, HDR_TID);
uint16_t fnum = SVAL(vwv,VWV(2));
- uint8 level = CVAL(vwv,VWV(3)+1);
+ uint8_t level = CVAL(vwv,VWV(3)+1);
transport->oplock.handler(transport, tid, fnum, level, transport->oplock.private);
}
size_t cli_req_append_ascii4(struct cli_request *req, const char *str, unsigned flags)
{
size_t size;
- cli_req_append_bytes(req, (const uint8 *)"\4", 1);
+ cli_req_append_bytes(req, (const uint8_t *)"\4", 1);
size = cli_req_append_string(req, str, flags);
return size + 1;
}
append raw bytes into the data portion of the request packet
return the number of bytes added
*/
-size_t cli_req_append_bytes(struct cli_request *req, const uint8 *bytes, size_t byte_len)
+size_t cli_req_append_bytes(struct cli_request *req, const uint8_t *bytes, size_t byte_len)
{
cli_req_grow_allocation(req, byte_len + req->out.data_size);
memcpy(req->out.data + req->out.data_size, bytes, byte_len);
append variable block (type 5 buffer) into the data portion of the request packet
return the number of bytes added
*/
-size_t cli_req_append_var_block(struct cli_request *req, const uint8 *bytes, uint16_t byte_len)
+size_t cli_req_append_var_block(struct cli_request *req, const uint8_t *bytes, uint16_t byte_len)
{
cli_req_grow_allocation(req, byte_len + 3 + req->out.data_size);
SCVAL(req->out.data + req->out.data_size, 0, 5);
****************************************************************************/
struct cli_request *smb_raw_trans_send_backend(struct cli_tree *tree,
struct smb_trans2 *parms,
- uint8 command)
+ uint8_t command)
{
int wct = 14 + parms->in.setup_count;
struct cli_request *req;
{
if (data->has_error) return False;
if (data->length < data->ofs+len) {
- uint8 *newp;
+ uint8_t *newp;
newp = Realloc(data->data, data->ofs+len);
if (!newp) {
SAFE_FREE(data->data);
return True;
}
-/* useful fn for writing a uint8 */
-BOOL asn1_write_uint8(ASN1_DATA *data, uint8 v)
+/* useful fn for writing a uint8_t */
+BOOL asn1_write_uint8(ASN1_DATA *data, uint8_t v)
{
return asn1_write(data, &v, 1);
}
/* push a tag onto the asn1 data buffer. Used for nested structures */
-BOOL asn1_push_tag(ASN1_DATA *data, uint8 tag)
+BOOL asn1_push_tag(ASN1_DATA *data, uint8_t tag)
{
struct nesting *nesting;
/* check a BOOLEAN */
BOOL asn1_check_BOOLEAN(ASN1_DATA *data, BOOL v)
{
- uint8 b = 0;
+ uint8_t b = 0;
asn1_read_uint8(data, &b);
if (b != ASN1_BOOLEAN) {
return True;
}
-/* read a uint8 from a ASN1 buffer */
-BOOL asn1_read_uint8(ASN1_DATA *data, uint8 *v)
+/* read a uint8_t from a ASN1 buffer */
+BOOL asn1_read_uint8(ASN1_DATA *data, uint8_t *v)
{
return asn1_read(data, v, 1);
}
/* start reading a nested asn1 structure */
-BOOL asn1_start_tag(ASN1_DATA *data, uint8 tag)
+BOOL asn1_start_tag(ASN1_DATA *data, uint8_t tag)
{
- uint8 b;
+ uint8_t b;
struct nesting *nesting;
if (!asn1_read_uint8(data, &b))
/* read an object ID from a ASN1 buffer */
BOOL asn1_read_OID(ASN1_DATA *data, char **OID)
{
- uint8 b;
+ uint8_t b;
pstring aoid;
fstring el;
/* read an interger */
BOOL asn1_read_Integer(ASN1_DATA *data, int *i)
{
- uint8 b;
+ uint8_t b;
*i = 0;
if (!asn1_start_tag(data, ASN1_INTEGER)) return False;
/* check a enumarted value is correct */
BOOL asn1_check_enumerated(ASN1_DATA *data, int v)
{
- uint8 b;
+ uint8_t b;
if (!asn1_start_tag(data, ASN1_ENUMERATED)) return False;
asn1_read_uint8(data, &b);
asn1_end_tag(data);
}
/* write an enumarted value to the stream */
-BOOL asn1_write_enumerated(ASN1_DATA *data, uint8 v)
+BOOL asn1_write_enumerated(ASN1_DATA *data, uint8_t v)
{
if (!asn1_push_tag(data, ASN1_ENUMERATED)) return False;
asn1_write_uint8(data, v);
/* Return the DOS error from the last packet - an error class and an error
code. */
-void cli_dos_error(struct cli_state *cli, uint8 *eclass, uint32_t *ecode)
+void cli_dos_error(struct cli_state *cli, uint8_t *eclass, uint32_t *ecode)
{
if (cli->transport->error.etype == ETYPE_DOS) {
ntstatus_to_dos(cli->transport->error.e.nt_status,
/* NT status -> dos error map */
static const struct {
- uint8 dos_class;
+ uint8_t dos_class;
uint32_t dos_code;
NTSTATUS ntstatus;
} ntstatus_to_dos_map[] = {
/* dos -> nt status error map */
static const struct {
- uint8 dos_class;
+ uint8_t dos_class;
uint32_t dos_code;
NTSTATUS ntstatus;
} dos_to_ntstatus_map[] = {
/*****************************************************************************
convert a dos eclas/ecode to a NT status32 code
*****************************************************************************/
-NTSTATUS dos_to_ntstatus(uint8 eclass, uint32_t ecode)
+NTSTATUS dos_to_ntstatus(uint8_t eclass, uint32_t ecode)
{
int i;
if (eclass == 0 && ecode == 0) return NT_STATUS_OK;
/*****************************************************************************
convert a NT status code to a dos class/code
*****************************************************************************/
-void ntstatus_to_dos(NTSTATUS ntstatus, uint8 *eclass, uint32_t *ecode)
+void ntstatus_to_dos(NTSTATUS ntstatus, uint8_t *eclass, uint32_t *ecode)
{
int i;
if (NT_STATUS_IS_OK(ntstatus)) {
}
void SMBsesskeygen_ntv2(const uchar kr[16],
- const uchar * nt_resp, uint8 sess_key[16])
+ const uchar * nt_resp, uint8_t sess_key[16])
{
/* a very nice, 128 bit, variable session key */
#endif
}
-void SMBsesskeygen_ntv1(const uchar kr[16], uint8 sess_key[16])
+void SMBsesskeygen_ntv1(const uchar kr[16], uint8_t sess_key[16])
{
/* yes, this session key does not change - yes, this
is a problem - but it is 128 bits */
void SMBsesskeygen_lm_sess_key(const uchar lm_hash[16],
const uchar lm_resp[24], /* only uses 8 */
- uint8 sess_key[16])
+ uint8_t sess_key[16])
{
/* Calculate the LM session key (effective length 40 bits,
but changes with each session) */
static const struct {
- uint8 class;
+ uint8_t class;
const char *class_name;
const struct err_code_struct *err_msgs;
} err_classes[] = {
/* return a dos error string given a error class and error code */
-const char *dos_errstr(uint8 class, uint16_t code)
+const char *dos_errstr(uint8_t class, uint16_t code)
{
static char *msg;
int i, j;
/*
parse a uint8
*/
-NTSTATUS ndr_pull_uint8(struct ndr_pull *ndr, uint8 *v)
+NTSTATUS ndr_pull_uint8(struct ndr_pull *ndr, uint8_t *v)
{
NDR_PULL_NEED_BYTES(ndr, 1);
*v = CVAL(ndr->data, ndr->offset);
/*
push a uint8
*/
-NTSTATUS ndr_push_uint8(struct ndr_push *ndr, uint8 v)
+NTSTATUS ndr_push_uint8(struct ndr_push *ndr, uint8_t v)
{
NDR_PUSH_NEED_BYTES(ndr, 1);
SCVAL(ndr->data, ndr->offset, v);
ndr->print(ndr, "%s: struct %s", name, type);
}
-void ndr_print_uint8(struct ndr_print *ndr, const char *name, uint8 v)
+void ndr_print_uint8(struct ndr_print *ndr, const char *name, uint8_t v)
{
ndr->print(ndr, "%-25s: 0x%02x (%u)", name, v, v);
}
}
void ndr_print_array_uint8(struct ndr_print *ndr, const char *name,
- const uint8 *data, uint32_t count)
+ const uint8_t *data, uint32_t count)
{
int i;
const char *username,
const char *password,
int chan_type,
- uint8 new_session_key[8])
+ uint8_t new_session_key[8])
{
NTSTATUS status;
struct dcerpc_pipe *p2;
struct netr_ServerReqChallenge r;
struct netr_ServerAuthenticate2 a;
- uint8 mach_pwd[16];
+ uint8_t mach_pwd[16];
struct creds_CredentialState creds;
const char *workgroup, *workstation;
uint32_t negotiate_flags = 0;
const char *uuid, unsigned version,
const char *domain,
const char *username,
- const uint8 session_key[8])
+ const uint8_t session_key[8])
{
NTSTATUS status;
- uint8 full_session_key[16];
+ uint8_t full_session_key[16];
struct schannel_state *schannel_state;
const char *workgroup, *workstation;
const char *password)
{
NTSTATUS status;
- uint8 session_key[8];
+ uint8_t session_key[8];
status = dcerpc_schannel_key(p, domain, username, password,
lp_server_role() == ROLE_DOMAIN_BDC? SEC_CHAN_BDC:SEC_CHAN_WKSTA,
a handler for oplock break events from the server - these need to be passed
along to the client
*/
-static BOOL oplock_handler(struct cli_transport *transport, uint16_t tid, uint16_t fnum, uint8 level, void *p_private)
+static BOOL oplock_handler(struct cli_transport *transport, uint16_t tid, uint16_t fnum, uint8_t level, void *p_private)
{
struct cvfs_private *private = p_private;
allocate a new rpc handle
*/
struct dcesrv_handle *dcesrv_handle_new(struct dcesrv_connection *dce_conn,
- uint8 handle_type)
+ uint8_t handle_type)
{
TALLOC_CTX *mem_ctx;
struct dcesrv_handle *h;
*/
struct dcesrv_handle *dcesrv_handle_fetch(struct dcesrv_connection *dce_conn,
struct policy_handle *p,
- uint8 handle_type)
+ uint8_t handle_type)
{
struct dcesrv_handle *h;
uint32_t *out_flags)
{
void *sam_ctx;
- uint8 *mach_pwd;
+ uint8_t *mach_pwd;
uint16_t acct_flags;
int num_records;
struct ldb_message **msgs;
}
NTSTATUS samdb_result_passwords(TALLOC_CTX *mem_ctx, struct ldb_message *msg,
- uint8 **lm_pwd, uint8 **nt_pwd)
+ uint8_t **lm_pwd, uint8_t **nt_pwd)
{
const char *unicodePwd = samdb_result_string(msg, "unicodePwd", NULL);
static void get_challenge(struct server_context *smb, char buff[8])
{
NTSTATUS nt_status;
- const uint8 *cryptkey;
+ const uint8_t *cryptkey;
/* muliple negprots are not premitted */
if (smb->negotiate.auth_context) {
static DATA_BLOB negprot_spnego(struct server_context *smb)
{
DATA_BLOB blob;
- uint8 guid[16];
+ uint8_t guid[16];
const char *OIDs_krb5[] = {OID_KERBEROS5,
OID_KERBEROS5_OLD,
OID_NTLMSSP,
union smb_ioctl nt;
uint32_t function;
uint16_t fnum;
- uint8 filter;
+ uint8_t filter;
BOOL fsctl;
DATA_BLOB *blob;
****************************************************************************/
void reply_special(struct request_context *req)
{
- uint8 msg_type;
+ uint8_t msg_type;
char buf[4];
msg_type = CVAL(req->in.buffer,0);
construct and send an error packet with a forced DOS error code
this is needed to match win2000 behaviour for some parts of the protocol
*/
-void req_reply_dos_error(struct request_context *req, uint8 eclass, uint16_t ecode)
+void req_reply_dos_error(struct request_context *req, uint8_t eclass, uint16_t ecode)
{
/* if the basic packet hasn't been setup yet then do it now */
if (req->out.buffer == NULL) {
if (!lp_nt_status_support() || !(req->smb->negotiate.client_caps & CAP_STATUS32)) {
/* convert to DOS error codes */
- uint8 eclass;
+ uint8_t eclass;
uint32_t ecode;
ntstatus_to_dos(status, &eclass, &ecode);
req_reply_dos_error(req, eclass, ecode);
return the number of bytes added
*/
size_t req_append_bytes(struct request_context *req,
- const uint8 *bytes, size_t byte_len)
+ const uint8_t *bytes, size_t byte_len)
{
req_grow_allocation(req, byte_len + req->out.data_size);
memcpy(req->out.data + req->out.data_size, bytes, byte_len);
return the number of bytes added
*/
size_t req_append_var_block(struct request_context *req,
- const uint8 *bytes, uint16_t byte_len)
+ const uint8_t *bytes, uint16_t byte_len)
{
req_grow_allocation(req, byte_len + 3 + req->out.data_size);
SCVAL(req->out.data + req->out.data_size, 0, 5);
p += req_append_bytes(req, file->search.search_id.data, 21);
p += req_append_bytes(req, (char*)&file->search.attrib, 1);
- srv_push_dos_date3(req->smb, (uint8 *)&dos_date, 0, file->search.write_time);
+ srv_push_dos_date3(req->smb, (uint8_t *)&dos_date, 0, file->search.write_time);
p += req_append_bytes(req, (char*)&dos_date, 4);
p += req_append_bytes(req, (char*)&file->search.size, 4);
memset(&search_name[0], ' ', 13);
/*
calculate the signature for a message
*/
-static void calc_signature(uint8 *buffer, size_t length,
- DATA_BLOB *mac_key, uint8 signature[8])
+static void calc_signature(uint8_t *buffer, size_t length,
+ DATA_BLOB *mac_key, uint8_t signature[8])
{
unsigned char calc_md5_mac[16];
struct MD5Context md5_ctx;
/*
send an oplock break request to a client
*/
-BOOL req_send_oplock_break(struct tcon_context *conn, uint16_t fnum, uint8 level)
+BOOL req_send_oplock_break(struct tcon_context *conn, uint16_t fnum, uint8_t level)
{
struct request_context *req;
/****************************************************************************
return a string containing the function name of a SMB command
****************************************************************************/
-static const char *smb_fn_name(uint8 type)
+static const char *smb_fn_name(uint8_t type)
{
const char *unknown_name = "SMBunknown";
****************************************************************************/
static void construct_reply(struct request_context *req)
{
- uint8 type = CVAL(req->in.hdr,HDR_COM);
+ uint8_t type = CVAL(req->in.hdr,HDR_COM);
/* see if its a special NBT packet */
if (CVAL(req->in.buffer,0) != 0) {
This takes GMT time and puts local time for zone_offset in the buffer
********************************************************************/
void srv_push_dos_date(struct server_context *smb_server,
- uint8 *buf, int offset, time_t unixdate)
+ uint8_t *buf, int offset, time_t unixdate)
{
push_dos_date(buf, offset, unixdate, smb_server->negotiate.zone_offset);
}
convert a dos date
********************************************************************/
time_t srv_pull_dos_date(struct server_context *smb_server,
- const uint8 *date_ptr)
+ const uint8_t *date_ptr)
{
return pull_dos_date(date_ptr, smb_server->negotiate.zone_offset);
}
like srv_pull_dos_date() but the words are reversed
********************************************************************/
time_t srv_pull_dos_date2(struct server_context *smb_server,
- const uint8 *date_ptr)
+ const uint8_t *date_ptr)
{
return pull_dos_date2(date_ptr, smb_server->negotiate.zone_offset);
}
these arrive in server zone, with corresponding DST
******************************************************************/
time_t srv_pull_dos_date3(struct server_context *smb_server,
- const uint8 *date_ptr)
+ const uint8_t *date_ptr)
{
return pull_dos_date3(date_ptr, smb_server->negotiate.zone_offset);
}
/****************************************************************************
Reply to an SMBtrans or SMBtrans2 request
****************************************************************************/
-void reply_trans_generic(struct request_context *req, uint8 command)
+void reply_trans_generic(struct request_context *req, uint8_t command)
{
struct smb_trans2 trans;
int i;
output(screen," sizeof(char): %d\n",sizeof(char));
output(screen," sizeof(int): %d\n",sizeof(int));
output(screen," sizeof(long): %d\n",sizeof(long));
- output(screen," sizeof(uint8): %d\n",sizeof(uint8));
+ output(screen," sizeof(uint8_t): %d\n",sizeof(uint8_t));
output(screen," sizeof(uint16_t): %d\n",sizeof(uint16_t));
output(screen," sizeof(uint32_t): %d\n",sizeof(uint32_t));
output(screen," sizeof(short): %d\n",sizeof(short));
smb_ucs2_t c2;
int c, len, fd;
int chars_allowed=0, alt_allowed=0;
- uint8 valid[0x10000];
+ uint8_t valid[0x10000];
printf("starting utable\n");
BOOL got_break;
uint16_t fnum;
uint16_t handle;
- uint8 level;
+ uint8_t level;
BOOL do_close;
} oplocks[NSERVERS][NINSTANCES];
#define BAD_HANDLE 0xFFFE
-static BOOL oplock_handler(struct cli_transport *transport, uint16_t tid, uint16_t fnum, uint8 level, void *private);
+static BOOL oplock_handler(struct cli_transport *transport, uint16_t tid, uint16_t fnum, uint8_t level, void *private);
static void idle_func(struct cli_transport *transport, void *private);
/*
/*
the oplock handler will either ack the break or close the file
*/
-static BOOL oplock_handler(struct cli_transport *transport, uint16_t tid, uint16_t fnum, uint8 level, void *private)
+static BOOL oplock_handler(struct cli_transport *transport, uint16_t tid, uint16_t fnum, uint8_t level, void *private)
{
union smb_close io;
NTSTATUS status;
/*
a handler function for oplock break requests
*/
-static BOOL oplock_handler(struct cli_transport *transport, uint16_t tid, uint16_t fnum, uint8 level, void *private)
+static BOOL oplock_handler(struct cli_transport *transport, uint16_t tid, uint16_t fnum, uint8_t level, void *private)
{
struct cli_tree *tree = private;
return cli_oplock_ack(tree, fnum, level);
/*
a handler function for oplock break requests
*/
-static BOOL oplock_handler_ack(struct cli_transport *transport, uint16_t tid, uint16_t fnum, uint8 level, void *private)
+static BOOL oplock_handler_ack(struct cli_transport *transport, uint16_t tid, uint16_t fnum, uint8_t level, void *private)
{
struct cli_tree *tree = private;
break_info.fnum = fnum;
/*
a handler function for oplock break requests - close the file
*/
-static BOOL oplock_handler_close(struct cli_transport *transport, uint16_t tid, uint16_t fnum, uint8 level, void *private)
+static BOOL oplock_handler_close(struct cli_transport *transport, uint16_t tid, uint16_t fnum, uint8_t level, void *private)
{
union smb_close io;
NTSTATUS status;
struct netr_ServerReqChallenge r;
struct netr_ServerAuthenticate a;
const char *plain_pass;
- uint8 mach_pwd[16];
+ uint8_t mach_pwd[16];
printf("Testing ServerReqChallenge\n");
struct netr_ServerReqChallenge r;
struct netr_ServerAuthenticate2 a;
const char *plain_pass;
- uint8 mach_pwd[16];
+ uint8_t mach_pwd[16];
printf("Testing ServerReqChallenge\n");
DATA_BLOB *chall,
DATA_BLOB *lm_response,
DATA_BLOB *nt_response,
- uint8 lm_key[8],
- uint8 user_session_key[16],
+ uint8_t lm_key[8],
+ uint8_t user_session_key[16],
char **error_string)
{
NTSTATUS status;
s2.in.level = lvl1; \
u = *q.out.info; \
if (lvl1 == 21) { \
- uint8 *bitmap = u.info21.logon_hours.bitmap; \
+ uint8_t *bitmap = u.info21.logon_hours.bitmap; \
ZERO_STRUCT(u.info21); \
if (fpval == SAMR_FIELD_LOGON_HOURS) { \
u.info21.logon_hours.units_per_week = 168; \
BOOL ret = True;
DATA_BLOB session_key;
DATA_BLOB confounded_session_key = data_blob_talloc(mem_ctx, NULL, 16);
- uint8 confounder[16];
+ uint8_t confounder[16];
char *newpass = samr_rand_pass(mem_ctx);
struct MD5Context ctx;
BOOL ret = True;
DATA_BLOB session_key;
DATA_BLOB confounded_session_key = data_blob_talloc(mem_ctx, NULL, 16);
- uint8 confounder[16];
+ uint8_t confounder[16];
char *newpass = samr_rand_pass(mem_ctx);
struct MD5Context ctx;
struct policy_handle user_handle;
char *oldpass = *password;
char *newpass = samr_rand_pass(mem_ctx);
- uint8 old_nt_hash[16], new_nt_hash[16];
- uint8 old_lm_hash[16], new_lm_hash[16];
+ uint8_t old_nt_hash[16], new_nt_hash[16];
+ uint8_t old_lm_hash[16], new_lm_hash[16];
status = test_OpenUser_byname(p, mem_ctx, handle, TEST_USERNAME, &user_handle);
if (!NT_STATUS_IS_OK(status)) {
struct samr_AsciiName server, account;
char *oldpass = *password;
char *newpass = samr_rand_pass(mem_ctx);
- uint8 old_lm_hash[16], new_lm_hash[16];
+ uint8_t old_lm_hash[16], new_lm_hash[16];
printf("Testing OemChangePasswordUser2\n");
struct samr_Hash nt_verifier, lm_verifier;
char *oldpass = *password;
char *newpass = samr_rand_pass(mem_ctx);
- uint8 old_nt_hash[16], new_nt_hash[16];
- uint8 old_lm_hash[16], new_lm_hash[16];
+ uint8_t old_nt_hash[16], new_nt_hash[16];
+ uint8_t old_lm_hash[16], new_lm_hash[16];
printf("Testing ChangePasswordUser2\n");
struct samr_Hash nt_verifier, lm_verifier;
char *oldpass = *password;
char *newpass = samr_rand_pass(mem_ctx);
- uint8 old_nt_hash[16], new_nt_hash[16];
- uint8 old_lm_hash[16], new_lm_hash[16];
+ uint8_t old_nt_hash[16], new_nt_hash[16];
+ uint8_t old_lm_hash[16], new_lm_hash[16];
printf("Testing ChangePasswordUser3\n");
/* check if the server produced the expected error code */
static BOOL check_error(int line, struct cli_state *c,
- uint8 eclass, uint32_t ecode, NTSTATUS nterr)
+ uint8_t eclass, uint32_t ecode, NTSTATUS nterr)
{
if (cli_is_dos_error(c->tree)) {
- uint8 class;
+ uint8_t class;
uint32_t num;
/* Check DOS error */
struct netlogon_string {
uint32_t comp_len;
char **component;
- uint8 extra_flag;
+ uint8_t extra_flag;
};
struct cldap_netlogon_reply {