static uid_t mount_uid;
static gid_t mount_gid;
static int mount_ro;
-static unsigned mount_fmask;
-static unsigned mount_dmask;
+static uint_t mount_fmask;
+static uint_t mount_dmask;
static int user_mount;
static char *options;
static uid_t mount_uid;
static gid_t mount_gid;
static int mount_ro;
-static unsigned mount_fmask;
-static unsigned mount_dmask;
+static uint_t mount_fmask;
+static uint_t mount_dmask;
static BOOL use_kerberos;
/* TODO: Add code to detect smbfs version in kernel */
static BOOL status32_smbfs = False;
char *password;
char *user_name;
char *kdc_server;
- unsigned flags;
+ uint_t flags;
int time_offset;
} auth;
You do this:
#define CVAL(buf,pos) (((uint8_t *)(buf))[pos])
-#define PVAL(buf,pos) ((unsigned)CVAL(buf,pos))
+#define PVAL(buf,pos) ((uint_t)CVAL(buf,pos))
#define SVAL(buf,pos) (PVAL(buf,pos)|PVAL(buf,(pos)+1)<<8)
then to extract a uint16_t value at offset 25 in a buffer you do this:
#define CAREFUL_ALIGNMENT 1
#endif
-#define CVAL(buf,pos) ((unsigned)(((const uint8_t *)(buf))[pos]))
+#define CVAL(buf,pos) ((uint_t)(((const uint8_t *)(buf))[pos]))
#define CVAL_NC(buf,pos) (((uint8_t *)(buf))[pos]) /* Non-const version of CVAL */
#define PVAL(buf,pos) (CVAL(buf,pos))
#define SCVAL(buf,pos,val) (CVAL_NC(buf,pos) = (val))
/*
* negotiated maximum transmit size - this is given to us by the server
*/
- unsigned max_xmit;
+ uint_t max_xmit;
/* maximum number of requests that can be multiplexed */
uint16_t max_mux;
/* a count of the number of packets we have received. We
* actually only care about zero/non-zero at this stage */
- unsigned pkt_count;
+ uint_t pkt_count;
/* the network address of the client */
char *client_addr;
} dos;
NTSTATUS nt_status;
enum socket_error socket_error;
- unsigned nbt_error;
+ uint_t nbt_error;
} e;
} error;
NTSTATUS status;
/* the sequence number of this packet - used for signing */
- unsigned seq_num;
+ uint_t seq_num;
/* set if this is a one-way request, meaning we are not
expecting a reply from the server. */
char *buffer;
/* the size of the raw buffer, including 4 byte header */
- unsigned size;
+ uint_t size;
/* how much has been allocated - on reply the buffer is over-allocated to
prevent too many realloc() calls
*/
- unsigned allocated;
+ uint_t allocated;
/* the start of the SMB header - this is always buffer+4 */
char *hdr;
/* the command words and command word count. vwv points
into the raw buffer */
char *vwv;
- unsigned wct;
+ uint_t wct;
/* the data buffer and size. data points into the raw buffer */
char *data;
- unsigned data_size;
+ uint_t data_size;
/* ptr is used as a moving pointer into the data area
* of the packet. The reason its here and not a local
void MD5Init(struct MD5Context *context);
void MD5Update(struct MD5Context *context, uint8_t const *buf,
- unsigned len);
+ uint_t len);
void MD5Final(uint8_t digest[16], struct MD5Context *context);
/*
void *ptr;
BOOL (*special)(const char *, char **);
const struct enum_list *enum_list;
- unsigned flags;
+ uint_t flags;
union {
BOOL bvalue;
int ivalue;
/****************************************************************************
set a bit in a bitmap
****************************************************************************/
-BOOL bitmap_set(struct bitmap *bm, unsigned i)
+BOOL bitmap_set(struct bitmap *bm, uint_t i)
{
if (i >= bm->n) {
DEBUG(0,("Setting invalid bitmap entry %d (of %d)\n",
/****************************************************************************
clear a bit in a bitmap
****************************************************************************/
-BOOL bitmap_clear(struct bitmap *bm, unsigned i)
+BOOL bitmap_clear(struct bitmap *bm, uint_t i)
{
if (i >= bm->n) {
DEBUG(0,("clearing invalid bitmap entry %d (of %d)\n",
/****************************************************************************
query a bit in a bitmap
****************************************************************************/
-BOOL bitmap_query(struct bitmap *bm, unsigned i)
+BOOL bitmap_query(struct bitmap *bm, uint_t i)
{
if (i >= bm->n) return False;
if (bm->b[i/32] & (1<<(i%32))) {
find a zero bit in a bitmap starting at the specified offset, with
wraparound
****************************************************************************/
-int bitmap_find(struct bitmap *bm, unsigned ofs)
+int bitmap_find(struct bitmap *bm, uint_t ofs)
{
uint_t i, j;
/*
* Note: this code is harmless on little-endian machines.
*/
-static void byteReverse(uint8_t *buf, unsigned longs)
+static void byteReverse(uint8_t *buf, uint_t longs)
{
uint32_t t;
do {
- t = (uint32_t) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
- ((unsigned) buf[1] << 8 | buf[0]);
+ t = (uint32_t) ((uint_t) buf[3] << 8 | buf[2]) << 16 |
+ ((uint_t) buf[1] << 8 | buf[0]);
*(uint32_t *) buf = t;
buf += 4;
} while (--longs);
* Update context to reflect the concatenation of another buffer full
* of bytes.
*/
-void MD5Update(struct MD5Context *ctx, uint8_t const *buf, unsigned len)
+void MD5Update(struct MD5Context *ctx, uint8_t const *buf, uint_t len)
{
register uint32_t t;
char **outbuf, size_t *outbytesleft)
{
while (*inbytesleft >= 1 && *outbytesleft >= 2) {
- unsigned v;
+ uint_t v;
if ((*inbuf)[0] != '@') {
/* seven bit ascii case */
i = ifc.ifc_len;
while (i > 0 && total < max_interfaces) {
- unsigned inc;
+ uint_t inc;
inc = ifr->ifr_addr.sa_len;
{
int fd;
char pidstr[20];
- unsigned ret;
+ uint_t ret;
pstring pidFile;
slprintf(pidFile, sizeof(pidFile)-1, "%s/%s.pid", lp_piddir(), name);
TALLOC_CTX *context;
size_t size;
void *ptr;
- unsigned magic;
+ uint_t magic;
};
if (!rt) return NULL;
s = talloc_asprintf(rt, "global talloc allocations in pid: %u\n",
- (unsigned) getpid());
+ (uint_t) getpid());
s = talloc_asprintf_append(rt, s, "%-40s %8s %8s\n",
"name", "chunks", "bytes");
s = talloc_asprintf_append(rt, s, "%-40s %8s %8s\n",
s = talloc_asprintf_append(rt, s, "%-40s %8u %8u\n",
what,
- (unsigned) n_chunks,
- (unsigned) bytes);
+ (uint_t) n_chunks,
+ (uint_t) bytes);
total_bytes += bytes;
total_chunks += n_chunks;
}
s = talloc_asprintf_append(rt, s, "%-40s %8u %8u\n",
"TOTAL",
- (unsigned) total_chunks, (unsigned) total_bytes);
+ (uint_t) total_chunks, (uint_t) total_bytes);
return s;
}
/*
realloc an array, checking for integer overflow in the array size
*/
-void *talloc_realloc_array(TALLOC_CTX *ctx, void *ptr, size_t el_size, unsigned count)
+void *talloc_realloc_array(TALLOC_CTX *ctx, void *ptr, size_t el_size, uint_t count)
{
if (count == 0 ||
count >= MAX_TALLOC_SIZE/el_size) {
int tdb_create_rwlocks(int fd, uint_t hash_size)
{
- unsigned size, i;
+ uint_t size, i;
tdb_rwlock_t *rwlocks;
size = TDB_SPINLOCK_SIZE(hash_size);
int tdb_clear_spinlocks(TDB_CONTEXT *tdb)
{
tdb_rwlock_t *rwlocks;
- unsigned i;
+ uint_t i;
if (tdb->header.rwlocks == 0) return 0;
if (!tdb->map_ptr) return -1;
if (tailer != rec.rec_len + sizeof(rec)) {
printf("ERROR: tailer does not match record! tailer=%u totalsize=%u\n",
- (unsigned)tailer, (unsigned)(rec.rec_len + sizeof(rec)));
+ (uint_t)tailer, (uint_t)(rec.rec_len + sizeof(rec)));
}
return rec.next;
}
static uint16_t make_dos_date1(struct tm *t)
{
uint16_t ret=0;
- ret = (((unsigned)(t->tm_mon+1)) >> 3) | ((t->tm_year-80) << 1);
+ ret = (((uint_t)(t->tm_mon+1)) >> 3) | ((t->tm_year-80) << 1);
ret = ((ret&0xFF)<<8) | (t->tm_mday | (((t->tm_mon+1) & 0x7) << 5));
return ret;
}
static uint16_t make_dos_time1(struct tm *t)
{
uint16_t ret=0;
- ret = ((((unsigned)t->tm_min >> 3)&0x7) | (((unsigned)t->tm_hour) << 3));
+ ret = ((((uint_t)t->tm_min >> 3)&0x7) | (((uint_t)t->tm_hour) << 3));
ret = ((ret&0xFF)<<8) | ((t->tm_sec/2) | ((t->tm_min & 0x7) << 5));
return ret;
}
/* see if a range of memory is all zero. A NULL pointer is considered
to be all zero */
-BOOL all_zero(const char *ptr, unsigned size)
+BOOL all_zero(const char *ptr, uint_t size)
{
int i;
if (!ptr) return True;
/*
return the total number of wins servers, dead or not
*/
-unsigned wins_srv_count(void)
+uint_t wins_srv_count(void)
{
const char **list;
int count = 0;
return a count of the number of IPs for a particular tag, including
dead ones
*/
-unsigned wins_srv_count_tag(const char *tag)
+uint_t wins_srv_count_tag(const char *tag)
{
const char **list;
int i, count=0;
for (i = 0; i < 32; i++) {
if (type & (1 << i)) {
for (j = 1; perms[j].str; j ++) {
- if (perms[j].mask == (((unsigned) 1) << i)) {
+ if (perms[j].mask == (((uint_t) 1) << i)) {
printf("\n\t%s", perms[j].str);
}
}
TODO : add a negative connection cache in here leveraged off of the one
found in the rpc code. --jerry
*/
-static BOOL ads_try_connect(ADS_STRUCT *ads, const char *server, unsigned port)
+static BOOL ads_try_connect(ADS_STRUCT *ads, const char *server, uint_t port)
{
char *srv;
"user", "computer", NULL};
const char *servicePrincipalName[5] = {NULL, NULL, NULL, NULL, NULL};
char *psp, *psp2;
- unsigned acct_control;
- unsigned exists=0;
+ uint_t acct_control;
+ uint_t exists=0;
LDAPMessage *res;
status = ads_find_machine_acct(ads, (void **)&res, hostname);
uint8_t *p;
uint32_t max_msg_size;
char *sname;
- unsigned sec_layer;
+ uint_t sec_layer;
ADS_STATUS status;
krb5_principal principal;
krb5_context ctx;
break;
case 'b':
b = (DATA_BLOB *)va_arg(ap, void *);
- len1 = va_arg(ap, unsigned);
+ len1 = va_arg(ap, uint_t);
/* make sure its in the right format - be strict */
NEED_DATA(len1);
if (blob->data + head_ofs < (uint8_t *)head_ofs || blob->data + head_ofs < blob->data)
int share_mode)
{
union smb_open open_parms;
- unsigned openfn=0;
- unsigned accessmode=0;
+ uint_t openfn=0;
+ uint_t accessmode=0;
TALLOC_CTX *mem_ctx;
NTSTATUS status;
trn_id = sys_random();
- return trn_id % (unsigned)0x7FFF;
+ return trn_id % (uint_t)0x7FFF;
}
}
/* cope with the ticket being in the future due to clock skew */
- if ((unsigned)credsp->times.starttime > time(NULL)) {
+ if ((uint_t)credsp->times.starttime > time(NULL)) {
time_t t = time(NULL);
- int time_offset = (unsigned)credsp->times.starttime - t;
+ int time_offset = (uint_t)credsp->times.starttime - t;
DEBUG(4,("Advancing clock by %d seconds to cope with clock skew\n", time_offset));
krb5_set_real_time(context, t + time_offset + 1, 0);
}
setup a SMB packet at transport level
*/
struct cli_request *cli_request_setup_transport(struct cli_transport *transport,
- uint8_t command, unsigned wct, unsigned buflen)
+ uint8_t command, uint_t wct, uint_t 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_t command, unsigned wct, unsigned buflen)
+ uint8_t command, uint_t wct, uint_t buflen)
{
struct cli_request *req;
uint16_t flags2;
*/
struct cli_request *cli_request_setup(struct cli_tree *tree,
uint8_t command,
- unsigned wct, unsigned buflen)
+ uint_t wct, uint_t buflen)
{
struct cli_request *req;
To cope with this req->out.ptr is supplied. This will be updated to
point at the same offset into the packet as before this call
*/
-static void cli_req_grow_allocation(struct cli_request *req, unsigned new_size)
+static void cli_req_grow_allocation(struct cli_request *req, uint_t new_size)
{
int delta;
char *buf2;
To cope with this req->out.ptr is supplied. This will be updated to
point at the same offset into the packet as before this call
*/
-static void cli_req_grow_data(struct cli_request *req, unsigned new_size)
+static void cli_req_grow_data(struct cli_request *req, uint_t new_size)
{
int delta;
return the number of bytes added to the packet
*/
-size_t cli_req_append_string(struct cli_request *req, const char *str, unsigned flags)
+size_t cli_req_append_string(struct cli_request *req, const char *str, uint_t flags)
{
size_t len;
this is used in places where the non-terminated string byte length is
placed in the packet as a separate field
*/
-size_t cli_req_append_string_len(struct cli_request *req, const char *str, unsigned flags, int *len)
+size_t cli_req_append_string_len(struct cli_request *req, const char *str, uint_t flags, int *len)
{
int diff = 0;
size_t ret;
if dest_len is -1 then no limit applies
*/
-size_t cli_req_append_ascii4(struct cli_request *req, const char *str, unsigned flags)
+size_t cli_req_append_ascii4(struct cli_request *req, const char *str, uint_t flags)
{
size_t size;
cli_req_append_bytes(req, (const uint8_t *)"\4", 1);
of bytes consumed in the packet is returned
*/
static size_t cli_req_pull_ucs2(struct cli_request *req, TALLOC_CTX *mem_ctx,
- char **dest, const char *src, int byte_len, unsigned flags)
+ char **dest, const char *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 cli_req_pull_ascii(struct cli_request *req, TALLOC_CTX *mem_ctx,
- char **dest, const char *src, int byte_len, unsigned flags)
+ char **dest, const char *src, int byte_len, uint_t flags)
{
int src_len, src_len2;
ssize_t ret;
of bytes consumed in the packet is returned
*/
size_t cli_req_pull_string(struct cli_request *req, TALLOC_CTX *mem_ctx,
- char **dest, const char *src, int byte_len, unsigned flags)
+ char **dest, const char *src, int byte_len, uint_t flags)
{
if (!(flags & STR_ASCII) &&
(((flags & STR_UNICODE) || (req->flags2 & FLAGS2_UNICODE_STRINGS)))) {
*/
static size_t cli_blob_pull_ucs2(TALLOC_CTX* mem_ctx,
DATA_BLOB *blob, const char **dest,
- const char *src, int byte_len, unsigned flags)
+ const char *src, int byte_len, uint_t flags)
{
int src_len, src_len2, alignment=0;
ssize_t ret;
*/
static size_t cli_blob_pull_ascii(TALLOC_CTX *mem_ctx,
DATA_BLOB *blob, const char **dest,
- const char *src, int byte_len, unsigned flags)
+ const char *src, int byte_len, uint_t flags)
{
int src_len, src_len2;
ssize_t ret;
DATA_BLOB *blob,
WIRE_STRING *dest,
uint16_t len_offset, uint16_t str_offset,
- unsigned flags)
+ uint_t flags)
{
int extra;
dest->s = NULL;
DATA_BLOB *blob,
const char **dest,
uint16_t str_offset,
- unsigned flags)
+ uint_t flags)
{
int extra = 0;
*dest = NULL;
*/
size_t cli_blob_append_string(struct cli_session *session,
TALLOC_CTX *mem_ctx, DATA_BLOB *blob,
- const char *str, unsigned flags)
+ const char *str, uint_t flags)
{
size_t max_len;
int len;
/* write an object ID to a ASN1 buffer */
BOOL asn1_write_OID(ASN1_DATA *data, const char *OID)
{
- unsigned v, v2;
+ uint_t v, v2;
const char *p = (const char *)OID;
char *newp;
pstrcat(aoid, el);
while (asn1_tag_remaining(data) > 0) {
- unsigned v = 0;
+ uint_t v = 0;
do {
asn1_read_uint8(data, &b);
v = (v<<7) | (b&0x7f);
*/
-#define uint8_t unsigned char
-
static const uint8_t perm1[56] = {57, 49, 41, 33, 25, 17, 9,
1, 58, 50, 42, 34, 26, 18,
10, 2, 59, 51, 43, 35, 27,
void E_P16(const uint8_t *p14,uint8_t *p16)
{
- unsigned const char sp8[8] = {0x4b, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25};
+ const uint8_t sp8[8] = {0x4b, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25};
smbhash(p16, sp8, p14, 1);
smbhash(p16+8, sp8, p14+7, 1);
}
/* perform a dcerpc bind, using the uuid as the key */
NTSTATUS dcerpc_bind_byuuid(struct dcerpc_pipe *p,
TALLOC_CTX *mem_ctx,
- const char *uuid, unsigned version)
+ const char *uuid, uint_t version)
{
struct dcerpc_syntax_id syntax;
struct dcerpc_syntax_id transfer_syntax;
uint32_t call_id;
uint32_t srv_max_xmit_frag;
uint32_t srv_max_recv_frag;
- unsigned flags;
+ uint_t flags;
struct dcerpc_security *security_state;
struct dcerpc_auth *auth_info;
const char *binding_string;
do a non-athenticated dcerpc bind
*/
NTSTATUS dcerpc_bind_auth_none(struct dcerpc_pipe *p,
- const char *uuid, unsigned version)
+ const char *uuid, uint_t version)
{
TALLOC_CTX *mem_ctx;
NTSTATUS status;
do ntlm style authentication on a dcerpc pipe
*/
NTSTATUS dcerpc_bind_auth_ntlm(struct dcerpc_pipe *p,
- const char *uuid, unsigned version,
+ const char *uuid, uint_t version,
const char *domain,
const char *username,
const char *password)
is the domain trust password
*/
NTSTATUS dcerpc_bind_auth_schannel_key(struct dcerpc_pipe *p,
- const char *uuid, unsigned version,
+ const char *uuid, uint_t version,
const char *domain,
const char *username,
const uint8_t session_key[8])
of the form HOSTNAME$ and the password is the domain trust password
*/
NTSTATUS dcerpc_bind_auth_schannel(struct dcerpc_pipe *p,
- const char *uuid, unsigned version,
+ const char *uuid, uint_t version,
const char *domain,
const char *username,
const char *password)
work out what TCP port to use for a given interface on a given host
*/
NTSTATUS dcerpc_epm_map_tcp_port(const char *server,
- const char *uuid, unsigned version,
+ const char *uuid, uint_t version,
uint32_t *port)
{
struct dcerpc_pipe *p;
case RAW_QFS_DSKATTR: {
/* map from generic to DSKATTR */
- unsigned bpunit = 64;
+ uint_t bpunit = 64;
/* we need to scale the sizes to fit */
for (bpunit=64; bpunit<0x10000; bpunit *= 2) {
/****************************************************************************
find a conn given a cnum
****************************************************************************/
-struct tcon_context *conn_find(struct server_context *smb, unsigned cnum)
+struct tcon_context *conn_find(struct server_context *smb, uint_t cnum)
{
int count=0;
struct tcon_context *conn;
/*
setup a chained reply in req->out with the given word count and initial data buffer size.
*/
-static void req_setup_chain_reply(struct request_context *req, unsigned wct, unsigned buflen)
+static void req_setup_chain_reply(struct request_context *req, uint_t wct, uint_t buflen)
{
uint32_t chain_base_size = req->out.size;
the caller will then fill in the command words and data before calling req_send_reply() to
send the reply on its way
*/
-void req_setup_reply(struct request_context *req, unsigned wct, unsigned buflen)
+void req_setup_reply(struct request_context *req, uint_t wct, uint_t buflen)
{
if (req->chain_count != 0) {
req_setup_chain_reply(req, wct, buflen);
To cope with this req->out.ptr is supplied. This will be updated to
point at the same offset into the packet as before this call
*/
-static void req_grow_allocation(struct request_context *req, unsigned new_size)
+static void req_grow_allocation(struct request_context *req, uint_t new_size)
{
int delta;
char *buf2;
To cope with this req->out.ptr is supplied. This will be updated to
point at the same offset into the packet as before this call
*/
-void req_grow_data(struct request_context *req, unsigned new_size)
+void req_grow_data(struct request_context *req, uint_t new_size)
{
int delta;
if dest_len is -1 then no limit applies
*/
-size_t req_push_str(struct request_context *req, char *dest, const char *str, int dest_len, unsigned flags)
+size_t req_push_str(struct request_context *req, char *dest, const char *str, int dest_len, uint_t flags)
{
size_t len;
- unsigned grow_size;
+ uint_t grow_size;
char *buf0;
const int max_bytes_per_char = 3;
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 request_context *req, const char **dest, const char *src, int byte_len, unsigned flags)
+static size_t req_pull_ucs2(struct request_context *req, const char **dest, const char *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 request_context *req, const char **dest, const char *src, int byte_len, unsigned flags)
+static size_t req_pull_ascii(struct request_context *req, const char **dest, const char *src, int byte_len, uint_t flags)
{
int src_len, src_len2;
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
*/
-size_t req_pull_string(struct request_context *req, const char **dest, const char *src, int byte_len, unsigned flags)
+size_t req_pull_string(struct request_context *req, const char **dest, const char *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 request_context *req, const char **dest, const char *src, unsigned flags)
+size_t req_pull_ascii4(struct request_context *req, const char **dest, const char *src, uint_t flags)
{
ssize_t ret;
/*
pull an open file handle from a packet, taking account of the chained_fnum
*/
-uint16_t req_fnum(struct request_context *req, const char *base, unsigned offset)
+uint16_t req_fnum(struct request_context *req, const char *base, uint_t offset)
{
if (req->chained_fnum != -1) {
return req->chained_fnum;
static void setup_listen(struct event_context *events,
const struct model_ops *model_ops,
void (*accept_handler)(struct event_context *,struct fd_event *,time_t,uint16_t),
- struct in_addr *ifip, unsigned port)
+ struct in_addr *ifip, uint_t port)
{
struct fd_event fde;
fde.fd = open_socket_in(SOCK_STREAM, port, 0, ifip->s_addr, True);
for (tok=strtok_r(lp_smb_ports(), delim, &ptr);
tok;
tok=strtok_r(NULL, delim, &ptr)) {
- unsigned port = atoi(tok);
+ uint_t port = atoi(tok);
if (port == 0) continue;
setup_listen(events, model_ops, model_ops->accept_connection, ifip, port);
}
};
-static void progress_bar(unsigned i, unsigned total)
+static void progress_bar(uint_t i, uint_t total)
{
if (i % 10 != 0) return;
printf("%5d/%5d\r", i, total);
#define NAME_LENGTH 20
-static unsigned total, collisions, failures;
+static uint_t total, collisions, failures;
static BOOL test_one(struct cli_state *cli, const char *name)
{
static void gen_name(char *name)
{
const char *chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz._-$~...";
- unsigned max_idx = strlen(chars);
- unsigned len;
+ uint_t max_idx = strlen(chars);
+ uint_t len;
int i;
char *p;
static BOOL analyze;
static BOOL hide_unlock_fails;
static BOOL use_oplocks;
-static unsigned lock_range = 100;
-static unsigned lock_base = 0;
-static unsigned min_length = 0;
+static uint_t lock_range = 100;
+static uint_t lock_base = 0;
+static uint_t min_length = 0;
static BOOL exact_error_codes;
static BOOL zero_zero;
int fnum[NSERVERS][NCONNECTIONS][NFILES],
struct record *rec)
{
- unsigned conn = rec->conn;
- unsigned f = rec->f;
+ uint_t conn = rec->conn;
+ uint_t f = rec->f;
uint64_t start = rec->start;
uint64_t len = rec->len;
enum brl_type op = rec->lock_type;
#endif
recorded[n].conn = random() % NCONNECTIONS;
recorded[n].f = random() % NFILES;
- recorded[n].start = lock_base + ((unsigned)random() % (lock_range-1));
+ recorded[n].start = lock_base + ((uint_t)random() % (lock_range-1));
recorded[n].len = min_length +
random() % (lock_range-(recorded[n].start-lock_base));
recorded[n].start *= RANGE_MULTIPLE;
struct record {
char r1, r2;
char conn, f, fstype;
- unsigned start, len;
+ uint_t start, len;
char needed;
};
}
static BOOL try_lock(struct cli_state *c, int fstype,
- int fd, unsigned start, unsigned len,
+ int fd, uint_t start, uint_t len,
enum brl_type op)
{
struct flock lock;
}
static BOOL try_unlock(struct cli_state *c, int fstype,
- int fd, unsigned start, unsigned len)
+ int fd, uint_t start, uint_t len)
{
struct flock lock;
int fnum[NSERVERS][NUMFSTYPES][NCONNECTIONS][NFILES],
struct record *rec)
{
- unsigned conn = rec->conn;
- unsigned f = rec->f;
- unsigned fstype = rec->fstype;
- unsigned start = rec->start;
- unsigned len = rec->len;
- unsigned r1 = rec->r1;
- unsigned r2 = rec->r2;
+ uint_t conn = rec->conn;
+ uint_t f = rec->f;
+ uint_t fstype = rec->fstype;
+ uint_t start = rec->start;
+ uint_t len = rec->len;
+ uint_t r1 = rec->r1;
+ uint_t r2 = rec->r2;
enum brl_type op;
int server;
BOOL ret[NSERVERS];
recorded[n].conn = random() % NCONNECTIONS;
recorded[n].fstype = random() % NUMFSTYPES;
recorded[n].f = random() % NFILES;
- recorded[n].start = LOCKBASE + ((unsigned)random() % (LOCKRANGE-1));
+ recorded[n].start = LOCKBASE + ((uint_t)random() % (LOCKRANGE-1));
recorded[n].len = 1 +
random() % (LOCKRANGE-(recorded[n].start-LOCKBASE));
recorded[n].start *= RANGE_MULTIPLE;
void nb_createx(const char *fname,
- unsigned create_options, unsigned create_disposition, int handle,
+ uint_t create_options, uint_t create_disposition, int handle,
NTSTATUS status)
{
union smb_open io;
uint32_t desired_access;
NTSTATUS ret;
TALLOC_CTX *mem_ctx;
- unsigned flags = 0;
+ uint_t flags = 0;
struct ftable *f;
mem_ctx = talloc_init("raw_open");
}
-void nb_lockx(int handle, unsigned offset, int size, NTSTATUS status)
+void nb_lockx(int handle, uint_t offset, int size, NTSTATUS status)
{
union smb_lock io;
int i;
check_status("LockX", status, ret);
}
-void nb_unlockx(int handle, unsigned offset, int size, NTSTATUS status)
+void nb_unlockx(int handle, uint_t offset, int size, NTSTATUS status)
{
union smb_lock io;
int i;
static struct {
const char *name;
enum fileinfo_level level;
- unsigned only_paths:1;
- unsigned only_handles:1;
+ uint_t only_paths:1;
+ uint_t only_handles:1;
uint32_t capability_mask;
NTSTATUS fnum_status, fname_status;
union smb_fileinfo fnum_finfo, fname_finfo;
s1 = fnum_find(sname); \
if (s1 && s1->stype.out.tfield != correct_size) { \
printf("(%d) handle %s/%s incorrect - %u should be %u\n", __LINE__, #stype, #tfield, \
- (unsigned)s1->stype.out.tfield, \
- (unsigned)correct_size); \
+ (uint_t)s1->stype.out.tfield, \
+ (uint_t)correct_size); \
ret = False; \
} \
s1 = fname_find(sname); \
if (s1 && s1->stype.out.tfield != correct_size) { \
printf("(%d) path %s/%s incorrect - %u should be %u\n", __LINE__, #stype, #tfield, \
- (unsigned)s1->stype.out.tfield, \
- (unsigned)correct_size); \
+ (uint_t)s1->stype.out.tfield, \
+ (uint_t)correct_size); \
ret = False; \
}} while (0)
s1 = fnum_find("STANDARD_INFO");
correct_size = s1->standard_info.out.size;
- printf("size: %u\n", (unsigned)correct_size);
+ printf("size: %u\n", (uint_t)correct_size);
SIZE_CHECK("GETATTR", getattr, size);
SIZE_CHECK("GETATTRE", getattre, size);
s1 = fnum_find("STANDARD_INFO");
correct_size = s1->standard_info.out.alloc_size;
- printf("alloc_size: %u\n", (unsigned)correct_size);
+ printf("alloc_size: %u\n", (uint_t)correct_size);
SIZE_CHECK("GETATTRE", getattre, alloc_size);
SIZE_CHECK("STANDARD", standard, alloc_size);
s1 = fnum_find(sname); \
if (s1 && s1->stype.out.tfield != correct_attrib) { \
printf("(%d) handle %s/%s incorrect - 0x%x should be 0x%x\n", __LINE__, #stype, #tfield, \
- (unsigned)s1->stype.out.tfield, \
- (unsigned)correct_attrib); \
+ (uint_t)s1->stype.out.tfield, \
+ (uint_t)correct_attrib); \
ret = False; \
} \
s1 = fname_find(sname); \
if (s1 && s1->stype.out.tfield != correct_attrib) { \
printf("(%d) path %s/%s incorrect - 0x%x should be 0x%x\n", __LINE__, #stype, #tfield, \
- (unsigned)s1->stype.out.tfield, \
- (unsigned)correct_attrib); \
+ (uint_t)s1->stype.out.tfield, \
+ (uint_t)correct_attrib); \
ret = False; \
}} while (0)
s1 = fnum_find("BASIC_INFO");
correct_attrib = s1->basic_info.out.attrib;
- printf("attrib: 0x%x\n", (unsigned)correct_attrib);
+ printf("attrib: 0x%x\n", (uint_t)correct_attrib);
ATTRIB_CHECK("GETATTR", getattr, attrib);
ATTRIB_CHECK("GETATTRE", getattre, attrib);
if (s1 && s1->stype.out.tfield != 0) { \
printf("(%d) handle %s/%s unknown != 0 (0x%x)\n", __LINE__, \
#stype, #tfield, \
- (unsigned)s1->stype.out.tfield); \
+ (uint_t)s1->stype.out.tfield); \
} \
s1 = fname_find(sname); \
if (s1 && s1->stype.out.tfield != 0) { \
printf("(%d) path %s/%s unknown != 0 (0x%x)\n", __LINE__, \
#stype, #tfield, \
- (unsigned)s1->stype.out.tfield); \
+ (uint_t)s1->stype.out.tfield); \
}} while (0)
/* now get a bit fancier .... */
/*
setup a random buffer based on a seed
*/
-static void setup_buffer(char *buf, unsigned seed, int len)
+static void setup_buffer(char *buf, uint_t seed, int len)
{
int i;
srandom(seed);
/*
check a random buffer based on a seed
*/
-static BOOL check_buffer(char *buf, unsigned seed, int len, int line)
+static BOOL check_buffer(char *buf, uint_t seed, int len, int line)
{
int i;
srandom(seed);
const int maxsize = 90000;
const char *fname = BASEDIR "\\test.txt";
const char *test_data = "TEST DATA";
- unsigned seed = time(NULL);
+ uint_t seed = time(NULL);
buf = talloc_zero(mem_ctx, maxsize);
const int maxsize = 90000;
const char *fname = BASEDIR "\\test.txt";
const char *test_data = "TEST DATA";
- unsigned seed = time(NULL);
+ uint_t seed = time(NULL);
buf = talloc_zero(mem_ctx, maxsize);
const int maxsize = 90000;
const char *fname = BASEDIR "\\test.txt";
const char *test_data = "TEST DATA";
- unsigned seed = time(NULL);
+ uint_t seed = time(NULL);
buf = talloc_zero(mem_ctx, maxsize);
const int maxsize = 90000;
const char *fname = BASEDIR "\\test.txt";
const char *test_data = "TEST DATA";
- unsigned seed = time(NULL);
+ uint_t seed = time(NULL);
buf = talloc_zero(mem_ctx, maxsize);
/*
setup a random buffer based on a seed
*/
-static void setup_buffer(char *buf, unsigned seed, int len)
+static void setup_buffer(char *buf, uint_t seed, int len)
{
int i;
srandom(seed);
/*
check a random buffer based on a seed
*/
-static BOOL check_buffer(char *buf, unsigned seed, int len, int line)
+static BOOL check_buffer(char *buf, uint_t seed, int len, int line)
{
int i;
srandom(seed);
char *buf;
const int maxsize = 90000;
const char *fname = BASEDIR "\\test.txt";
- unsigned seed = time(NULL);
+ uint_t seed = time(NULL);
union smb_fileinfo finfo;
buf = talloc_zero(mem_ctx, maxsize);
char *buf;
const int maxsize = 90000;
const char *fname = BASEDIR "\\test.txt";
- unsigned seed = time(NULL);
+ uint_t seed = time(NULL);
union smb_fileinfo finfo;
buf = talloc_zero(mem_ctx, maxsize);
char *buf;
const int maxsize = 90000;
const char *fname = BASEDIR "\\test.txt";
- unsigned seed = time(NULL);
+ uint_t seed = time(NULL);
union smb_fileinfo finfo;
buf = talloc_zero(mem_ctx, maxsize);
char *buf;
const int maxsize = 90000;
const char *fname = BASEDIR "\\test.txt";
- unsigned seed = time(NULL);
+ uint_t seed = time(NULL);
union smb_fileinfo finfo;
buf = talloc_zero(mem_ctx, maxsize);
printf("Testing CreateSecret\n");
- asprintf(&secname, "torturesecret-%u", (unsigned)random());
+ asprintf(&secname, "torturesecret-%u", (uint_t)random());
init_lsa_Name(&r.in.name, secname);
for (i=0;i<torture_numops;i++) {
- unsigned n = (unsigned)sys_random()%10;
+ uint_t n = (uint_t)sys_random()%10;
if (i % 10 == 0) {
printf("%d\r", i); fflush(stdout);
}
uint_t i = 0;
char buf[131072];
char buf_rd[131072];
- unsigned count;
- unsigned countprev = 0;
+ uint_t count;
+ uint_t countprev = 0;
ssize_t sent = 0;
BOOL correct = True;
if (procnum == 0)
{
- sent = ((unsigned)sys_random()%(20))+ 1;
+ sent = ((uint_t)sys_random()%(20))+ 1;
if (sent > sizeof(buf) - count)
{
sent = sizeof(buf) - count;
for (i=0;i<torture_numops;i++)
{
- size_t buf_size = ((unsigned)sys_random()%(sizeof(buf)-1))+ 1;
+ size_t buf_size = ((uint_t)sys_random()%(sizeof(buf)-1))+ 1;
if (i % 10 == 0) {
printf("%d\r", i); fflush(stdout);
}
const char *fname = "\\lockt1.lck";
int fnum1, fnum2, fnum3;
time_t t1, t2;
- unsigned lock_timeout;
+ uint_t lock_timeout;
if (!torture_open_connection(&cli1) || !torture_open_connection(&cli2)) {
return False;
static struct {
const char *name;
BOOL (*fn)(int);
- unsigned flags;
+ uint_t flags;
} torture_ops[] = {
{"FDPASS", run_fdpasstest, 0},
{"LOCK1", run_locktest1, 0},
}
}
-BOOL net_find_server(unsigned flags, struct in_addr *server_ip, char **server_name)
+BOOL net_find_server(uint_t flags, struct in_addr *server_ip, char **server_name)
{
if (opt_host) {
}
-struct cli_state *net_make_ipc_connection(unsigned flags)
+struct cli_state *net_make_ipc_connection(uint_t flags)
{
char *server_name = NULL;
struct in_addr server_ip;
length encoded strings, terminated by either 1) a zero length string or 2)
a 0xc0 byte with what appears to be a one byte flags immediately following.
*/
-static unsigned pull_netlogon_string(struct netlogon_string *ret,const char *d)
+static uint_t pull_netlogon_string(struct netlogon_string *ret,const char *d)
{
char *p = (char *)d;
ZERO_STRUCTP(ret);
do {
- unsigned len = (uint8_t)*p;
+ uint_t len = (uint8_t)*p;
p++;
if (len > 0 && len != 0xc0) {
do a cldap netlogon query
*/
static int send_cldap_netlogon(int sock, const char *domain,
- const char *hostname, unsigned ntversion)
+ const char *hostname, uint_t ntversion)
{
ASN1_DATA data;
char ntver[4];
* if the host is not explicitly specified
* @return BOOL (true means rpc supported)
*/
-BOOL net_rpc_check(unsigned flags)
+BOOL net_rpc_check(uint_t flags)
{
struct cli_state cli;
BOOL ret = False;
}
-static void dump_database(struct cli_state *cli, unsigned db_type, DOM_CRED *ret_creds)
+static void dump_database(struct cli_state *cli, uint_t db_type, DOM_CRED *ret_creds)
{
- unsigned sync_context = 0;
+ uint_t sync_context = 0;
NTSTATUS result;
int i;
TALLOC_CTX *mem_ctx;
}
static void
-fetch_database(struct cli_state *cli, unsigned db_type, DOM_CRED *ret_creds,
+fetch_database(struct cli_state *cli, uint_t db_type, DOM_CRED *ret_creds,
DOM_SID dom_sid)
{
- unsigned sync_context = 0;
+ uint_t sync_context = 0;
NTSTATUS result;
int i;
TALLOC_CTX *mem_ctx;