write to a local file with CR/LF->LF translation if appropriate. return the
number taken from the buffer. This may not equal the number written.
****************************************************************************/
-static int writefile(int f, char *b, int n)
+static int writefile(int f, const void *_b, int n)
{
+ const uint8_t *b = _b;
int i;
if (!translation) {
read from a file with LF->CR/LF translation if appropriate. return the
number read. read approx n bytes.
****************************************************************************/
-static int readfile(char *b, int n, XFILE *f)
+static int readfile(void *_b, int n, XFILE *f)
{
+ uint8_t *b = _b;
int i;
int c;
{
int handle = 0, fnum;
BOOL newhandle = False;
- char *data;
+ uint8_t *data;
struct timeval tp_start;
int read_size = io_bufsize;
uint16_t attr;
DEBUG(2,("getting file %s of size %.0f as %s ",
rname, (double)size, lname));
- if(!(data = (char *)malloc(read_size))) {
+ if(!(data = (uint8_t *)malloc(read_size))) {
d_printf("malloc fail for size %d\n", read_size);
smbcli_close(cli->tree, fnum);
return 1;
XFILE *f;
size_t start = 0;
off_t nread = 0;
- char *buf = NULL;
+ uint8_t *buf = NULL;
int maxwrite = io_bufsize;
int rc = 0;
DEBUG(1,("putting file %s as %s ",lname,
rname));
- buf = (char *)malloc(maxwrite);
+ buf = (uint8_t *)malloc(maxwrite);
if (!buf) {
d_printf("ERROR: Not enough memory!\n");
return 1;
struct request_buffer {
/* the raw SMB buffer, including the 4 byte length header */
- char *buffer;
+ uint8_t *buffer;
/* the size of the raw buffer, including 4 byte header */
uint_t size;
uint_t allocated;
/* the start of the SMB header - this is always buffer+4 */
- char *hdr;
+ uint8_t *hdr;
/* the command words and command word count. vwv points
into the raw buffer */
- char *vwv;
+ uint8_t *vwv;
uint_t wct;
/* the data buffer and size. data points into the raw buffer */
- char *data;
+ uint8_t *data;
uint_t data_size;
/* ptr is used as a moving pointer into the data area
* variable in each function is that when a realloc of
* a send packet is done we need to move this
* pointer */
- char *ptr;
+ uint8_t *ptr;
};
#endif
uint16_t remaining;
} in;
struct {
- char *data;
+ uint8_t *data;
uint16_t remaining;
uint16_t compaction_mode;
uint16_t nread;
uint32_t timeout;
} in;
struct {
- char *data;
+ uint8_t *data;
uint32_t nread;
} out;
} readbraw;
uint16_t remaining;
} in;
struct {
- char *data;
+ uint8_t *data;
uint16_t nread;
} out;
} lockread;
uint16_t remaining;
} in;
struct {
- char *data;
+ uint8_t *data;
uint16_t nread;
} out;
} read;
uint16_t wmode;
uint16_t remaining;
uint32_t count;
- const char *data;
+ const uint8_t *data;
} in;
struct {
uint32_t nwritten;
uint16_t count;
uint32_t offset;
uint16_t remaining;
- const char *data;
+ const uint8_t *data;
} in;
struct {
uint32_t nwritten;
uint16_t count;
uint32_t offset;
uint16_t remaining;
- const char *data;
+ const uint8_t *data;
} in;
struct {
uint16_t nwritten;
uint16_t count;
uint32_t offset;
time_t mtime;
- const char *data;
+ const uint8_t *data;
} in;
struct {
uint16_t nwritten;
struct {
uint16_t fnum;
uint16_t count;
- const char *data;
+ const uint8_t *data;
} in;
} splwrite;
};
size_t nsent;
DATA_BLOB blob;
- blob.data = rec->ndone + (char *)&rec->header;
+ blob.data = rec->ndone + (uint8_t *)&rec->header;
blob.length = sizeof(rec->header) - rec->ndone;
status = socket_send(rec->sock, &blob, &nsent, 0);
put a dos date into a buffer (time/date format)
This takes GMT time and puts local time in the buffer
********************************************************************/
-void push_dos_date(char *buf, int offset, time_t unixdate, int zone_offset)
+void push_dos_date(uint8_t *buf, int offset, time_t unixdate, int zone_offset)
{
uint32_t x = make_dos_date(unixdate, zone_offset);
SIVAL(buf,offset,x);
put a dos date into a buffer (date/time format)
This takes GMT time and puts local time in the buffer
********************************************************************/
-void push_dos_date2(char *buf,int offset,time_t unixdate, int zone_offset)
+void push_dos_date2(uint8_t *buf,int offset,time_t unixdate, int zone_offset)
{
uint32_t x;
x = make_dos_date(unixdate, zone_offset);
GMT and converts it to LOCAL time before putting it (most SMBs assume
localtime for this sort of date)
********************************************************************/
-void push_dos_date3(char *buf,int offset,time_t unixdate, int zone_offset)
+void push_dos_date3(uint8_t *buf,int offset,time_t unixdate, int zone_offset)
{
if (!null_time(unixdate)) {
unixdate -= zone_offset;
/*
put a NTTIME into a packet
*/
-void push_nttime(void *base, uint16_t offset, NTTIME t)
+void push_nttime(uint8_t *base, uint16_t offset, NTTIME t)
{
SBVAL(base, offset, t);
}
/*
pull a NTTIME from a packet
*/
-NTTIME pull_nttime(void *base, uint16_t offset)
+NTTIME pull_nttime(uint8_t *base, uint16_t offset)
{
NTTIME ret = BVAL(base, offset);
return ret;
req = smbcli_request_setup(tree, SMBsendtxt, 1, 0);
SSVAL(req->out.vwv, VWV(0), grp);
- smbcli_req_append_bytes(req, msg, len);
+ smbcli_req_append_bytes(req, (const uint8_t *)msg, len);
if (!smbcli_request_send(req) ||
!smbcli_request_receive(req) ||
/****************************************************************************
Read size bytes at offset offset using SMBreadX.
****************************************************************************/
-ssize_t smbcli_read(struct smbcli_tree *tree, int fnum, char *buf, off_t offset,
+ssize_t smbcli_read(struct smbcli_tree *tree, int fnum, void *_buf, off_t offset,
size_t size)
{
+ uint8_t *buf = _buf;
union smb_read parms;
int readsize;
ssize_t total = 0;
****************************************************************************/
ssize_t smbcli_write(struct smbcli_tree *tree,
int fnum, uint16_t write_mode,
- const uint8_t *buf, off_t offset, size_t size)
+ const void *_buf, off_t offset, size_t size)
{
+ const uint8_t *buf = _buf;
union smb_write parms;
int block = (tree->session->transport->negotiate.max_xmit - (MIN_SMB_SIZE+32));
ssize_t total = 0;
write to a file using a SMBwrite and not bypassing 0 byte writes
****************************************************************************/
ssize_t smbcli_smbwrite(struct smbcli_tree *tree,
- int fnum, char *buf, off_t offset, size_t size1)
+ int fnum, const void *_buf, off_t offset, size_t size1)
{
+ const uint8_t *buf = _buf;
union smb_write parms;
ssize_t total = 0;
union smb_sesssetup *parms)
{
uint16_t len;
- char *p;
+ uint8_t *p;
if (!smbcli_request_receive(req)) {
return smbcli_request_destroy(req);
/****************************************************************************
Write to socket. Return amount written.
****************************************************************************/
-ssize_t smbcli_sock_write(struct smbcli_socket *sock, const char *data, size_t len)
+ssize_t smbcli_sock_write(struct smbcli_socket *sock, const uint8_t *data, size_t len)
{
NTSTATUS status;
DATA_BLOB blob;
/****************************************************************************
Read from socket. return amount read
****************************************************************************/
-ssize_t smbcli_sock_read(struct smbcli_socket *sock, char *data, size_t len)
+ssize_t smbcli_sock_read(struct smbcli_socket *sock, uint8_t *data, size_t len)
{
NTSTATUS status;
size_t nread;
struct nmb_name *calling,
struct nmb_name *called)
{
- char *p;
+ uint8_t *p;
int len = NBT_HDR_SIZE;
struct smbcli_request *req;
/* put in the destination name */
p = req->out.buffer + NBT_HDR_SIZE;
- name_mangle(called->name, p, called->name_type);
- len += name_len(p);
+ name_mangle(called->name, (char *)p, called->name_type);
+ len += name_len((char *)p);
/* and my name */
p = req->out.buffer+len;
- name_mangle(calling->name, p, calling->name_type);
- len += name_len(p);
+ name_mangle(calling->name, (char *)p, calling->name_type);
+ len += name_len((char *)p);
_smb_setlen(req->out.buffer,len-4);
SCVAL(req->out.buffer,0,0x81);
****************************************************************************/
NTSTATUS smb_tree_connect_recv(struct smbcli_request *req, TALLOC_CTX *mem_ctx, union smb_tcon *parms)
{
- char *p;
+ uint8_t *p;
if (!smbcli_request_receive(req) ||
smbcli_request_is_error(req)) {
This takes GMT time and puts local time in the buffer
********************************************************************/
void raw_push_dos_date2(struct smbcli_transport *transport,
- char *buf, int offset, time_t unixdate)
+ uint8_t *buf, int offset, time_t unixdate)
{
push_dos_date2(buf, offset, unixdate, transport->negotiate.server_zone);
}
GMT and converts it to LOCAL time in zone_offset before putting it
********************************************************************/
void raw_push_dos_date3(struct smbcli_transport *transport,
- char *buf, int offset, time_t unixdate)
+ uint8_t *buf, int offset, time_t unixdate)
{
push_dos_date3(buf, offset, unixdate, transport->negotiate.server_zone);
}
/* copy in all the locks */
lockp = &parms->lockx.in.locks[0];
for (i = 0; i < lock_count; i++) {
- char *p = req->out.data + lck_size * i;
+ uint8_t *p = req->out.data + lck_size * i;
SSVAL(p, 0, lockp[i].pid);
if (parms->lockx.in.mode & LOCKING_ANDX_LARGE_FILES) {
SSVAL(p, 2, 0); /* reserved */
/* setup the protocol strings */
for (i=0; i < ARRAY_SIZE(prots) && prots[i].prot <= maxprotocol; i++) {
- smbcli_req_append_bytes(req, "\2", 1);
+ smbcli_req_append_bytes(req, (const uint8_t *)"\2", 1);
smbcli_req_append_string(req, prots[i].name, STR_TERMINATE | STR_ASCII);
}
static void smbcli_req_grow_allocation(struct smbcli_request *req, uint_t new_size)
{
int delta;
- char *buf2;
+ uint8_t *buf2;
delta = new_size - req->out.data_size;
if (delta + req->out.size <= req->out.allocated) {
handle oplock break requests from the server - return True if the request was
an oplock break
*/
-BOOL handle_oplock_break(struct smbcli_transport *transport, uint_t len, const char *hdr, const char *vwv)
+BOOL handle_oplock_break(struct smbcli_transport *transport, uint_t len, const uint8_t *hdr, const uint8_t *vwv)
{
/* we must be very fussy about what we consider an oplock break to avoid
matching readbraw replies */
of bytes consumed in the packet is returned
*/
static size_t smbcli_req_pull_ucs2(struct smbcli_request *req, TALLOC_CTX *mem_ctx,
- char **dest, const char *src, int byte_len, uint_t flags)
+ char **dest, const uint8_t *src, int byte_len, uint_t flags)
{
int src_len, src_len2, alignment=0;
ssize_t ret;
of bytes consumed in the packet is returned
*/
size_t smbcli_req_pull_ascii(struct smbcli_request *req, TALLOC_CTX *mem_ctx,
- char **dest, const char *src, int byte_len, uint_t flags)
+ char **dest, const uint8_t *src, int byte_len, uint_t flags)
{
int src_len, src_len2;
ssize_t ret;
if (byte_len != -1 && src_len > byte_len) {
src_len = byte_len;
}
- src_len2 = strnlen(src, src_len);
+ src_len2 = strnlen((const char *)src, src_len);
if (src_len2 < src_len - 1) {
/* include the termination if we didn't reach the end of the packet */
src_len2++;
of bytes consumed in the packet is returned
*/
size_t smbcli_req_pull_string(struct smbcli_request *req, TALLOC_CTX *mem_ctx,
- char **dest, const char *src, int byte_len, uint_t flags)
+ char **dest, const uint8_t *src, int byte_len, uint_t flags)
{
if (!(flags & STR_ASCII) &&
(((flags & STR_UNICODE) || (req->flags2 & FLAGS2_UNICODE_STRINGS)))) {
if byte_len is -1 then limit the blob only by packet size
*/
-DATA_BLOB smbcli_req_pull_blob(struct smbcli_request *req, TALLOC_CTX *mem_ctx, const char *src, int byte_len)
+DATA_BLOB smbcli_req_pull_blob(struct smbcli_request *req, TALLOC_CTX *mem_ctx, const uint8_t *src, int byte_len)
{
int src_len;
/* check that a lump of data in a request is within the bounds of the data section of
the packet */
-static BOOL smbcli_req_data_oob(struct smbcli_request *req, const char *ptr, uint32_t count)
+static BOOL smbcli_req_data_oob(struct smbcli_request *req, const uint8_t *ptr, uint32_t count)
{
/* be careful with wraparound! */
if (ptr < req->in.data ||
return False if any part is outside the data portion of the packet
*/
-BOOL smbcli_raw_pull_data(struct smbcli_request *req, const char *src, int len, char *dest)
+BOOL smbcli_raw_pull_data(struct smbcli_request *req, const uint8_t *src, int len, uint8_t *dest)
{
if (len == 0) return True;
*/
static size_t smbcli_blob_pull_ucs2(TALLOC_CTX* mem_ctx,
DATA_BLOB *blob, const char **dest,
- const char *src, int byte_len, uint_t flags)
+ const uint8_t *src, int byte_len, uint_t flags)
{
int src_len, src_len2, alignment=0;
ssize_t ret;
char *dest2;
- if (src < (const char *)blob->data ||
- src >= (const char *)(blob->data + blob->length)) {
+ if (src < blob->data ||
+ src >= (blob->data + blob->length)) {
*dest = NULL;
return 0;
}
*/
static size_t smbcli_blob_pull_ascii(TALLOC_CTX *mem_ctx,
DATA_BLOB *blob, const char **dest,
- const char *src, int byte_len, uint_t flags)
+ const uint8_t *src, int byte_len, uint_t flags)
{
int src_len, src_len2;
ssize_t ret;
if (byte_len != -1 && src_len > byte_len) {
src_len = byte_len;
}
- src_len2 = strnlen(src, src_len);
+ src_len2 = strnlen((const char *)src, src_len);
if (src_len2 < src_len - 1) {
/* include the termination if we didn't reach the end of the packet */
{
union smb_search_data search_data;
int i;
- char *p;
+ uint8_t *p;
if (req->in.data_size < 3 + count*43) {
req->status = NT_STATUS_INVALID_PARAMETER;
static BOOL raw_trans_oob(struct smbcli_request *req,
uint_t offset, uint_t count)
{
- char *ptr;
+ uint8_t *ptr;
if (count == 0) {
return False;
{
int wct = 14 + parms->in.setup_count;
struct smbcli_request *req;
- char *outdata,*outparam;
+ uint8_t *outdata,*outparam;
int i;
int padding;
size_t namelen = 0;
struct smb_nttrans *parms)
{
struct smbcli_request *req;
- char *outdata, *outparam;
+ uint8_t *outdata, *outparam;
int i;
int align = 0;
{
uint8_t calc_md5_mac[16];
struct MD5Context md5_ctx;
- unsigned char key_buf[16];
+ uint8_t key_buf[16];
/*
* Firstly put the sequence number into the first 4 bytes.
{
uint8_t client_chal[8];
DATA_BLOB response = data_blob(NULL, 0);
- char long_date[8];
+ uint8_t long_date[8];
NTTIME nttime;
unix_to_nt_time(&nttime, time(NULL));
/* initialise the auth_context for this server and return the cryptkey */
-static void get_challenge(struct smbsrv_connection *smb_conn, char buff[8])
+static void get_challenge(struct smbsrv_connection *smb_conn, uint8_t buff[8])
{
NTSTATUS nt_status;
const uint8_t *cryptkey;
int Index=0;
int choice = -1;
int protocol;
- char *p;
+ uint8_t *p;
if (req->smb_conn->negotiate.done_negprot) {
smbsrv_terminate_connection(req->smb_conn, "multiple negprot's are not permitted");
while (p < req->in.data + req->in.data_size) {
Index++;
- DEBUG(3,("Requested protocol [%s]\n",p));
- p += strlen(p) + 2;
+ DEBUG(3,("Requested protocol [%s]\n",(const char *)p));
+ p += strlen((const char *)p) + 2;
}
/* Check for protocols, most desirable first */
if ((supported_protocols[protocol].protocol_level <= lp_maxprotocol()) &&
(supported_protocols[protocol].protocol_level >= lp_minprotocol()))
while (p < (req->in.data + req->in.data_size)) {
- if (strequal(p,supported_protocols[protocol].proto_name))
+ if (strequal((const char *)p,supported_protocols[protocol].proto_name))
choice = Index;
Index++;
- p += strlen(p) + 2;
+ p += strlen((const char *)p) + 2;
}
if(choice != -1)
break;
io->ntcreatex.in.ea_list = NULL;
req_pull_string(req, &io->ntcreatex.in.fname,
- (const char *)(params + 54),
+ params + 54,
trans->in.params.length - 54,
STR_NO_RANGE_CHECK | STR_TERMINATE);
if (!io->ntcreatex.in.fname) {
{
union smb_tcon con;
NTSTATUS status;
- char *p;
+ uint8_t *p;
/* parse request */
REQ_CHECK_WCT(req, 0);
{
NTSTATUS status;
union smb_tcon con;
- char *p;
+ uint8_t *p;
uint16_t passlen;
con.tconx.level = RAW_TCON_TCONX;
void reply_mv(struct smbsrv_request *req)
{
union smb_rename *io;
- char *p;
+ uint8_t *p;
/* parse the request */
REQ_CHECK_WCT(req, 1);
void reply_ntrename(struct smbsrv_request *req)
{
union smb_rename *io;
- char *p;
+ uint8_t *p;
/* parse the request */
REQ_CHECK_WCT(req, 4);
void reply_copy(struct smbsrv_request *req)
{
struct smb_copy *cp;
- char *p;
+ uint8_t *p;
/* parse request */
REQ_CHECK_WCT(req, 3);
union smb_lock *lck;
uint_t total_locks, i;
uint_t lck_size;
- char *p;
+ uint8_t *p;
/* parse request */
REQ_CHECK_WCT(req, 8);
{
NTSTATUS status;
union smb_sesssetup sess;
- char *p;
+ uint8_t *p;
uint16_t passlen;
sess.old.level = RAW_SESSSETUP_OLD;
{
NTSTATUS status;
union smb_sesssetup sess;
- char *p;
+ uint8_t *p;
uint16_t passlen1, passlen2;
sess.nt1.level = RAW_SESSSETUP_NT1;
{
NTSTATUS status;
union smb_sesssetup sess;
- char *p;
+ uint8_t *p;
uint16_t blob_len;
sess.spnego.level = RAW_SESSSETUP_SPNEGO;
void reply_special(struct smbsrv_request *req)
{
uint8_t msg_type;
- char *buf = talloc_zero_array_p(req, char, 4);
+ uint8_t *buf = talloc_zero_array_p(req, uint8_t, 4);
msg_type = CVAL(req->in.buffer,0);
static void req_grow_allocation(struct smbsrv_request *req, uint_t new_size)
{
int delta;
- char *buf2;
+ uint8_t *buf2;
delta = new_size - req->out.data_size;
if (delta + req->out.size <= req->out.allocated) {
if dest_len is -1 then no limit applies
*/
-size_t req_push_str(struct smbsrv_request *req, char *dest, const char *str, int dest_len, uint_t flags)
+size_t req_push_str(struct smbsrv_request *req, uint8_t *dest, const char *str, int dest_len, uint_t flags)
{
size_t len;
uint_t grow_size;
- char *buf0;
+ uint8_t *buf0;
const int max_bytes_per_char = 3;
if (!(flags & (STR_ASCII|STR_UNICODE))) {
on failure zero is returned and *dest is set to NULL, otherwise the number
of bytes consumed in the packet is returned
*/
-static size_t req_pull_ucs2(struct smbsrv_request *req, const char **dest, const char *src, int byte_len, uint_t flags)
+static size_t req_pull_ucs2(struct smbsrv_request *req, const char **dest, const uint8_t *src, int byte_len, uint_t flags)
{
int src_len, src_len2, alignment=0;
ssize_t ret;
on failure zero is returned and *dest is set to NULL, otherwise the number
of bytes consumed in the packet is returned
*/
-static size_t req_pull_ascii(struct smbsrv_request *req, const char **dest, const char *src, int byte_len, uint_t flags)
+static size_t req_pull_ascii(struct smbsrv_request *req, const char **dest, const uint8_t *src, int byte_len, uint_t flags)
{
int src_len, src_len2;
ssize_t ret;
}
}
- src_len2 = strnlen(src, src_len);
+ src_len2 = strnlen((const char *)src, src_len);
if (src_len2 <= src_len - 1) {
/* include the termination if we didn't reach the end of the packet */
src_len2++;
on failure zero is returned and *dest is set to NULL, otherwise the number
of bytes consumed in the packet is returned
*/
-size_t req_pull_string(struct smbsrv_request *req, const char **dest, const char *src, int byte_len, uint_t flags)
+size_t req_pull_string(struct smbsrv_request *req, const char **dest, const uint8_t *src, int byte_len, uint_t flags)
{
if (!(flags & STR_ASCII) &&
(((flags & STR_UNICODE) || (req->flags2 & FLAGS2_UNICODE_STRINGS)))) {
on failure *dest is set to the zero length string. This seems to
match win2000 behaviour
*/
-size_t req_pull_ascii4(struct smbsrv_request *req, const char **dest, const char *src, uint_t flags)
+size_t req_pull_ascii4(struct smbsrv_request *req, const char **dest, const uint8_t *src, uint_t flags)
{
ssize_t ret;
return False if any part is outside the data portion of the packet
*/
-BOOL req_pull_blob(struct smbsrv_request *req, const char *src, int len, DATA_BLOB *blob)
+BOOL req_pull_blob(struct smbsrv_request *req, const uint8_t *src, int len, DATA_BLOB *blob)
{
if (len != 0 && req_data_oob(req, src, len)) {
return False;
/* check that a lump of data in a request is within the bounds of the data section of
the packet */
-BOOL req_data_oob(struct smbsrv_request *req, const char *ptr, uint32_t count)
+BOOL req_data_oob(struct smbsrv_request *req, const uint8_t *ptr, uint32_t count)
{
if (count == 0) {
return False;
/*
pull an open file handle from a packet, taking account of the chained_fnum
*/
-uint16_t req_fnum(struct smbsrv_request *req, const char *base, uint_t offset)
+uint16_t req_fnum(struct smbsrv_request *req, const uint8_t *base, uint_t offset)
{
if (req->chained_fnum != -1) {
return req->chained_fnum;
static BOOL find_fill_info(struct smbsrv_request *req,
union smb_search_data *file)
{
- char *p;
+ uint8_t *p;
if (req->out.data_size + 43 > req_max_data(req)) {
return False;
union smb_search_next *sn;
uint16_t resume_key_length;
struct search_state state;
- char *p;
+ uint8_t *p;
NTSTATUS status;
enum smb_search_level level = RAW_SEARCH_SEARCH;
uint8_t op = CVAL(req->in.hdr,HDR_COM);
{
union smb_search_close *sc;
uint16_t resume_key_length;
- char *p;
+ uint8_t *p;
const char *pattern;
REQ_TALLOC(sc);
return NT_STATUS_NO_MEMORY;
}
- req->in.buffer = talloc_array_p(req, char, NBT_HDR_SIZE);
+ req->in.buffer = talloc_array_p(req, uint8_t, NBT_HDR_SIZE);
if (req->in.buffer == NULL) {
talloc_free(req);
return NT_STATUS_NO_MEMORY;
void chain_reply(struct smbsrv_request *req)
{
uint16_t chain_cmd, chain_offset;
- char *vwv, *data;
+ uint8_t *vwv, *data;
uint16_t wct;
uint16_t data_size;
This takes GMT time and puts local time in the buffer
********************************************************************/
void srv_push_dos_date2(struct smbsrv_connection *smb_server,
- char *buf, int offset, time_t unixdate)
+ uint8_t *buf, int offset, time_t unixdate)
{
push_dos_date2(buf, offset, unixdate, smb_server->negotiate.zone_offset);
}
GMT and converts it to LOCAL time in zone_offset before putting it
********************************************************************/
void srv_push_dos_date3(struct smbsrv_connection *smb_server,
- char *buf, int offset, time_t unixdate)
+ uint8_t *buf, int offset, time_t unixdate)
{
push_dos_date3(buf, offset, unixdate, smb_server->negotiate.zone_offset);
}
printf("ERROR: open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
}
- smbcli_write(cli->tree, fnum, 0, (char *)&t2, 0, sizeof(t2));
+ smbcli_write(cli->tree, fnum, 0, &t2, 0, sizeof(t2));
SSVAL(t2.in.params.data, 0, fnum);
printf("ERROR: open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
}
- smbcli_write(cli->tree, fnum, 0, (char *)&t2, 0, sizeof(t2));
+ smbcli_write(cli->tree, fnum, 0, &t2, 0, sizeof(t2));
smbcli_close(cli->tree, fnum);
SIVAL(t2.in.params.data, 2, 0);
printf("ERROR: open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
}
- smbcli_write(cli->tree, fnum, 0, (char *)&t2, 0, sizeof(t2));
+ smbcli_write(cli->tree, fnum, 0, &t2, 0, sizeof(t2));
smbcli_close(cli->tree, fnum);
SSVAL(t2.in.params.data, 0, 0);
printf("ERROR: open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
}
- smbcli_write(cli->tree, fnum, 0, (char *)&t2, 0, sizeof(t2));
+ smbcli_write(cli->tree, fnum, 0, &t2, 0, sizeof(t2));
SSVAL(t2.in.params.data, 0, fnum);
SSVAL(t2.in.params.data, 4, 0);
printf("ERROR: open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
}
- smbcli_write(cli->tree, fnum, 0, (char *)&t2, 0, sizeof(t2));
+ smbcli_write(cli->tree, fnum, 0, &t2, 0, sizeof(t2));
smbcli_close(cli->tree, fnum);
SSVAL(t2.in.params.data, 2, 0);
} else if (fnum2 == -1) {
res = A_0;
} else {
- char x = 1;
+ uint8_t x = 1;
res = A_0;
- if (smbcli_read(cli1->tree, fnum2, (void *)&x, 0, 1) == 1) {
+ if (smbcli_read(cli1->tree, fnum2, &x, 0, 1) == 1) {
res += A_R;
}
- if (smbcli_write(cli1->tree, fnum2, 0, (void *)&x, 0, 1) == 1) {
+ if (smbcli_write(cli1->tree, fnum2, 0, &x, 0, 1) == 1) {
res += A_W;
}
}
} else if (fnum2 == -1) {
res = A_0;
} else {
- char x = 1;
+ uint8_t x = 1;
res = A_0;
- if (smbcli_read(cli2->tree, fnum2, (void *)&x, 0, 1) == 1) {
+ if (smbcli_read(cli2->tree, fnum2, &x, 0, 1) == 1) {
res += A_R;
}
- if (smbcli_write(cli2->tree, fnum2, 0, (void *)&x, 0, 1) == 1) {
+ if (smbcli_write(cli2->tree, fnum2, 0, &x, 0, 1) == 1) {
res += A_W;
}
}
union smb_open io1, io2;
extern int torture_numops;
int failures = 0;
- char buf[1];
+ uint8_t buf[1];
ZERO_STRUCT(buf);
} else {
res = A_0;
if (smbcli_read(cli2->tree,
- io2.ntcreatex.out.fnum, (void *)buf, 0, sizeof(buf)) >= 1) {
+ io2.ntcreatex.out.fnum, buf, 0, sizeof(buf)) >= 1) {
res += A_R;
}
if (smbcli_write(cli2->tree,
- io2.ntcreatex.out.fnum, 0, (void *)buf, 0, sizeof(buf)) >= 1) {
+ io2.ntcreatex.out.fnum, 0, buf, 0, sizeof(buf)) >= 1) {
res += A_W;
}
}
const char *fname = "\\lockt4.lck";
int fnum1, fnum2, f;
BOOL ret;
- char buf[1000];
+ uint8_t buf[1000];
BOOL correct = True;
if (!torture_open_connection(&cli1) || !torture_open_connection(&cli2)) {
const char *fname = "\\lockt5.lck";
int fnum1, fnum2, fnum3;
BOOL ret;
- char buf[1000];
+ uint8_t buf[1000];
BOOL correct = True;
if (!torture_open_connection(&cli1) || !torture_open_connection(&cli2)) {
int fnum1;
int fnum2 = -1;
size_t size;
- char buf[200];
+ uint8_t buf[200];
BOOL correct = False;
if (!torture_open_connection(&cli1)) {
fstring fname;
const char *alt_name;
int fnum;
- char c2[4];
+ uint8_t c2[4];
int c, len, fd;
int chars_allowed=0, alt_allowed=0;
uint8_t valid[0x10000];
static char *form_name(int c)
{
static fstring fname;
- char c2[4];
+ uint8_t c2[4];
char *p;
int len;
return False;
}
- smbcli_read(cli->tree, fnum, (char *)c2, 0, size);
+ smbcli_read(cli->tree, fnum, c2, 0, size);
printf("%04x: ", c);
equiv[c][0] = c;
for (i=0; i<size/sizeof(int); i++) {
fflush(stdout);
}
- smbcli_write(cli->tree, fnum, 0, (char *)&c, size, sizeof(c));
+ smbcli_write(cli->tree, fnum, 0, &c, size, sizeof(c));
smbcli_close(cli->tree, fnum);
}
union smb_write io;
int i;
NTSTATUS ret;
- char *buf;
+ uint8_t *buf;
i = find_handle(handle);
union smb_write io;
int i;
NTSTATUS ret;
- char *buf;
+ uint8_t *buf;
i = find_handle(handle);
union smb_read io;
int i;
NTSTATUS ret;
- char *buf;
+ uint8_t *buf;
i = find_handle(handle);
union smb_close cl;
int fnum;
const char *fname = BASEDIR "\\test.txt";
- char c = 1;
+ uint8_t c = 1;
printf("TESTING SESSION HANDLING\n");
union smb_close cl;
int fnum;
const char *fname = BASEDIR "\\test.txt";
- char c = 1;
+ uint8_t c = 1;
printf("TESTING TREE HANDLING\n");
union smb_close cl;
int fnum;
const char *fname = BASEDIR "\\test.txt";
- char c = 1;
+ uint8_t c = 1;
uint16_t pid1, pid2;
printf("TESTING PID HANDLING\n");
BOOL ret = True;
int fnum;
const char *fname = BASEDIR "\\test.txt";
- char c = 1;
+ uint8_t c = 1;
if (!torture_setup_dir(cli, BASEDIR)) {
return False;
NTSTATUS status;
BOOL ret = True;
int fnum;
- char c = 0;
+ uint8_t c = 0;
const char *fname = BASEDIR "\\test.txt";
if (!torture_setup_dir(cli, BASEDIR)) {
*/
static enum rdwr_mode check_rdwr(struct smbcli_tree *tree, int fnum)
{
- char c = 1;
+ uint8_t c = 1;
BOOL can_read = (smbcli_read(tree, fnum, &c, 0, 1) == 1);
BOOL can_write = (smbcli_write(tree, fnum, 0, &c, 0, 1) == 1);
if ( can_read && can_write) return RDWR_RDWR;
/*
setup a random buffer based on a seed
*/
-static void setup_buffer(char *buf, uint_t seed, int len)
+static void setup_buffer(uint8_t *buf, uint_t seed, int len)
{
int i;
srandom(seed);
/*
check a random buffer based on a seed
*/
-static BOOL check_buffer(char *buf, uint_t seed, int len, int line)
+static BOOL check_buffer(uint8_t *buf, uint_t seed, int len, int line)
{
int i;
srandom(seed);
for (i=0;i<len;i++) {
- char v = random();
+ uint8_t v = random();
if (buf[i] != v) {
printf("Buffer incorrect at line %d! ofs=%d v1=0x%x v2=0x%x\n",
line, i, buf[i], v);
NTSTATUS status;
BOOL ret = True;
int fnum;
- char *buf;
+ uint8_t *buf;
const int maxsize = 90000;
const char *fname = BASEDIR "\\test.txt";
const char *test_data = "TEST DATA";
NTSTATUS status;
BOOL ret = True;
int fnum;
- char *buf;
+ uint8_t *buf;
const int maxsize = 90000;
const char *fname = BASEDIR "\\test.txt";
const char *test_data = "TEST DATA";
NTSTATUS status;
BOOL ret = True;
int fnum;
- char *buf;
+ uint8_t *buf;
const int maxsize = 90000;
const char *fname = BASEDIR "\\test.txt";
const char *test_data = "TEST DATA";
NTSTATUS status;
BOOL ret = True;
int fnum;
- char *buf;
+ uint8_t *buf;
const int maxsize = 90000;
const char *fname = BASEDIR "\\test.txt";
const char *test_data = "TEST DATA";
BOOL ret = True;
int fnum, fnum2;
const char *fname = BASEDIR "\\test.txt";
- char c[2];
+ uint8_t c[2];
if (!torture_setup_dir(cli, BASEDIR)) {
return False;
{
int fnum;
const char *full_name;
- char *buf;
+ uint8_t *buf;
ssize_t ret;
full_name = talloc_asprintf(mem_ctx, "%s:%s", fname, sname);
/*
setup a random buffer based on a seed
*/
-static void setup_buffer(char *buf, uint_t seed, int len)
+static void setup_buffer(uint8_t *buf, uint_t seed, int len)
{
int i;
srandom(seed);
/*
check a random buffer based on a seed
*/
-static BOOL check_buffer(char *buf, uint_t seed, int len, const char *location)
+static BOOL check_buffer(uint8_t *buf, uint_t seed, int len, const char *location)
{
int i;
srandom(seed);
for (i=0;i<len;i++) {
- char v = random();
+ uint8_t v = random();
if (buf[i] != v) {
printf("Buffer incorrect at %s! ofs=%d buf=0x%x correct=0x%x\n",
location, i, buf[i], v);
NTSTATUS status;
BOOL ret = True;
int fnum;
- char *buf;
+ uint8_t *buf;
const int maxsize = 90000;
const char *fname = BASEDIR "\\test.txt";
uint_t seed = time(NULL);
NTSTATUS status;
BOOL ret = True;
int fnum, i;
- char *buf;
+ uint8_t *buf;
const int maxsize = 90000;
const char *fname = BASEDIR "\\test.txt";
uint_t seed = time(NULL);
NTSTATUS status;
BOOL ret = True;
int fnum;
- char *buf;
+ uint8_t *buf;
const int maxsize = 90000;
const char *fname = BASEDIR "\\test.txt";
uint_t seed = time(NULL);
NTSTATUS status;
BOOL ret = True;
int fnum;
- char *buf;
+ uint8_t *buf;
const int maxsize = 90000;
const char *fname = BASEDIR "\\test.txt";
uint_t seed = time(NULL);
int fnum2;
pid_t pid2, pid = getpid();
int i, j;
- char buf[1024];
+ uint8_t buf[1024];
BOOL correct = True;
fnum2 = smbcli_open(c->tree, lockfname, O_RDWR | O_CREAT | O_EXCL,
break;
}
- if (smbcli_write(c->tree, fnum, 0, (char *)&pid, 0, sizeof(pid)) != sizeof(pid)) {
+ if (smbcli_write(c->tree, fnum, 0, &pid, 0, sizeof(pid)) != sizeof(pid)) {
printf("write failed (%s)\n", smbcli_errstr(c->tree));
correct = False;
}
for (j=0;j<50;j++) {
- if (smbcli_write(c->tree, fnum, 0, (char *)buf,
+ if (smbcli_write(c->tree, fnum, 0, buf,
sizeof(pid)+(j*sizeof(buf)),
sizeof(buf)) != sizeof(buf)) {
printf("write failed (%s)\n", smbcli_errstr(c->tree));
pid2 = 0;
- if (smbcli_read(c->tree, fnum, (char *)&pid2, 0, sizeof(pid)) != sizeof(pid)) {
+ if (smbcli_read(c->tree, fnum, &pid2, 0, sizeof(pid)) != sizeof(pid)) {
printf("read failed (%s)\n", smbcli_errstr(c->tree));
correct = False;
}
{
int fnum = -1;
uint_t i = 0;
- char buf[131072];
- char buf_rd[131072];
+ uint8_t buf[131072];
+ uint8_t buf_rd[131072];
uint_t count;
uint_t countprev = 0;
ssize_t sent = 0;
int fnum1;
uint16_t cnum1, cnum2, cnum3;
uint16_t vuid1, vuid2;
- char buf[4];
+ uint8_t buf[4];
BOOL ret = True;
struct smbcli_tree *tree1;
const char *host = lp_parm_string(-1, "torture", "host");
struct smbcli_state *cli1, *cli2;
const char *fname = "\\fdpass.tst";
int fnum1, oldtid;
- pstring buf;
+ uint8_t buf[1024];
if (!torture_open_connection(&cli1) || !torture_open_connection(&cli2)) {
return False;
fnum = smbcli_open(cli->tree, fname2,
O_RDWR | O_CREAT | O_TRUNC, DENY_NONE);
- smbcli_write(cli->tree, fnum, 0, (char *)&fnum, 0, sizeof(fnum));
+ smbcli_write(cli->tree, fnum, 0, &fnum, 0, sizeof(fnum));
smbcli_close(cli->tree, fnum);
if (NT_STATUS_IS_ERR(smbcli_qpathinfo2(cli->tree, "\\trans2\\", &c_time, &a_time, &m_time2, &w_time, &size, NULL, NULL))) {
printf("ERROR: qpathinfo2 failed (%s)\n", smbcli_errstr(cli->tree));
static struct smbcli_state *cli2;
const char *fname = "\\readonly.file";
int fnum1, fnum2;
- char buf[20];
+ uint8_t buf[20];
size_t fsize;
BOOL correct = True;
char *tmp_path;