1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

r25554: Convert last instances of BOOL, True and False to the standard types.

This commit is contained in:
Jelmer Vernooij 2007-10-06 22:28:14 +00:00 committed by Gerald (Jerry) Carter
parent b7371f1a19
commit 566aa14139
236 changed files with 4638 additions and 4637 deletions

View File

@ -235,15 +235,15 @@ void creds_client_authenticator(struct creds_CredentialState *creds,
/*
check that a credentials reply from a server is correct
*/
BOOL creds_client_check(struct creds_CredentialState *creds,
bool creds_client_check(struct creds_CredentialState *creds,
const struct netr_Credential *received_credentials)
{
if (!received_credentials ||
memcmp(received_credentials->data, creds->server.data, 8) != 0) {
DEBUG(2,("credentials check failed\n"));
return False;
return false;
}
return True;
return true;
}
@ -278,16 +278,16 @@ void creds_server_init(struct creds_CredentialState *creds,
/*
check that a credentials reply from a server is correct
*/
BOOL creds_server_check(const struct creds_CredentialState *creds,
bool creds_server_check(const struct creds_CredentialState *creds,
const struct netr_Credential *received_credentials)
{
if (memcmp(received_credentials->data, creds->client.data, 8) != 0) {
DEBUG(2,("credentials check failed\n"));
dump_data_pw("client creds", creds->client.data, 8);
dump_data_pw("calc creds", received_credentials->data, 8);
return False;
return false;
}
return True;
return true;
}
NTSTATUS creds_server_step_check(struct creds_CredentialState *creds,

View File

@ -30,7 +30,7 @@
as the in blob
*/
static void sess_crypt_blob(DATA_BLOB *out, const DATA_BLOB *in, const DATA_BLOB *session_key,
BOOL forward)
bool forward)
{
int i, k;
@ -84,7 +84,7 @@ DATA_BLOB sess_encrypt_string(const char *str, const DATA_BLOB *session_key)
memset(src.data+8, 0, dlen);
memcpy(src.data+8, str, slen);
sess_crypt_blob(&ret, &src, session_key, True);
sess_crypt_blob(&ret, &src, session_key, true);
data_blob_free(&src);
@ -112,7 +112,7 @@ char *sess_decrypt_string(TALLOC_CTX *mem_ctx,
return NULL;
}
sess_crypt_blob(&out, blob, session_key, False);
sess_crypt_blob(&out, blob, session_key, false);
if (IVAL(out.data, 4) != 1) {
DEBUG(0,("Unexpected revision number %d in session crypted string\n",
@ -166,7 +166,7 @@ DATA_BLOB sess_encrypt_blob(TALLOC_CTX *mem_ctx, DATA_BLOB *blob_in, const DATA_
memset(src.data+8, 0, dlen);
memcpy(src.data+8, blob_in->data, blob_in->length);
sess_crypt_blob(&ret, &src, session_key, True);
sess_crypt_blob(&ret, &src, session_key, true);
data_blob_free(&src);
@ -193,7 +193,7 @@ NTSTATUS sess_decrypt_blob(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob, const DAT
return NT_STATUS_NO_MEMORY;
}
sess_crypt_blob(&out, blob, session_key, False);
sess_crypt_blob(&out, blob, session_key, false);
if (IVAL(out.data, 4) != 1) {
DEBUG(2,("Unexpected revision number %d in session crypted secret (BLOB)\n",

View File

@ -34,11 +34,11 @@
It takes a password ('unix' string), a 8 byte "crypt key"
and puts 24 bytes of encrypted password into p24
Returns False if password must have been truncated to create LM hash
Returns false if password must have been truncated to create LM hash
*/
BOOL SMBencrypt(const char *passwd, const uint8_t *c8, uint8_t p24[24])
bool SMBencrypt(const char *passwd, const uint8_t *c8, uint8_t p24[24])
{
BOOL ret;
bool ret;
uint8_t p21[21];
memset(p21,'\0',21);
@ -62,7 +62,7 @@ BOOL SMBencrypt(const char *passwd, const uint8_t *c8, uint8_t p24[24])
* @param p16 return password hashed with md4, caller allocated 16 byte buffer
*/
_PUBLIC_ BOOL E_md4hash(const char *passwd, uint8_t p16[16])
_PUBLIC_ bool E_md4hash(const char *passwd, uint8_t p16[16])
{
int len;
void *wpwd;
@ -72,27 +72,27 @@ _PUBLIC_ BOOL E_md4hash(const char *passwd, uint8_t p16[16])
/* We don't want to return fixed data, as most callers
* don't check */
mdfour(p16, (const uint8_t *)passwd, strlen(passwd));
return False;
return false;
}
len -= 2;
mdfour(p16, wpwd, len);
talloc_free(wpwd);
return True;
return true;
}
/**
* Creates the DES forward-only Hash of the users password in DOS ASCII charset
* @param passwd password in 'unix' charset.
* @param p16 return password hashed with DES, caller allocated 16 byte buffer
* @return False if password was > 14 characters, and therefore may be incorrect, otherwise True
* @return false if password was > 14 characters, and therefore may be incorrect, otherwise true
* @note p16 is filled in regardless
*/
_PUBLIC_ BOOL E_deshash(const char *passwd, uint8_t p16[16])
_PUBLIC_ bool E_deshash(const char *passwd, uint8_t p16[16])
{
BOOL ret = True;
bool ret = true;
fstring dospwd;
ZERO_STRUCT(dospwd);
@ -103,7 +103,7 @@ _PUBLIC_ BOOL E_deshash(const char *passwd, uint8_t p16[16])
E_P16((const uint8_t *)dospwd, p16);
if (strlen(dospwd) > 14) {
ret = False;
ret = false;
}
ZERO_STRUCT(dospwd);
@ -112,9 +112,9 @@ _PUBLIC_ BOOL E_deshash(const char *passwd, uint8_t p16[16])
}
/* Does both the NTLMv2 owfs of a user's password */
BOOL ntv2_owf_gen(const uint8_t owf[16],
bool ntv2_owf_gen(const uint8_t owf[16],
const char *user_in, const char *domain_in,
BOOL upper_case_domain, /* Transform the domain into UPPER case */
bool upper_case_domain, /* Transform the domain into UPPER case */
uint8_t kr_buf[16])
{
void *user;
@ -125,7 +125,7 @@ BOOL ntv2_owf_gen(const uint8_t owf[16],
HMACMD5Context ctx;
TALLOC_CTX *mem_ctx = talloc_init("ntv2_owf_gen for %s\\%s", domain_in, user_in);
if (!mem_ctx) {
return False;
return false;
}
if (!user_in) {
@ -139,14 +139,14 @@ BOOL ntv2_owf_gen(const uint8_t owf[16],
user_in = strupper_talloc(mem_ctx, user_in);
if (user_in == NULL) {
talloc_free(mem_ctx);
return False;
return false;
}
if (upper_case_domain) {
domain_in = strupper_talloc(mem_ctx, domain_in);
if (domain_in == NULL) {
talloc_free(mem_ctx);
return False;
return false;
}
}
@ -154,14 +154,14 @@ BOOL ntv2_owf_gen(const uint8_t owf[16],
if (user_byte_len == (ssize_t)-1) {
DEBUG(0, ("push_uss2_talloc() for user returned -1 (probably talloc() failure)\n"));
talloc_free(mem_ctx);
return False;
return false;
}
domain_byte_len = push_ucs2_talloc(mem_ctx, &domain, domain_in);
if (domain_byte_len == (ssize_t)-1) {
DEBUG(0, ("push_ucs2_talloc() for domain returned -1 (probably talloc() failure)\n"));
talloc_free(mem_ctx);
return False;
return false;
}
SMB_ASSERT(user_byte_len >= 2);
@ -185,7 +185,7 @@ BOOL ntv2_owf_gen(const uint8_t owf[16],
#endif
talloc_free(mem_ctx);
return True;
return true;
}
/* Does the des encryption from the NT or LM MD4 hash. */
@ -393,7 +393,7 @@ static DATA_BLOB LMv2_generate_response(TALLOC_CTX *mem_ctx,
return final_response;
}
BOOL SMBNTLMv2encrypt_hash(TALLOC_CTX *mem_ctx,
bool SMBNTLMv2encrypt_hash(TALLOC_CTX *mem_ctx,
const char *user, const char *domain, const uint8_t nt_hash[16],
const DATA_BLOB *server_chal,
const DATA_BLOB *names_blob,
@ -406,8 +406,8 @@ BOOL SMBNTLMv2encrypt_hash(TALLOC_CTX *mem_ctx,
the username and domain.
This prevents username swapping during the auth exchange
*/
if (!ntv2_owf_gen(nt_hash, user, domain, True, ntlm_v2_hash)) {
return False;
if (!ntv2_owf_gen(nt_hash, user, domain, true, ntlm_v2_hash)) {
return false;
}
if (nt_response) {
@ -437,10 +437,10 @@ BOOL SMBNTLMv2encrypt_hash(TALLOC_CTX *mem_ctx,
}
}
return True;
return true;
}
BOOL SMBNTLMv2encrypt(TALLOC_CTX *mem_ctx,
bool SMBNTLMv2encrypt(TALLOC_CTX *mem_ctx,
const char *user, const char *domain,
const char *password,
const DATA_BLOB *server_chal,
@ -460,7 +460,7 @@ BOOL SMBNTLMv2encrypt(TALLOC_CTX *mem_ctx,
encode a password buffer with a unicode password. The buffer
is filled with random data to make it harder to attack.
************************************************************/
BOOL encode_pw_buffer(uint8_t buffer[516], const char *password, int string_flags)
bool encode_pw_buffer(uint8_t buffer[516], const char *password, int string_flags)
{
uint8_t new_pw[512];
size_t new_pw_len;
@ -482,7 +482,7 @@ BOOL encode_pw_buffer(uint8_t buffer[516], const char *password, int string_flag
*/
SIVAL(buffer, 512, new_pw_len);
ZERO_STRUCT(new_pw);
return True;
return true;
}
@ -491,7 +491,7 @@ BOOL encode_pw_buffer(uint8_t buffer[516], const char *password, int string_flag
*new_pw_len is the length in bytes of the possibly mulitbyte
returned password including termination.
************************************************************/
BOOL decode_pw_buffer(uint8_t in_buffer[516], char *new_pwrd,
bool decode_pw_buffer(uint8_t in_buffer[516], char *new_pwrd,
int new_pwrd_size, uint32_t *new_pw_len,
int string_flags)
{
@ -517,7 +517,7 @@ BOOL decode_pw_buffer(uint8_t in_buffer[516], char *new_pwrd,
/* Password cannot be longer than the size of the password buffer */
if ( (byte_len < 0) || (byte_len > 512)) {
return False;
return false;
}
/* decode into the return buffer. Buffer length supplied */
@ -531,5 +531,5 @@ BOOL decode_pw_buffer(uint8_t in_buffer[516], char *new_pwrd,
DEBUG(100,("original char len:%d\n", byte_len/2));
#endif
return True;
return true;
}

View File

@ -309,7 +309,7 @@ struct cldap_request *cldap_search_send(struct cldap_socket *cldap,
req->state = CLDAP_REQUEST_SEND;
req->timeout = io->in.timeout;
req->num_retries = io->in.retries;
req->is_reply = False;
req->is_reply = false;
req->asn1 = asn1_init(req);
if (!req->asn1) {
goto failed;
@ -337,7 +337,7 @@ struct cldap_request *cldap_search_send(struct cldap_socket *cldap,
search->deref = LDAP_DEREFERENCE_NEVER;
search->timelimit = 0;
search->sizelimit = 0;
search->attributesonly = False;
search->attributesonly = false;
search->num_attributes = str_list_length(io->in.attributes);
search->attributes = io->in.attributes;
search->tree = ldb_parse_tree(req, io->in.filter);
@ -378,7 +378,7 @@ NTSTATUS cldap_reply_send(struct cldap_socket *cldap, struct cldap_reply *io)
req->cldap = cldap;
req->state = CLDAP_REQUEST_SEND;
req->is_reply = True;
req->is_reply = true;
req->asn1 = asn1_init(req);
if (!req->asn1) {
goto failed;

View File

@ -30,24 +30,24 @@
/*
wrapper around smbcli_sock_connect()
*/
BOOL smbcli_socket_connect(struct smbcli_state *cli, const char *server)
bool smbcli_socket_connect(struct smbcli_state *cli, const char *server)
{
struct smbcli_socket *sock;
sock = smbcli_sock_connect_byname(server, 0, NULL, NULL);
if (sock == NULL) return False;
if (sock == NULL) return false;
cli->transport = smbcli_transport_init(sock, cli, True);
cli->transport = smbcli_transport_init(sock, cli, true);
if (!cli->transport) {
return False;
return false;
}
return True;
return true;
}
/* wrapper around smbcli_transport_connect() */
BOOL smbcli_transport_establish(struct smbcli_state *cli,
bool smbcli_transport_establish(struct smbcli_state *cli,
struct nbt_name *calling,
struct nbt_name *called)
{
@ -68,7 +68,7 @@ NTSTATUS smbcli_session_setup(struct smbcli_state *cli,
struct smb_composite_sesssetup setup;
NTSTATUS status;
cli->session = smbcli_session_init(cli->transport, cli, True);
cli->session = smbcli_session_init(cli->transport, cli, true);
if (!cli->session) return NT_STATUS_UNSUCCESSFUL;
setup.in.sesskey = cli->transport->negotiate.sesskey;
@ -91,7 +91,7 @@ NTSTATUS smbcli_tconX(struct smbcli_state *cli, const char *sharename,
TALLOC_CTX *mem_ctx;
NTSTATUS status;
cli->tree = smbcli_tree_init(cli->session, cli, True);
cli->tree = smbcli_tree_init(cli->session, cli, true);
if (!cli->tree) return NT_STATUS_UNSUCCESSFUL;
mem_ctx = talloc_init("tcon");
@ -216,7 +216,7 @@ bool smbcli_parse_unc(const char *unc_name, TALLOC_CTX *mem_ctx,
if (strncmp(unc_name, "\\\\", 2) &&
strncmp(unc_name, "//", 2)) {
return False;
return false;
}
*hostname = talloc_strdup(mem_ctx, &unc_name[2]);
@ -228,13 +228,13 @@ bool smbcli_parse_unc(const char *unc_name, TALLOC_CTX *mem_ctx,
}
if (*hostname && *sharename) {
return True;
return true;
}
talloc_free(*hostname);
talloc_free(*sharename);
*hostname = *sharename = NULL;
return False;
return false;
}

View File

@ -25,7 +25,7 @@
struct delete_state {
struct smbcli_tree *tree;
int total_deleted;
BOOL failed;
bool failed;
};
/*
@ -61,14 +61,14 @@ static void delete_fn(struct clilist_file_info *finfo, const char *name, void *s
if (NT_STATUS_IS_ERR(smbcli_rmdir(dstate->tree, s))) {
DEBUG(2,("Failed to delete %s - %s\n",
s, smbcli_errstr(dstate->tree)));
dstate->failed = True;
dstate->failed = true;
}
dstate->total_deleted++;
} else {
if (NT_STATUS_IS_ERR(smbcli_unlink(dstate->tree, s))) {
DEBUG(2,("Failed to delete %s - %s\n",
s, smbcli_errstr(dstate->tree)));
dstate->failed = True;
dstate->failed = true;
}
dstate->total_deleted++;
}
@ -87,7 +87,7 @@ int smbcli_deltree(struct smbcli_tree *tree, const char *dname)
dstate.tree = tree;
dstate.total_deleted = 0;
dstate.failed = False;
dstate.failed = false;
/* it might be a file */
if (NT_STATUS_IS_OK(smbcli_unlink(tree, dname))) {

View File

@ -30,7 +30,7 @@
static NTSTATUS smbcli_link_internal(struct smbcli_tree *tree,
const char *fname_src,
const char *fname_dst, BOOL hard_link)
const char *fname_dst, bool hard_link)
{
union smb_setfileinfo parms;
NTSTATUS status;
@ -84,7 +84,7 @@ uint32_t unix_perms_to_wire(mode_t perms)
NTSTATUS smbcli_unix_symlink(struct smbcli_tree *tree, const char *fname_src,
const char *fname_dst)
{
return smbcli_link_internal(tree, fname_src, fname_dst, False);
return smbcli_link_internal(tree, fname_src, fname_dst, false);
}
/****************************************************************************
@ -93,7 +93,7 @@ NTSTATUS smbcli_unix_symlink(struct smbcli_tree *tree, const char *fname_src,
NTSTATUS smbcli_unix_hardlink(struct smbcli_tree *tree, const char *fname_src,
const char *fname_dst)
{
return smbcli_link_internal(tree, fname_src, fname_dst, True);
return smbcli_link_internal(tree, fname_src, fname_dst, true);
}
@ -206,7 +206,8 @@ NTSTATUS smbcli_rmdir(struct smbcli_tree *tree, const char *dname)
/****************************************************************************
Set or clear the delete on close flag.
****************************************************************************/
NTSTATUS smbcli_nt_delete_on_close(struct smbcli_tree *tree, int fnum, BOOL flag)
NTSTATUS smbcli_nt_delete_on_close(struct smbcli_tree *tree, int fnum,
bool flag)
{
union smb_setfileinfo parms;
NTSTATUS status;

View File

@ -37,7 +37,7 @@ struct search_private {
/****************************************************************************
Interpret a long filename structure.
****************************************************************************/
static BOOL interpret_long_filename(enum smb_search_data_level level,
static bool interpret_long_filename(enum smb_search_data_level level,
const union smb_search_data *info,
struct clilist_file_info *finfo)
{
@ -65,14 +65,14 @@ static BOOL interpret_long_filename(enum smb_search_data_level level,
default:
DEBUG(0,("Unhandled level %d in interpret_long_filename\n", (int)level));
return False;
return false;
}
return True;
return true;
}
/* callback function used for trans2 search */
static BOOL smbcli_list_new_callback(void *private, const union smb_search_data *file)
static bool smbcli_list_new_callback(void *private, const union smb_search_data *file)
{
struct search_private *state = (struct search_private*) private;
struct clilist_file_info *tdl;
@ -83,7 +83,7 @@ static BOOL smbcli_list_new_callback(void *private, const union smb_search_data
struct clilist_file_info,
state->dirlist_len + 1);
if (!tdl) {
return False;
return false;
}
state->dirlist = tdl;
state->dirlist_len++;
@ -94,7 +94,7 @@ static BOOL smbcli_list_new_callback(void *private, const union smb_search_data
state->total_received++;
state->ff_searchcount++;
return True;
return true;
}
int smbcli_list_new(struct smbcli_tree *tree, const char *Mask, uint16_t attribute,
@ -106,7 +106,7 @@ int smbcli_list_new(struct smbcli_tree *tree, const char *Mask, uint16_t attribu
union smb_search_next next_parms;
struct search_private state; /* for callbacks */
int received = 0;
BOOL first = True;
bool first = true;
int num_received = 0;
int max_matches = 512;
char *mask;
@ -159,7 +159,7 @@ int smbcli_list_new(struct smbcli_tree *tree, const char *Mask, uint16_t attribu
received = first_parms.t2ffirst.out.count;
if (received <= 0) break;
if (ff_eos) break;
first = False;
first = false;
} else {
NTSTATUS status;
@ -203,7 +203,7 @@ int smbcli_list_new(struct smbcli_tree *tree, const char *Mask, uint16_t attribu
Interpret a short filename structure.
The length of the structure is returned.
****************************************************************************/
static BOOL interpret_short_filename(enum smb_search_data_level level,
static bool interpret_short_filename(enum smb_search_data_level level,
const union smb_search_data *info,
struct clilist_file_info *finfo)
{
@ -223,14 +223,14 @@ static BOOL interpret_short_filename(enum smb_search_data_level level,
default:
DEBUG(0,("Unhandled level %d in interpret_short_filename\n", (int)level));
return False;
return false;
}
return True;
return true;
}
/* callback function used for smb_search */
static BOOL smbcli_list_old_callback(void *private, const union smb_search_data *file)
static bool smbcli_list_old_callback(void *private, const union smb_search_data *file)
{
struct search_private *state = (struct search_private*) private;
struct clilist_file_info *tdl;
@ -242,7 +242,7 @@ static BOOL smbcli_list_old_callback(void *private, const union smb_search_data
state->dirlist_len + 1);
if (!tdl) {
return False;
return false;
}
state->dirlist = tdl;
state->dirlist_len++;
@ -253,7 +253,7 @@ static BOOL smbcli_list_old_callback(void *private, const union smb_search_data
state->ff_searchcount++;
state->id = file->search.id; /* return resume info */
return True;
return true;
}
int smbcli_list_old(struct smbcli_tree *tree, const char *Mask, uint16_t attribute,
@ -265,7 +265,7 @@ int smbcli_list_old(struct smbcli_tree *tree, const char *Mask, uint16_t attribu
struct search_private state; /* for callbacks */
const int num_asked = 500;
int received = 0;
BOOL first = True;
bool first = true;
int num_received = 0;
char *mask;
int i;
@ -303,7 +303,7 @@ int smbcli_list_old(struct smbcli_tree *tree, const char *Mask, uint16_t attribu
received = first_parms.search_first.out.count;
if (received <= 0) break;
first = False;
first = false;
} else {
NTSTATUS status;

View File

@ -26,7 +26,7 @@
/****************************************************************************
start a message sequence
****************************************************************************/
BOOL smbcli_message_start(struct smbcli_tree *tree, const char *host, const char *username,
bool smbcli_message_start(struct smbcli_tree *tree, const char *host, const char *username,
int *grp)
{
struct smbcli_request *req;
@ -38,20 +38,20 @@ BOOL smbcli_message_start(struct smbcli_tree *tree, const char *host, const char
!smbcli_request_receive(req) ||
smbcli_is_error(tree)) {
smbcli_request_destroy(req);
return False;
return false;
}
*grp = SVAL(req->in.vwv, VWV(0));
smbcli_request_destroy(req);
return True;
return true;
}
/****************************************************************************
send a message
****************************************************************************/
BOOL smbcli_message_text(struct smbcli_tree *tree, char *msg, int len, int grp)
bool smbcli_message_text(struct smbcli_tree *tree, char *msg, int len, int grp)
{
struct smbcli_request *req;
@ -64,17 +64,17 @@ BOOL smbcli_message_text(struct smbcli_tree *tree, char *msg, int len, int grp)
!smbcli_request_receive(req) ||
smbcli_is_error(tree)) {
smbcli_request_destroy(req);
return False;
return false;
}
smbcli_request_destroy(req);
return True;
return true;
}
/****************************************************************************
end a message
****************************************************************************/
BOOL smbcli_message_end(struct smbcli_tree *tree, int grp)
bool smbcli_message_end(struct smbcli_tree *tree, int grp)
{
struct smbcli_request *req;
@ -85,10 +85,10 @@ BOOL smbcli_message_end(struct smbcli_tree *tree, int grp)
!smbcli_request_receive(req) ||
smbcli_is_error(tree)) {
smbcli_request_destroy(req);
return False;
return false;
}
smbcli_request_destroy(req);
return True;
return true;
}

View File

@ -56,7 +56,7 @@ ssize_t smbcli_read(struct smbcli_tree *tree, int fnum, void *_buf, off_t offset
parms.readx.in.mincnt = readsize;
parms.readx.in.maxcnt = readsize;
parms.readx.in.remaining = size - total;
parms.readx.in.read_for_execute = False;
parms.readx.in.read_for_execute = false;
parms.readx.out.data = buf + total;
status = smb_raw_read(tree, &parms);

View File

@ -53,7 +53,7 @@ _PUBLIC_ NTSTATUS composite_wait(struct composite_context *c)
{
if (c == NULL) return NT_STATUS_NO_MEMORY;
c->used_wait = True;
c->used_wait = true;
while (c->state < COMPOSITE_STATE_DONE) {
if (event_loop_once(c->event_ctx) != 0) {
@ -69,16 +69,16 @@ _PUBLIC_ NTSTATUS composite_wait(struct composite_context *c)
* Some composite helpers that are handy if you write larger composite
* functions.
*/
_PUBLIC_ BOOL composite_is_ok(struct composite_context *ctx)
_PUBLIC_ bool composite_is_ok(struct composite_context *ctx)
{
if (NT_STATUS_IS_OK(ctx->status)) {
return True;
return true;
}
ctx->state = COMPOSITE_STATE_ERROR;
if (ctx->async.fn != NULL) {
ctx->async.fn(ctx);
}
return False;
return false;
}
/*
@ -113,13 +113,13 @@ _PUBLIC_ void composite_error(struct composite_context *ctx, NTSTATUS status)
SMB_ASSERT(!composite_is_ok(ctx));
}
_PUBLIC_ BOOL composite_nomem(const void *p, struct composite_context *ctx)
_PUBLIC_ bool composite_nomem(const void *p, struct composite_context *ctx)
{
if (p != NULL) {
return False;
return false;
}
composite_error(ctx, NT_STATUS_NO_MEMORY);
return True;
return true;
}
_PUBLIC_ void composite_done(struct composite_context *ctx)

View File

@ -27,7 +27,7 @@
#include "libcli/ldap/ldap.h"
static BOOL ldap_push_filter(struct asn1_data *data, struct ldb_parse_tree *tree)
static bool ldap_push_filter(struct asn1_data *data, struct ldb_parse_tree *tree)
{
int i;
@ -37,7 +37,7 @@ static BOOL ldap_push_filter(struct asn1_data *data, struct ldb_parse_tree *tree
asn1_push_tag(data, ASN1_CONTEXT(tree->operation==LDB_OP_AND?0:1));
for (i=0; i<tree->u.list.num_elements; i++) {
if (!ldap_push_filter(data, tree->u.list.elements[i])) {
return False;
return false;
}
}
asn1_pop_tag(data);
@ -46,7 +46,7 @@ static BOOL ldap_push_filter(struct asn1_data *data, struct ldb_parse_tree *tree
case LDB_OP_NOT:
asn1_push_tag(data, ASN1_CONTEXT(2));
if (!ldap_push_filter(data, tree->u.isnot.child)) {
return False;
return false;
}
asn1_pop_tag(data);
break;
@ -166,7 +166,7 @@ static BOOL ldap_push_filter(struct asn1_data *data, struct ldb_parse_tree *tree
break;
default:
return False;
return false;
}
return !data->has_error;
}
@ -187,12 +187,12 @@ static void ldap_encode_response(struct asn1_data *data, struct ldap_Result *res
}
}
BOOL ldap_encode(struct ldap_message *msg, DATA_BLOB *result, TALLOC_CTX *mem_ctx)
bool ldap_encode(struct ldap_message *msg, DATA_BLOB *result, TALLOC_CTX *mem_ctx)
{
struct asn1_data *data = asn1_init(mem_ctx);
int i, j;
if (!data) return False;
if (!data) return false;
asn1_push_tag(data, ASN1_SEQUENCE(0));
asn1_write_Integer(data, msg->messageid);
@ -225,7 +225,7 @@ BOOL ldap_encode(struct ldap_message *msg, DATA_BLOB *result, TALLOC_CTX *mem_ct
asn1_pop_tag(data);
break;
default:
return False;
return false;
}
asn1_pop_tag(data);
@ -256,7 +256,7 @@ BOOL ldap_encode(struct ldap_message *msg, DATA_BLOB *result, TALLOC_CTX *mem_ct
asn1_write_BOOLEAN(data, r->attributesonly);
if (!ldap_push_filter(data, r->tree)) {
return False;
return false;
}
asn1_push_tag(data, ASN1_SEQUENCE(0));
@ -467,7 +467,7 @@ BOOL ldap_encode(struct ldap_message *msg, DATA_BLOB *result, TALLOC_CTX *mem_ct
break;
}
default:
return False;
return false;
}
if (msg->controls != NULL) {
@ -475,7 +475,7 @@ BOOL ldap_encode(struct ldap_message *msg, DATA_BLOB *result, TALLOC_CTX *mem_ct
for (i = 0; msg->controls[i] != NULL; i++) {
if (!ldap_encode_control(mem_ctx, data, msg->controls[i])) {
return False;
return false;
}
}
@ -486,12 +486,12 @@ BOOL ldap_encode(struct ldap_message *msg, DATA_BLOB *result, TALLOC_CTX *mem_ct
if (data->has_error) {
asn1_free(data);
return False;
return false;
}
*result = data_blob_talloc(mem_ctx, data->data, data->length);
asn1_free(data);
return True;
return true;
}
static const char *blob2string_talloc(TALLOC_CTX *mem_ctx,
@ -503,16 +503,16 @@ static const char *blob2string_talloc(TALLOC_CTX *mem_ctx,
return result;
}
static BOOL asn1_read_OctetString_talloc(TALLOC_CTX *mem_ctx,
static bool asn1_read_OctetString_talloc(TALLOC_CTX *mem_ctx,
struct asn1_data *data,
const char **result)
{
DATA_BLOB string;
if (!asn1_read_OctetString(data, mem_ctx, &string))
return False;
return false;
*result = blob2string_talloc(mem_ctx, string);
data_blob_free(&string);
return True;
return true;
}
static void ldap_decode_response(TALLOC_CTX *mem_ctx,

View File

@ -258,7 +258,7 @@ NTSTATUS ldap_bind_sasl(struct ldap_connection *conn, struct cli_credentials *cr
}
status = ildap_search(conn, "", LDAP_SEARCH_SCOPE_BASE, "", supported_sasl_mech_attrs,
False, NULL, NULL, &sasl_mechs_msgs);
false, NULL, NULL, &sasl_mechs_msgs);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(1, ("Failed to inquire of target's available sasl mechs in rootdse search: %s\n",
nt_errstr(status)));

View File

@ -226,7 +226,7 @@ static void ldap_io_handler(struct event_context *ev, struct fd_event *fde,
parse a ldap URL
*/
static NTSTATUS ldap_parse_basic_url(TALLOC_CTX *mem_ctx, const char *url,
char **host, uint16_t *port, BOOL *ldaps)
char **host, uint16_t *port, bool *ldaps)
{
int tmp_port = 0;
char protocol[11];
@ -243,10 +243,10 @@ static NTSTATUS ldap_parse_basic_url(TALLOC_CTX *mem_ctx, const char *url,
if (strequal(protocol, "ldap")) {
*port = 389;
*ldaps = False;
*ldaps = false;
} else if (strequal(protocol, "ldaps")) {
*port = 636;
*ldaps = True;
*ldaps = true;
} else {
DEBUG(0, ("unrecognised ldap protocol (%s)!\n", protocol));
return NT_STATUS_PROTOCOL_UNREACHABLE;

File diff suppressed because it is too large Load Diff

View File

@ -41,7 +41,7 @@ int ildap_count_entries(struct ldap_connection *conn, struct ldap_message **res)
*/
NTSTATUS ildap_search_bytree(struct ldap_connection *conn, const char *basedn,
int scope, struct ldb_parse_tree *tree,
const char * const *attrs, BOOL attributesonly,
const char * const *attrs, bool attributesonly,
struct ldb_control **control_req,
struct ldb_control ***control_res,
struct ldap_message ***results)
@ -75,7 +75,7 @@ NTSTATUS ildap_search_bytree(struct ldap_connection *conn, const char *basedn,
req = ldap_request_send(conn, msg);
talloc_steal(msg, req);
for (i=n=0;True;i++) {
for (i=n=0;true;i++) {
struct ldap_message *res;
status = ldap_result_n(req, i, &res);
if (!NT_STATUS_IS_OK(status)) break;
@ -114,7 +114,7 @@ NTSTATUS ildap_search_bytree(struct ldap_connection *conn, const char *basedn,
*/
NTSTATUS ildap_search(struct ldap_connection *conn, const char *basedn,
int scope, const char *expression,
const char * const *attrs, BOOL attributesonly,
const char * const *attrs, bool attributesonly,
struct ldb_control **control_req,
struct ldb_control ***control_res,
struct ldap_message ***results)

View File

@ -32,7 +32,7 @@ struct ldap_message *new_ldap_message(TALLOC_CTX *mem_ctx)
}
BOOL add_value_to_attrib(TALLOC_CTX *mem_ctx, struct ldb_val *value,
bool add_value_to_attrib(TALLOC_CTX *mem_ctx, struct ldb_val *value,
struct ldb_message_element *attrib)
{
attrib->values = talloc_realloc(mem_ctx,
@ -40,16 +40,16 @@ BOOL add_value_to_attrib(TALLOC_CTX *mem_ctx, struct ldb_val *value,
DATA_BLOB,
attrib->num_values+1);
if (attrib->values == NULL)
return False;
return false;
attrib->values[attrib->num_values].data = talloc_steal(attrib->values,
value->data);
attrib->values[attrib->num_values].length = value->length;
attrib->num_values += 1;
return True;
return true;
}
BOOL add_attrib_to_array_talloc(TALLOC_CTX *mem_ctx,
bool add_attrib_to_array_talloc(TALLOC_CTX *mem_ctx,
const struct ldb_message_element *attrib,
struct ldb_message_element **attribs,
int *num_attribs)
@ -60,16 +60,16 @@ BOOL add_attrib_to_array_talloc(TALLOC_CTX *mem_ctx,
*num_attribs+1);
if (*attribs == NULL)
return False;
return false;
(*attribs)[*num_attribs] = *attrib;
talloc_steal(*attribs, attrib->values);
talloc_steal(*attribs, attrib->name);
*num_attribs += 1;
return True;
return true;
}
BOOL add_mod_to_array_talloc(TALLOC_CTX *mem_ctx,
bool add_mod_to_array_talloc(TALLOC_CTX *mem_ctx,
struct ldap_mod *mod,
struct ldap_mod **mods,
int *num_mods)
@ -77,10 +77,10 @@ BOOL add_mod_to_array_talloc(TALLOC_CTX *mem_ctx,
*mods = talloc_realloc(mem_ctx, *mods, struct ldap_mod, (*num_mods)+1);
if (*mods == NULL)
return False;
return false;
(*mods)[*num_mods] = *mod;
*num_mods += 1;
return True;
return true;
}

View File

@ -57,7 +57,7 @@ _PUBLIC_ struct nbt_name_request *nbt_name_query_send(struct nbt_name_socket *nb
io->in.dest_addr, lp_nbt_port(global_loadparm));
if (dest == NULL) goto failed;
req = nbt_name_request_send(nbtsock, dest, packet,
io->in.timeout, io->in.retries, False);
io->in.timeout, io->in.retries, false);
if (req == NULL) goto failed;
talloc_free(packet);
@ -161,7 +161,7 @@ _PUBLIC_ struct nbt_name_request *nbt_name_status_send(struct nbt_name_socket *n
io->in.dest_addr, lp_nbt_port(global_loadparm));
if (dest == NULL) goto failed;
req = nbt_name_request_send(nbtsock, dest, packet,
io->in.timeout, io->in.retries, False);
io->in.timeout, io->in.retries, false);
if (req == NULL) goto failed;
talloc_free(packet);

View File

@ -72,7 +72,7 @@ struct nbt_name_request *nbt_name_refresh_send(struct nbt_name_socket *nbtsock,
io->in.dest_addr, lp_nbt_port(global_loadparm));
if (dest == NULL) goto failed;
req = nbt_name_request_send(nbtsock, dest, packet,
io->in.timeout, io->in.retries, False);
io->in.timeout, io->in.retries, false);
if (req == NULL) goto failed;
talloc_free(packet);
@ -242,7 +242,7 @@ struct composite_context *nbt_name_refresh_wins_send(struct nbt_name_socket *nbt
state->io->in.dest_addr = state->wins_servers[0];
state->io->in.address = io->in.addresses[0];
state->io->in.nb_flags = io->in.nb_flags;
state->io->in.broadcast = False;
state->io->in.broadcast = false;
state->io->in.ttl = io->in.ttl;
state->io->in.timeout = 2;
state->io->in.retries = 2;

View File

@ -80,7 +80,7 @@ struct nbt_name_request *nbt_name_register_send(struct nbt_name_socket *nbtsock,
io->in.dest_addr, lp_nbt_port(global_loadparm));
if (dest == NULL) goto failed;
req = nbt_name_request_send(nbtsock, dest, packet,
io->in.timeout, io->in.retries, False);
io->in.timeout, io->in.retries, false);
if (req == NULL) goto failed;
talloc_free(packet);
@ -166,7 +166,7 @@ static void name_register_bcast_handler(struct nbt_name_request *req)
status = nbt_name_register_recv(state->req, state, state->io);
if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT)) {
if (state->io->in.register_demand == True) {
if (state->io->in.register_demand == true) {
/* all done */
c->state = COMPOSITE_STATE_DONE;
c->status = NT_STATUS_OK;
@ -174,7 +174,7 @@ static void name_register_bcast_handler(struct nbt_name_request *req)
}
/* the registration timed out - good, send the demand */
state->io->in.register_demand = True;
state->io->in.register_demand = true;
state->io->in.retries = 0;
state->req = nbt_name_register_send(state->nbtsock, state->io);
if (state->req == NULL) {
@ -226,9 +226,9 @@ struct composite_context *nbt_name_register_bcast_send(struct nbt_name_socket *n
state->io->in.dest_addr = io->in.dest_addr;
state->io->in.address = io->in.address;
state->io->in.nb_flags = io->in.nb_flags;
state->io->in.register_demand = False;
state->io->in.broadcast = True;
state->io->in.multi_homed = False;
state->io->in.register_demand = false;
state->io->in.broadcast = true;
state->io->in.multi_homed = false;
state->io->in.ttl = io->in.ttl;
state->io->in.timeout = 1;
state->io->in.retries = 2;
@ -379,9 +379,9 @@ struct composite_context *nbt_name_register_wins_send(struct nbt_name_socket *nb
state->io->in.dest_addr = state->wins_servers[0];
state->io->in.address = io->in.addresses[0];
state->io->in.nb_flags = io->in.nb_flags;
state->io->in.broadcast = False;
state->io->in.register_demand = False;
state->io->in.multi_homed = (io->in.nb_flags & NBT_NM_GROUP)?False:True;
state->io->in.broadcast = false;
state->io->in.register_demand = false;
state->io->in.multi_homed = (io->in.nb_flags & NBT_NM_GROUP)?false:true;
state->io->in.ttl = io->in.ttl;
state->io->in.timeout = 3;
state->io->in.retries = 2;

View File

@ -70,7 +70,7 @@ struct nbt_name_request *nbt_name_release_send(struct nbt_name_socket *nbtsock,
io->in.dest_addr, lp_nbt_port(global_loadparm));
if (dest == NULL) goto failed;
req = nbt_name_request_send(nbtsock, dest, packet,
io->in.timeout, io->in.retries, False);
io->in.timeout, io->in.retries, false);
if (req == NULL) goto failed;
talloc_free(packet);

View File

@ -149,7 +149,7 @@ _PUBLIC_ NTSTATUS ndr_push_nbt_string(struct ndr_push *ndr, int ndr_flags, const
/* see if we have pushed the remaing string allready,
* if so we use a label pointer to this string
*/
status = ndr_token_retrieve_cmp_fn(&ndr->nbt_string_list, s, &offset, (comparison_fn_t)strcmp, False);
status = ndr_token_retrieve_cmp_fn(&ndr->nbt_string_list, s, &offset, (comparison_fn_t)strcmp, false);
if (NT_STATUS_IS_OK(status)) {
uint8_t b[2];

View File

@ -241,7 +241,7 @@ static void nbt_name_socket_recv(struct nbt_name_socket *nbtsock)
/* we know we won't need any more retries - the server
has received our request */
req->num_retries = 0;
req->received_wack = True;
req->received_wack = true;
/* although there can be a timeout in the packet, w2k3 screws it up,
so better to set it ourselves */
req->timeout = lp_parm_int(global_loadparm, NULL, "nbt", "wack_timeout", 30);
@ -355,7 +355,7 @@ struct nbt_name_request *nbt_name_request_send(struct nbt_name_socket *nbtsock,
struct socket_address *dest,
struct nbt_name_packet *request,
int timeout, int retries,
BOOL allow_multiple_replies)
bool allow_multiple_replies)
{
struct nbt_name_request *req;
int id;
@ -367,7 +367,7 @@ struct nbt_name_request *nbt_name_request_send(struct nbt_name_socket *nbtsock,
req->nbtsock = nbtsock;
req->allow_multiple_replies = allow_multiple_replies;
req->state = NBT_REQUEST_SEND;
req->is_reply = False;
req->is_reply = false;
req->timeout = timeout;
req->num_retries = retries;
req->dest = dest;
@ -431,7 +431,7 @@ NTSTATUS nbt_name_reply_send(struct nbt_name_socket *nbtsock,
req->dest = dest;
if (talloc_reference(req, dest) == NULL) goto failed;
req->state = NBT_REQUEST_SEND;
req->is_reply = True;
req->is_reply = true;
talloc_set_destructor(req, nbt_name_request_destructor);

View File

@ -23,9 +23,9 @@
/****************************************************************************
send an ack for an oplock break request
****************************************************************************/
_PUBLIC_ BOOL smbcli_oplock_ack(struct smbcli_tree *tree, uint16_t fnum, uint16_t ack_level)
_PUBLIC_ bool smbcli_oplock_ack(struct smbcli_tree *tree, uint16_t fnum, uint16_t ack_level)
{
BOOL ret;
bool ret;
struct smbcli_request *req;
req = smbcli_request_setup(tree, SMBlockingX, 8, 0);
@ -53,7 +53,7 @@ _PUBLIC_ BOOL smbcli_oplock_ack(struct smbcli_tree *tree, uint16_t fnum, uint16_
set the oplock handler for a connection
****************************************************************************/
_PUBLIC_ void smbcli_oplock_handler(struct smbcli_transport *transport,
BOOL (*handler)(struct smbcli_transport *, uint16_t, uint16_t, uint8_t, void *),
bool (*handler)(struct smbcli_transport *, uint16_t, uint16_t, uint8_t, void *),
void *private)
{
transport->oplock.handler = handler;

View File

@ -33,7 +33,7 @@
Initialize the session context
****************************************************************************/
struct smbcli_session *smbcli_session_init(struct smbcli_transport *transport,
TALLOC_CTX *parent_ctx, BOOL primary)
TALLOC_CTX *parent_ctx, bool primary)
{
struct smbcli_session *session;
uint16_t flags2;

View File

@ -72,7 +72,8 @@ static NTSTATUS smbcli_transport_finish_recv(void *private, DATA_BLOB blob);
create a transport structure based on an established socket
*/
struct smbcli_transport *smbcli_transport_init(struct smbcli_socket *sock,
TALLOC_CTX *parent_ctx, BOOL primary)
TALLOC_CTX *parent_ctx,
bool primary)
{
struct smbcli_transport *transport;
@ -261,7 +262,7 @@ NTSTATUS smbcli_transport_connect_recv(struct smbcli_request *req)
/*
send a session request (if needed)
*/
BOOL smbcli_transport_connect(struct smbcli_transport *transport,
bool smbcli_transport_connect(struct smbcli_transport *transport,
struct nbt_name *calling,
struct nbt_name *called)
{
@ -269,7 +270,7 @@ BOOL smbcli_transport_connect(struct smbcli_transport *transport,
NTSTATUS status;
if (transport->socket->port == 445) {
return True;
return true;
}
req = smbcli_transport_connect_send(transport,
@ -500,16 +501,16 @@ error:
/*
process some read/write requests that are pending
return False if the socket is dead
return false if the socket is dead
*/
BOOL smbcli_transport_process(struct smbcli_transport *transport)
bool smbcli_transport_process(struct smbcli_transport *transport)
{
NTSTATUS status;
size_t npending;
packet_queue_run(transport->packet);
if (transport->socket->sock == NULL) {
return False;
return false;
}
status = socket_pending(transport->socket->sock, &npending);
@ -517,9 +518,9 @@ BOOL smbcli_transport_process(struct smbcli_transport *transport)
packet_recv(transport->packet);
}
if (transport->socket->sock == NULL) {
return False;
return false;
}
return True;
return true;
}
/*

View File

@ -34,7 +34,7 @@
Initialize the tree context
****************************************************************************/
struct smbcli_tree *smbcli_tree_init(struct smbcli_session *session,
TALLOC_CTX *parent_ctx, BOOL primary)
TALLOC_CTX *parent_ctx, bool primary)
{
struct smbcli_tree *tree;
@ -189,7 +189,7 @@ NTSTATUS smbcli_tree_full_connection(TALLOC_CTX *parent_ctx,
io.in.service = service;
io.in.service_type = service_type;
io.in.credentials = credentials;
io.in.fallback_to_anonymous = False;
io.in.fallback_to_anonymous = false;
io.in.workgroup = lp_workgroup(global_loadparm);
status = smb_composite_connect(&io, parent_ctx, ev);

View File

@ -333,7 +333,7 @@ NTSTATUS ea_pull_name_list(const DATA_BLOB *blob,
/*
put a ea_name list into a data blob
*/
BOOL ea_push_name_list(TALLOC_CTX *mem_ctx,
bool ea_push_name_list(TALLOC_CTX *mem_ctx,
DATA_BLOB *data, uint_t num_names, struct ea_name *eas)
{
int i;
@ -344,7 +344,7 @@ BOOL ea_push_name_list(TALLOC_CTX *mem_ctx,
*data = data_blob_talloc(mem_ctx, NULL, ea_size);
if (data->data == NULL) {
return False;
return false;
}
SIVAL(data->data, 0, ea_size);
@ -357,5 +357,5 @@ BOOL ea_push_name_list(TALLOC_CTX *mem_ctx,
off += 1+nlen+1;
}
return True;
return true;
}

View File

@ -426,7 +426,7 @@ struct smbcli_request *smb_raw_open_send(struct smbcli_tree *tree, union smb_ope
{
int len;
struct smbcli_request *req = NULL;
BOOL bigoffset = False;
bool bigoffset = false;
switch (parms->generic.level) {
case RAW_OPEN_T2OPEN:
@ -527,7 +527,7 @@ struct smbcli_request *smb_raw_open_send(struct smbcli_tree *tree, union smb_ope
smbcli_req_append_string(req, parms->openxreadx.in.fname, STR_TERMINATE);
if (tree->session->transport->negotiate.capabilities & CAP_LARGE_FILES) {
bigoffset = True;
bigoffset = true;
}
smbcli_chained_request_setup(req, SMBreadX, bigoffset ? 12 : 10, 0);

View File

@ -144,8 +144,8 @@ NTSTATUS smb_raw_negotiate_recv(struct smbcli_request *req)
}
if (transport->negotiate.capabilities & CAP_RAW_MODE) {
transport->negotiate.readbraw_supported = True;
transport->negotiate.writebraw_supported = True;
transport->negotiate.readbraw_supported = true;
transport->negotiate.writebraw_supported = true;
}
} else if (transport->negotiate.protocol >= PROTOCOL_LANMAN1) {
SMBCLI_CHECK_WCT(req, 13);

View File

@ -31,13 +31,13 @@
****************************************************************************/
struct smbcli_request *smb_raw_read_send(struct smbcli_tree *tree, union smb_read *parms)
{
BOOL bigoffset = False;
bool bigoffset = false;
struct smbcli_request *req = NULL;
switch (parms->generic.level) {
case RAW_READ_READBRAW:
if (tree->session->transport->negotiate.capabilities & CAP_LARGE_FILES) {
bigoffset = True;
bigoffset = true;
}
SETUP_REQUEST(SMBreadbraw, bigoffset? 10:8, 0);
SSVAL(req->out.vwv, VWV(0), parms->readbraw.in.file.fnum);
@ -69,7 +69,7 @@ struct smbcli_request *smb_raw_read_send(struct smbcli_tree *tree, union smb_rea
case RAW_READ_READX:
if (tree->session->transport->negotiate.capabilities & CAP_LARGE_FILES) {
bigoffset = True;
bigoffset = true;
}
SETUP_REQUEST(SMBreadX, bigoffset ? 12 : 10, 0);
SSVAL(req->out.vwv, VWV(0), SMB_CHAIN_NONE);
@ -206,7 +206,7 @@ NTSTATUS smb_raw_read(struct smbcli_tree *tree, union smb_read *parms)
****************************************************************************/
struct smbcli_request *smb_raw_write_send(struct smbcli_tree *tree, union smb_write *parms)
{
BOOL bigoffset = False;
bool bigoffset = false;
struct smbcli_request *req = NULL;
switch (parms->generic.level) {
@ -253,7 +253,7 @@ struct smbcli_request *smb_raw_write_send(struct smbcli_tree *tree, union smb_wr
case RAW_WRITE_WRITEX:
if (tree->session->transport->negotiate.capabilities & CAP_LARGE_FILES) {
bigoffset = True;
bigoffset = true;
}
SETUP_REQUEST(SMBwriteX, bigoffset ? 14 : 12, parms->writex.in.count);
SSVAL(req->out.vwv, VWV(0), SMB_CHAIN_NONE);

View File

@ -309,7 +309,7 @@ NTSTATUS smbcli_chained_advance(struct smbcli_request *req)
/*
send a message
*/
BOOL smbcli_request_send(struct smbcli_request *req)
bool smbcli_request_send(struct smbcli_request *req)
{
if (IVAL(req->out.buffer, 0) == 0) {
_smb_setlen(req->out.buffer, req->out.size - NBT_HDR_SIZE);
@ -319,23 +319,23 @@ BOOL smbcli_request_send(struct smbcli_request *req)
smbcli_transport_send(req);
return True;
return true;
}
/*
receive a response to a packet
*/
BOOL smbcli_request_receive(struct smbcli_request *req)
bool smbcli_request_receive(struct smbcli_request *req)
{
/* req can be NULL when a send has failed. This eliminates lots of NULL
checks in each module */
if (!req) return False;
if (!req) return false;
/* keep receiving packets until this one is replied to */
while (req->state <= SMBCLI_REQUEST_RECV) {
if (event_loop_once(req->transport->socket->event.ctx) != 0) {
return False;
return false;
}
}
@ -347,7 +347,7 @@ BOOL smbcli_request_receive(struct smbcli_request *req)
receive another reply to a request - this is used for requests that
have multi-part replies (such as SMBtrans2)
*/
BOOL smbcli_request_receive_more(struct smbcli_request *req)
bool smbcli_request_receive_more(struct smbcli_request *req)
{
req->state = SMBCLI_REQUEST_RECV;
DLIST_ADD(req->transport->pending_recv, req);
@ -357,10 +357,10 @@ BOOL smbcli_request_receive_more(struct smbcli_request *req)
/*
handle oplock break requests from the server - return True if the request was
handle oplock break requests from the server - return true if the request was
an oplock break
*/
BOOL smbcli_handle_oplock_break(struct smbcli_transport *transport, uint_t len, const uint8_t *hdr, const uint8_t *vwv)
bool smbcli_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 */
@ -370,7 +370,7 @@ BOOL smbcli_handle_oplock_break(struct smbcli_transport *transport, uint_t len,
SVAL(hdr, HDR_MID) != 0xFFFF ||
SVAL(vwv,VWV(6)) != 0 ||
SVAL(vwv,VWV(7)) != 0) {
return False;
return false;
}
if (transport->oplock.handler) {
@ -380,7 +380,7 @@ BOOL smbcli_handle_oplock_break(struct smbcli_transport *transport, uint_t len,
transport->oplock.handler(transport, tid, fnum, level, transport->oplock.private);
}
return True;
return true;
}
/*
@ -395,7 +395,7 @@ NTSTATUS smbcli_request_simple_recv(struct smbcli_request *req)
/* Return true if the last packet was in error */
BOOL smbcli_request_is_error(struct smbcli_request *req)
bool smbcli_request_is_error(struct smbcli_request *req)
{
return NT_STATUS_IS_ERR(req->status);
}
@ -676,33 +676,33 @@ DATA_BLOB smbcli_req_pull_blob(struct smbcli_request *req, TALLOC_CTX *mem_ctx,
/* 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 uint8_t *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 ||
ptr >= req->in.data + req->in.data_size ||
count > req->in.data_size ||
ptr + count > req->in.data + req->in.data_size) {
return True;
return true;
}
return False;
return false;
}
/*
pull a lump of data from a request packet
return False if any part is outside the data portion of the packet
return false if any part is outside the data portion of the packet
*/
BOOL smbcli_raw_pull_data(struct smbcli_request *req, const uint8_t *src, int len, uint8_t *dest)
bool smbcli_raw_pull_data(struct smbcli_request *req, const uint8_t *src, int len, uint8_t *dest)
{
if (len == 0) return True;
if (len == 0) return true;
if (smbcli_req_data_oob(req, src, len)) {
return False;
return false;
}
memcpy(dest, src, len);
return True;
return true;
}

View File

@ -27,7 +27,7 @@
/*
Handle setfileinfo/setpathinfo passthu constructions
*/
BOOL smb_raw_setfileinfo_passthru(TALLOC_CTX *mem_ctx,
bool smb_raw_setfileinfo_passthru(TALLOC_CTX *mem_ctx,
enum smb_setfileinfo_level level,
union smb_setfileinfo *parms,
DATA_BLOB *blob)
@ -36,7 +36,7 @@ BOOL smb_raw_setfileinfo_passthru(TALLOC_CTX *mem_ctx,
#define NEED_BLOB(n) do { \
*blob = data_blob_talloc(mem_ctx, NULL, n); \
if (blob->data == NULL) return False; \
if (blob->data == NULL) return false; \
} while (0)
switch (level) {
@ -48,22 +48,22 @@ BOOL smb_raw_setfileinfo_passthru(TALLOC_CTX *mem_ctx,
smbcli_push_nttime(blob->data, 24, parms->basic_info.in.change_time);
SIVAL(blob->data, 32, parms->basic_info.in.attrib);
SIVAL(blob->data, 36, 0); /* padding */
return True;
return true;
case RAW_SFILEINFO_DISPOSITION_INFORMATION:
NEED_BLOB(4);
SIVAL(blob->data, 0, parms->disposition_info.in.delete_on_close);
return True;
return true;
case RAW_SFILEINFO_ALLOCATION_INFORMATION:
NEED_BLOB(8);
SBVAL(blob->data, 0, parms->allocation_info.in.alloc_size);
return True;
return true;
case RAW_SFILEINFO_END_OF_FILE_INFORMATION:
NEED_BLOB(8);
SBVAL(blob->data, 0, parms->end_of_file_info.in.size);
return True;
return true;
case RAW_SFILEINFO_RENAME_INFORMATION:
NEED_BLOB(12);
@ -73,17 +73,17 @@ BOOL smb_raw_setfileinfo_passthru(TALLOC_CTX *mem_ctx,
parms->rename_information.in.new_name,
STR_UNICODE|STR_TERMINATE);
SIVAL(blob->data, 8, len - 2);
return True;
return true;
case RAW_SFILEINFO_POSITION_INFORMATION:
NEED_BLOB(8);
SBVAL(blob->data, 0, parms->position_information.in.position);
return True;
return true;
case RAW_SFILEINFO_MODE_INFORMATION:
NEED_BLOB(4);
SIVAL(blob->data, 0, parms->mode_information.in.mode);
return True;
return true;
case RAW_FILEINFO_SEC_DESC: {
NTSTATUS status;
@ -91,9 +91,9 @@ BOOL smb_raw_setfileinfo_passthru(TALLOC_CTX *mem_ctx,
status = ndr_push_struct_blob(blob, mem_ctx,
parms->set_secdesc.in.sd,
(ndr_push_flags_fn_t)ndr_push_security_descriptor);
if (!NT_STATUS_IS_OK(status)) return False;
if (!NT_STATUS_IS_OK(status)) return false;
return True;
return true;
}
/* Unhandled levels */
@ -107,16 +107,16 @@ BOOL smb_raw_setfileinfo_passthru(TALLOC_CTX *mem_ctx,
default:
DEBUG(0,("Unhandled setfileinfo passthru level %d\n", level));
return False;
return false;
}
return False;
return false;
}
/*
Handle setfileinfo/setpathinfo trans2 backend.
*/
static BOOL smb_raw_setinfo_backend(struct smbcli_tree *tree,
static bool smb_raw_setinfo_backend(struct smbcli_tree *tree,
TALLOC_CTX *mem_ctx,
union smb_setfileinfo *parms,
DATA_BLOB *blob)
@ -127,7 +127,7 @@ static BOOL smb_raw_setinfo_backend(struct smbcli_tree *tree,
case RAW_SFILEINFO_SETATTRE:
case RAW_SFILEINFO_SEC_DESC:
/* not handled here */
return False;
return false;
case RAW_SFILEINFO_STANDARD:
NEED_BLOB(12);
@ -137,12 +137,12 @@ static BOOL smb_raw_setinfo_backend(struct smbcli_tree *tree,
blob->data, 4, parms->standard.in.access_time);
raw_push_dos_date2(tree->session->transport,
blob->data, 8, parms->standard.in.write_time);
return True;
return true;
case RAW_SFILEINFO_EA_SET:
NEED_BLOB(ea_list_size(parms->ea_set.in.num_eas, parms->ea_set.in.eas));
ea_put_list(blob->data, parms->ea_set.in.num_eas, parms->ea_set.in.eas);
return True;
return true;
case RAW_SFILEINFO_BASIC_INFO:
case RAW_SFILEINFO_BASIC_INFORMATION:
@ -164,7 +164,7 @@ static BOOL smb_raw_setinfo_backend(struct smbcli_tree *tree,
SBVAL(blob->data, 76, parms->unix_basic.in.unique_id);
SBVAL(blob->data, 84, parms->unix_basic.in.permissions);
SBVAL(blob->data, 92, parms->unix_basic.in.nlink);
return True;
return true;
case RAW_SFILEINFO_UNIX_INFO2:
NEED_BLOB(116);
@ -184,7 +184,7 @@ static BOOL smb_raw_setinfo_backend(struct smbcli_tree *tree,
smbcli_push_nttime(blob->data, 100, parms->unix_info2.in.create_time);
SIVAL(blob->data, 108, parms->unix_info2.in.file_flags);
SIVAL(blob->data, 112, parms->unix_info2.in.flags_mask);
return True;
return true;
case RAW_SFILEINFO_DISPOSITION_INFO:
case RAW_SFILEINFO_DISPOSITION_INFORMATION:
@ -230,7 +230,7 @@ static BOOL smb_raw_setinfo_backend(struct smbcli_tree *tree,
break;
}
return False;
return false;
}
/****************************************************************************

View File

@ -39,7 +39,7 @@ _PUBLIC_ NTSTATUS smb_raw_shadow_data(struct smbcli_tree *tree,
nt.ntioctl.level = RAW_IOCTL_NTIOCTL;
nt.ntioctl.in.function = FSCTL_GET_SHADOW_COPY_DATA;
nt.ntioctl.in.file.fnum = info->in.file.fnum;
nt.ntioctl.in.fsctl = True;
nt.ntioctl.in.fsctl = true;
nt.ntioctl.in.filter = 0;
nt.ntioctl.in.max_data = info->in.max_data;
nt.ntioctl.in.blob = data_blob(NULL, 0);

View File

@ -27,13 +27,13 @@
/*
check out of bounds for incoming data
*/
static BOOL raw_trans_oob(struct smbcli_request *req,
static bool raw_trans_oob(struct smbcli_request *req,
uint_t offset, uint_t count)
{
uint8_t *ptr;
if (count == 0) {
return False;
return false;
}
ptr = req->in.hdr + offset;
@ -43,9 +43,9 @@ static BOOL raw_trans_oob(struct smbcli_request *req,
ptr >= req->in.data + req->in.data_size ||
count > req->in.data_size ||
ptr + count > req->in.data + req->in.data_size) {
return True;
return true;
}
return False;
return false;
}
/****************************************************************************

View File

@ -28,41 +28,41 @@
/***********************************************************
SMB signing - Common code before we set a new signing implementation
************************************************************/
BOOL set_smb_signing_common(struct smb_signing_context *sign_info)
bool set_smb_signing_common(struct smb_signing_context *sign_info)
{
if (sign_info->doing_signing) {
DEBUG(5, ("SMB Signing already in progress, so we don't start it again\n"));
return False;
return false;
}
if (!sign_info->allow_smb_signing) {
DEBUG(5, ("SMB Signing has been locally disabled\n"));
return False;
return false;
}
return True;
return true;
}
/***********************************************************
SMB signing - Common code before we set a new signing implementation
************************************************************/
static BOOL smbcli_set_smb_signing_common(struct smbcli_transport *transport)
static bool smbcli_set_smb_signing_common(struct smbcli_transport *transport)
{
if (!set_smb_signing_common(&transport->negotiate.sign_info)) {
return False;
return false;
}
if (!(transport->negotiate.sec_mode &
(NEGOTIATE_SECURITY_SIGNATURES_REQUIRED|NEGOTIATE_SECURITY_SIGNATURES_ENABLED))) {
DEBUG(5, ("SMB Signing is not negotiated by the peer\n"));
return False;
return false;
}
/* These calls are INCOMPATIBLE with SMB signing */
transport->negotiate.readbraw_supported = False;
transport->negotiate.writebraw_supported = False;
transport->negotiate.readbraw_supported = false;
transport->negotiate.writebraw_supported = false;
return True;
return true;
}
void mark_packet_signed(struct request_buffer *out)
@ -73,17 +73,17 @@ void mark_packet_signed(struct request_buffer *out)
SSVAL(out->hdr, HDR_FLG2, flags2);
}
BOOL signing_good(struct smb_signing_context *sign_info,
unsigned int seq, BOOL good)
bool signing_good(struct smb_signing_context *sign_info,
unsigned int seq, bool good)
{
if (good) {
if (!sign_info->doing_signing) {
DEBUG(5, ("Seen valid packet, so turning signing on\n"));
sign_info->doing_signing = True;
sign_info->doing_signing = true;
}
if (!sign_info->seen_valid) {
DEBUG(5, ("Seen valid packet, so marking signing as 'seen valid'\n"));
sign_info->seen_valid = True;
sign_info->seen_valid = true;
}
} else {
if (!sign_info->seen_valid) {
@ -91,14 +91,14 @@ BOOL signing_good(struct smb_signing_context *sign_info,
DEBUG(5, ("signing_good: signing negotiated but not required and peer\n"
"isn't sending correct signatures. Turning off.\n"));
smbcli_set_signing_off(sign_info);
return True;
return true;
} else {
/* bad packet after signing started - fail and disconnect. */
DEBUG(0, ("signing_good: BAD SIG: seq %u\n", seq));
return False;
return false;
}
}
return True;
return true;
}
void sign_outgoing_message(struct request_buffer *out, DATA_BLOB *mac_key, unsigned int seq_num)
@ -133,9 +133,9 @@ void sign_outgoing_message(struct request_buffer *out, DATA_BLOB *mac_key, unsig
Uncomment this to test if the remote server actually verifies signitures...*/
}
BOOL check_signed_incoming_message(struct request_buffer *in, DATA_BLOB *mac_key, uint_t seq_num)
bool check_signed_incoming_message(struct request_buffer *in, DATA_BLOB *mac_key, uint_t seq_num)
{
BOOL good;
bool good;
uint8_t calc_md5_mac[16];
uint8_t *server_sent_mac;
uint8_t sequence_buf[8];
@ -146,12 +146,12 @@ BOOL check_signed_incoming_message(struct request_buffer *in, DATA_BLOB *mac_key
/* room enough for the signature? */
if (in->size < NBT_HDR_SIZE + HDR_SS_FIELD + 8) {
return False;
return false;
}
if (!mac_key->length) {
/* NO key yet */
return False;
return false;
}
/* its quite bogus to be guessing sequence numbers, but very useful
@ -258,24 +258,24 @@ void smbcli_request_calculate_sign_mac(struct smbcli_request *req)
@note Used as an initialisation only - it will not correctly
shut down a real signing mechanism
*/
BOOL smbcli_set_signing_off(struct smb_signing_context *sign_info)
bool smbcli_set_signing_off(struct smb_signing_context *sign_info)
{
DEBUG(5, ("Shutdown SMB signing\n"));
sign_info->doing_signing = False;
sign_info->doing_signing = false;
sign_info->next_seq_num = 0;
data_blob_free(&sign_info->mac_key);
sign_info->signing_state = SMB_SIGNING_ENGINE_OFF;
return True;
return true;
}
/**
SMB signing - TEMP implementation - setup the MAC key.
*/
BOOL smbcli_temp_set_signing(struct smbcli_transport *transport)
bool smbcli_temp_set_signing(struct smbcli_transport *transport)
{
if (!smbcli_set_smb_signing_common(transport)) {
return False;
return false;
}
DEBUG(5, ("BSRSPYL SMB signing enabled\n"));
smbcli_set_signing_off(&transport->negotiate.sign_info);
@ -283,7 +283,7 @@ BOOL smbcli_temp_set_signing(struct smbcli_transport *transport)
transport->negotiate.sign_info.mac_key = data_blob(NULL, 0);
transport->negotiate.sign_info.signing_state = SMB_SIGNING_ENGINE_BSRSPYL;
return True;
return true;
}
/***********************************************************
@ -291,22 +291,22 @@ BOOL smbcli_temp_set_signing(struct smbcli_transport *transport)
************************************************************/
/**
* Check a packet supplied by the server.
* @return False if we had an established signing connection
* which had a back checksum, True otherwise
* @return false if we had an established signing connection
* which had a back checksum, true otherwise
*/
BOOL smbcli_request_check_sign_mac(struct smbcli_request *req)
bool smbcli_request_check_sign_mac(struct smbcli_request *req)
{
BOOL good;
bool good;
switch (req->transport->negotiate.sign_info.signing_state)
{
case SMB_SIGNING_ENGINE_OFF:
return True;
return true;
case SMB_SIGNING_ENGINE_BSRSPYL:
case SMB_SIGNING_ENGINE_ON:
{
if (req->in.size < (HDR_SS_FIELD + 8)) {
return False;
return false;
} else {
good = check_signed_incoming_message(&req->in,
&req->transport->negotiate.sign_info.mac_key,
@ -317,14 +317,14 @@ BOOL smbcli_request_check_sign_mac(struct smbcli_request *req)
}
}
}
return False;
return false;
}
/***********************************************************
SMB signing - Simple implementation - setup the MAC key.
************************************************************/
BOOL smbcli_simple_set_signing(TALLOC_CTX *mem_ctx,
bool smbcli_simple_set_signing(TALLOC_CTX *mem_ctx,
struct smb_signing_context *sign_info,
const DATA_BLOB *user_session_key,
const DATA_BLOB *response)
@ -354,19 +354,19 @@ BOOL smbcli_simple_set_signing(TALLOC_CTX *mem_ctx,
sign_info->signing_state = SMB_SIGNING_ENGINE_ON;
return True;
return true;
}
/***********************************************************
SMB signing - Simple implementation - setup the MAC key.
************************************************************/
BOOL smbcli_transport_simple_set_signing(struct smbcli_transport *transport,
bool smbcli_transport_simple_set_signing(struct smbcli_transport *transport,
const DATA_BLOB user_session_key,
const DATA_BLOB response)
{
if (!smbcli_set_smb_signing_common(transport)) {
return False;
return false;
}
return smbcli_simple_set_signing(transport,
@ -380,21 +380,21 @@ bool smbcli_init_signing(struct smbcli_transport *transport)
{
transport->negotiate.sign_info.mac_key = data_blob(NULL, 0);
if (!smbcli_set_signing_off(&transport->negotiate.sign_info)) {
return False;
return false;
}
switch (lp_client_signing(global_loadparm)) {
case SMB_SIGNING_OFF:
transport->negotiate.sign_info.allow_smb_signing = False;
transport->negotiate.sign_info.allow_smb_signing = false;
break;
case SMB_SIGNING_SUPPORTED:
case SMB_SIGNING_AUTO:
transport->negotiate.sign_info.allow_smb_signing = True;
transport->negotiate.sign_info.allow_smb_signing = true;
break;
case SMB_SIGNING_REQUIRED:
transport->negotiate.sign_info.allow_smb_signing = True;
transport->negotiate.sign_info.mandatory_signing = True;
transport->negotiate.sign_info.allow_smb_signing = true;
transport->negotiate.sign_info.mandatory_signing = true;
break;
}
return True;
return true;
}

View File

@ -51,7 +51,7 @@ struct composite_context *resolve_name_bcast_send(TALLOC_CTX *mem_ctx,
}
address_list[count] = NULL;
c = resolve_name_nbtlist_send(mem_ctx, event_ctx, name, address_list, True, False);
c = resolve_name_nbtlist_send(mem_ctx, event_ctx, name, address_list, true, false);
talloc_free(address_list);
return c;

View File

@ -99,8 +99,8 @@ struct composite_context *resolve_name_nbtlist_send(TALLOC_CTX *mem_ctx,
struct event_context *event_ctx,
struct nbt_name *name,
const char **address_list,
BOOL broadcast,
BOOL wins_lookup)
bool broadcast,
bool wins_lookup)
{
struct composite_context *c;
struct nbtlist_state *state;
@ -193,7 +193,7 @@ NTSTATUS resolve_name_nbtlist_recv(struct composite_context *c,
NTSTATUS resolve_name_nbtlist(struct nbt_name *name,
TALLOC_CTX *mem_ctx,
const char **address_list,
BOOL broadcast, BOOL wins_lookup,
bool broadcast, bool wins_lookup,
const char **reply_addr)
{
struct composite_context *c = resolve_name_nbtlist_send(mem_ctx, NULL, name, address_list,

View File

@ -34,7 +34,7 @@ struct composite_context *resolve_name_wins_send(
{
const char **address_list = lp_wins_server_list(global_loadparm);
if (address_list == NULL) return NULL;
return resolve_name_nbtlist_send(mem_ctx, event_ctx, name, address_list, False, True);
return resolve_name_nbtlist_send(mem_ctx, event_ctx, name, address_list, false, true);
}
/*

View File

@ -241,24 +241,24 @@ NTSTATUS dom_sid_split_rid(TALLOC_CTX *mem_ctx, const struct dom_sid *sid,
}
/*
return True if the 2nd sid is in the domain given by the first sid
return true if the 2nd sid is in the domain given by the first sid
*/
BOOL dom_sid_in_domain(const struct dom_sid *domain_sid,
bool dom_sid_in_domain(const struct dom_sid *domain_sid,
const struct dom_sid *sid)
{
int i;
if (!domain_sid || !sid) {
return False;
return false;
}
if (domain_sid->num_auths > sid->num_auths) {
return False;
return false;
}
for (i = domain_sid->num_auths-1; i >= 0; --i) {
if (domain_sid->sub_auths[i] != sid->sub_auths[i]) {
return False;
return false;
}
}

View File

@ -192,21 +192,21 @@ static uint64_t sec_privilege_mask(enum sec_privilege privilege)
/*
return True if a security_token has a particular privilege bit set
return true if a security_token has a particular privilege bit set
*/
BOOL security_token_has_privilege(const struct security_token *token, enum sec_privilege privilege)
bool security_token_has_privilege(const struct security_token *token, enum sec_privilege privilege)
{
uint64_t mask;
if (privilege < 1 || privilege > 64) {
return False;
return false;
}
mask = sec_privilege_mask(privilege);
if (token->privilege_mask & mask) {
return True;
return true;
}
return False;
return false;
}
/*

View File

@ -32,7 +32,7 @@ struct flag_map {
/*
map a series of letter codes into a uint32_t
*/
static BOOL sddl_map_flags(const struct flag_map *map, const char *str,
static bool sddl_map_flags(const struct flag_map *map, const char *str,
uint32_t *flags, size_t *len)
{
const char *str0 = str;
@ -51,10 +51,10 @@ static BOOL sddl_map_flags(const struct flag_map *map, const char *str,
}
if (map[i].name == NULL) {
DEBUG(1, ("Unknown flag - %s in %s\n", str, str0));
return False;
return false;
}
}
return True;
return true;
}
/*
@ -176,10 +176,10 @@ static const struct flag_map ace_access_mask[] = {
/*
decode an ACE
return True on success, False on failure
return true on success, false on failure
note that this routine modifies the string
*/
static BOOL sddl_decode_ace(TALLOC_CTX *mem_ctx, struct security_ace *ace, char *str,
static bool sddl_decode_ace(TALLOC_CTX *mem_ctx, struct security_ace *ace, char *str,
const struct dom_sid *domain_sid)
{
const char *tok[6];
@ -194,7 +194,7 @@ static BOOL sddl_decode_ace(TALLOC_CTX *mem_ctx, struct security_ace *ace, char
tok[0] = str;
for (i=0;i<5;i++) {
char *ptr = strchr(str, ';');
if (ptr == NULL) return False;
if (ptr == NULL) return false;
*ptr = 0;
str = ptr+1;
tok[i+1] = str;
@ -202,13 +202,13 @@ static BOOL sddl_decode_ace(TALLOC_CTX *mem_ctx, struct security_ace *ace, char
/* parse ace type */
if (!sddl_map_flags(ace_types, tok[0], &v, NULL)) {
return False;
return false;
}
ace->type = v;
/* ace flags */
if (!sddl_map_flags(ace_flags, tok[1], &v, NULL)) {
return False;
return false;
}
ace->flags = v;
@ -217,7 +217,7 @@ static BOOL sddl_decode_ace(TALLOC_CTX *mem_ctx, struct security_ace *ace, char
ace->access_mask = strtol(tok[2], NULL, 16);
} else {
if (!sddl_map_flags(ace_access_mask, tok[2], &v, NULL)) {
return False;
return false;
}
ace->access_mask = v;
}
@ -227,7 +227,7 @@ static BOOL sddl_decode_ace(TALLOC_CTX *mem_ctx, struct security_ace *ace, char
NTSTATUS status = GUID_from_string(tok[3],
&ace->object.object.type.type);
if (!NT_STATUS_IS_OK(status)) {
return False;
return false;
}
ace->object.object.flags |= SEC_ACE_OBJECT_TYPE_PRESENT;
}
@ -237,7 +237,7 @@ static BOOL sddl_decode_ace(TALLOC_CTX *mem_ctx, struct security_ace *ace, char
NTSTATUS status = GUID_from_string(tok[4],
&ace->object.object.inherited_type.inherited_type);
if (!NT_STATUS_IS_OK(status)) {
return False;
return false;
}
ace->object.object.flags |= SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT;
}
@ -246,13 +246,13 @@ static BOOL sddl_decode_ace(TALLOC_CTX *mem_ctx, struct security_ace *ace, char
s = tok[5];
sid = sddl_decode_sid(mem_ctx, &s, domain_sid);
if (sid == NULL) {
return False;
return false;
}
ace->trustee = *sid;
talloc_steal(mem_ctx, sid->sub_auths);
talloc_free(sid);
return True;
return true;
}
static const struct flag_map acl_flags[] = {
@ -388,7 +388,7 @@ failed:
turn a set of flags into a string
*/
static char *sddl_flags_to_string(TALLOC_CTX *mem_ctx, const struct flag_map *map,
uint32_t flags, BOOL check_all)
uint32_t flags, bool check_all)
{
int i;
char *s;
@ -477,13 +477,13 @@ static char *sddl_encode_ace(TALLOC_CTX *mem_ctx, const struct security_ace *ace
return NULL;
}
s_type = sddl_flags_to_string(tmp_ctx, ace_types, ace->type, True);
s_type = sddl_flags_to_string(tmp_ctx, ace_types, ace->type, true);
if (s_type == NULL) goto failed;
s_flags = sddl_flags_to_string(tmp_ctx, ace_flags, ace->flags, True);
s_flags = sddl_flags_to_string(tmp_ctx, ace_flags, ace->flags, true);
if (s_flags == NULL) goto failed;
s_mask = sddl_flags_to_string(tmp_ctx, ace_access_mask, ace->access_mask, True);
s_mask = sddl_flags_to_string(tmp_ctx, ace_access_mask, ace->access_mask, true);
if (s_mask == NULL) {
s_mask = talloc_asprintf(tmp_ctx, "0x%08x", ace->access_mask);
if (s_mask == NULL) goto failed;
@ -525,7 +525,7 @@ static char *sddl_encode_acl(TALLOC_CTX *mem_ctx, const struct security_acl *acl
int i;
/* add any ACL flags */
sddl = sddl_flags_to_string(mem_ctx, acl_flags, flags, False);
sddl = sddl_flags_to_string(mem_ctx, acl_flags, flags, false);
if (sddl == NULL) goto failed;
/* now the ACEs, encoded in braces */

View File

@ -242,77 +242,77 @@ NTSTATUS security_descriptor_dacl_del(struct security_descriptor *sd,
/*
compare two security ace structures
*/
BOOL security_ace_equal(const struct security_ace *ace1,
bool security_ace_equal(const struct security_ace *ace1,
const struct security_ace *ace2)
{
if (ace1 == ace2) return True;
if (!ace1 || !ace2) return False;
if (ace1->type != ace2->type) return False;
if (ace1->flags != ace2->flags) return False;
if (ace1->access_mask != ace2->access_mask) return False;
if (!dom_sid_equal(&ace1->trustee, &ace2->trustee)) return False;
if (ace1 == ace2) return true;
if (!ace1 || !ace2) return false;
if (ace1->type != ace2->type) return false;
if (ace1->flags != ace2->flags) return false;
if (ace1->access_mask != ace2->access_mask) return false;
if (!dom_sid_equal(&ace1->trustee, &ace2->trustee)) return false;
return True;
return true;
}
/*
compare two security acl structures
*/
BOOL security_acl_equal(const struct security_acl *acl1,
bool security_acl_equal(const struct security_acl *acl1,
const struct security_acl *acl2)
{
int i;
if (acl1 == acl2) return True;
if (!acl1 || !acl2) return False;
if (acl1->revision != acl2->revision) return False;
if (acl1->num_aces != acl2->num_aces) return False;
if (acl1 == acl2) return true;
if (!acl1 || !acl2) return false;
if (acl1->revision != acl2->revision) return false;
if (acl1->num_aces != acl2->num_aces) return false;
for (i=0;i<acl1->num_aces;i++) {
if (!security_ace_equal(&acl1->aces[i], &acl2->aces[i])) return False;
if (!security_ace_equal(&acl1->aces[i], &acl2->aces[i])) return false;
}
return True;
return true;
}
/*
compare two security descriptors.
*/
BOOL security_descriptor_equal(const struct security_descriptor *sd1,
bool security_descriptor_equal(const struct security_descriptor *sd1,
const struct security_descriptor *sd2)
{
if (sd1 == sd2) return True;
if (!sd1 || !sd2) return False;
if (sd1->revision != sd2->revision) return False;
if (sd1->type != sd2->type) return False;
if (sd1 == sd2) return true;
if (!sd1 || !sd2) return false;
if (sd1->revision != sd2->revision) return false;
if (sd1->type != sd2->type) return false;
if (!dom_sid_equal(sd1->owner_sid, sd2->owner_sid)) return False;
if (!dom_sid_equal(sd1->group_sid, sd2->group_sid)) return False;
if (!security_acl_equal(sd1->sacl, sd2->sacl)) return False;
if (!security_acl_equal(sd1->dacl, sd2->dacl)) return False;
if (!dom_sid_equal(sd1->owner_sid, sd2->owner_sid)) return false;
if (!dom_sid_equal(sd1->group_sid, sd2->group_sid)) return false;
if (!security_acl_equal(sd1->sacl, sd2->sacl)) return false;
if (!security_acl_equal(sd1->dacl, sd2->dacl)) return false;
return True;
return true;
}
/*
compare two security descriptors, but allow certain (missing) parts
to be masked out of the comparison
*/
BOOL security_descriptor_mask_equal(const struct security_descriptor *sd1,
bool security_descriptor_mask_equal(const struct security_descriptor *sd1,
const struct security_descriptor *sd2,
uint32_t mask)
{
if (sd1 == sd2) return True;
if (!sd1 || !sd2) return False;
if (sd1->revision != sd2->revision) return False;
if ((sd1->type & mask) != (sd2->type & mask)) return False;
if (sd1 == sd2) return true;
if (!sd1 || !sd2) return false;
if (sd1->revision != sd2->revision) return false;
if ((sd1->type & mask) != (sd2->type & mask)) return false;
if (!dom_sid_equal(sd1->owner_sid, sd2->owner_sid)) return False;
if (!dom_sid_equal(sd1->group_sid, sd2->group_sid)) return False;
if ((mask & SEC_DESC_DACL_PRESENT) && !security_acl_equal(sd1->dacl, sd2->dacl)) return False;
if ((mask & SEC_DESC_SACL_PRESENT) && !security_acl_equal(sd1->sacl, sd2->sacl)) return False;
if (!dom_sid_equal(sd1->owner_sid, sd2->owner_sid)) return false;
if (!dom_sid_equal(sd1->group_sid, sd2->group_sid)) return false;
if ((mask & SEC_DESC_DACL_PRESENT) && !security_acl_equal(sd1->dacl, sd2->dacl)) return false;
if ((mask & SEC_DESC_SACL_PRESENT) && !security_acl_equal(sd1->sacl, sd2->sacl)) return false;
return True;
return true;
}

View File

@ -79,19 +79,19 @@ void security_token_debug(int dbg_lev, const struct security_token *token)
/* These really should be cheaper... */
BOOL security_token_is_sid(const struct security_token *token, const struct dom_sid *sid)
bool security_token_is_sid(const struct security_token *token, const struct dom_sid *sid)
{
if (dom_sid_equal(token->user_sid, sid)) {
return True;
return true;
}
return False;
return false;
}
BOOL security_token_is_sid_string(const struct security_token *token, const char *sid_string)
bool security_token_is_sid_string(const struct security_token *token, const char *sid_string)
{
BOOL ret;
bool ret;
struct dom_sid *sid = dom_sid_parse_talloc(NULL, sid_string);
if (!sid) return False;
if (!sid) return false;
ret = security_token_is_sid(token, sid);
@ -99,32 +99,32 @@ BOOL security_token_is_sid_string(const struct security_token *token, const char
return ret;
}
BOOL security_token_is_system(const struct security_token *token)
bool security_token_is_system(const struct security_token *token)
{
return security_token_is_sid_string(token, SID_NT_SYSTEM);
}
BOOL security_token_is_anonymous(const struct security_token *token)
bool security_token_is_anonymous(const struct security_token *token)
{
return security_token_is_sid_string(token, SID_NT_ANONYMOUS);
}
BOOL security_token_has_sid(const struct security_token *token, const struct dom_sid *sid)
bool security_token_has_sid(const struct security_token *token, const struct dom_sid *sid)
{
int i;
for (i = 0; i < token->num_sids; i++) {
if (dom_sid_equal(token->sids[i], sid)) {
return True;
return true;
}
}
return False;
return false;
}
BOOL security_token_has_sid_string(const struct security_token *token, const char *sid_string)
bool security_token_has_sid_string(const struct security_token *token, const char *sid_string)
{
BOOL ret;
bool ret;
struct dom_sid *sid = dom_sid_parse_talloc(NULL, sid_string);
if (!sid) return False;
if (!sid) return false;
ret = security_token_has_sid(token, sid);
@ -132,12 +132,12 @@ BOOL security_token_has_sid_string(const struct security_token *token, const cha
return ret;
}
BOOL security_token_has_builtin_administrators(const struct security_token *token)
bool security_token_has_builtin_administrators(const struct security_token *token)
{
return security_token_has_sid_string(token, SID_BUILTIN_ADMINISTRATORS);
}
BOOL security_token_has_nt_authenticated_users(const struct security_token *token)
bool security_token_has_nt_authenticated_users(const struct security_token *token)
{
return security_token_has_sid_string(token, SID_NT_AUTHENTICATED_USERS);
}

View File

@ -46,7 +46,7 @@ NTSTATUS smb2_cancel(struct smb2_request *r)
/* we don't want a seqmun for a SMB2 Cancel */
old_seqnum = r->transport->seqnum;
c = smb2_request_init(r->transport, SMB2_OP_CANCEL, 0x04, False, 0);
c = smb2_request_init(r->transport, SMB2_OP_CANCEL, 0x04, false, 0);
r->transport->seqnum = old_seqnum;
NT_STATUS_HAVE_NO_MEMORY(c);
c->seqnum = 0;

View File

@ -31,7 +31,7 @@ struct smb2_request *smb2_close_send(struct smb2_tree *tree, struct smb2_close *
{
struct smb2_request *req;
req = smb2_request_init_tree(tree, SMB2_OP_CLOSE, 0x18, False, 0);
req = smb2_request_init_tree(tree, SMB2_OP_CLOSE, 0x18, false, 0);
if (req == NULL) return NULL;
SSVAL(req->out.body, 0x02, io->in.flags);
@ -54,7 +54,7 @@ NTSTATUS smb2_close_recv(struct smb2_request *req, struct smb2_close *io)
return smb2_request_destroy(req);
}
SMB2_CHECK_PACKET_RECV(req, 0x3C, False);
SMB2_CHECK_PACKET_RECV(req, 0x3C, false);
io->out.flags = SVAL(req->in.body, 0x02);
io->out._pad = IVAL(req->in.body, 0x04);

View File

@ -69,7 +69,7 @@ static void continue_session(struct composite_context *creq)
c->status = smb2_session_setup_spnego_recv(creq);
if (!composite_is_ok(c)) return;
state->tree = smb2_tree_init(state->session, state, True);
state->tree = smb2_tree_init(state->session, state, true);
if (composite_nomem(state->tree, c)) return;
state->tcon.in.unknown1 = 0x09;
@ -99,7 +99,7 @@ static void continue_negprot(struct smb2_request *req)
c->status = smb2_negprot_recv(req, c, &state->negprot);
if (!composite_is_ok(c)) return;
state->session = smb2_session_init(transport, state, True);
state->session = smb2_session_init(transport, state, true);
if (composite_nomem(state->session, c)) return;
creq = smb2_session_setup_spnego_send(state->session, state->credentials);

View File

@ -32,7 +32,7 @@
*/
NTSTATUS smb2_create_blob_add(TALLOC_CTX *mem_ctx, DATA_BLOB *blob,
uint32_t tag,
DATA_BLOB add, BOOL last)
DATA_BLOB add, bool last)
{
uint32_t ofs = blob->length;
uint8_t pad = smb2_padding_size(add.length, 8);
@ -65,7 +65,7 @@ struct smb2_request *smb2_create_send(struct smb2_tree *tree, struct smb2_create
NTSTATUS status;
DATA_BLOB blob = data_blob(NULL, 0);
req = smb2_request_init_tree(tree, SMB2_OP_CREATE, 0x38, True, 0);
req = smb2_request_init_tree(tree, SMB2_OP_CREATE, 0x38, true, 0);
if (req == NULL) return NULL;
SSVAL(req->out.body, 0x02, io->in.oplock_flags);
@ -90,7 +90,7 @@ struct smb2_request *smb2_create_send(struct smb2_tree *tree, struct smb2_create
DATA_BLOB b = data_blob_talloc(req, NULL,
ea_list_size_chained(io->in.eas.num_eas, io->in.eas.eas));
ea_put_list_chained(b.data, io->in.eas.num_eas, io->in.eas.eas);
status = smb2_create_blob_add(req, &blob, CREATE_TAG_EXTA, b, False);
status = smb2_create_blob_add(req, &blob, CREATE_TAG_EXTA, b, false);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(req);
return NULL;
@ -100,7 +100,7 @@ struct smb2_request *smb2_create_send(struct smb2_tree *tree, struct smb2_create
/* an empty MxAc tag seems to be used to ask the server to
return the maximum access mask allowed on the file */
status = smb2_create_blob_add(req, &blob, CREATE_TAG_MXAC, data_blob(NULL, 0), True);
status = smb2_create_blob_add(req, &blob, CREATE_TAG_MXAC, data_blob(NULL, 0), true);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(req);
@ -130,7 +130,7 @@ NTSTATUS smb2_create_recv(struct smb2_request *req, TALLOC_CTX *mem_ctx, struct
return smb2_request_destroy(req);
}
SMB2_CHECK_PACKET_RECV(req, 0x58, True);
SMB2_CHECK_PACKET_RECV(req, 0x58, true);
io->out.oplock_flags = SVAL(req->in.body, 0x02);
io->out.create_action = IVAL(req->in.body, 0x04);

View File

@ -32,7 +32,7 @@ struct smb2_request *smb2_find_send(struct smb2_tree *tree, struct smb2_find *io
struct smb2_request *req;
NTSTATUS status;
req = smb2_request_init_tree(tree, SMB2_OP_FIND, 0x20, True, 0);
req = smb2_request_init_tree(tree, SMB2_OP_FIND, 0x20, true, 0);
if (req == NULL) return NULL;
SCVAL(req->out.body, 0x02, io->in.level);
@ -67,7 +67,7 @@ NTSTATUS smb2_find_recv(struct smb2_request *req, TALLOC_CTX *mem_ctx,
return smb2_request_destroy(req);
}
SMB2_CHECK_PACKET_RECV(req, 0x08, True);
SMB2_CHECK_PACKET_RECV(req, 0x08, true);
status = smb2_pull_o16s32_blob(&req->in, mem_ctx,
req->in.body+0x02, &io->out.blob);

View File

@ -30,7 +30,7 @@ struct smb2_request *smb2_flush_send(struct smb2_tree *tree, struct smb2_flush *
{
struct smb2_request *req;
req = smb2_request_init_tree(tree, SMB2_OP_FLUSH, 0x18, False, 0);
req = smb2_request_init_tree(tree, SMB2_OP_FLUSH, 0x18, false, 0);
if (req == NULL) return NULL;
SSVAL(req->out.body, 0x02, 0); /* pad? */
@ -53,7 +53,7 @@ NTSTATUS smb2_flush_recv(struct smb2_request *req, struct smb2_flush *io)
return smb2_request_destroy(req);
}
SMB2_CHECK_PACKET_RECV(req, 0x04, False);
SMB2_CHECK_PACKET_RECV(req, 0x04, false);
return smb2_request_destroy(req);
}

View File

@ -31,7 +31,7 @@ struct smb2_request *smb2_getinfo_send(struct smb2_tree *tree, struct smb2_getin
{
struct smb2_request *req;
req = smb2_request_init_tree(tree, SMB2_OP_GETINFO, 0x28, False, 0);
req = smb2_request_init_tree(tree, SMB2_OP_GETINFO, 0x28, false, 0);
if (req == NULL) return NULL;
/* this seems to be a bug, they use 0x29 but only send 0x28 bytes */
@ -64,7 +64,7 @@ NTSTATUS smb2_getinfo_recv(struct smb2_request *req, TALLOC_CTX *mem_ctx,
return smb2_request_destroy(req);
}
SMB2_CHECK_PACKET_RECV(req, 0x08, True);
SMB2_CHECK_PACKET_RECV(req, 0x08, true);
status = smb2_pull_o16s16_blob(&req->in, mem_ctx, req->in.body+0x02, &io->out.blob);
if (!NT_STATUS_IS_OK(status)) {

View File

@ -31,7 +31,7 @@ struct smb2_request *smb2_ioctl_send(struct smb2_tree *tree, struct smb2_ioctl *
NTSTATUS status;
struct smb2_request *req;
req = smb2_request_init_tree(tree, SMB2_OP_IOCTL, 0x38, True,
req = smb2_request_init_tree(tree, SMB2_OP_IOCTL, 0x38, true,
io->in.in.length+io->in.out.length);
if (req == NULL) return NULL;
@ -75,7 +75,7 @@ NTSTATUS smb2_ioctl_recv(struct smb2_request *req,
return smb2_request_destroy(req);
}
SMB2_CHECK_PACKET_RECV(req, 0x30, True);
SMB2_CHECK_PACKET_RECV(req, 0x30, true);
io->out._pad = SVAL(req->in.body, 0x02);
io->out.function = IVAL(req->in.body, 0x04);

View File

@ -30,7 +30,7 @@ struct smb2_request *smb2_keepalive_send(struct smb2_transport *transport)
{
struct smb2_request *req;
req = smb2_request_init(transport, SMB2_OP_KEEPALIVE, 0x04, False, 0);
req = smb2_request_init(transport, SMB2_OP_KEEPALIVE, 0x04, false, 0);
if (req == NULL) return NULL;
SSVAL(req->out.body, 0x02, 0);
@ -51,7 +51,7 @@ NTSTATUS smb2_keepalive_recv(struct smb2_request *req)
return smb2_request_destroy(req);
}
SMB2_CHECK_PACKET_RECV(req, 0x04, False);
SMB2_CHECK_PACKET_RECV(req, 0x04, false);
return smb2_request_destroy(req);
}

View File

@ -30,7 +30,7 @@ struct smb2_request *smb2_lock_send(struct smb2_tree *tree, struct smb2_lock *io
{
struct smb2_request *req;
req = smb2_request_init_tree(tree, SMB2_OP_LOCK, 0x30, False, 0);
req = smb2_request_init_tree(tree, SMB2_OP_LOCK, 0x30, false, 0);
if (req == NULL) return NULL;
SSVAL(req->out.body, 0x02, io->in.unknown1);
@ -57,7 +57,7 @@ NTSTATUS smb2_lock_recv(struct smb2_request *req, struct smb2_lock *io)
return smb2_request_destroy(req);
}
SMB2_CHECK_PACKET_RECV(req, 0x04, False);
SMB2_CHECK_PACKET_RECV(req, 0x04, false);
io->out.unknown1 = SVAL(req->in.body, 0x02);

View File

@ -30,7 +30,7 @@ struct smb2_request *smb2_logoff_send(struct smb2_session *session)
{
struct smb2_request *req;
req = smb2_request_init(session->transport, SMB2_OP_LOGOFF, 0x04, False, 0);
req = smb2_request_init(session->transport, SMB2_OP_LOGOFF, 0x04, false, 0);
if (req == NULL) return NULL;
SBVAL(req->out.hdr, SMB2_HDR_UID, session->uid);
@ -53,7 +53,7 @@ NTSTATUS smb2_logoff_recv(struct smb2_request *req)
return smb2_request_destroy(req);
}
SMB2_CHECK_PACKET_RECV(req, 0x04, False);
SMB2_CHECK_PACKET_RECV(req, 0x04, false);
return smb2_request_destroy(req);
}

View File

@ -32,7 +32,7 @@ struct smb2_request *smb2_negprot_send(struct smb2_transport *transport,
{
struct smb2_request *req;
req = smb2_request_init(transport, SMB2_OP_NEGPROT, 0x26, False, 0);
req = smb2_request_init(transport, SMB2_OP_NEGPROT, 0x26, false, 0);
if (req == NULL) return NULL;
/* this seems to be a bug, they use 0x24 but the length is 0x26 */
@ -60,7 +60,7 @@ NTSTATUS smb2_negprot_recv(struct smb2_request *req, TALLOC_CTX *mem_ctx,
return smb2_request_destroy(req);
}
SMB2_CHECK_PACKET_RECV(req, 0x40, True);
SMB2_CHECK_PACKET_RECV(req, 0x40, true);
io->out._pad = SVAL(req->in.body, 0x02);
io->out.unknown2 = IVAL(req->in.body, 0x04);

View File

@ -32,7 +32,7 @@ struct smb2_request *smb2_notify_send(struct smb2_tree *tree, struct smb2_notify
struct smb2_request *req;
uint32_t old_timeout;
req = smb2_request_init_tree(tree, SMB2_OP_NOTIFY, 0x20, False, 0);
req = smb2_request_init_tree(tree, SMB2_OP_NOTIFY, 0x20, false, 0);
if (req == NULL) return NULL;
SSVAL(req->out.hdr, SMB2_HDR_UNKNOWN1, 0x0030);
@ -67,7 +67,7 @@ NTSTATUS smb2_notify_recv(struct smb2_request *req, TALLOC_CTX *mem_ctx,
return smb2_request_destroy(req);
}
SMB2_CHECK_PACKET_RECV(req, 0x08, True);
SMB2_CHECK_PACKET_RECV(req, 0x08, true);
status = smb2_pull_o16s32_blob(&req->in, mem_ctx, req->in.body+0x02, &blob);
if (!NT_STATUS_IS_OK(status)) {

View File

@ -30,7 +30,7 @@ struct smb2_request *smb2_read_send(struct smb2_tree *tree, struct smb2_read *io
{
struct smb2_request *req;
req = smb2_request_init_tree(tree, SMB2_OP_READ, 0x30, True, 0);
req = smb2_request_init_tree(tree, SMB2_OP_READ, 0x30, true, 0);
if (req == NULL) return NULL;
SSVAL(req->out.body, 0x02, 0); /* pad */
@ -59,7 +59,7 @@ NTSTATUS smb2_read_recv(struct smb2_request *req,
return smb2_request_destroy(req);
}
SMB2_CHECK_PACKET_RECV(req, 0x10, True);
SMB2_CHECK_PACKET_RECV(req, 0x10, true);
status = smb2_pull_o16s32_blob(&req->in, mem_ctx, req->in.body+0x02, &io->out.data);
if (!NT_STATUS_IS_OK(status)) {

View File

@ -31,7 +31,7 @@
initialise a smb2 request
*/
struct smb2_request *smb2_request_init(struct smb2_transport *transport, uint16_t opcode,
uint16_t body_fixed_size, BOOL body_dynamic_present,
uint16_t body_fixed_size, bool body_dynamic_present,
uint32_t body_dynamic_size)
{
struct smb2_request *req;
@ -113,7 +113,7 @@ struct smb2_request *smb2_request_init(struct smb2_transport *transport, uint16_
initialise a smb2 request for tree operations
*/
struct smb2_request *smb2_request_init_tree(struct smb2_tree *tree, uint16_t opcode,
uint16_t body_fixed_size, BOOL body_dynamic_present,
uint16_t body_fixed_size, bool body_dynamic_present,
uint32_t body_dynamic_size)
{
struct smb2_request *req = smb2_request_init(tree->session->transport, opcode,
@ -157,16 +157,16 @@ NTSTATUS smb2_request_destroy(struct smb2_request *req)
/*
receive a response to a packet
*/
BOOL smb2_request_receive(struct smb2_request *req)
bool smb2_request_receive(struct smb2_request *req)
{
/* req can be NULL when a send has failed. This eliminates lots of NULL
checks in each module */
if (!req) return False;
if (!req) return false;
/* keep receiving packets until this one is replied to */
while (req->state <= SMB2_REQUEST_RECV) {
if (event_loop_once(req->transport->socket->event.ctx) != 0) {
return False;
return false;
}
}
@ -174,13 +174,13 @@ BOOL smb2_request_receive(struct smb2_request *req)
}
/* Return true if the last packet was in error */
BOOL smb2_request_is_error(struct smb2_request *req)
bool smb2_request_is_error(struct smb2_request *req)
{
return NT_STATUS_IS_ERR(req->status);
}
/* Return true if the last packet was OK */
BOOL smb2_request_is_ok(struct smb2_request *req)
bool smb2_request_is_ok(struct smb2_request *req)
{
return NT_STATUS_IS_OK(req->status);
}
@ -188,16 +188,16 @@ BOOL smb2_request_is_ok(struct smb2_request *req)
/*
check if a range in the reply body is out of bounds
*/
BOOL smb2_oob(struct smb2_request_buffer *buf, const uint8_t *ptr, size_t size)
bool smb2_oob(struct smb2_request_buffer *buf, const uint8_t *ptr, size_t size)
{
/* be careful with wraparound! */
if (ptr < buf->body ||
ptr >= buf->body + buf->body_size ||
size > buf->body_size ||
ptr + size > buf->body + buf->body_size) {
return True;
return true;
}
return False;
return false;
}
size_t smb2_padding_size(uint32_t offset, size_t n)

View File

@ -30,7 +30,7 @@
initialise a smb2_session structure
*/
struct smb2_session *smb2_session_init(struct smb2_transport *transport,
TALLOC_CTX *parent_ctx, BOOL primary)
TALLOC_CTX *parent_ctx, bool primary)
{
struct smb2_session *session;
NTSTATUS status;
@ -68,7 +68,7 @@ struct smb2_request *smb2_session_setup_send(struct smb2_session *session,
NTSTATUS status;
req = smb2_request_init(session->transport, SMB2_OP_SESSSETUP,
0x18, True, io->in.secblob.length);
0x18, true, io->in.secblob.length);
if (req == NULL) return NULL;
SBVAL(req->out.hdr, SMB2_HDR_UID, session->uid);
@ -105,7 +105,7 @@ NTSTATUS smb2_session_setup_recv(struct smb2_request *req, TALLOC_CTX *mem_ctx,
return smb2_request_destroy(req);
}
SMB2_CHECK_PACKET_RECV(req, 0x08, True);
SMB2_CHECK_PACKET_RECV(req, 0x08, true);
io->out._pad = SVAL(req->in.body, 0x02);
io->out.uid = BVAL(req->in.hdr, SMB2_HDR_UID);

View File

@ -32,7 +32,7 @@ struct smb2_request *smb2_setinfo_send(struct smb2_tree *tree, struct smb2_setin
NTSTATUS status;
struct smb2_request *req;
req = smb2_request_init_tree(tree, SMB2_OP_SETINFO, 0x20, True, io->in.blob.length);
req = smb2_request_init_tree(tree, SMB2_OP_SETINFO, 0x20, true, io->in.blob.length);
if (req == NULL) return NULL;
SSVAL(req->out.body, 0x02, io->in.level);
@ -62,7 +62,7 @@ NTSTATUS smb2_setinfo_recv(struct smb2_request *req)
return smb2_request_destroy(req);
}
SMB2_CHECK_PACKET_RECV(req, 0x02, False);
SMB2_CHECK_PACKET_RECV(req, 0x02, false);
return smb2_request_destroy(req);
}

View File

@ -27,7 +27,7 @@
initialise a smb2_session structure
*/
struct smb2_tree *smb2_tree_init(struct smb2_session *session,
TALLOC_CTX *parent_ctx, BOOL primary)
TALLOC_CTX *parent_ctx, bool primary)
{
struct smb2_tree *tree;
@ -53,7 +53,7 @@ struct smb2_request *smb2_tree_connect_send(struct smb2_tree *tree,
NTSTATUS status;
req = smb2_request_init(tree->session->transport, SMB2_OP_TCON,
0x08, True, 0);
0x08, true, 0);
if (req == NULL) return NULL;
SBVAL(req->out.hdr, SMB2_HDR_UID, tree->session->uid);
@ -81,7 +81,7 @@ NTSTATUS smb2_tree_connect_recv(struct smb2_request *req, struct smb2_tree_conne
return smb2_request_destroy(req);
}
SMB2_CHECK_PACKET_RECV(req, 0x10, False);
SMB2_CHECK_PACKET_RECV(req, 0x10, false);
io->out.tid = IVAL(req->in.hdr, SMB2_HDR_TID);

View File

@ -30,7 +30,7 @@ struct smb2_request *smb2_tdis_send(struct smb2_tree *tree)
{
struct smb2_request *req;
req = smb2_request_init_tree(tree, SMB2_OP_TDIS, 0x04, False, 0);
req = smb2_request_init_tree(tree, SMB2_OP_TDIS, 0x04, false, 0);
if (req == NULL) return NULL;
SSVAL(req->out.body, 0x02, 0);
@ -51,7 +51,7 @@ NTSTATUS smb2_tdis_recv(struct smb2_request *req)
return smb2_request_destroy(req);
}
SMB2_CHECK_PACKET_RECV(req, 0x04, False);
SMB2_CHECK_PACKET_RECV(req, 0x04, false);
return smb2_request_destroy(req);
}

View File

@ -193,7 +193,7 @@ static NTSTATUS smb2_transport_finish_recv(void *private, DATA_BLOB blob)
if (NT_STATUS_EQUAL(req->status, STATUS_PENDING)) {
if (flags & 0x00000002) {
req->cancel.can_cancel = True;
req->cancel.can_cancel = true;
req->cancel.pending_id = IVAL(hdr, SMB2_HDR_PID);
for (i=0; i< req->cancel.do_cancel; i++) {
smb2_cancel(req);

View File

@ -31,7 +31,7 @@ struct smb2_request *smb2_write_send(struct smb2_tree *tree, struct smb2_write *
NTSTATUS status;
struct smb2_request *req;
req = smb2_request_init_tree(tree, SMB2_OP_WRITE, 0x30, True, io->in.data.length);
req = smb2_request_init_tree(tree, SMB2_OP_WRITE, 0x30, true, io->in.data.length);
if (req == NULL) return NULL;
status = smb2_push_o16s32_blob(&req->out, 0x02, io->in.data);
@ -62,7 +62,7 @@ NTSTATUS smb2_write_recv(struct smb2_request *req, struct smb2_write *io)
return smb2_request_destroy(req);
}
SMB2_CHECK_PACKET_RECV(req, 0x10, True);
SMB2_CHECK_PACKET_RECV(req, 0x10, true);
io->out._pad = SVAL(req->in.body, 0x02);
io->out.nwritten = IVAL(req->in.body, 0x04);

View File

@ -116,12 +116,12 @@ static NTSTATUS connect_session_setup_anon(struct composite_context *c,
status = smb_composite_sesssetup_recv(state->creq);
NT_STATUS_NOT_OK_RETURN(status);
io->out.anonymous_fallback_done = True;
io->out.anonymous_fallback_done = true;
state->session->vuid = state->io_setup->out.vuid;
/* setup for a tconx */
io->out.tree = smbcli_tree_init(state->session, state, True);
io->out.tree = smbcli_tree_init(state->session, state, true);
NT_STATUS_HAVE_NO_MEMORY(io->out.tree);
state->io_tcon = talloc(c, union smb_tcon);
@ -203,7 +203,7 @@ static NTSTATUS connect_session_setup(struct composite_context *c,
state->session->vuid = state->io_setup->out.vuid;
/* setup for a tconx */
io->out.tree = smbcli_tree_init(state->session, state, True);
io->out.tree = smbcli_tree_init(state->session, state, true);
NT_STATUS_HAVE_NO_MEMORY(io->out.tree);
state->io_tcon = talloc(c, union smb_tcon);
@ -251,7 +251,7 @@ static NTSTATUS connect_negprot(struct composite_context *c,
NT_STATUS_NOT_OK_RETURN(status);
/* next step is a session setup */
state->session = smbcli_session_init(state->transport, state, True);
state->session = smbcli_session_init(state->transport, state, true);
NT_STATUS_HAVE_NO_MEMORY(state->session);
state->io_setup = talloc(c, struct smb_composite_sesssetup);
@ -307,7 +307,7 @@ static NTSTATUS connect_socket(struct composite_context *c,
NT_STATUS_NOT_OK_RETURN(status);
/* the socket is up - we can initialise the smbcli transport layer */
state->transport = smbcli_transport_init(state->sock, state, True);
state->transport = smbcli_transport_init(state->sock, state, true);
NT_STATUS_HAVE_NO_MEMORY(state->transport);
if (is_ipaddress(state->sock->hostname) &&

View File

@ -142,7 +142,7 @@ struct composite_context *smb_composite_fetchfile_send(struct smb_composite_fetc
state->connect->in.service = io->in.service;
state->connect->in.service_type = io->in.service_type;
state->connect->in.credentials = io->in.credentials;
state->connect->in.fallback_to_anonymous = False;
state->connect->in.fallback_to_anonymous = false;
state->connect->in.workgroup = io->in.workgroup;
state->creq = smb_composite_connect_send(state->connect, state, event_ctx);

View File

@ -148,7 +148,7 @@ struct composite_context *smb_composite_fsinfo_send(struct smbcli_tree *tree,
state->connect->in.service = io->in.service;
state->connect->in.service_type = io->in.service_type;
state->connect->in.credentials = io->in.credentials;
state->connect->in.fallback_to_anonymous = False;
state->connect->in.fallback_to_anonymous = false;
state->connect->in.workgroup = io->in.workgroup;
c->state = COMPOSITE_STATE_IN_PROGRESS;

View File

@ -105,7 +105,7 @@ static NTSTATUS loadfile_open(struct composite_context *c,
state->io_read->readx.in.mincnt = MIN(32768, io->out.size);
state->io_read->readx.in.maxcnt = state->io_read->readx.in.mincnt;
state->io_read->readx.in.remaining = 0;
state->io_read->readx.in.read_for_execute = False;
state->io_read->readx.in.read_for_execute = false;
state->io_read->readx.out.data = io->out.data;
state->req = smb_raw_read_send(tree, state->io_read);

View File

@ -37,41 +37,41 @@ void asn1_free(struct asn1_data *data)
}
/* write to the ASN1 buffer, advancing the buffer pointer */
BOOL asn1_write(struct asn1_data *data, const void *p, int len)
bool asn1_write(struct asn1_data *data, const void *p, int len)
{
if (data->has_error) return False;
if (data->has_error) return false;
if (data->length < data->ofs+len) {
uint8_t *newp;
newp = talloc_realloc(data, data->data, uint8_t, data->ofs+len);
if (!newp) {
asn1_free(data);
data->has_error = True;
return False;
data->has_error = true;
return false;
}
data->data = newp;
data->length = data->ofs+len;
}
memcpy(data->data + data->ofs, p, len);
data->ofs += len;
return True;
return true;
}
/* useful fn for writing a uint8_t */
BOOL asn1_write_uint8(struct asn1_data *data, uint8_t v)
bool asn1_write_uint8(struct 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(struct asn1_data *data, uint8_t tag)
bool asn1_push_tag(struct asn1_data *data, uint8_t tag)
{
struct nesting *nesting;
asn1_write_uint8(data, tag);
nesting = talloc(data, struct nesting);
if (!nesting) {
data->has_error = True;
return False;
data->has_error = true;
return false;
}
nesting->start = data->ofs;
@ -81,7 +81,7 @@ BOOL asn1_push_tag(struct asn1_data *data, uint8_t tag)
}
/* pop a tag */
BOOL asn1_pop_tag(struct asn1_data *data)
bool asn1_pop_tag(struct asn1_data *data)
{
struct nesting *nesting;
size_t len;
@ -89,8 +89,8 @@ BOOL asn1_pop_tag(struct asn1_data *data)
nesting = data->nesting;
if (!nesting) {
data->has_error = True;
return False;
data->has_error = true;
return false;
}
len = data->ofs - (nesting->start+1);
/* yes, this is ugly. We don't know in advance how many bytes the length
@ -98,10 +98,10 @@ BOOL asn1_pop_tag(struct asn1_data *data)
need to correct our mistake */
if (len > 0xFFFFFF) {
data->data[nesting->start] = 0x84;
if (!asn1_write_uint8(data, 0)) return False;
if (!asn1_write_uint8(data, 0)) return False;
if (!asn1_write_uint8(data, 0)) return False;
if (!asn1_write_uint8(data, 0)) return False;
if (!asn1_write_uint8(data, 0)) return false;
if (!asn1_write_uint8(data, 0)) return false;
if (!asn1_write_uint8(data, 0)) return false;
if (!asn1_write_uint8(data, 0)) return false;
memmove(data->data+nesting->start+5, data->data+nesting->start+1, len);
data->data[nesting->start+1] = (len>>24) & 0xFF;
data->data[nesting->start+2] = (len>>16) & 0xFF;
@ -109,23 +109,23 @@ BOOL asn1_pop_tag(struct asn1_data *data)
data->data[nesting->start+4] = len&0xff;
} else if (len > 0xFFFF) {
data->data[nesting->start] = 0x83;
if (!asn1_write_uint8(data, 0)) return False;
if (!asn1_write_uint8(data, 0)) return False;
if (!asn1_write_uint8(data, 0)) return False;
if (!asn1_write_uint8(data, 0)) return false;
if (!asn1_write_uint8(data, 0)) return false;
if (!asn1_write_uint8(data, 0)) return false;
memmove(data->data+nesting->start+4, data->data+nesting->start+1, len);
data->data[nesting->start+1] = (len>>16) & 0xFF;
data->data[nesting->start+2] = (len>>8) & 0xFF;
data->data[nesting->start+3] = len&0xff;
} else if (len > 255) {
data->data[nesting->start] = 0x82;
if (!asn1_write_uint8(data, 0)) return False;
if (!asn1_write_uint8(data, 0)) return False;
if (!asn1_write_uint8(data, 0)) return false;
if (!asn1_write_uint8(data, 0)) return false;
memmove(data->data+nesting->start+3, data->data+nesting->start+1, len);
data->data[nesting->start+1] = len>>8;
data->data[nesting->start+2] = len&0xff;
} else if (len > 127) {
data->data[nesting->start] = 0x81;
if (!asn1_write_uint8(data, 0)) return False;
if (!asn1_write_uint8(data, 0)) return false;
memmove(data->data+nesting->start+2, data->data+nesting->start+1, len);
data->data[nesting->start+1] = len;
} else {
@ -134,20 +134,20 @@ BOOL asn1_pop_tag(struct asn1_data *data)
data->nesting = nesting->next;
talloc_free(nesting);
return True;
return true;
}
/* "i" is the one's complement representation, as is the normal result of an
* implicit signed->unsigned conversion */
static BOOL push_int_bigendian(struct asn1_data *data, unsigned int i, BOOL negative)
static bool push_int_bigendian(struct asn1_data *data, unsigned int i, bool negative)
{
uint8_t lowest = i & 0xFF;
i = i >> 8;
if (i != 0)
if (!push_int_bigendian(data, i, negative))
return False;
return false;
if (data->nesting->start+1 == data->ofs) {
@ -157,14 +157,14 @@ static BOOL push_int_bigendian(struct asn1_data *data, unsigned int i, BOOL nega
if (negative) {
/* Don't write leading 0xff's */
if (lowest == 0xFF)
return True;
return true;
if ((lowest & 0x80) == 0) {
/* The only exception for a leading 0xff is if
* the highest bit is 0, which would indicate
* a positive value */
if (!asn1_write_uint8(data, 0xff))
return False;
return false;
}
} else {
if (lowest & 0x80) {
@ -172,7 +172,7 @@ static BOOL push_int_bigendian(struct asn1_data *data, unsigned int i, BOOL nega
* this would indicate a negative number. Push
* a 0 to indicate a positive one */
if (!asn1_write_uint8(data, 0))
return False;
return false;
}
}
}
@ -183,7 +183,7 @@ static BOOL push_int_bigendian(struct asn1_data *data, unsigned int i, BOOL nega
/* write an Integer without the tag framing. Needed for example for the LDAP
* Abandon Operation */
BOOL asn1_write_implicit_Integer(struct asn1_data *data, int i)
bool asn1_write_implicit_Integer(struct asn1_data *data, int i)
{
if (i == -1) {
/* -1 is special as it consists of all-0xff bytes. In
@ -198,14 +198,14 @@ BOOL asn1_write_implicit_Integer(struct asn1_data *data, int i)
/* write an integer */
BOOL asn1_write_Integer(struct asn1_data *data, int i)
bool asn1_write_Integer(struct asn1_data *data, int i)
{
if (!asn1_push_tag(data, ASN1_INTEGER)) return False;
if (!asn1_write_implicit_Integer(data, i)) return False;
if (!asn1_push_tag(data, ASN1_INTEGER)) return false;
if (!asn1_write_implicit_Integer(data, i)) return false;
return asn1_pop_tag(data);
}
BOOL ber_write_OID_String(DATA_BLOB *blob, const char *OID)
bool ber_write_OID_String(DATA_BLOB *blob, const char *OID)
{
uint_t v, v2;
const char *p = (const char *)OID;
@ -213,16 +213,16 @@ BOOL ber_write_OID_String(DATA_BLOB *blob, const char *OID)
int i;
v = strtoul(p, &newp, 10);
if (newp[0] != '.') return False;
if (newp[0] != '.') return false;
p = newp + 1;
v2 = strtoul(p, &newp, 10);
if (newp[0] != '.') return False;
if (newp[0] != '.') return false;
p = newp + 1;
/*the ber representation can't use more space then the string one */
*blob = data_blob(NULL, strlen(OID));
if (!blob->data) return False;
if (!blob->data) return false;
blob->data[0] = 40*v + v2;
@ -235,7 +235,7 @@ BOOL ber_write_OID_String(DATA_BLOB *blob, const char *OID)
p = newp;
} else {
data_blob_free(blob);
return False;
return false;
}
if (v >= (1<<28)) blob->data[i++] = (0x80 | ((v>>28)&0x7f));
if (v >= (1<<21)) blob->data[i++] = (0x80 | ((v>>21)&0x7f));
@ -246,31 +246,31 @@ BOOL ber_write_OID_String(DATA_BLOB *blob, const char *OID)
blob->length = i;
return True;
return true;
}
/* write an object ID to a ASN1 buffer */
BOOL asn1_write_OID(struct asn1_data *data, const char *OID)
bool asn1_write_OID(struct asn1_data *data, const char *OID)
{
DATA_BLOB blob;
if (!asn1_push_tag(data, ASN1_OID)) return False;
if (!asn1_push_tag(data, ASN1_OID)) return false;
if (!ber_write_OID_String(&blob, OID)) {
data->has_error = True;
return False;
data->has_error = true;
return false;
}
if (!asn1_write(data, blob.data, blob.length)) {
data->has_error = True;
return False;
data->has_error = true;
return false;
}
data_blob_free(&blob);
return asn1_pop_tag(data);
}
/* write an octet string */
BOOL asn1_write_OctetString(struct asn1_data *data, const void *p, size_t length)
bool asn1_write_OctetString(struct asn1_data *data, const void *p, size_t length)
{
asn1_push_tag(data, ASN1_OCTET_STRING);
asn1_write(data, p, length);
@ -279,14 +279,14 @@ BOOL asn1_write_OctetString(struct asn1_data *data, const void *p, size_t length
}
/* write a LDAP string */
BOOL asn1_write_LDAPString(struct asn1_data *data, const char *s)
bool asn1_write_LDAPString(struct asn1_data *data, const char *s)
{
asn1_write(data, s, strlen(s));
return !data->has_error;
}
/* write a general string */
BOOL asn1_write_GeneralString(struct asn1_data *data, const char *s)
bool asn1_write_GeneralString(struct asn1_data *data, const char *s)
{
asn1_push_tag(data, ASN1_GENERAL_STRING);
asn1_write_LDAPString(data, s);
@ -294,7 +294,7 @@ BOOL asn1_write_GeneralString(struct asn1_data *data, const char *s)
return !data->has_error;
}
BOOL asn1_write_ContextSimple(struct asn1_data *data, uint8_t num, DATA_BLOB *blob)
bool asn1_write_ContextSimple(struct asn1_data *data, uint8_t num, DATA_BLOB *blob)
{
asn1_push_tag(data, ASN1_CONTEXT_SIMPLE(num));
asn1_write(data, blob->data, blob->length);
@ -303,7 +303,7 @@ BOOL asn1_write_ContextSimple(struct asn1_data *data, uint8_t num, DATA_BLOB *bl
}
/* write a BOOLEAN */
BOOL asn1_write_BOOLEAN(struct asn1_data *data, BOOL v)
bool asn1_write_BOOLEAN(struct asn1_data *data, bool v)
{
asn1_push_tag(data, ASN1_BOOLEAN);
asn1_write_uint8(data, v ? 0xFF : 0);
@ -311,140 +311,140 @@ BOOL asn1_write_BOOLEAN(struct asn1_data *data, BOOL v)
return !data->has_error;
}
BOOL asn1_read_BOOLEAN(struct asn1_data *data, BOOL *v)
bool asn1_read_BOOLEAN(struct asn1_data *data, bool *v)
{
uint8_t tmp = 0;
asn1_start_tag(data, ASN1_BOOLEAN);
asn1_read_uint8(data, &tmp);
if (tmp == 0xFF) {
*v = True;
*v = true;
} else {
*v = False;
*v = false;
}
asn1_end_tag(data);
return !data->has_error;
}
/* check a BOOLEAN */
BOOL asn1_check_BOOLEAN(struct asn1_data *data, BOOL v)
bool asn1_check_BOOLEAN(struct asn1_data *data, bool v)
{
uint8_t b = 0;
asn1_read_uint8(data, &b);
if (b != ASN1_BOOLEAN) {
data->has_error = True;
return False;
data->has_error = true;
return false;
}
asn1_read_uint8(data, &b);
if (b != v) {
data->has_error = True;
return False;
data->has_error = true;
return false;
}
return !data->has_error;
}
/* load a struct asn1_data structure with a lump of data, ready to be parsed */
BOOL asn1_load(struct asn1_data *data, DATA_BLOB blob)
bool asn1_load(struct asn1_data *data, DATA_BLOB blob)
{
ZERO_STRUCTP(data);
data->data = talloc_memdup(data, blob.data, blob.length);
if (!data->data) {
data->has_error = True;
return False;
data->has_error = true;
return false;
}
data->length = blob.length;
return True;
return true;
}
/* Peek into an ASN1 buffer, not advancing the pointer */
BOOL asn1_peek(struct asn1_data *data, void *p, int len)
bool asn1_peek(struct asn1_data *data, void *p, int len)
{
if (data->has_error)
return False;
return false;
if (len < 0 || data->ofs + len < data->ofs || data->ofs + len < len)
return False;
return false;
if (data->ofs + len > data->length) {
/* we need to mark the buffer as consumed, so the caller knows
this was an out of data error, and not a decode error */
data->ofs = data->length;
return False;
return false;
}
memcpy(p, data->data + data->ofs, len);
return True;
return true;
}
/* read from a ASN1 buffer, advancing the buffer pointer */
BOOL asn1_read(struct asn1_data *data, void *p, int len)
bool asn1_read(struct asn1_data *data, void *p, int len)
{
if (!asn1_peek(data, p, len)) {
data->has_error = True;
return False;
data->has_error = true;
return false;
}
data->ofs += len;
return True;
return true;
}
/* read a uint8_t from a ASN1 buffer */
BOOL asn1_read_uint8(struct asn1_data *data, uint8_t *v)
bool asn1_read_uint8(struct asn1_data *data, uint8_t *v)
{
return asn1_read(data, v, 1);
}
BOOL asn1_peek_uint8(struct asn1_data *data, uint8_t *v)
bool asn1_peek_uint8(struct asn1_data *data, uint8_t *v)
{
return asn1_peek(data, v, 1);
}
BOOL asn1_peek_tag(struct asn1_data *data, uint8_t tag)
bool asn1_peek_tag(struct asn1_data *data, uint8_t tag)
{
uint8_t b;
if (asn1_tag_remaining(data) <= 0) {
return False;
return false;
}
if (!asn1_peek_uint8(data, &b))
return False;
return false;
return (b == tag);
}
/* start reading a nested asn1 structure */
BOOL asn1_start_tag(struct asn1_data *data, uint8_t tag)
bool asn1_start_tag(struct asn1_data *data, uint8_t tag)
{
uint8_t b;
struct nesting *nesting;
if (!asn1_read_uint8(data, &b))
return False;
return false;
if (b != tag) {
data->has_error = True;
return False;
data->has_error = true;
return false;
}
nesting = talloc(data, struct nesting);
if (!nesting) {
data->has_error = True;
return False;
data->has_error = true;
return false;
}
if (!asn1_read_uint8(data, &b)) {
return False;
return false;
}
if (b & 0x80) {
int n = b & 0x7f;
if (!asn1_read_uint8(data, &b))
return False;
return false;
nesting->taglen = b;
while (n > 1) {
if (!asn1_read_uint8(data, &b))
return False;
return false;
nesting->taglen = (nesting->taglen << 8) | b;
n--;
}
@ -455,32 +455,32 @@ BOOL asn1_start_tag(struct asn1_data *data, uint8_t tag)
nesting->next = data->nesting;
data->nesting = nesting;
if (asn1_tag_remaining(data) == -1) {
return False;
return false;
}
return !data->has_error;
}
/* stop reading a tag */
BOOL asn1_end_tag(struct asn1_data *data)
bool asn1_end_tag(struct asn1_data *data)
{
struct nesting *nesting;
/* make sure we read it all */
if (asn1_tag_remaining(data) != 0) {
data->has_error = True;
return False;
data->has_error = true;
return false;
}
nesting = data->nesting;
if (!nesting) {
data->has_error = True;
return False;
data->has_error = true;
return false;
}
data->nesting = nesting->next;
talloc_free(nesting);
return True;
return true;
}
/* work out how many bytes are left in this nested tag */
@ -492,26 +492,26 @@ int asn1_tag_remaining(struct asn1_data *data)
}
if (!data->nesting) {
data->has_error = True;
data->has_error = true;
return -1;
}
remaining = data->nesting->taglen - (data->ofs - data->nesting->start);
if (remaining > (data->length - data->ofs)) {
data->has_error = True;
data->has_error = true;
return -1;
}
return remaining;
}
/* read an object ID from a data blob */
BOOL ber_read_OID_String(TALLOC_CTX *mem_ctx, DATA_BLOB blob, const char **OID)
bool ber_read_OID_String(TALLOC_CTX *mem_ctx, DATA_BLOB blob, const char **OID)
{
int i;
uint8_t *b;
uint_t v;
char *tmp_oid = NULL;
if (blob.length < 2) return False;
if (blob.length < 2) return false;
b = blob.data;
@ -531,82 +531,82 @@ BOOL ber_read_OID_String(TALLOC_CTX *mem_ctx, DATA_BLOB blob, const char **OID)
if (v != 0) {
talloc_free(tmp_oid);
return False;
return false;
}
*OID = tmp_oid;
return True;
return true;
nomem:
return False;
return false;
}
/* read an object ID from a ASN1 buffer */
BOOL asn1_read_OID(struct asn1_data *data, TALLOC_CTX *mem_ctx, const char **OID)
bool asn1_read_OID(struct asn1_data *data, TALLOC_CTX *mem_ctx, const char **OID)
{
DATA_BLOB blob;
int len;
if (!asn1_start_tag(data, ASN1_OID)) return False;
if (!asn1_start_tag(data, ASN1_OID)) return false;
len = asn1_tag_remaining(data);
if (len < 0) {
data->has_error = True;
return False;
data->has_error = true;
return false;
}
blob = data_blob(NULL, len);
if (!blob.data) {
data->has_error = True;
return False;
data->has_error = true;
return false;
}
asn1_read(data, blob.data, len);
asn1_end_tag(data);
if (data->has_error) {
data_blob_free(&blob);
return False;
return false;
}
if (!ber_read_OID_String(mem_ctx, blob, OID)) {
data->has_error = True;
data->has_error = true;
data_blob_free(&blob);
return False;
return false;
}
data_blob_free(&blob);
return True;
return true;
}
/* check that the next object ID is correct */
BOOL asn1_check_OID(struct asn1_data *data, const char *OID)
bool asn1_check_OID(struct asn1_data *data, const char *OID)
{
const char *id;
if (!asn1_read_OID(data, data, &id)) return False;
if (!asn1_read_OID(data, data, &id)) return false;
if (strcmp(id, OID) != 0) {
talloc_free(discard_const(id));
data->has_error = True;
return False;
data->has_error = true;
return false;
}
talloc_free(discard_const(id));
return True;
return true;
}
/* read a LDAPString from a ASN1 buffer */
BOOL asn1_read_LDAPString(struct asn1_data *data, TALLOC_CTX *mem_ctx, char **s)
bool asn1_read_LDAPString(struct asn1_data *data, TALLOC_CTX *mem_ctx, char **s)
{
int len;
len = asn1_tag_remaining(data);
if (len < 0) {
data->has_error = True;
return False;
data->has_error = true;
return false;
}
*s = talloc_array(mem_ctx, char, len+1);
if (! *s) {
data->has_error = True;
return False;
data->has_error = true;
return false;
}
asn1_read(data, *s, len);
(*s)[len] = 0;
@ -615,29 +615,29 @@ BOOL asn1_read_LDAPString(struct asn1_data *data, TALLOC_CTX *mem_ctx, char **s)
/* read a GeneralString from a ASN1 buffer */
BOOL asn1_read_GeneralString(struct asn1_data *data, TALLOC_CTX *mem_ctx, char **s)
bool asn1_read_GeneralString(struct asn1_data *data, TALLOC_CTX *mem_ctx, char **s)
{
if (!asn1_start_tag(data, ASN1_GENERAL_STRING)) return False;
if (!asn1_read_LDAPString(data, mem_ctx, s)) return False;
if (!asn1_start_tag(data, ASN1_GENERAL_STRING)) return false;
if (!asn1_read_LDAPString(data, mem_ctx, s)) return false;
return asn1_end_tag(data);
}
/* read a octet string blob */
BOOL asn1_read_OctetString(struct asn1_data *data, TALLOC_CTX *mem_ctx, DATA_BLOB *blob)
bool asn1_read_OctetString(struct asn1_data *data, TALLOC_CTX *mem_ctx, DATA_BLOB *blob)
{
int len;
ZERO_STRUCTP(blob);
if (!asn1_start_tag(data, ASN1_OCTET_STRING)) return False;
if (!asn1_start_tag(data, ASN1_OCTET_STRING)) return false;
len = asn1_tag_remaining(data);
if (len < 0) {
data->has_error = True;
return False;
data->has_error = true;
return false;
}
*blob = data_blob_talloc(mem_ctx, NULL, len+1);
if (!blob->data) {
data->has_error = True;
return False;
data->has_error = true;
return false;
}
asn1_read(data, blob->data, len);
asn1_end_tag(data);
@ -647,25 +647,25 @@ BOOL asn1_read_OctetString(struct asn1_data *data, TALLOC_CTX *mem_ctx, DATA_BLO
if (data->has_error) {
data_blob_free(blob);
*blob = data_blob(NULL, 0);
return False;
return false;
}
return True;
return true;
}
BOOL asn1_read_ContextSimple(struct asn1_data *data, uint8_t num, DATA_BLOB *blob)
bool asn1_read_ContextSimple(struct asn1_data *data, uint8_t num, DATA_BLOB *blob)
{
int len;
ZERO_STRUCTP(blob);
if (!asn1_start_tag(data, ASN1_CONTEXT_SIMPLE(num))) return False;
if (!asn1_start_tag(data, ASN1_CONTEXT_SIMPLE(num))) return false;
len = asn1_tag_remaining(data);
if (len < 0) {
data->has_error = True;
return False;
data->has_error = true;
return false;
}
*blob = data_blob(NULL, len);
if ((len != 0) && (!blob->data)) {
data->has_error = True;
return False;
data->has_error = true;
return false;
}
asn1_read(data, blob->data, len);
asn1_end_tag(data);
@ -673,13 +673,13 @@ BOOL asn1_read_ContextSimple(struct asn1_data *data, uint8_t num, DATA_BLOB *blo
}
/* read an interger without tag*/
BOOL asn1_read_implicit_Integer(struct asn1_data *data, int *i)
bool asn1_read_implicit_Integer(struct asn1_data *data, int *i)
{
uint8_t b;
*i = 0;
while (!data->has_error && asn1_tag_remaining(data)>0) {
if (!asn1_read_uint8(data, &b)) return False;
if (!asn1_read_uint8(data, &b)) return false;
*i = (*i << 8) + b;
}
return !data->has_error;
@ -687,21 +687,21 @@ BOOL asn1_read_implicit_Integer(struct asn1_data *data, int *i)
}
/* read an interger */
BOOL asn1_read_Integer(struct asn1_data *data, int *i)
bool asn1_read_Integer(struct asn1_data *data, int *i)
{
*i = 0;
if (!asn1_start_tag(data, ASN1_INTEGER)) return False;
if (!asn1_read_implicit_Integer(data, i)) return False;
if (!asn1_start_tag(data, ASN1_INTEGER)) return false;
if (!asn1_read_implicit_Integer(data, i)) return false;
return asn1_end_tag(data);
}
/* read an interger */
BOOL asn1_read_enumerated(struct asn1_data *data, int *v)
bool asn1_read_enumerated(struct asn1_data *data, int *v)
{
*v = 0;
if (!asn1_start_tag(data, ASN1_ENUMERATED)) return False;
if (!asn1_start_tag(data, ASN1_ENUMERATED)) return false;
while (!data->has_error && asn1_tag_remaining(data)>0) {
uint8_t b;
asn1_read_uint8(data, &b);
@ -711,23 +711,23 @@ BOOL asn1_read_enumerated(struct asn1_data *data, int *v)
}
/* check a enumarted value is correct */
BOOL asn1_check_enumerated(struct asn1_data *data, int v)
bool asn1_check_enumerated(struct asn1_data *data, int v)
{
uint8_t b;
if (!asn1_start_tag(data, ASN1_ENUMERATED)) return False;
if (!asn1_start_tag(data, ASN1_ENUMERATED)) return false;
asn1_read_uint8(data, &b);
asn1_end_tag(data);
if (v != b)
data->has_error = False;
data->has_error = false;
return !data->has_error;
}
/* write an enumarted value to the stream */
BOOL asn1_write_enumerated(struct asn1_data *data, uint8_t v)
bool asn1_write_enumerated(struct asn1_data *data, uint8_t v)
{
if (!asn1_push_tag(data, ASN1_ENUMERATED)) return False;
if (!asn1_push_tag(data, ASN1_ENUMERATED)) return false;
asn1_write_uint8(data, v);
asn1_pop_tag(data);
return !data->has_error;

View File

@ -61,7 +61,7 @@ static NTSTATUS smblsa_connect(struct smbcli_state *cli)
return NT_STATUS_NO_MEMORY;
}
lsa->ipc_tree = smbcli_tree_init(cli->session, lsa, False);
lsa->ipc_tree = smbcli_tree_init(cli->session, lsa, false);
if (lsa->ipc_tree == NULL) {
return NT_STATUS_NO_MEMORY;
}

View File

@ -1162,7 +1162,7 @@ static const struct {
/*
check if a DOS encoded NTSTATUS code maps to the given NTSTATUS code
*/
BOOL ntstatus_dos_equal(NTSTATUS status1, NTSTATUS status2)
bool ntstatus_dos_equal(NTSTATUS status1, NTSTATUS status2)
{
/* when we negotiate nt status support, we don't want to consider
the mapping of dos codes, as we want to catch the cases where

View File

@ -37,7 +37,7 @@ static struct wrepl_request *wrepl_request_finished(struct wrepl_request *req, N
*/
static void wrepl_socket_dead(struct wrepl_socket *wrepl_socket, NTSTATUS status)
{
wrepl_socket->dead = True;
wrepl_socket->dead = true;
if (wrepl_socket->packet) {
packet_recv_disable(wrepl_socket->packet);
@ -148,7 +148,7 @@ static void wrepl_error(void *private, NTSTATUS status)
static int wrepl_socket_destructor(struct wrepl_socket *sock)
{
if (sock->dead) {
sock->free_skipped = True;
sock->free_skipped = true;
return -1;
}
wrepl_socket_dead(sock, NT_STATUS_LOCAL_DISCONNECT);
@ -387,7 +387,7 @@ static void wrepl_request_trigger_handler(struct event_context *ev, struct timed
/*
trigger an immediate event on a wrepl_request
the return value should only be used in wrepl_request_send()
this is the only place where req->trigger is True
this is the only place where req->trigger is true
*/
static struct wrepl_request *wrepl_request_finished(struct wrepl_request *req, NTSTATUS status)
{
@ -406,7 +406,7 @@ static struct wrepl_request *wrepl_request_finished(struct wrepl_request *req, N
req->status = status;
if (req->trigger) {
req->trigger = False;
req->trigger = false;
/* a zero timeout means immediate */
te = event_add_timed(req->wrepl_socket->event.ctx,
req, timeval_zero(),
@ -448,7 +448,7 @@ static int wrepl_send_ctrl_destructor(struct wrepl_send_ctrl_state *s)
/* here, we need to make sure the async request handler is called
* later in the next event_loop and now now
*/
req->trigger = True;
req->trigger = true;
wrepl_request_finished(req, NT_STATUS_OK);
if (s->ctrl.disconnect_after_send) {
@ -473,7 +473,7 @@ struct wrepl_request *wrepl_request_send(struct wrepl_socket *wrepl_socket,
if (!req) return NULL;
req->wrepl_socket = wrepl_socket;
req->state = WREPL_REQUEST_RECV;
req->trigger = True;
req->trigger = true;
DLIST_ADD_END(wrepl_socket->recv_queue, req, struct wrepl_request *);
talloc_set_destructor(req, wrepl_request_destructor);
@ -516,7 +516,7 @@ struct wrepl_request *wrepl_request_send(struct wrepl_socket *wrepl_socket,
return wrepl_request_finished(req, req->status);
}
req->trigger = False;
req->trigger = false;
return req;
}
@ -638,8 +638,8 @@ struct wrepl_request *wrepl_associate_stop_send(struct wrepl_socket *wrepl_socke
ZERO_STRUCT(ctrl);
if (io->in.reason == 0) {
ctrl.send_only = True;
ctrl.disconnect_after_send = True;
ctrl.send_only = true;
ctrl.disconnect_after_send = true;
}
req = wrepl_request_send(wrepl_socket, packet, &ctrl);

View File

@ -120,7 +120,7 @@ struct wrepl_pull_table {
#define WREPL_NAME_TYPE(flags) (flags & WREPL_FLAGS_RECORD_TYPE)
#define WREPL_NAME_STATE(flags) ((flags & WREPL_FLAGS_RECORD_STATE)>>2)
#define WREPL_NAME_NODE(flags) ((flags & WREPL_FLAGS_NODE_TYPE)>>5)
#define WREPL_NAME_IS_STATIC(flags) ((flags & WREPL_FLAGS_IS_STATIC)?True:False)
#define WREPL_NAME_IS_STATIC(flags) ((flags & WREPL_FLAGS_IS_STATIC)?true:false)
#define WREPL_NAME_FLAGS(type, state, node, is_static) \
(type | (state << 2) | (node << 5) | \

View File

@ -57,7 +57,7 @@ struct composite_context* libnet_GroupInfo_send(struct libnet_context *ctx,
{
struct composite_context *c;
struct group_info_state *s;
BOOL prereq_met = False;
bool prereq_met = false;
struct composite_context *lookup_req;
/* composite context allocation and setup */

View File

@ -926,7 +926,7 @@ static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx,
r2->in.netbios_name = netbios_name;
r2->in.level = LIBNET_JOINDOMAIN_AUTOMATIC;
r2->in.acct_type = acct_type;
r2->in.recreate_account = False;
r2->in.recreate_account = false;
status = libnet_JoinDomain(ctx, r2, r2);
if (!NT_STATUS_IS_OK(status)) {
r->out.error_string = talloc_steal(mem_ctx, r2->out.error_string);

View File

@ -260,7 +260,7 @@ struct composite_context* libnet_LookupName_send(struct libnet_context *ctx,
struct composite_context *c;
struct lookup_name_state *s;
struct rpc_request *lookup_req;
BOOL prereq_met = False;
bool prereq_met = false;
c = composite_create(mem_ctx, ctx->event_ctx);
if (c == NULL) return NULL;

View File

@ -247,7 +247,7 @@ static NTSTATUS samsync_ldb_handle_user(TALLOC_CTX *mem_ctx,
struct ldb_message **remote_msgs = NULL;
int ret, i;
uint32_t acb;
BOOL add = False;
bool add = false;
const char *attrs[] = { NULL };
/* we may change this to a global search, then fill in only the things not in ldap later */
const char *remote_attrs[] = { "userPrincipalName", "servicePrincipalName",
@ -275,7 +275,7 @@ static NTSTATUS samsync_ldb_handle_user(TALLOC_CTX *mem_ctx,
ldb_errstring(state->sam_ldb));
return NT_STATUS_INTERNAL_DB_CORRUPTION;
} else if (ret == 0) {
add = True;
add = true;
} else if (ret > 1) {
*error_string = talloc_asprintf(mem_ctx, "More than one user with SID: %s in local LDB",
dom_sid_string(mem_ctx, user_sid));
@ -517,7 +517,7 @@ static NTSTATUS samsync_ldb_handle_group(TALLOC_CTX *mem_ctx,
struct ldb_message *msg;
struct ldb_message **msgs;
int ret;
BOOL add = False;
bool add = false;
const char *attrs[] = { NULL };
msg = ldb_msg_new(mem_ctx);
@ -534,7 +534,7 @@ static NTSTATUS samsync_ldb_handle_group(TALLOC_CTX *mem_ctx,
*error_string = talloc_asprintf(mem_ctx, "gendb_search failed: %s", ldb_errstring(state->sam_ldb));
return NT_STATUS_INTERNAL_DB_CORRUPTION;
} else if (ret == 0) {
add = True;
add = true;
} else if (ret > 1) {
*error_string = talloc_asprintf(mem_ctx, "More than one group/alias with SID: %s",
dom_sid_string(mem_ctx,
@ -729,7 +729,7 @@ static NTSTATUS samsync_ldb_handle_alias(TALLOC_CTX *mem_ctx,
struct ldb_message *msg;
struct ldb_message **msgs;
int ret;
BOOL add = False;
bool add = false;
const char *attrs[] = { NULL };
msg = ldb_msg_new(mem_ctx);
@ -746,7 +746,7 @@ static NTSTATUS samsync_ldb_handle_alias(TALLOC_CTX *mem_ctx,
*error_string = talloc_asprintf(mem_ctx, "gendb_search failed: %s", ldb_errstring(state->sam_ldb));
return NT_STATUS_INTERNAL_DB_CORRUPTION;
} else if (ret == 0) {
add = True;
add = true;
} else if (ret > 1) {
*error_string = talloc_asprintf(mem_ctx, "More than one group/alias with SID: %s",
dom_sid_string(mem_ctx,

View File

@ -62,7 +62,7 @@ struct composite_context* libnet_CreateUser_send(struct libnet_context *ctx,
struct composite_context *c;
struct create_user_state *s;
struct composite_context *create_req;
BOOL prereq_met = False;
bool prereq_met = false;
/* composite context allocation and setup */
c = composite_create(mem_ctx, ctx->event_ctx);
@ -231,7 +231,7 @@ struct composite_context *libnet_DeleteUser_send(struct libnet_context *ctx,
struct composite_context *c;
struct delete_user_state *s;
struct composite_context *delete_req;
BOOL prereq_met = False;
bool prereq_met = false;
/* composite context allocation and setup */
c = composite_create(mem_ctx, ctx->event_ctx);
@ -402,7 +402,7 @@ struct composite_context *libnet_ModifyUser_send(struct libnet_context *ctx,
struct composite_context *c;
struct modify_user_state *s;
struct composite_context *userinfo_req;
BOOL prereq_met = False;
bool prereq_met = false;
c = composite_create(mem_ctx, ctx->event_ctx);
if (c == NULL) return NULL;
@ -629,7 +629,7 @@ struct composite_context* libnet_UserInfo_send(struct libnet_context *ctx,
struct composite_context *c;
struct user_info_state *s;
struct composite_context *lookup_req;
BOOL prereq_met = False;
bool prereq_met = false;
/* composite context allocation and setup */
c = composite_create(mem_ctx, ctx->event_ctx);
@ -878,7 +878,7 @@ struct composite_context* libnet_UserList_send(struct libnet_context *ctx,
struct composite_context *c;
struct userlist_state *s;
struct rpc_request *query_req;
BOOL prereq_met = False;
bool prereq_met = false;
/* composite context allocation and setup */
c = composite_create(mem_ctx, ctx->event_ctx);
@ -952,7 +952,7 @@ static void continue_domain_queried(struct rpc_request *req)
struct composite_context *c;
struct userlist_state *s;
struct rpc_request *enum_req;
BOOL prereq_met = False;
bool prereq_met = false;
c = talloc_get_type(req->async.private_data, struct composite_context);
s = talloc_get_type(c->private_data, struct userlist_state);

View File

@ -81,7 +81,7 @@ static NTSTATUS fix_user(TALLOC_CTX *mem_ctx,
} else {
user->lmpassword = keys.keys.keys2.lmpassword.pwd;
}
user->lm_password_present = True;
user->lm_password_present = true;
}
if (keys.keys.keys2.ntpassword.length == 16) {
if (rid_crypt) {
@ -90,7 +90,7 @@ static NTSTATUS fix_user(TALLOC_CTX *mem_ctx,
} else {
user->ntpassword = keys.keys.keys2.ntpassword.pwd;
}
user->nt_password_present = True;
user->nt_password_present = true;
}
/* TODO: rid decrypt history fields */
} else {

View File

@ -29,7 +29,7 @@
#include "librpc/gen_ndr/ndr_lsa.h"
BOOL samr_domain_opened(struct libnet_context *ctx, const char *domain_name,
bool samr_domain_opened(struct libnet_context *ctx, const char *domain_name,
struct composite_context **parent_ctx,
struct libnet_DomainOpen *domain_open,
void (*continue_fn)(struct composite_context*),
@ -37,7 +37,7 @@ BOOL samr_domain_opened(struct libnet_context *ctx, const char *domain_name,
{
struct composite_context *domopen_req;
if (parent_ctx == NULL || *parent_ctx == NULL) return False;
if (parent_ctx == NULL || *parent_ctx == NULL) return false;
if (domain_name == NULL) {
/*
@ -52,7 +52,7 @@ BOOL samr_domain_opened(struct libnet_context *ctx, const char *domain_name,
} else {
composite_error(*parent_ctx, NT_STATUS_INVALID_PARAMETER);
return True;
return true;
}
} else {
@ -71,20 +71,20 @@ BOOL samr_domain_opened(struct libnet_context *ctx, const char *domain_name,
} else {
/* domain has already been opened and it's the same domain
as requested */
return True;
return true;
}
}
/* send request to open the domain */
domopen_req = libnet_DomainOpen_send(ctx, domain_open, monitor);
if (composite_nomem(domopen_req, *parent_ctx)) return False;
if (composite_nomem(domopen_req, *parent_ctx)) return false;
composite_continue(*parent_ctx, domopen_req, continue_fn, *parent_ctx);
return False;
return false;
}
BOOL lsa_domain_opened(struct libnet_context *ctx, const char *domain_name,
bool lsa_domain_opened(struct libnet_context *ctx, const char *domain_name,
struct composite_context **parent_ctx,
struct libnet_DomainOpen *domain_open,
void (*continue_fn)(struct composite_context*),
@ -92,7 +92,7 @@ BOOL lsa_domain_opened(struct libnet_context *ctx, const char *domain_name,
{
struct composite_context *domopen_req;
if (parent_ctx == NULL || *parent_ctx == NULL) return False;
if (parent_ctx == NULL || *parent_ctx == NULL) return false;
if (domain_name == NULL) {
/*
@ -109,7 +109,7 @@ BOOL lsa_domain_opened(struct libnet_context *ctx, const char *domain_name,
composite_error(*parent_ctx, NT_STATUS_INVALID_PARAMETER);
/* this ensures the calling function exits and composite function error
gets noticed quickly */
return True;
return true;
}
} else {
@ -128,15 +128,15 @@ BOOL lsa_domain_opened(struct libnet_context *ctx, const char *domain_name,
} else {
/* domain has already been opened and it's the same domain
as requested */
return True;
return true;
}
}
/* send request to open the domain */
domopen_req = libnet_DomainOpen_send(ctx, domain_open, monitor);
/* see the comment above to find out why true is returned here */
if (composite_nomem(domopen_req, *parent_ctx)) return True;
if (composite_nomem(domopen_req, *parent_ctx)) return true;
composite_continue(*parent_ctx, domopen_req, continue_fn, *parent_ctx);
return False;
return false;
}

View File

@ -662,7 +662,7 @@ static NTSTATUS usermod_change(struct composite_context *c,
uint16_t level = 27;
/* prepare UserInfo level and data based on bitmask field */
do_set = usermod_setfields(s, &level, i, False);
do_set = usermod_setfields(s, &level, i, false);
if (level < 1 || level > 26) {
/* apparently there's a field that the setfields routine
@ -752,7 +752,7 @@ static void continue_usermod_user_queried(struct rpc_request *req)
of many) */
s->info = *s->queryuser.out.info;
usermod_setfields(s, &level, i, True);
usermod_setfields(s, &level, i, true);
/* prepare rpc call arguments */
s->setuser.in.user_handle = &s->user_handle;

View File

@ -32,10 +32,10 @@
extern int winbindd_fd;
static char winbind_separator_int(BOOL strict)
static char winbind_separator_int(bool strict)
{
struct winbindd_response response;
static BOOL got_sep;
static bool got_sep;
static char sep;
if (got_sep)
@ -56,7 +56,7 @@ static char winbind_separator_int(BOOL strict)
}
sep = response.data.info.winbind_separator;
got_sep = True;
got_sep = true;
if (!sep) {
d_fprintf(stderr, "winbind separator was NULL!\n");
@ -72,7 +72,7 @@ static char winbind_separator_int(BOOL strict)
static char winbind_separator(void)
{
return winbind_separator_int(False);
return winbind_separator_int(false);
}
static const char *get_winbind_domain(void)
@ -101,7 +101,7 @@ static const char *get_winbind_domain(void)
/* Copy of parse_domain_user from winbindd_util.c. Parse a string of the
form DOMAIN/user into a domain and a user */
static BOOL parse_wbinfo_domain_user(const char *domuser, fstring domain,
static bool parse_wbinfo_domain_user(const char *domuser, fstring domain,
fstring user)
{
@ -110,7 +110,7 @@ static BOOL parse_wbinfo_domain_user(const char *domuser, fstring domain,
if (!p) {
fstrcpy(user, domuser);
fstrcpy(domain, get_winbind_domain());
return True;
return true;
}
fstrcpy(user, p+1);
@ -118,12 +118,12 @@ static BOOL parse_wbinfo_domain_user(const char *domuser, fstring domain,
domain[PTR_DIFF(p, domuser)] = 0;
strupper_m(domain);
return True;
return true;
}
/* pull pwent info for a given user */
static BOOL wbinfo_get_userinfo(char *user)
static bool wbinfo_get_userinfo(char *user)
{
struct winbindd_request request;
struct winbindd_response response;
@ -139,7 +139,7 @@ static BOOL wbinfo_get_userinfo(char *user)
result = winbindd_request_response(WINBINDD_GETPWNAM, &request, &response);
if (result != NSS_STATUS_SUCCESS)
return False;
return false;
d_printf( "%s:%s:%d:%d:%s:%s:%s\n",
response.data.pw.pw_name,
@ -150,11 +150,11 @@ static BOOL wbinfo_get_userinfo(char *user)
response.data.pw.pw_dir,
response.data.pw.pw_shell );
return True;
return true;
}
/* pull pwent info for a given uid */
static BOOL wbinfo_get_uidinfo(int uid)
static bool wbinfo_get_uidinfo(int uid)
{
struct winbindd_request request;
struct winbindd_response response;
@ -168,7 +168,7 @@ static BOOL wbinfo_get_uidinfo(int uid)
result = winbindd_request_response(WINBINDD_GETPWUID, &request, &response);
if (result != NSS_STATUS_SUCCESS)
return False;
return false;
d_printf( "%s:%s:%d:%d:%s:%s:%s\n",
response.data.pw.pw_name,
@ -179,11 +179,11 @@ static BOOL wbinfo_get_uidinfo(int uid)
response.data.pw.pw_dir,
response.data.pw.pw_shell );
return True;
return true;
}
/* pull grent for a given group */
static BOOL wbinfo_get_groupinfo(char *group)
static bool wbinfo_get_groupinfo(char *group)
{
struct winbindd_request request;
struct winbindd_response response;
@ -200,19 +200,19 @@ static BOOL wbinfo_get_groupinfo(char *group)
&response);
if ( result != NSS_STATUS_SUCCESS)
return False;
return false;
d_printf( "%s:%s:%d\n",
response.data.gr.gr_name,
response.data.gr.gr_passwd,
response.data.gr.gr_gid );
return True;
return true;
}
/* List groups a user is a member of */
static BOOL wbinfo_get_usergroups(char *user)
static bool wbinfo_get_usergroups(char *user)
{
struct winbindd_request request;
struct winbindd_response response;
@ -229,19 +229,19 @@ static BOOL wbinfo_get_usergroups(char *user)
result = winbindd_request_response(WINBINDD_GETGROUPS, &request, &response);
if (result != NSS_STATUS_SUCCESS)
return False;
return false;
for (i = 0; i < response.data.num_entries; i++)
d_printf("%d\n", (int)((gid_t *)response.extra_data.data)[i]);
SAFE_FREE(response.extra_data.data);
return True;
return true;
}
/* List group SIDs a user SID is a member of */
static BOOL wbinfo_get_usersids(char *user_sid)
static bool wbinfo_get_usersids(char *user_sid)
{
struct winbindd_request request;
struct winbindd_response response;
@ -258,7 +258,7 @@ static BOOL wbinfo_get_usersids(char *user_sid)
result = winbindd_request_response(WINBINDD_GETUSERSIDS, &request, &response);
if (result != NSS_STATUS_SUCCESS)
return False;
return false;
s = (const char *)response.extra_data.data;
for (i = 0; i < response.data.num_entries; i++) {
@ -268,10 +268,10 @@ static BOOL wbinfo_get_usersids(char *user_sid)
SAFE_FREE(response.extra_data.data);
return True;
return true;
}
static BOOL wbinfo_get_userdomgroups(const char *user_sid)
static bool wbinfo_get_userdomgroups(const char *user_sid)
{
struct winbindd_request request;
struct winbindd_response response;
@ -287,19 +287,19 @@ static BOOL wbinfo_get_userdomgroups(const char *user_sid)
&response);
if (result != NSS_STATUS_SUCCESS)
return False;
return false;
if (response.data.num_entries != 0)
printf("%s", (char *)response.extra_data.data);
SAFE_FREE(response.extra_data.data);
return True;
return true;
}
/* Convert NetBIOS name to IP */
static BOOL wbinfo_wins_byname(char *name)
static bool wbinfo_wins_byname(char *name)
{
struct winbindd_request request;
struct winbindd_response response;
@ -313,19 +313,19 @@ static BOOL wbinfo_wins_byname(char *name)
if (winbindd_request_response(WINBINDD_WINS_BYNAME, &request, &response) !=
NSS_STATUS_SUCCESS) {
return False;
return false;
}
/* Display response */
d_printf("%s\n", response.data.winsresp);
return True;
return true;
}
/* Convert IP to NetBIOS name */
static BOOL wbinfo_wins_byip(char *ip)
static bool wbinfo_wins_byip(char *ip)
{
struct winbindd_request request;
struct winbindd_response response;
@ -339,19 +339,19 @@ static BOOL wbinfo_wins_byip(char *ip)
if (winbindd_request_response(WINBINDD_WINS_BYIP, &request, &response) !=
NSS_STATUS_SUCCESS) {
return False;
return false;
}
/* Display response */
d_printf("%s\n", response.data.winsresp);
return True;
return true;
}
/* List trusted domains */
static BOOL wbinfo_list_domains(BOOL list_all_domains)
static bool wbinfo_list_domains(bool list_all_domains)
{
struct winbindd_request request;
struct winbindd_response response;
@ -365,7 +365,7 @@ static BOOL wbinfo_list_domains(BOOL list_all_domains)
if (winbindd_request_response(WINBINDD_LIST_TRUSTDOM, &request, &response) !=
NSS_STATUS_SUCCESS)
return False;
return false;
/* Display response */
@ -379,7 +379,7 @@ static BOOL wbinfo_list_domains(BOOL list_all_domains)
if (p == 0) {
d_fprintf(stderr, "Got invalid response: %s\n",
extra_data);
return False;
return false;
}
*p = 0;
d_printf("%s\n", name);
@ -388,20 +388,20 @@ static BOOL wbinfo_list_domains(BOOL list_all_domains)
SAFE_FREE(response.extra_data.data);
}
return True;
return true;
}
/* List own domain */
static BOOL wbinfo_list_own_domain(void)
static bool wbinfo_list_own_domain(void)
{
d_printf("%s\n", get_winbind_domain());
return True;
return true;
}
/* show sequence numbers */
static BOOL wbinfo_show_sequence(const char *domain)
static bool wbinfo_show_sequence(const char *domain)
{
struct winbindd_request request;
struct winbindd_response response;
@ -416,7 +416,7 @@ static BOOL wbinfo_show_sequence(const char *domain)
if (winbindd_request_response(WINBINDD_SHOW_SEQUENCE, &request, &response) !=
NSS_STATUS_SUCCESS)
return False;
return false;
/* Display response */
@ -426,12 +426,12 @@ static BOOL wbinfo_show_sequence(const char *domain)
SAFE_FREE(response.extra_data.data);
}
return True;
return true;
}
/* Show domain info */
static BOOL wbinfo_domain_info(const char *domain_name)
static bool wbinfo_domain_info(const char *domain_name)
{
struct winbindd_request request;
struct winbindd_response response;
@ -448,7 +448,7 @@ static BOOL wbinfo_domain_info(const char *domain_name)
if (winbindd_request_response(WINBINDD_DOMAIN_INFO, &request, &response) !=
NSS_STATUS_SUCCESS)
return False;
return false;
/* Display response */
@ -465,11 +465,11 @@ static BOOL wbinfo_domain_info(const char *domain_name)
d_printf("Primary : %s\n",
response.data.domain_info.primary ? "Yes" : "No");
return True;
return true;
}
/* Get a foreign DC's name */
static BOOL wbinfo_getdcname(const char *domain_name)
static bool wbinfo_getdcname(const char *domain_name)
{
struct winbindd_request request;
struct winbindd_response response;
@ -484,19 +484,19 @@ static BOOL wbinfo_getdcname(const char *domain_name)
if (winbindd_request_response(WINBINDD_GETDCNAME, &request, &response) !=
NSS_STATUS_SUCCESS) {
d_fprintf(stderr, "Could not get dc name for %s\n", domain_name);
return False;
return false;
}
/* Display response */
d_printf("%s\n", response.data.dc_name);
return True;
return true;
}
/* Check trust account password */
static BOOL wbinfo_check_secret(void)
static bool wbinfo_check_secret(void)
{
struct winbindd_response response;
NSS_STATUS result;
@ -518,7 +518,7 @@ static BOOL wbinfo_check_secret(void)
/* Convert uid to sid */
static BOOL wbinfo_uid_to_sid(uid_t uid)
static bool wbinfo_uid_to_sid(uid_t uid)
{
struct winbindd_request request;
struct winbindd_response response;
@ -532,18 +532,18 @@ static BOOL wbinfo_uid_to_sid(uid_t uid)
if (winbindd_request_response(WINBINDD_UID_TO_SID, &request, &response) !=
NSS_STATUS_SUCCESS)
return False;
return false;
/* Display response */
d_printf("%s\n", response.data.sid.sid);
return True;
return true;
}
/* Convert gid to sid */
static BOOL wbinfo_gid_to_sid(gid_t gid)
static bool wbinfo_gid_to_sid(gid_t gid)
{
struct winbindd_request request;
struct winbindd_response response;
@ -557,18 +557,18 @@ static BOOL wbinfo_gid_to_sid(gid_t gid)
if (winbindd_request_response(WINBINDD_GID_TO_SID, &request, &response) !=
NSS_STATUS_SUCCESS)
return False;
return false;
/* Display response */
d_printf("%s\n", response.data.sid.sid);
return True;
return true;
}
/* Convert sid to uid */
static BOOL wbinfo_sid_to_uid(char *sid)
static bool wbinfo_sid_to_uid(char *sid)
{
struct winbindd_request request;
struct winbindd_response response;
@ -582,16 +582,16 @@ static BOOL wbinfo_sid_to_uid(char *sid)
if (winbindd_request_response(WINBINDD_SID_TO_UID, &request, &response) !=
NSS_STATUS_SUCCESS)
return False;
return false;
/* Display response */
d_printf("%d\n", (int)response.data.uid);
return True;
return true;
}
static BOOL wbinfo_sid_to_gid(char *sid)
static bool wbinfo_sid_to_gid(char *sid)
{
struct winbindd_request request;
struct winbindd_response response;
@ -605,18 +605,18 @@ static BOOL wbinfo_sid_to_gid(char *sid)
if (winbindd_request_response(WINBINDD_SID_TO_GID, &request, &response) !=
NSS_STATUS_SUCCESS)
return False;
return false;
/* Display response */
d_printf("%d\n", (int)response.data.gid);
return True;
return true;
}
/* Convert sid to string */
static BOOL wbinfo_lookupsid(char *sid)
static bool wbinfo_lookupsid(char *sid)
{
struct winbindd_request request;
struct winbindd_response response;
@ -630,7 +630,7 @@ static BOOL wbinfo_lookupsid(char *sid)
if (winbindd_request_response(WINBINDD_LOOKUPSID, &request, &response) !=
NSS_STATUS_SUCCESS)
return False;
return false;
/* Display response */
@ -638,7 +638,7 @@ static BOOL wbinfo_lookupsid(char *sid)
winbind_separator(), response.data.name.name,
response.data.name.type);
return True;
return true;
}
static const char *sid_type_lookup(enum lsa_SidType r)
@ -659,7 +659,7 @@ static const char *sid_type_lookup(enum lsa_SidType r)
/* Convert string to sid */
static BOOL wbinfo_lookupname(char *name)
static bool wbinfo_lookupname(char *name)
{
struct winbindd_request request;
struct winbindd_response response;
@ -674,18 +674,18 @@ static BOOL wbinfo_lookupname(char *name)
if (winbindd_request_response(WINBINDD_LOOKUPNAME, &request, &response) !=
NSS_STATUS_SUCCESS)
return False;
return false;
/* Display response */
d_printf("%s %s (%d)\n", response.data.sid.sid, sid_type_lookup(response.data.sid.type), response.data.sid.type);
return True;
return true;
}
/* Authenticate a user with a plaintext password */
static BOOL wbinfo_auth_krb5(char *username, const char *cctype, uint32_t flags)
static bool wbinfo_auth_krb5(char *username, const char *cctype, uint32_t flags)
{
struct winbindd_request request;
struct winbindd_response response;
@ -746,7 +746,7 @@ static BOOL wbinfo_auth_krb5(char *username, const char *cctype, uint32_t flags)
/* Authenticate a user with a plaintext password */
static BOOL wbinfo_auth(char *username)
static bool wbinfo_auth(char *username)
{
struct winbindd_request request;
struct winbindd_response response;
@ -786,7 +786,7 @@ static BOOL wbinfo_auth(char *username)
/* Authenticate a user with a challenge/response */
static BOOL wbinfo_auth_crap(char *username)
static bool wbinfo_auth_crap(char *username)
{
struct winbindd_request request;
struct winbindd_response response;
@ -830,7 +830,7 @@ static BOOL wbinfo_auth_crap(char *username)
mem_ctx = talloc_new(NULL);
if (mem_ctx == NULL) {
d_printf("talloc_new failed\n");
return False;
return false;
}
server_chal = data_blob(request.data.auth_crap.chal, 8);
@ -843,7 +843,7 @@ static BOOL wbinfo_auth_crap(char *username)
&lm_response, &nt_response, NULL, NULL)) {
data_blob_free(&names_blob);
data_blob_free(&server_chal);
return False;
return false;
}
data_blob_free(&names_blob);
data_blob_free(&server_chal);
@ -893,7 +893,7 @@ static BOOL wbinfo_auth_crap(char *username)
/* Print domain users */
static BOOL print_domain_users(const char *domain)
static bool print_domain_users(const char *domain)
{
struct winbindd_request request;
struct winbindd_response response;
@ -915,12 +915,12 @@ static BOOL print_domain_users(const char *domain)
if (winbindd_request_response(WINBINDD_LIST_USERS, &request, &response) !=
NSS_STATUS_SUCCESS)
return False;
return false;
/* Look through extra data */
if (!response.extra_data.data)
return False;
return false;
extra_data = (const char *)response.extra_data.data;
@ -929,12 +929,12 @@ static BOOL print_domain_users(const char *domain)
SAFE_FREE(response.extra_data.data);
return True;
return true;
}
/* Print domain groups */
static BOOL print_domain_groups(const char *domain)
static bool print_domain_groups(const char *domain)
{
struct winbindd_request request;
struct winbindd_response response;
@ -953,12 +953,12 @@ static BOOL print_domain_groups(const char *domain)
if (winbindd_request_response(WINBINDD_LIST_GROUPS, &request, &response) !=
NSS_STATUS_SUCCESS)
return False;
return false;
/* Look through extra data */
if (!response.extra_data.data)
return False;
return false;
extra_data = (const char *)response.extra_data.data;
@ -967,10 +967,10 @@ static BOOL print_domain_groups(const char *domain)
SAFE_FREE(response.extra_data.data);
return True;
return true;
}
static BOOL wbinfo_ping(void)
static bool wbinfo_ping(void)
{
NSS_STATUS result;
@ -1150,7 +1150,7 @@ int main(int argc, char **argv, char **envp)
}
break;
case 'm':
if (!wbinfo_list_domains(False)) {
if (!wbinfo_list_domains(false)) {
d_fprintf(stderr, "Could not list trusted domains\n");
goto done;
}
@ -1210,18 +1210,18 @@ int main(int argc, char **argv, char **envp)
}
break;
case 'a': {
BOOL got_error = False;
bool got_error = false;
if (!wbinfo_auth(string_arg)) {
d_fprintf(stderr, "Could not authenticate user %s with "
"plaintext password\n", string_arg);
got_error = True;
got_error = true;
}
if (!wbinfo_auth_crap(string_arg)) {
d_fprintf(stderr, "Could not authenticate user %s with "
"challenge/response\n", string_arg);
got_error = True;
got_error = true;
}
if (got_error)
@ -1253,7 +1253,7 @@ int main(int argc, char **argv, char **envp)
}
break;
case OPT_SEPARATOR: {
const char sep = winbind_separator_int(True);
const char sep = winbind_separator_int(true);
if ( !sep ) {
goto done;
}
@ -1261,7 +1261,7 @@ int main(int argc, char **argv, char **envp)
break;
}
case OPT_LIST_ALL_DOMAINS:
if (!wbinfo_list_domains(True)) {
if (!wbinfo_list_domains(true)) {
goto done;
}
break;

View File

@ -46,8 +46,8 @@ struct cvfs_private {
struct ntvfs_module_context *ntvfs;
struct async_info *pending;
struct cvfs_file *files;
BOOL map_generic;
BOOL map_trans2;
bool map_generic;
bool map_trans2;
};
@ -84,15 +84,15 @@ struct async_info {
#define CIFS_MAP_GENERIC "cifs:map-generic"
#define CIFS_MAP_TRANS2 "cifs:map-trans2"
#define CIFS_USE_MACHINE_ACCT_DEFAULT False
#define CIFS_MAP_GENERIC_DEFAULT False
#define CIFS_MAP_TRANS2_DEFAULT True
#define CIFS_USE_MACHINE_ACCT_DEFAULT false
#define CIFS_MAP_GENERIC_DEFAULT false
#define CIFS_MAP_TRANS2_DEFAULT true
/*
a handler for oplock break events from the server - these need to be passed
along to the client
*/
static BOOL oplock_handler(struct smbcli_transport *transport, uint16_t tid, uint16_t fnum, uint8_t level, void *p_private)
static bool oplock_handler(struct smbcli_transport *transport, uint16_t tid, uint16_t fnum, uint8_t level, void *p_private)
{
struct cvfs_private *private = p_private;
NTSTATUS status;
@ -107,13 +107,13 @@ static BOOL oplock_handler(struct smbcli_transport *transport, uint16_t tid, uin
if (!h) {
DEBUG(5,("vfs_cifs: ignoring oplock break level %d for fnum %d\n", level, fnum));
return True;
return true;
}
DEBUG(5,("vfs_cifs: sending oplock break level %d for fnum %d\n", level, fnum));
status = ntvfs_send_oplock_break(private->ntvfs, h, level);
if (!NT_STATUS_IS_OK(status)) return False;
return True;
if (!NT_STATUS_IS_OK(status)) return false;
return true;
}
/*
@ -130,7 +130,7 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
struct share_config *scfg = ntvfs->ctx->config;
struct cli_credentials *credentials;
BOOL machine_account;
bool machine_account;
/* Here we need to determine which server to connect to.
* For now we use parametric options, type cifs.
@ -197,7 +197,7 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
io.in.port = 0;
io.in.called_name = host;
io.in.credentials = credentials;
io.in.fallback_to_anonymous = False;
io.in.fallback_to_anonymous = false;
io.in.workgroup = lp_workgroup(global_loadparm);
io.in.service = remote_share;
io.in.service_type = "?????";
@ -922,7 +922,7 @@ static NTSTATUS cvfs_lpq(struct ntvfs_module_context *ntvfs,
static NTSTATUS cvfs_search_first(struct ntvfs_module_context *ntvfs,
struct ntvfs_request *req, union smb_search_first *io,
void *search_private,
BOOL (*callback)(void *, const union smb_search_data *))
bool (*callback)(void *, const union smb_search_data *))
{
struct cvfs_private *private = ntvfs->private_data;
@ -935,7 +935,7 @@ static NTSTATUS cvfs_search_first(struct ntvfs_module_context *ntvfs,
static NTSTATUS cvfs_search_next(struct ntvfs_module_context *ntvfs,
struct ntvfs_request *req, union smb_search_next *io,
void *search_private,
BOOL (*callback)(void *, const union smb_search_data *))
bool (*callback)(void *, const union smb_search_data *))
{
struct cvfs_private *private = ntvfs->private_data;

View File

@ -39,7 +39,7 @@
#define O_DIRECTORY 0
#endif
#define CHECK_READ_ONLY(req) do { if (share_bool_option(ntvfs->ctx->config, SHARE_READONLY, True)) return NT_STATUS_ACCESS_DENIED; } while (0)
#define CHECK_READ_ONLY(req) do { if (share_bool_option(ntvfs->ctx->config, SHARE_READONLY, true)) return NT_STATUS_ACCESS_DENIED; } while (0)
/*
connect to a share - used when a tree_connect operation comes
@ -311,7 +311,7 @@ static NTSTATUS cifspsx_open(struct ntvfs_module_context *ntvfs,
int fd, flags;
struct cifspsx_file *f;
int create_flags, rdwr_flags;
BOOL readonly;
bool readonly;
NTSTATUS status;
struct ntvfs_handle *handle;
@ -829,7 +829,7 @@ static NTSTATUS cifspsx_lpq(struct ntvfs_module_context *ntvfs,
static NTSTATUS cifspsx_search_first(struct ntvfs_module_context *ntvfs,
struct ntvfs_request *req, union smb_search_first *io,
void *search_private,
BOOL (*callback)(void *, const union smb_search_data *))
bool (*callback)(void *, const union smb_search_data *))
{
struct cifspsx_dir *dir;
int i;
@ -903,7 +903,7 @@ static NTSTATUS cifspsx_search_first(struct ntvfs_module_context *ntvfs,
static NTSTATUS cifspsx_search_next(struct ntvfs_module_context *ntvfs,
struct ntvfs_request *req, union smb_search_next *io,
void *search_private,
BOOL (*callback)(void *, const union smb_search_data *))
bool (*callback)(void *, const union smb_search_data *))
{
struct cifspsx_dir *dir;
int i;

View File

@ -126,7 +126,7 @@ static struct brl_handle *brl_tdb_create_handle(TALLOC_CTX *mem_ctx, struct ntvf
/*
see if two locking contexts are equal
*/
static BOOL brl_tdb_same_context(struct lock_context *ctx1, struct lock_context *ctx2)
static bool brl_tdb_same_context(struct lock_context *ctx1, struct lock_context *ctx2)
{
return (cluster_id_equal(&ctx1->server, &ctx2->server) &&
ctx1->smbpid == ctx2->smbpid &&
@ -139,7 +139,7 @@ static BOOL brl_tdb_same_context(struct lock_context *ctx1, struct lock_context
lck1 is the existing lock. lck2 is the new lock we are
looking at adding
*/
static BOOL brl_tdb_overlap(struct lock_struct *lck1,
static bool brl_tdb_overlap(struct lock_struct *lck1,
struct lock_struct *lck2)
{
/* this extra check is not redundent - it copes with locks
@ -147,12 +147,12 @@ static BOOL brl_tdb_overlap(struct lock_struct *lck1,
if (lck1->size != 0 &&
lck1->start == lck2->start &&
lck1->size == lck2->size) {
return True;
return true;
}
if (lck1->start >= (lck2->start+lck2->size) ||
lck2->start >= (lck1->start+lck1->size)) {
return False;
return false;
}
/* we have a conflict. Now check to see if lck1 really still
@ -163,28 +163,28 @@ static BOOL brl_tdb_overlap(struct lock_struct *lck1,
* hasn't been written yet. When clustered this will need to
* call into ctdb */
return True;
return true;
}
/*
See if lock2 can be added when lock1 is in place.
*/
static BOOL brl_tdb_conflict(struct lock_struct *lck1,
static bool brl_tdb_conflict(struct lock_struct *lck1,
struct lock_struct *lck2)
{
/* pending locks don't conflict with anything */
if (lck1->lock_type >= PENDING_READ_LOCK ||
lck2->lock_type >= PENDING_READ_LOCK) {
return False;
return false;
}
if (lck1->lock_type == READ_LOCK && lck2->lock_type == READ_LOCK) {
return False;
return false;
}
if (brl_tdb_same_context(&lck1->context, &lck2->context) &&
lck2->lock_type == READ_LOCK && lck1->ntvfs == lck2->ntvfs) {
return False;
return false;
}
return brl_tdb_overlap(lck1, lck2);
@ -195,16 +195,16 @@ static BOOL brl_tdb_conflict(struct lock_struct *lck1,
Check to see if this lock conflicts, but ignore our own locks on the
same fnum only.
*/
static BOOL brl_tdb_conflict_other(struct lock_struct *lck1, struct lock_struct *lck2)
static bool brl_tdb_conflict_other(struct lock_struct *lck1, struct lock_struct *lck2)
{
/* pending locks don't conflict with anything */
if (lck1->lock_type >= PENDING_READ_LOCK ||
lck2->lock_type >= PENDING_READ_LOCK) {
return False;
return false;
}
if (lck1->lock_type == READ_LOCK && lck2->lock_type == READ_LOCK)
return False;
return false;
/*
* note that incoming write calls conflict with existing READ
@ -214,7 +214,7 @@ static BOOL brl_tdb_conflict_other(struct lock_struct *lck1, struct lock_struct
if (brl_tdb_same_context(&lck1->context, &lck2->context) &&
lck1->ntvfs == lck2->ntvfs &&
(lck2->lock_type == READ_LOCK || lck1->lock_type == WRITE_LOCK)) {
return False;
return false;
}
return brl_tdb_overlap(lck1, lck2);

View File

@ -58,7 +58,7 @@ struct notify_list {
#define NOTIFY_KEY "notify array"
#define NOTIFY_ENABLE "notify:enable"
#define NOTIFY_ENABLE_DEFAULT True
#define NOTIFY_ENABLE_DEFAULT true
static NTSTATUS notify_remove_all(struct notify_context *notify);
static void notify_handler(struct messaging_context *msg_ctx, void *private_data,
@ -86,7 +86,7 @@ struct notify_context *notify_init(TALLOC_CTX *mem_ctx, struct server_id server,
{
struct notify_context *notify;
if (share_bool_option(scfg, NOTIFY_ENABLE, NOTIFY_ENABLE_DEFAULT) != True) {
if (share_bool_option(scfg, NOTIFY_ENABLE, NOTIFY_ENABLE_DEFAULT) != true) {
return NULL;
}

View File

@ -91,7 +91,7 @@ _PUBLIC_ struct odb_lock *odb_lock(TALLOC_CTX *mem_ctx,
*/
_PUBLIC_ NTSTATUS odb_open_file(struct odb_lock *lck, void *file_handle,
uint32_t stream_id, uint32_t share_access,
uint32_t access_mask, BOOL delete_on_close,
uint32_t access_mask, bool delete_on_close,
const char *path,
uint32_t oplock_level, uint32_t *oplock_granted)
{
@ -139,7 +139,7 @@ _PUBLIC_ NTSTATUS odb_rename(struct odb_lock *lck, const char *path)
/*
update delete on close flag on an open file
*/
_PUBLIC_ NTSTATUS odb_set_delete_on_close(struct odb_lock *lck, BOOL del_on_close)
_PUBLIC_ NTSTATUS odb_set_delete_on_close(struct odb_lock *lck, bool del_on_close)
{
return ops->odb_set_delete_on_close(lck, del_on_close);
}
@ -149,7 +149,7 @@ _PUBLIC_ NTSTATUS odb_set_delete_on_close(struct odb_lock *lck, BOOL del_on_clos
people still have the file open
*/
_PUBLIC_ NTSTATUS odb_get_delete_on_close(struct odb_context *odb,
DATA_BLOB *key, BOOL *del_on_close,
DATA_BLOB *key, bool *del_on_close,
int *open_count, char **path)
{
return ops->odb_get_delete_on_close(odb, key, del_on_close, open_count, path);

View File

@ -52,7 +52,7 @@
struct odb_context {
struct tdb_wrap *w;
struct ntvfs_context *ntvfs_ctx;
BOOL oplocks;
bool oplocks;
};
/*
@ -266,7 +266,7 @@ static NTSTATUS odb_oplock_break_send(struct odb_context *odb, struct opendb_ent
*/
static NTSTATUS odb_tdb_open_file(struct odb_lock *lck, void *file_handle,
uint32_t stream_id, uint32_t share_access,
uint32_t access_mask, BOOL delete_on_close,
uint32_t access_mask, bool delete_on_close,
const char *path,
uint32_t oplock_level, uint32_t *oplock_granted)
{
@ -276,7 +276,7 @@ static NTSTATUS odb_tdb_open_file(struct odb_lock *lck, void *file_handle,
struct opendb_file file;
NTSTATUS status;
if (odb->oplocks == False) {
if (odb->oplocks == false) {
oplock_level = OPLOCK_NONE;
}
@ -407,7 +407,7 @@ static NTSTATUS odb_tdb_close_file(struct odb_lock *lck, void *file_handle)
if (file_handle == file.entries[i].file_handle &&
cluster_id_equal(&odb->ntvfs_ctx->server_id, &file.entries[i].server)) {
if (file.entries[i].delete_on_close) {
file.delete_on_close = True;
file.delete_on_close = true;
}
if (i < file.num_entries-1) {
memmove(file.entries+i, file.entries+i+1,
@ -494,7 +494,7 @@ static NTSTATUS odb_tdb_rename(struct odb_lock *lck, const char *path)
/*
update delete on close flag on an open file
*/
static NTSTATUS odb_tdb_set_delete_on_close(struct odb_lock *lck, BOOL del_on_close)
static NTSTATUS odb_tdb_set_delete_on_close(struct odb_lock *lck, bool del_on_close)
{
NTSTATUS status;
struct opendb_file file;
@ -512,7 +512,7 @@ static NTSTATUS odb_tdb_set_delete_on_close(struct odb_lock *lck, BOOL del_on_cl
people still have the file open
*/
static NTSTATUS odb_tdb_get_delete_on_close(struct odb_context *odb,
DATA_BLOB *key, BOOL *del_on_close,
DATA_BLOB *key, bool *del_on_close,
int *open_count, char **path)
{
NTSTATUS status;
@ -525,7 +525,7 @@ static NTSTATUS odb_tdb_get_delete_on_close(struct odb_context *odb,
status = odb_pull_record(lck, &file);
if (NT_STATUS_EQUAL(NT_STATUS_OBJECT_NAME_NOT_FOUND, status)) {
talloc_free(lck);
(*del_on_close) = False;
(*del_on_close) = false;
return NT_STATUS_OK;
}
if (!NT_STATUS_IS_OK(status)) {
@ -541,7 +541,7 @@ static NTSTATUS odb_tdb_get_delete_on_close(struct odb_context *odb,
*path = talloc_strdup(odb, file.path);
NT_STATUS_HAVE_NO_MEMORY(*path);
if (file.num_entries == 1 && file.entries[0].delete_on_close) {
(*del_on_close) = True;
(*del_on_close) = true;
}
}

View File

@ -669,7 +669,7 @@ static NTSTATUS ipc_lpq(struct ntvfs_module_context *ntvfs,
static NTSTATUS ipc_search_first(struct ntvfs_module_context *ntvfs,
struct ntvfs_request *req, union smb_search_first *io,
void *search_private,
BOOL (*callback)(void *, const union smb_search_data *))
bool (*callback)(void *, const union smb_search_data *))
{
return NT_STATUS_ACCESS_DENIED;
}
@ -680,7 +680,7 @@ static NTSTATUS ipc_search_first(struct ntvfs_module_context *ntvfs,
static NTSTATUS ipc_search_next(struct ntvfs_module_context *ntvfs,
struct ntvfs_request *req, union smb_search_next *io,
void *search_private,
BOOL (*callback)(void *, const union smb_search_data *))
bool (*callback)(void *, const union smb_search_data *))
{
return NT_STATUS_ACCESS_DENIED;
}

View File

@ -841,7 +841,7 @@ static void nbench_search_first_send(struct ntvfs_request *req)
static NTSTATUS nbench_search_first(struct ntvfs_module_context *ntvfs,
struct ntvfs_request *req, union smb_search_first *io,
void *search_private,
BOOL (*callback)(void *, const union smb_search_data *))
bool (*callback)(void *, const union smb_search_data *))
{
NTSTATUS status;
@ -863,7 +863,7 @@ static void nbench_search_next_send(struct ntvfs_request *req)
static NTSTATUS nbench_search_next(struct ntvfs_module_context *ntvfs,
struct ntvfs_request *req, union smb_search_next *io,
void *search_private,
BOOL (*callback)(void *, const union smb_search_data *))
bool (*callback)(void *, const union smb_search_data *))
{
NTSTATUS status;

View File

@ -113,7 +113,7 @@ _PUBLIC_ const struct ntvfs_critical_sizes *ntvfs_interface_version(void)
return &critical_sizes;
}
_PUBLIC_ BOOL ntvfs_interface_differs(const struct ntvfs_critical_sizes *const iface)
_PUBLIC_ bool ntvfs_interface_differs(const struct ntvfs_critical_sizes *const iface)
{
/* The comparison would be easier with memcmp, but compiler-interset
* alignment padding is not guaranteed to be zeroed.
@ -122,28 +122,28 @@ _PUBLIC_ BOOL ntvfs_interface_differs(const struct ntvfs_critical_sizes *const i
#define FIELD_DIFFERS(field) (iface->field != critical_sizes.field)
if (FIELD_DIFFERS(interface_version))
return True;
return true;
if (FIELD_DIFFERS(sizeof_ntvfs_critical_sizes))
return True;
return true;
if (FIELD_DIFFERS(sizeof_ntvfs_context))
return True;
return true;
if (FIELD_DIFFERS(sizeof_ntvfs_module_context))
return True;
return true;
if (FIELD_DIFFERS(sizeof_ntvfs_ops))
return True;
return true;
if (FIELD_DIFFERS(sizeof_ntvfs_async_state))
return True;
return true;
if (FIELD_DIFFERS(sizeof_ntvfs_request))
return True;
return true;
/* Versions match. */
return False;
return false;
#undef FIELD_DIFFERS
}

View File

@ -116,21 +116,21 @@ static NTSTATUS ntvfs_map_async_finish(struct ntvfs_request *req, NTSTATUS statu
see if a filename ends in EXE COM DLL or SYM. This is needed for the
DENY_DOS mapping for OpenX
*/
BOOL is_exe_filename(const char *fname)
bool is_exe_filename(const char *fname)
{
char *p;
p = strrchr(fname, '.');
if (!p) {
return False;
return false;
}
p++;
if (strcasecmp(p, "EXE") == 0 ||
strcasecmp(p, "COM") == 0 ||
strcasecmp(p, "DLL") == 0 ||
strcasecmp(p, "SYM") == 0) {
return True;
return true;
}
return False;
return false;
}
@ -1247,7 +1247,7 @@ _PUBLIC_ NTSTATUS ntvfs_map_read(struct ntvfs_module_context *ntvfs,
}
rd2->readx.level = RAW_READ_READX;
rd2->readx.in.read_for_execute = False;
rd2->readx.in.read_for_execute = false;
switch (rd->generic.level) {
case RAW_READ_READX:

View File

@ -149,7 +149,7 @@ _PUBLIC_ NTSTATUS ntvfs_copy(struct ntvfs_request *req, struct smb_copy *cp)
/* directory search */
_PUBLIC_ NTSTATUS ntvfs_search_first(struct ntvfs_request *req, union smb_search_first *io, void *private,
BOOL ntvfs_callback(void *private, const union smb_search_data *file))
bool ntvfs_callback(void *private, const union smb_search_data *file))
{
struct ntvfs_module_context *ntvfs = req->ctx->modules;
if (!ntvfs->ops->search_first) {
@ -159,7 +159,7 @@ _PUBLIC_ NTSTATUS ntvfs_search_first(struct ntvfs_request *req, union smb_search
}
_PUBLIC_ NTSTATUS ntvfs_search_next(struct ntvfs_request *req, union smb_search_next *io, void *private,
BOOL ntvfs_callback(void *private, const union smb_search_data *file))
bool ntvfs_callback(void *private, const union smb_search_data *file))
{
struct ntvfs_module_context *ntvfs = req->ctx->modules;
if (!ntvfs->ops->search_next) {
@ -469,7 +469,7 @@ _PUBLIC_ NTSTATUS ntvfs_next_open(struct ntvfs_module_context *ntvfs,
_PUBLIC_ NTSTATUS ntvfs_next_search_first(struct ntvfs_module_context *ntvfs,
struct ntvfs_request *req,
union smb_search_first *io, void *private,
BOOL (*callback)(void *private, const union smb_search_data *file))
bool (*callback)(void *private, const union smb_search_data *file))
{
if (!ntvfs->next || !ntvfs->next->ops->search_first) {
return NT_STATUS_NOT_IMPLEMENTED;
@ -480,7 +480,7 @@ _PUBLIC_ NTSTATUS ntvfs_next_search_first(struct ntvfs_module_context *ntvfs,
_PUBLIC_ NTSTATUS ntvfs_next_search_next(struct ntvfs_module_context *ntvfs,
struct ntvfs_request *req,
union smb_search_next *io, void *private,
BOOL (*callback)(void *private, const union smb_search_data *file))
bool (*callback)(void *private, const union smb_search_data *file))
{
if (!ntvfs->next || !ntvfs->next->ops->search_next) {
return NT_STATUS_NOT_IMPLEMENTED;

View File

@ -112,7 +112,7 @@ _PUBLIC_ NTSTATUS ntvfs_handle_set_backend_data(struct ntvfs_handle *h,
TALLOC_CTX *private_data)
{
struct ntvfs_handle_data *d;
BOOL first_time = h->backend_data?False:True;
bool first_time = h->backend_data?false:true;
for (d=h->backend_data; d; d = d->next) {
if (d->owner != ntvfs) continue;

View File

@ -365,7 +365,7 @@ NTSTATUS pvfs_acl_query(struct pvfs_state *pvfs,
/*
check the read only bit against any of the write access bits
*/
static BOOL pvfs_read_only(struct pvfs_state *pvfs, uint32_t access_mask)
static bool pvfs_read_only(struct pvfs_state *pvfs, uint32_t access_mask)
{
if ((pvfs->flags & PVFS_FLAG_READONLY) &&
(access_mask & (SEC_FILE_WRITE_DATA |
@ -376,9 +376,9 @@ static BOOL pvfs_read_only(struct pvfs_state *pvfs, uint32_t access_mask)
SEC_STD_WRITE_DAC |
SEC_STD_WRITE_OWNER |
SEC_DIR_DELETE_CHILD))) {
return True;
return true;
}
return False;
return false;
}
/*
@ -548,24 +548,24 @@ NTSTATUS pvfs_access_check_parent(struct pvfs_state *pvfs,
/*
determine if an ACE is inheritable
*/
static BOOL pvfs_inheritable_ace(struct pvfs_state *pvfs,
static bool pvfs_inheritable_ace(struct pvfs_state *pvfs,
const struct security_ace *ace,
BOOL container)
bool container)
{
if (!container) {
return (ace->flags & SEC_ACE_FLAG_OBJECT_INHERIT) != 0;
}
if (ace->flags & SEC_ACE_FLAG_CONTAINER_INHERIT) {
return True;
return true;
}
if ((ace->flags & SEC_ACE_FLAG_OBJECT_INHERIT) &&
!(ace->flags & SEC_ACE_FLAG_NO_PROPAGATE_INHERIT)) {
return True;
return true;
}
return False;
return false;
}
/*
@ -576,7 +576,7 @@ static BOOL pvfs_inheritable_ace(struct pvfs_state *pvfs,
static NTSTATUS pvfs_acl_inherit_aces(struct pvfs_state *pvfs,
struct security_descriptor *parent_sd,
struct security_descriptor *sd,
BOOL container)
bool container)
{
int i;
@ -663,7 +663,7 @@ NTSTATUS pvfs_acl_inherit(struct pvfs_state *pvfs,
NTSTATUS status;
struct pvfs_filename *parent;
struct security_descriptor *parent_sd, *sd;
BOOL container;
bool container;
/* form the parents path */
status = pvfs_resolve_parent(pvfs, req, name, &parent);
@ -716,7 +716,7 @@ NTSTATUS pvfs_acl_inherit(struct pvfs_state *pvfs,
sd->type |= SEC_DESC_DACL_PRESENT;
container = (name->dos.attrib & FILE_ATTRIBUTE_DIRECTORY) ? True:False;
container = (name->dos.attrib & FILE_ATTRIBUTE_DIRECTORY) ? true:false;
/* fill in the aces from the parent */
status = pvfs_acl_inherit_aces(pvfs, parent_sd, sd, container);

View File

@ -33,13 +33,13 @@ struct name_cache_entry {
struct pvfs_dir {
struct pvfs_state *pvfs;
BOOL no_wildcard;
bool no_wildcard;
char *single_name;
const char *pattern;
off_t offset;
DIR *dir;
const char *unix_path;
BOOL end_of_search;
bool end_of_search;
struct name_cache_entry *name_cache;
uint32_t name_cache_index;
};
@ -69,8 +69,8 @@ static NTSTATUS pvfs_list_no_wildcard(struct pvfs_state *pvfs, struct pvfs_filen
}
dir->pvfs = pvfs;
dir->no_wildcard = True;
dir->end_of_search = False;
dir->no_wildcard = true;
dir->end_of_search = false;
dir->unix_path = talloc_strdup(dir, name->full_name);
if (!dir->unix_path) {
return NT_STATUS_NO_MEMORY;
@ -145,8 +145,8 @@ NTSTATUS pvfs_list_start(struct pvfs_state *pvfs, struct pvfs_filename *name,
}
dir->pvfs = pvfs;
dir->no_wildcard = False;
dir->end_of_search = False;
dir->no_wildcard = false;
dir->end_of_search = false;
dir->offset = DIR_OFFSET_DOT;
dir->name_cache = talloc_zero_array(dir,
struct name_cache_entry,
@ -187,7 +187,7 @@ const char *pvfs_list_next(struct pvfs_dir *dir, off_t *ofs)
/* non-wildcard searches are easy */
if (dir->no_wildcard) {
dir->end_of_search = True;
dir->end_of_search = true;
if (*ofs != 0) return NULL;
(*ofs)++;
return dir->single_name;
@ -246,7 +246,7 @@ const char *pvfs_list_next(struct pvfs_dir *dir, off_t *ofs)
return dname;
}
dir->end_of_search = True;
dir->end_of_search = true;
return NULL;
}
@ -259,9 +259,9 @@ const char *pvfs_list_unix_path(struct pvfs_dir *dir)
}
/*
return True if end of search has been reached
return true if end of search has been reached
*/
BOOL pvfs_list_eos(struct pvfs_dir *dir, off_t ofs)
bool pvfs_list_eos(struct pvfs_dir *dir, off_t ofs)
{
return dir->end_of_search;
}
@ -274,7 +274,7 @@ NTSTATUS pvfs_list_seek(struct pvfs_dir *dir, const char *name, off_t *ofs)
struct dirent *de;
int i;
dir->end_of_search = False;
dir->end_of_search = false;
if (ISDOT(name)) {
dir->offset = DIR_OFFSET_DOTDOT;
@ -313,7 +313,7 @@ NTSTATUS pvfs_list_seek(struct pvfs_dir *dir, const char *name, off_t *ofs)
}
}
dir->end_of_search = True;
dir->end_of_search = true;
return NT_STATUS_OBJECT_NAME_NOT_FOUND;
}
@ -326,7 +326,7 @@ NTSTATUS pvfs_list_seek_ofs(struct pvfs_dir *dir, uint32_t resume_key, off_t *of
struct dirent *de;
int i;
dir->end_of_search = False;
dir->end_of_search = false;
if (resume_key == DIR_OFFSET_DOT) {
*ofs = DIR_OFFSET_DOTDOT;
@ -341,7 +341,7 @@ NTSTATUS pvfs_list_seek_ofs(struct pvfs_dir *dir, uint32_t resume_key, off_t *of
if (resume_key == DIR_OFFSET_BASE) {
rewinddir(dir->dir);
if ((de=readdir(dir->dir)) == NULL) {
dir->end_of_search = True;
dir->end_of_search = true;
return NT_STATUS_OBJECT_NAME_NOT_FOUND;
}
*ofs = telldir(dir->dir) + DIR_OFFSET_BASE;
@ -374,7 +374,7 @@ NTSTATUS pvfs_list_seek_ofs(struct pvfs_dir *dir, uint32_t resume_key, off_t *of
}
}
dir->end_of_search = True;
dir->end_of_search = true;
return NT_STATUS_OBJECT_NAME_NOT_FOUND;
}
@ -383,21 +383,21 @@ NTSTATUS pvfs_list_seek_ofs(struct pvfs_dir *dir, uint32_t resume_key, off_t *of
/*
see if a directory is empty
*/
BOOL pvfs_directory_empty(struct pvfs_state *pvfs, struct pvfs_filename *name)
bool pvfs_directory_empty(struct pvfs_state *pvfs, struct pvfs_filename *name)
{
struct dirent *de;
DIR *dir = opendir(name->full_name);
if (dir == NULL) {
return True;
return true;
}
while ((de = readdir(dir))) {
if (!ISDOT(de->d_name) && !ISDOTDOT(de->d_name)) {
closedir(dir);
return False;
return false;
}
}
closedir(dir);
return True;
return true;
}

View File

@ -104,7 +104,7 @@ static void pvfs_pending_lock_continue(void *private, enum pvfs_wait_notice reas
enum brl_type rw;
NTSTATUS status;
int i;
BOOL timed_out;
bool timed_out;
timed_out = (reason != PVFS_WAIT_EVENT);
@ -136,7 +136,7 @@ static void pvfs_pending_lock_continue(void *private, enum pvfs_wait_notice reas
}
if (NT_STATUS_IS_OK(status)) {
f->lock_count++;
timed_out = False;
timed_out = false;
}
/* if we have failed and timed out, or succeeded, then we

View File

@ -58,7 +58,7 @@ static void pvfs_notify_send_next(struct event_context *ev, struct timed_event *
send a reply to a pending notify request
*/
static void pvfs_notify_send(struct pvfs_notify_buffer *notify_buffer,
NTSTATUS status, BOOL immediate)
NTSTATUS status, bool immediate)
{
struct notify_pending *pending = notify_buffer->pending;
struct ntvfs_request *req;
@ -118,7 +118,7 @@ static int pvfs_notify_destructor(struct pvfs_notify_buffer *n)
{
notify_remove(n->f->pvfs->notify_context, n);
n->f->notify_buffer = NULL;
pvfs_notify_send(n, NT_STATUS_OK, True);
pvfs_notify_send(n, NT_STATUS_OK, true);
return 0;
}
@ -161,7 +161,7 @@ static void pvfs_notify_callback(void *private, const struct notify_event *ev)
/* send what we have, unless its the first part of a rename */
if (ev->action != NOTIFY_ACTION_OLD_NAME) {
pvfs_notify_send(n, NT_STATUS_OK, True);
pvfs_notify_send(n, NT_STATUS_OK, true);
}
}
@ -169,7 +169,7 @@ static void pvfs_notify_callback(void *private, const struct notify_event *ev)
setup a notify buffer on a directory handle
*/
static NTSTATUS pvfs_notify_setup(struct pvfs_state *pvfs, struct pvfs_file *f,
uint32_t buffer_size, uint32_t filter, BOOL recursive)
uint32_t buffer_size, uint32_t filter, bool recursive)
{
NTSTATUS status;
struct notify_entry e;
@ -206,9 +206,9 @@ static void pvfs_notify_end(void *private, enum pvfs_wait_notice reason)
struct pvfs_notify_buffer *notify_buffer = talloc_get_type(private,
struct pvfs_notify_buffer);
if (reason == PVFS_WAIT_CANCEL) {
pvfs_notify_send(notify_buffer, NT_STATUS_CANCELLED, False);
pvfs_notify_send(notify_buffer, NT_STATUS_CANCELLED, false);
} else {
pvfs_notify_send(notify_buffer, NT_STATUS_OK, True);
pvfs_notify_send(notify_buffer, NT_STATUS_OK, true);
}
}
@ -277,7 +277,7 @@ NTSTATUS pvfs_notify(struct ntvfs_module_context *ntvfs,
}
req->async_states->state |= NTVFS_ASYNC_STATE_ASYNC;
pvfs_notify_send(f->notify_buffer, NT_STATUS_OK, False);
pvfs_notify_send(f->notify_buffer, NT_STATUS_OK, false);
return NT_STATUS_OK;
}

View File

@ -186,7 +186,7 @@ static NTSTATUS pvfs_open_directory(struct pvfs_state *pvfs,
uint32_t create_action;
uint32_t access_mask = io->generic.in.access_mask;
struct odb_lock *lck;
BOOL del_on_close;
bool del_on_close;
uint32_t create_options;
uint32_t share_access;
@ -268,14 +268,14 @@ static NTSTATUS pvfs_open_directory(struct pvfs_state *pvfs,
f->handle->seek_offset = 0;
f->handle->position = 0;
f->handle->mode = 0;
f->handle->sticky_write_time = False;
f->handle->open_completed = False;
f->handle->sticky_write_time = false;
f->handle->open_completed = false;
if ((create_options & NTCREATEX_OPTIONS_DELETE_ON_CLOSE) &&
pvfs_directory_empty(pvfs, f->handle->name)) {
del_on_close = True;
del_on_close = true;
} else {
del_on_close = False;
del_on_close = false;
}
if (name->exists) {
@ -305,7 +305,7 @@ static NTSTATUS pvfs_open_directory(struct pvfs_state *pvfs,
return status;
}
f->handle->have_opendb_entry = True;
f->handle->have_opendb_entry = true;
}
DLIST_ADD(pvfs->files.list, f);
@ -357,7 +357,7 @@ static NTSTATUS pvfs_open_directory(struct pvfs_state *pvfs,
goto cleanup_delete;
}
f->handle->have_opendb_entry = True;
f->handle->have_opendb_entry = true;
create_action = NTCREATEX_ACTION_CREATED;
@ -379,7 +379,7 @@ static NTSTATUS pvfs_open_directory(struct pvfs_state *pvfs,
goto cleanup_delete;
}
f->handle->open_completed = True;
f->handle->open_completed = true;
io->generic.out.oplock_level = OPLOCK_NONE;
io->generic.out.file.ntvfs = h;
@ -552,7 +552,7 @@ static NTSTATUS pvfs_create_file(struct pvfs_state *pvfs,
uint32_t access_mask = io->generic.in.access_mask;
mode_t mode;
uint32_t attrib;
BOOL del_on_close;
bool del_on_close;
struct pvfs_filename *parent;
uint32_t oplock_level = OPLOCK_NONE, oplock_granted;
@ -656,9 +656,9 @@ static NTSTATUS pvfs_create_file(struct pvfs_state *pvfs,
}
if (create_options & NTCREATEX_OPTIONS_DELETE_ON_CLOSE) {
del_on_close = True;
del_on_close = true;
} else {
del_on_close = False;
del_on_close = false;
}
if (pvfs->flags & PVFS_FLAG_FAKE_OPLOCKS) {
@ -702,9 +702,9 @@ static NTSTATUS pvfs_create_file(struct pvfs_state *pvfs,
f->handle->seek_offset = 0;
f->handle->position = 0;
f->handle->mode = 0;
f->handle->have_opendb_entry = True;
f->handle->sticky_write_time = False;
f->handle->open_completed = False;
f->handle->have_opendb_entry = true;
f->handle->sticky_write_time = false;
f->handle->open_completed = false;
DLIST_ADD(pvfs->files.list, f);
@ -733,7 +733,7 @@ static NTSTATUS pvfs_create_file(struct pvfs_state *pvfs,
goto cleanup_delete;
}
f->handle->open_completed = True;
f->handle->open_completed = true;
notify_trigger(pvfs->notify_context,
NOTIFY_ACTION_ADDED,
@ -989,8 +989,8 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
uint32_t create_options;
uint32_t share_access;
uint32_t access_mask;
BOOL del_on_close;
BOOL stream_existed, stream_truncate=False;
bool del_on_close;
bool stream_existed, stream_truncate=false;
uint32_t oplock_level = OPLOCK_NONE, oplock_granted;
/* use the generic mapping code to avoid implementing all the
@ -1035,7 +1035,7 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
if (name->stream_name == NULL) {
flags = O_TRUNC;
} else {
stream_truncate = True;
stream_truncate = true;
}
break;
@ -1053,7 +1053,7 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
if (name->stream_name == NULL) {
flags = O_TRUNC;
} else {
stream_truncate = True;
stream_truncate = true;
}
break;
@ -1133,9 +1133,9 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
f->handle->seek_offset = 0;
f->handle->position = 0;
f->handle->mode = 0;
f->handle->have_opendb_entry = False;
f->handle->sticky_write_time = False;
f->handle->open_completed = False;
f->handle->have_opendb_entry = false;
f->handle->sticky_write_time = false;
f->handle->open_completed = false;
/* form the lock context used for byte range locking and
opendb locking */
@ -1172,9 +1172,9 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
*/
if (create_options & NTCREATEX_OPTIONS_DELETE_ON_CLOSE &&
req->ctx->protocol == PROTOCOL_SMB2) {
del_on_close = True;
del_on_close = true;
} else {
del_on_close = False;
del_on_close = false;
}
if (pvfs->flags & PVFS_FLAG_FAKE_OPLOCKS) {
@ -1206,7 +1206,7 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
oplock_granted = OPLOCK_BATCH;
}
f->handle->have_opendb_entry = True;
f->handle->have_opendb_entry = true;
if (access_mask & (SEC_FILE_WRITE_DATA | SEC_FILE_APPEND_DATA)) {
flags |= O_RDWR;
@ -1273,7 +1273,7 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
/* mark the open as having completed fully, so delete on close
can now be used */
f->handle->open_completed = True;
f->handle->open_completed = true;
io->generic.out.oplock_level = oplock_granted;
io->generic.out.file.ntvfs = h;
@ -1379,7 +1379,7 @@ NTSTATUS pvfs_exit(struct ntvfs_module_context *ntvfs,
*/
NTSTATUS pvfs_set_delete_on_close(struct pvfs_state *pvfs,
struct ntvfs_request *req,
struct pvfs_file *f, BOOL del_on_close)
struct pvfs_file *f, bool del_on_close)
{
struct odb_lock *lck;
NTSTATUS status;
@ -1532,17 +1532,17 @@ NTSTATUS pvfs_can_stat(struct pvfs_state *pvfs,
/*
determine if delete on close is set on
*/
BOOL pvfs_delete_on_close_set(struct pvfs_state *pvfs, struct pvfs_file_handle *h,
bool pvfs_delete_on_close_set(struct pvfs_state *pvfs, struct pvfs_file_handle *h,
int *open_count, char **path)
{
NTSTATUS status;
BOOL del_on_close;
bool del_on_close;
status = odb_get_delete_on_close(pvfs->odb_context, &h->odb_locking_key,
&del_on_close, open_count, path);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(1,("WARNING: unable to determine delete on close status for open file\n"));
return False;
return false;
}
return del_on_close;

Some files were not shown because too many files have changed in this diff Show More