diff options
Diffstat (limited to 'source4/libcli')
74 files changed, 830 insertions, 828 deletions
diff --git a/source4/libcli/auth/credentials.c b/source4/libcli/auth/credentials.c index feb8c92a0b..a6cb17c12e 100644 --- a/source4/libcli/auth/credentials.c +++ b/source4/libcli/auth/credentials.c @@ -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, diff --git a/source4/libcli/auth/session.c b/source4/libcli/auth/session.c index 7f44b6b5a9..29af7fafe8 100644 --- a/source4/libcli/auth/session.c +++ b/source4/libcli/auth/session.c @@ -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", diff --git a/source4/libcli/auth/smbencrypt.c b/source4/libcli/auth/smbencrypt.c index 1f940fb79d..bfac395ef9 100644 --- a/source4/libcli/auth/smbencrypt.c +++ b/source4/libcli/auth/smbencrypt.c @@ -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; } diff --git a/source4/libcli/cldap/cldap.c b/source4/libcli/cldap/cldap.c index 8ef511ed79..f2f661acaa 100644 --- a/source4/libcli/cldap/cldap.c +++ b/source4/libcli/cldap/cldap.c @@ -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; diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index 96946da7fe..a56100fc80 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -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; } diff --git a/source4/libcli/clideltree.c b/source4/libcli/clideltree.c index d191bd277a..2c306e501e 100644 --- a/source4/libcli/clideltree.c +++ b/source4/libcli/clideltree.c @@ -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))) { diff --git a/source4/libcli/clifile.c b/source4/libcli/clifile.c index b30b82bd79..e59b7f9af3 100644 --- a/source4/libcli/clifile.c +++ b/source4/libcli/clifile.c @@ -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; diff --git a/source4/libcli/clilist.c b/source4/libcli/clilist.c index 14fd3ee4f7..07393a3491 100644 --- a/source4/libcli/clilist.c +++ b/source4/libcli/clilist.c @@ -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; diff --git a/source4/libcli/climessage.c b/source4/libcli/climessage.c index 35607ba45b..6002ccfc59 100644 --- a/source4/libcli/climessage.c +++ b/source4/libcli/climessage.c @@ -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; } diff --git a/source4/libcli/clireadwrite.c b/source4/libcli/clireadwrite.c index 89ae157042..f5ba799bbc 100644 --- a/source4/libcli/clireadwrite.c +++ b/source4/libcli/clireadwrite.c @@ -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); diff --git a/source4/libcli/composite/composite.c b/source4/libcli/composite/composite.c index 3e21c3823c..67d5885497 100644 --- a/source4/libcli/composite/composite.c +++ b/source4/libcli/composite/composite.c @@ -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) diff --git a/source4/libcli/ldap/ldap.c b/source4/libcli/ldap/ldap.c index 06ff000acf..11689fbd79 100644 --- a/source4/libcli/ldap/ldap.c +++ b/source4/libcli/ldap/ldap.c @@ -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, diff --git a/source4/libcli/ldap/ldap_bind.c b/source4/libcli/ldap/ldap_bind.c index cbe8772414..d285735d4e 100644 --- a/source4/libcli/ldap/ldap_bind.c +++ b/source4/libcli/ldap/ldap_bind.c @@ -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))); diff --git a/source4/libcli/ldap/ldap_client.c b/source4/libcli/ldap/ldap_client.c index 8476a4977b..aea95de161 100644 --- a/source4/libcli/ldap/ldap_client.c +++ b/source4/libcli/ldap/ldap_client.c @@ -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; diff --git a/source4/libcli/ldap/ldap_controls.c b/source4/libcli/ldap/ldap_controls.c index 3a5d14c0c9..b7fd1ce178 100644 --- a/source4/libcli/ldap/ldap_controls.c +++ b/source4/libcli/ldap/ldap_controls.c @@ -26,56 +26,56 @@ struct control_handler { const char *oid; - BOOL (*decode)(void *mem_ctx, DATA_BLOB in, void **out); - BOOL (*encode)(void *mem_ctx, void *in, DATA_BLOB *out); + bool (*decode)(void *mem_ctx, DATA_BLOB in, void **out); + bool (*encode)(void *mem_ctx, void *in, DATA_BLOB *out); }; -static BOOL decode_server_sort_response(void *mem_ctx, DATA_BLOB in, void **out) +static bool decode_server_sort_response(void *mem_ctx, DATA_BLOB in, void **out) { DATA_BLOB attr; struct asn1_data *data = asn1_init(mem_ctx); struct ldb_sort_resp_control *lsrc; - if (!data) return False; + if (!data) return false; if (!asn1_load(data, in)) { - return False; + return false; } lsrc = talloc(mem_ctx, struct ldb_sort_resp_control); if (!lsrc) { - return False; + return false; } if (!asn1_start_tag(data, ASN1_SEQUENCE(0))) { - return False; + return false; } if (!asn1_read_enumerated(data, &(lsrc->result))) { - return False; + return false; } lsrc->attr_desc = NULL; if (asn1_peek_tag(data, ASN1_OCTET_STRING)) { if (!asn1_read_OctetString(data, mem_ctx, &attr)) { - return False; + return false; } lsrc->attr_desc = talloc_strndup(lsrc, (const char *)attr.data, attr.length); if (!lsrc->attr_desc) { - return False; + return false; } } if (!asn1_end_tag(data)) { - return False; + return false; } *out = lsrc; - return True; + return true; } -static BOOL decode_server_sort_request(void *mem_ctx, DATA_BLOB in, void **out) +static bool decode_server_sort_request(void *mem_ctx, DATA_BLOB in, void **out) { DATA_BLOB attr; DATA_BLOB rule; @@ -83,14 +83,14 @@ static BOOL decode_server_sort_request(void *mem_ctx, DATA_BLOB in, void **out) struct ldb_server_sort_control **lssc; int num; - if (!data) return False; + if (!data) return false; if (!asn1_load(data, in)) { - return False; + return false; } if (!asn1_start_tag(data, ASN1_SEQUENCE(0))) { - return False; + return false; } lssc = NULL; @@ -98,46 +98,46 @@ static BOOL decode_server_sort_request(void *mem_ctx, DATA_BLOB in, void **out) for (num = 0; asn1_peek_tag(data, ASN1_SEQUENCE(0)); num++) { lssc = talloc_realloc(mem_ctx, lssc, struct ldb_server_sort_control *, num + 2); if (!lssc) { - return False; + return false; } lssc[num] = talloc_zero(lssc, struct ldb_server_sort_control); if (!lssc[num]) { - return False; + return false; } if (!asn1_start_tag(data, ASN1_SEQUENCE(0))) { - return False; + return false; } if (!asn1_read_OctetString(data, mem_ctx, &attr)) { - return False; + return false; } lssc[num]->attributeName = talloc_strndup(lssc[num], (const char *)attr.data, attr.length); if (!lssc [num]->attributeName) { - return False; + return false; } if (asn1_peek_tag(data, ASN1_OCTET_STRING)) { if (!asn1_read_OctetString(data, mem_ctx, &rule)) { - return False; + return false; } lssc[num]->orderingRule = talloc_strndup(lssc[num], (const char *)rule.data, rule.length); if (!lssc[num]->orderingRule) { - return False; + return false; } } if (asn1_peek_tag(data, ASN1_BOOLEAN)) { - BOOL reverse; + bool reverse; if (!asn1_read_BOOLEAN(data, &reverse)) { - return False; + return false; } lssc[num]->reverse = reverse; } if (!asn1_end_tag(data)) { - return False; + return false; } } @@ -146,248 +146,248 @@ static BOOL decode_server_sort_request(void *mem_ctx, DATA_BLOB in, void **out) } if (!asn1_end_tag(data)) { - return False; + return false; } *out = lssc; - return True; + return true; } -static BOOL decode_extended_dn_request(void *mem_ctx, DATA_BLOB in, void **out) +static bool decode_extended_dn_request(void *mem_ctx, DATA_BLOB in, void **out) { struct asn1_data *data = asn1_init(mem_ctx); struct ldb_extended_dn_control *ledc; - if (!data) return False; + if (!data) return false; if (!asn1_load(data, in)) { - return False; + return false; } ledc = talloc(mem_ctx, struct ldb_extended_dn_control); if (!ledc) { - return False; + return false; } if (!asn1_start_tag(data, ASN1_SEQUENCE(0))) { - return False; + return false; } if (!asn1_read_Integer(data, &(ledc->type))) { - return False; + return false; } if (!asn1_end_tag(data)) { - return False; + return false; } *out = ledc; - return True; + return true; } -static BOOL decode_sd_flags_request(void *mem_ctx, DATA_BLOB in, void **out) +static bool decode_sd_flags_request(void *mem_ctx, DATA_BLOB in, void **out) { struct asn1_data *data = asn1_init(mem_ctx); struct ldb_sd_flags_control *lsdfc; - if (!data) return False; + if (!data) return false; if (!asn1_load(data, in)) { - return False; + return false; } lsdfc = talloc(mem_ctx, struct ldb_sd_flags_control); if (!lsdfc) { - return False; + return false; } if (!asn1_start_tag(data, ASN1_SEQUENCE(0))) { - return False; + return false; } if (!asn1_read_Integer(data, &(lsdfc->secinfo_flags))) { - return False; + return false; } if (!asn1_end_tag(data)) { - return False; + return false; } *out = lsdfc; - return True; + return true; } -static BOOL decode_search_options_request(void *mem_ctx, DATA_BLOB in, void **out) +static bool decode_search_options_request(void *mem_ctx, DATA_BLOB in, void **out) { struct asn1_data *data = asn1_init(mem_ctx); struct ldb_search_options_control *lsoc; - if (!data) return False; + if (!data) return false; if (!asn1_load(data, in)) { - return False; + return false; } lsoc = talloc(mem_ctx, struct ldb_search_options_control); if (!lsoc) { - return False; + return false; } if (!asn1_start_tag(data, ASN1_SEQUENCE(0))) { - return False; + return false; } if (!asn1_read_Integer(data, &(lsoc->search_options))) { - return False; + return false; } if (!asn1_end_tag(data)) { - return False; + return false; } *out = lsoc; - return True; + return true; } -static BOOL decode_paged_results_request(void *mem_ctx, DATA_BLOB in, void **out) +static bool decode_paged_results_request(void *mem_ctx, DATA_BLOB in, void **out) { DATA_BLOB cookie; struct asn1_data *data = asn1_init(mem_ctx); struct ldb_paged_control *lprc; - if (!data) return False; + if (!data) return false; if (!asn1_load(data, in)) { - return False; + return false; } lprc = talloc(mem_ctx, struct ldb_paged_control); if (!lprc) { - return False; + return false; } if (!asn1_start_tag(data, ASN1_SEQUENCE(0))) { - return False; + return false; } if (!asn1_read_Integer(data, &(lprc->size))) { - return False; + return false; } if (!asn1_read_OctetString(data, mem_ctx, &cookie)) { - return False; + return false; } lprc->cookie_len = cookie.length; if (lprc->cookie_len) { lprc->cookie = talloc_memdup(lprc, cookie.data, cookie.length); if (!(lprc->cookie)) { - return False; + return false; } } else { lprc->cookie = NULL; } if (!asn1_end_tag(data)) { - return False; + return false; } *out = lprc; - return True; + return true; } -static BOOL decode_dirsync_request(void *mem_ctx, DATA_BLOB in, void **out) +static bool decode_dirsync_request(void *mem_ctx, DATA_BLOB in, void **out) { DATA_BLOB cookie; struct asn1_data *data = asn1_init(mem_ctx); struct ldb_dirsync_control *ldc; - if (!data) return False; + if (!data) return false; if (!asn1_load(data, in)) { - return False; + return false; } ldc = talloc(mem_ctx, struct ldb_dirsync_control); if (!ldc) { - return False; + return false; } if (!asn1_start_tag(data, ASN1_SEQUENCE(0))) { - return False; + return false; } if (!asn1_read_Integer(data, &(ldc->flags))) { - return False; + return false; } if (!asn1_read_Integer(data, &(ldc->max_attributes))) { - return False; + return false; } if (!asn1_read_OctetString(data, mem_ctx, &cookie)) { - return False; + return false; } ldc->cookie_len = cookie.length; if (ldc->cookie_len) { ldc->cookie = talloc_memdup(ldc, cookie.data, cookie.length); if (!(ldc->cookie)) { - return False; + return false; } } else { ldc->cookie = NULL; } if (!asn1_end_tag(data)) { - return False; + return false; } *out = ldc; - return True; + return true; } /* seem that this controls has 2 forms one in case it is used with * a Search Request and another when used ina Search Response */ -static BOOL decode_asq_control(void *mem_ctx, DATA_BLOB in, void **out) +static bool decode_asq_control(void *mem_ctx, DATA_BLOB in, void **out) { DATA_BLOB source_attribute; struct asn1_data *data = asn1_init(mem_ctx); struct ldb_asq_control *lac; - if (!data) return False; + if (!data) return false; if (!asn1_load(data, in)) { - return False; + return false; } lac = talloc(mem_ctx, struct ldb_asq_control); if (!lac) { - return False; + return false; } if (!asn1_start_tag(data, ASN1_SEQUENCE(0))) { - return False; + return false; } if (asn1_peek_tag(data, ASN1_OCTET_STRING)) { if (!asn1_read_OctetString(data, mem_ctx, &source_attribute)) { - return False; + return false; } lac->src_attr_len = source_attribute.length; if (lac->src_attr_len) { lac->source_attribute = talloc_strndup(lac, (const char *)source_attribute.data, source_attribute.length); if (!(lac->source_attribute)) { - return False; + return false; } } else { lac->source_attribute = NULL; @@ -398,96 +398,96 @@ static BOOL decode_asq_control(void *mem_ctx, DATA_BLOB in, void **out) } else if (asn1_peek_tag(data, ASN1_ENUMERATED)) { if (!asn1_read_enumerated(data, &(lac->result))) { - return False; + return false; } lac->request = 0; } else { - return False; + return false; } if (!asn1_end_tag(data)) { - return False; + return false; } *out = lac; - return True; + return true; } -static BOOL decode_domain_scope_request(void *mem_ctx, DATA_BLOB in, void **out) +static bool decode_domain_scope_request(void *mem_ctx, DATA_BLOB in, void **out) { if (in.length != 0) { - return False; + return false; } - return True; + return true; } -static BOOL decode_notification_request(void *mem_ctx, DATA_BLOB in, void **out) +static bool decode_notification_request(void *mem_ctx, DATA_BLOB in, void **out) { if (in.length != 0) { - return False; + return false; } - return True; + return true; } -static BOOL decode_show_deleted_request(void *mem_ctx, DATA_BLOB in, void **out) +static bool decode_show_deleted_request(void *mem_ctx, DATA_BLOB in, void **out) { if (in.length != 0) { - return False; + return false; } - return True; + return true; } -static BOOL decode_permissive_modify_request(void *mem_ctx, DATA_BLOB in, void **out) +static bool decode_permissive_modify_request(void *mem_ctx, DATA_BLOB in, void **out) { if (in.length != 0) { - return False; + return false; } - return True; + return true; } -static BOOL decode_manageDSAIT_request(void *mem_ctx, DATA_BLOB in, void **out) +static bool decode_manageDSAIT_request(void *mem_ctx, DATA_BLOB in, void **out) { if (in.length != 0) { - return False; + return false; } - return True; + return true; } -static BOOL decode_vlv_request(void *mem_ctx, DATA_BLOB in, void **out) +static bool decode_vlv_request(void *mem_ctx, DATA_BLOB in, void **out) { DATA_BLOB assertion_value, context_id; struct asn1_data *data = asn1_init(mem_ctx); struct ldb_vlv_req_control *lvrc; - if (!data) return False; + if (!data) return false; if (!asn1_load(data, in)) { - return False; + return false; } lvrc = talloc(mem_ctx, struct ldb_vlv_req_control); if (!lvrc) { - return False; + return false; } if (!asn1_start_tag(data, ASN1_SEQUENCE(0))) { - return False; + return false; } if (!asn1_read_Integer(data, &(lvrc->beforeCount))) { - return False; + return false; } if (!asn1_read_Integer(data, &(lvrc->afterCount))) { - return False; + return false; } if (asn1_peek_tag(data, ASN1_CONTEXT(0))) { @@ -495,27 +495,27 @@ static BOOL decode_vlv_request(void *mem_ctx, DATA_BLOB in, void **out) lvrc->type = 0; if (!asn1_start_tag(data, ASN1_CONTEXT(0))) { - return False; + return false; } if (!asn1_start_tag(data, ASN1_SEQUENCE(0))) { - return False; + return false; } if (!asn1_read_Integer(data, &(lvrc->match.byOffset.offset))) { - return False; + return false; } if (!asn1_read_Integer(data, &(lvrc->match.byOffset.contentCount))) { - return False; + return false; } if (!asn1_end_tag(data)) { /*SEQUENCE*/ - return False; + return false; } if (!asn1_end_tag(data)) { /*CONTEXT*/ - return False; + return false; } } else { @@ -523,38 +523,38 @@ static BOOL decode_vlv_request(void *mem_ctx, DATA_BLOB in, void **out) lvrc->type = 1; if (!asn1_start_tag(data, ASN1_CONTEXT(1))) { - return False; + return false; } if (!asn1_read_OctetString(data, mem_ctx, &assertion_value)) { - return False; + return false; } lvrc->match.gtOrEq.value_len = assertion_value.length; if (lvrc->match.gtOrEq.value_len) { lvrc->match.gtOrEq.value = talloc_memdup(lvrc, assertion_value.data, assertion_value.length); if (!(lvrc->match.gtOrEq.value)) { - return False; + return false; } } else { lvrc->match.gtOrEq.value = NULL; } if (!asn1_end_tag(data)) { /*CONTEXT*/ - return False; + return false; } } if (asn1_peek_tag(data, ASN1_OCTET_STRING)) { if (!asn1_read_OctetString(data, mem_ctx, &context_id)) { - return False; + return false; } lvrc->ctxid_len = context_id.length; if (lvrc->ctxid_len) { lvrc->contextId = talloc_memdup(lvrc, context_id.data, context_id.length); if (!(lvrc->contextId)) { - return False; + return false; } } else { lvrc->contextId = NULL; @@ -565,54 +565,54 @@ static BOOL decode_vlv_request(void *mem_ctx, DATA_BLOB in, void **out) } if (!asn1_end_tag(data)) { - return False; + return false; } *out = lvrc; - return True; + return true; } -static BOOL decode_vlv_response(void *mem_ctx, DATA_BLOB in, void **out) +static bool decode_vlv_response(void *mem_ctx, DATA_BLOB in, void **out) { DATA_BLOB context_id; struct asn1_data *data = asn1_init(mem_ctx); struct ldb_vlv_resp_control *lvrc; - if (!data) return False; + if (!data) return false; if (!asn1_load(data, in)) { - return False; + return false; } lvrc = talloc(mem_ctx, struct ldb_vlv_resp_control); if (!lvrc) { - return False; + return false; } if (!asn1_start_tag(data, ASN1_SEQUENCE(0))) { - return False; + return false; } if (!asn1_read_Integer(data, &(lvrc->targetPosition))) { - return False; + return false; } if (!asn1_read_Integer(data, &(lvrc->contentCount))) { - return False; + return false; } if (!asn1_read_enumerated(data, &(lvrc->vlv_result))) { - return False; + return false; } if (asn1_peek_tag(data, ASN1_OCTET_STRING)) { if (!asn1_read_OctetString(data, mem_ctx, &context_id)) { - return False; + return false; } lvrc->contextId = talloc_strndup(lvrc, (const char *)context_id.data, context_id.length); if (!lvrc->contextId) { - return False; + return false; } lvrc->ctxid_len = context_id.length; } else { @@ -621,455 +621,455 @@ static BOOL decode_vlv_response(void *mem_ctx, DATA_BLOB in, void **out) } if (!asn1_end_tag(data)) { - return False; + return false; } *out = lvrc; - return True; + return true; } -static BOOL encode_server_sort_response(void *mem_ctx, void *in, DATA_BLOB *out) +static bool encode_server_sort_response(void *mem_ctx, void *in, DATA_BLOB *out) { struct ldb_sort_resp_control *lsrc = talloc_get_type(in, struct ldb_sort_resp_control); struct asn1_data *data = asn1_init(mem_ctx); - if (!data) return False; + if (!data) return false; if (!asn1_push_tag(data, ASN1_SEQUENCE(0))) { - return False; + return false; } if (!asn1_write_enumerated(data, lsrc->result)) { - return False; + return false; } if (lsrc->attr_desc) { if (!asn1_write_OctetString(data, lsrc->attr_desc, strlen(lsrc->attr_desc))) { - return False; + return false; } } if (!asn1_pop_tag(data)) { - return False; + return false; } *out = data_blob_talloc(mem_ctx, data->data, data->length); if (out->data == NULL) { - return False; + return false; } talloc_free(data); - return True; + return true; } -static BOOL encode_server_sort_request(void *mem_ctx, void *in, DATA_BLOB *out) +static bool encode_server_sort_request(void *mem_ctx, void *in, DATA_BLOB *out) { struct ldb_server_sort_control **lssc = talloc_get_type(in, struct ldb_server_sort_control *); struct asn1_data *data = asn1_init(mem_ctx); int num; - if (!data) return False; + if (!data) return false; if (!asn1_push_tag(data, ASN1_SEQUENCE(0))) { - return False; + return false; } for (num = 0; lssc[num]; num++) { if (!asn1_push_tag(data, ASN1_SEQUENCE(0))) { - return False; + return false; } if (!asn1_write_OctetString(data, lssc[num]->attributeName, strlen(lssc[num]->attributeName))) { - return False; + return false; } if (lssc[num]->orderingRule) { if (!asn1_write_OctetString(data, lssc[num]->orderingRule, strlen(lssc[num]->orderingRule))) { - return False; + return false; } } if (lssc[num]->reverse) { if (!asn1_write_BOOLEAN(data, lssc[num]->reverse)) { - return False; + return false; } } if (!asn1_pop_tag(data)) { - return False; + return false; } } if (!asn1_pop_tag(data)) { - return False; + return false; } *out = data_blob_talloc(mem_ctx, data->data, data->length); if (out->data == NULL) { - return False; + return false; } talloc_free(data); - return True; + return true; } -static BOOL encode_extended_dn_request(void *mem_ctx, void *in, DATA_BLOB *out) +static bool encode_extended_dn_request(void *mem_ctx, void *in, DATA_BLOB *out) { struct ldb_extended_dn_control *ledc = talloc_get_type(in, struct ldb_extended_dn_control); struct asn1_data *data = asn1_init(mem_ctx); - if (!data) return False; + if (!data) return false; if (!asn1_push_tag(data, ASN1_SEQUENCE(0))) { - return False; + return false; } if (!asn1_write_Integer(data, ledc->type)) { - return False; + return false; } if (!asn1_pop_tag(data)) { - return False; + return false; } *out = data_blob_talloc(mem_ctx, data->data, data->length); if (out->data == NULL) { - return False; + return false; } talloc_free(data); - return True; + return true; } -static BOOL encode_sd_flags_request(void *mem_ctx, void *in, DATA_BLOB *out) +static bool encode_sd_flags_request(void *mem_ctx, void *in, DATA_BLOB *out) { struct ldb_sd_flags_control *lsdfc = talloc_get_type(in, struct ldb_sd_flags_control); struct asn1_data *data = asn1_init(mem_ctx); - if (!data) return False; + if (!data) return false; if (!asn1_push_tag(data, ASN1_SEQUENCE(0))) { - return False; + return false; } if (!asn1_write_Integer(data, lsdfc->secinfo_flags)) { - return False; + return false; } if (!asn1_pop_tag(data)) { - return False; + return false; } *out = data_blob_talloc(mem_ctx, data->data, data->length); if (out->data == NULL) { - return False; + return false; } talloc_free(data); - return True; + return true; } -static BOOL encode_search_options_request(void *mem_ctx, void *in, DATA_BLOB *out) +static bool encode_search_options_request(void *mem_ctx, void *in, DATA_BLOB *out) { struct ldb_search_options_control *lsoc = talloc_get_type(in, struct ldb_search_options_control); struct asn1_data *data = asn1_init(mem_ctx); - if (!data) return False; + if (!data) return false; if (!asn1_push_tag(data, ASN1_SEQUENCE(0))) { - return False; + return false; } if (!asn1_write_Integer(data, lsoc->search_options)) { - return False; + return false; } if (!asn1_pop_tag(data)) { - return False; + return false; } *out = data_blob_talloc(mem_ctx, data->data, data->length); if (out->data == NULL) { - return False; + return false; } talloc_free(data); - return True; + return true; } -static BOOL encode_paged_results_request(void *mem_ctx, void *in, DATA_BLOB *out) +static bool encode_paged_results_request(void *mem_ctx, void *in, DATA_BLOB *out) { struct ldb_paged_control *lprc = talloc_get_type(in, struct ldb_paged_control); struct asn1_data *data = asn1_init(mem_ctx); - if (!data) return False; + if (!data) return false; if (!asn1_push_tag(data, ASN1_SEQUENCE(0))) { - return False; + return false; } if (!asn1_write_Integer(data, lprc->size)) { - return False; + return false; } if (!asn1_write_OctetString(data, lprc->cookie, lprc->cookie_len)) { - return False; + return false; } if (!asn1_pop_tag(data)) { - return False; + return false; } *out = data_blob_talloc(mem_ctx, data->data, data->length); if (out->data == NULL) { - return False; + return false; } talloc_free(data); - return True; + return true; } /* seem that this controls has 2 forms one in case it is used with * a Search Request and another when used ina Search Response */ -static BOOL encode_asq_control(void *mem_ctx, void *in, DATA_BLOB *out) +static bool encode_asq_control(void *mem_ctx, void *in, DATA_BLOB *out) { struct ldb_asq_control *lac = talloc_get_type(in, struct ldb_asq_control); struct asn1_data *data = asn1_init(mem_ctx); - if (!data) return False; + if (!data) return false; if (!asn1_push_tag(data, ASN1_SEQUENCE(0))) { - return False; + return false; } if (lac->request) { if (!asn1_write_OctetString(data, lac->source_attribute, lac->src_attr_len)) { - return False; + return false; } } else { if (!asn1_write_enumerated(data, lac->result)) { - return False; + return false; } } if (!asn1_pop_tag(data)) { - return False; + return false; } *out = data_blob_talloc(mem_ctx, data->data, data->length); if (out->data == NULL) { - return False; + return false; } talloc_free(data); - return True; + return true; } -static BOOL encode_dirsync_request(void *mem_ctx, void *in, DATA_BLOB *out) +static bool encode_dirsync_request(void *mem_ctx, void *in, DATA_BLOB *out) { struct ldb_dirsync_control *ldc = talloc_get_type(in, struct ldb_dirsync_control); struct asn1_data *data = asn1_init(mem_ctx); - if (!data) return False; + if (!data) return false; if (!asn1_push_tag(data, ASN1_SEQUENCE(0))) { - return False; + return false; } if (!asn1_write_Integer(data, ldc->flags)) { - return False; + return false; } if (!asn1_write_Integer(data, ldc->max_attributes)) { - return False; + return false; } if (!asn1_write_OctetString(data, ldc->cookie, ldc->cookie_len)) { - return False; + return false; } if (!asn1_pop_tag(data)) { - return False; + return false; } *out = data_blob_talloc(mem_ctx, data->data, data->length); if (out->data == NULL) { - return False; + return false; } talloc_free(data); - return True; + return true; } -static BOOL encode_domain_scope_request(void *mem_ctx, void *in, DATA_BLOB *out) +static bool encode_domain_scope_request(void *mem_ctx, void *in, DATA_BLOB *out) { if (in) { - return False; + return false; } *out = data_blob(NULL, 0); - return True; + return true; } -static BOOL encode_notification_request(void *mem_ctx, void *in, DATA_BLOB *out) +static bool encode_notification_request(void *mem_ctx, void *in, DATA_BLOB *out) { if (in) { - return False; + return false; } *out = data_blob(NULL, 0); - return True; + return true; } -static BOOL encode_show_deleted_request(void *mem_ctx, void *in, DATA_BLOB *out) +static bool encode_show_deleted_request(void *mem_ctx, void *in, DATA_BLOB *out) { if (in) { - return False; + return false; } *out = data_blob(NULL, 0); - return True; + return true; } -static BOOL encode_permissive_modify_request(void *mem_ctx, void *in, DATA_BLOB *out) +static bool encode_permissive_modify_request(void *mem_ctx, void *in, DATA_BLOB *out) { if (in) { - return False; + return false; } *out = data_blob(NULL, 0); - return True; + return true; } -static BOOL encode_manageDSAIT_request(void *mem_ctx, void *in, DATA_BLOB *out) +static bool encode_manageDSAIT_request(void *mem_ctx, void *in, DATA_BLOB *out) { if (in) { - return False; + return false; } *out = data_blob(NULL, 0); - return True; + return true; } -static BOOL encode_vlv_request(void *mem_ctx, void *in, DATA_BLOB *out) +static bool encode_vlv_request(void *mem_ctx, void *in, DATA_BLOB *out) { struct ldb_vlv_req_control *lvrc = talloc_get_type(in, struct ldb_vlv_req_control); struct asn1_data *data = asn1_init(mem_ctx); - if (!data) return False; + if (!data) return false; if (!asn1_push_tag(data, ASN1_SEQUENCE(0))) { - return False; + return false; } if (!asn1_write_Integer(data, lvrc->beforeCount)) { - return False; + return false; } if (!asn1_write_Integer(data, lvrc->afterCount)) { - return False; + return false; } if (lvrc->type == 0) { if (!asn1_push_tag(data, ASN1_CONTEXT(0))) { - return False; + return false; } if (!asn1_push_tag(data, ASN1_SEQUENCE(0))) { - return False; + return false; } if (!asn1_write_Integer(data, lvrc->match.byOffset.offset)) { - return False; + return false; } if (!asn1_write_Integer(data, lvrc->match.byOffset.contentCount)) { - return False; + return false; } if (!asn1_pop_tag(data)) { /*SEQUENCE*/ - return False; + return false; } if (!asn1_pop_tag(data)) { /*CONTEXT*/ - return False; + return false; } } else { if (!asn1_push_tag(data, ASN1_CONTEXT(1))) { - return False; + return false; } if (!asn1_write_OctetString(data, lvrc->match.gtOrEq.value, lvrc->match.gtOrEq.value_len)) { - return False; + return false; } if (!asn1_pop_tag(data)) { /*CONTEXT*/ - return False; + return false; } } if (lvrc->ctxid_len) { if (!asn1_write_OctetString(data, lvrc->contextId, lvrc->ctxid_len)) { - return False; + return false; } } if (!asn1_pop_tag(data)) { - return False; + return false; } *out = data_blob_talloc(mem_ctx, data->data, data->length); if (out->data == NULL) { - return False; + return false; } talloc_free(data); - return True; + return true; } -static BOOL encode_vlv_response(void *mem_ctx, void *in, DATA_BLOB *out) +static bool encode_vlv_response(void *mem_ctx, void *in, DATA_BLOB *out) { struct ldb_vlv_resp_control *lvrc = talloc_get_type(in, struct ldb_vlv_resp_control); struct asn1_data *data = asn1_init(mem_ctx); - if (!data) return False; + if (!data) return false; if (!asn1_push_tag(data, ASN1_SEQUENCE(0))) { - return False; + return false; } if (!asn1_write_Integer(data, lvrc->targetPosition)) { - return False; + return false; } if (!asn1_write_Integer(data, lvrc->contentCount)) { - return False; + return false; } if (!asn1_write_enumerated(data, lvrc->vlv_result)) { - return False; + return false; } if (lvrc->ctxid_len) { if (!asn1_write_OctetString(data, lvrc->contextId, lvrc->ctxid_len)) { - return False; + return false; } } if (!asn1_pop_tag(data)) { - return False; + return false; } *out = data_blob_talloc(mem_ctx, data->data, data->length); if (out->data == NULL) { - return False; + return false; } talloc_free(data); - return True; + return true; } struct control_handler ldap_known_controls[] = { @@ -1095,49 +1095,49 @@ struct control_handler ldap_known_controls[] = { { NULL, NULL, NULL } }; -BOOL ldap_decode_control_value(void *mem_ctx, DATA_BLOB value, struct ldb_control *ctrl) +bool ldap_decode_control_value(void *mem_ctx, DATA_BLOB value, struct ldb_control *ctrl) { int i; for (i = 0; ldap_known_controls[i].oid != NULL; i++) { if (strcmp(ldap_known_controls[i].oid, ctrl->oid) == 0) { if (!ldap_known_controls[i].decode || !ldap_known_controls[i].decode(mem_ctx, value, &ctrl->data)) { - return False; + return false; } break; } } if (ldap_known_controls[i].oid == NULL) { - return False; + return false; } - return True; + return true; } -BOOL ldap_decode_control_wrapper(void *mem_ctx, struct asn1_data *data, struct ldb_control *ctrl, DATA_BLOB *value) +bool ldap_decode_control_wrapper(void *mem_ctx, struct asn1_data *data, struct ldb_control *ctrl, DATA_BLOB *value) { DATA_BLOB oid; if (!asn1_start_tag(data, ASN1_SEQUENCE(0))) { - return False; + return false; } if (!asn1_read_OctetString(data, mem_ctx, &oid)) { - return False; + return false; } ctrl->oid = talloc_strndup(mem_ctx, (char *)oid.data, oid.length); if (!ctrl->oid) { - return False; + return false; } if (asn1_peek_tag(data, ASN1_BOOLEAN)) { - BOOL critical; + bool critical; if (!asn1_read_BOOLEAN(data, &critical)) { - return False; + return false; } ctrl->critical = critical; } else { - ctrl->critical = False; + ctrl->critical = false; } ctrl->data = NULL; @@ -1148,18 +1148,18 @@ BOOL ldap_decode_control_wrapper(void *mem_ctx, struct asn1_data *data, struct l } if (!asn1_read_OctetString(data, mem_ctx, value)) { - return False; + return false; } end_tag: if (!asn1_end_tag(data)) { - return False; + return false; } - return True; + return true; } -BOOL ldap_encode_control(void *mem_ctx, struct asn1_data *data, struct ldb_control *ctrl) +bool ldap_encode_control(void *mem_ctx, struct asn1_data *data, struct ldb_control *ctrl) { DATA_BLOB value; int i; @@ -1168,33 +1168,33 @@ BOOL ldap_encode_control(void *mem_ctx, struct asn1_data *data, struct ldb_contr if (strcmp(ldap_known_controls[i].oid, ctrl->oid) == 0) { if (!ldap_known_controls[i].encode) { if (ctrl->critical) { - return False; + return false; } else { /* not encoding this control */ - return True; + return true; } } if (!ldap_known_controls[i].encode(mem_ctx, ctrl->data, &value)) { - return False; + return false; } break; } } if (ldap_known_controls[i].oid == NULL) { - return False; + return false; } if (!asn1_push_tag(data, ASN1_SEQUENCE(0))) { - return False; + return false; } if (!asn1_write_OctetString(data, ctrl->oid, strlen(ctrl->oid))) { - return False; + return false; } if (ctrl->critical) { if (!asn1_write_BOOLEAN(data, ctrl->critical)) { - return False; + return false; } } @@ -1203,13 +1203,13 @@ BOOL ldap_encode_control(void *mem_ctx, struct asn1_data *data, struct ldb_contr } if (!asn1_write_OctetString(data, value.data, value.length)) { - return False; + return false; } pop_tag: if (!asn1_pop_tag(data)) { - return False; + return false; } - return True; + return true; } diff --git a/source4/libcli/ldap/ldap_ildap.c b/source4/libcli/ldap/ldap_ildap.c index 62019b8cc1..7b592c65ae 100644 --- a/source4/libcli/ldap/ldap_ildap.c +++ b/source4/libcli/ldap/ldap_ildap.c @@ -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) diff --git a/source4/libcli/ldap/ldap_msg.c b/source4/libcli/ldap/ldap_msg.c index c9643dafda..12832b8ec4 100644 --- a/source4/libcli/ldap/ldap_msg.c +++ b/source4/libcli/ldap/ldap_msg.c @@ -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; } diff --git a/source4/libcli/nbt/namequery.c b/source4/libcli/nbt/namequery.c index a55d743efb..755e06e880 100644 --- a/source4/libcli/nbt/namequery.c +++ b/source4/libcli/nbt/namequery.c @@ -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); diff --git a/source4/libcli/nbt/namerefresh.c b/source4/libcli/nbt/namerefresh.c index 3114cb2b10..d723eed9f5 100644 --- a/source4/libcli/nbt/namerefresh.c +++ b/source4/libcli/nbt/namerefresh.c @@ -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; diff --git a/source4/libcli/nbt/nameregister.c b/source4/libcli/nbt/nameregister.c index b8fe362694..fd4a94dd44 100644 --- a/source4/libcli/nbt/nameregister.c +++ b/source4/libcli/nbt/nameregister.c @@ -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; diff --git a/source4/libcli/nbt/namerelease.c b/source4/libcli/nbt/namerelease.c index a72a5c706f..1b3c9ae17e 100644 --- a/source4/libcli/nbt/namerelease.c +++ b/source4/libcli/nbt/namerelease.c @@ -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); diff --git a/source4/libcli/nbt/nbtname.c b/source4/libcli/nbt/nbtname.c index 416814220b..37cdf64023 100644 --- a/source4/libcli/nbt/nbtname.c +++ b/source4/libcli/nbt/nbtname.c @@ -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]; diff --git a/source4/libcli/nbt/nbtsocket.c b/source4/libcli/nbt/nbtsocket.c index 174b08ddf6..7d88c83044 100644 --- a/source4/libcli/nbt/nbtsocket.c +++ b/source4/libcli/nbt/nbtsocket.c @@ -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); diff --git a/source4/libcli/raw/clioplock.c b/source4/libcli/raw/clioplock.c index 12b586aafa..ae4e58ae01 100644 --- a/source4/libcli/raw/clioplock.c +++ b/source4/libcli/raw/clioplock.c @@ -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; diff --git a/source4/libcli/raw/clisession.c b/source4/libcli/raw/clisession.c index c6c575b818..617131c53c 100644 --- a/source4/libcli/raw/clisession.c +++ b/source4/libcli/raw/clisession.c @@ -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; diff --git a/source4/libcli/raw/clitransport.c b/source4/libcli/raw/clitransport.c index 6b2c4c37fe..0bf805910e 100644 --- a/source4/libcli/raw/clitransport.c +++ b/source4/libcli/raw/clitransport.c @@ -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; } /* diff --git a/source4/libcli/raw/clitree.c b/source4/libcli/raw/clitree.c index 4ff11f3a69..54f8ac95a4 100644 --- a/source4/libcli/raw/clitree.c +++ b/source4/libcli/raw/clitree.c @@ -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); diff --git a/source4/libcli/raw/raweas.c b/source4/libcli/raw/raweas.c index 06b5b4fc4d..8ea8e621c9 100644 --- a/source4/libcli/raw/raweas.c +++ b/source4/libcli/raw/raweas.c @@ -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; } diff --git a/source4/libcli/raw/rawfile.c b/source4/libcli/raw/rawfile.c index 60a9bf2656..83303cf470 100644 --- a/source4/libcli/raw/rawfile.c +++ b/source4/libcli/raw/rawfile.c @@ -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); diff --git a/source4/libcli/raw/rawnegotiate.c b/source4/libcli/raw/rawnegotiate.c index c58ac1f0df..82d6fe5236 100644 --- a/source4/libcli/raw/rawnegotiate.c +++ b/source4/libcli/raw/rawnegotiate.c @@ -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); diff --git a/source4/libcli/raw/rawreadwrite.c b/source4/libcli/raw/rawreadwrite.c index a288b7ec54..b0c49ddab7 100644 --- a/source4/libcli/raw/rawreadwrite.c +++ b/source4/libcli/raw/rawreadwrite.c @@ -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); diff --git a/source4/libcli/raw/rawrequest.c b/source4/libcli/raw/rawrequest.c index 778b896abd..6a4f432088 100644 --- a/source4/libcli/raw/rawrequest.c +++ b/source4/libcli/raw/rawrequest.c @@ -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; } diff --git a/source4/libcli/raw/rawsetfileinfo.c b/source4/libcli/raw/rawsetfileinfo.c index 7738e849e8..5fa0c1f2da 100644 --- a/source4/libcli/raw/rawsetfileinfo.c +++ b/source4/libcli/raw/rawsetfileinfo.c @@ -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; } /**************************************************************************** diff --git a/source4/libcli/raw/rawshadow.c b/source4/libcli/raw/rawshadow.c index 8fc81dab4c..4c58c91383 100644 --- a/source4/libcli/raw/rawshadow.c +++ b/source4/libcli/raw/rawshadow.c @@ -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); diff --git a/source4/libcli/raw/rawtrans.c b/source4/libcli/raw/rawtrans.c index 40a30bd067..53670d22a3 100644 --- a/source4/libcli/raw/rawtrans.c +++ b/source4/libcli/raw/rawtrans.c @@ -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; } /**************************************************************************** diff --git a/source4/libcli/raw/smb_signing.c b/source4/libcli/raw/smb_signing.c index 59c13bbeb6..e19e81af7e 100644 --- a/source4/libcli/raw/smb_signing.c +++ b/source4/libcli/raw/smb_signing.c @@ -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; } diff --git a/source4/libcli/resolve/bcast.c b/source4/libcli/resolve/bcast.c index f356dafdaa..3193d70789 100644 --- a/source4/libcli/resolve/bcast.c +++ b/source4/libcli/resolve/bcast.c @@ -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; diff --git a/source4/libcli/resolve/nbtlist.c b/source4/libcli/resolve/nbtlist.c index 9720434cb9..baf3874aa4 100644 --- a/source4/libcli/resolve/nbtlist.c +++ b/source4/libcli/resolve/nbtlist.c @@ -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, diff --git a/source4/libcli/resolve/wins.c b/source4/libcli/resolve/wins.c index 05a2d4da31..2cbcd5f483 100644 --- a/source4/libcli/resolve/wins.c +++ b/source4/libcli/resolve/wins.c @@ -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); } /* diff --git a/source4/libcli/security/dom_sid.c b/source4/libcli/security/dom_sid.c index 1ba3edd9bf..f5457e7e0e 100644 --- a/source4/libcli/security/dom_sid.c +++ b/source4/libcli/security/dom_sid.c @@ -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; } } diff --git a/source4/libcli/security/privilege.c b/source4/libcli/security/privilege.c index 103e2e3c14..2cbef13538 100644 --- a/source4/libcli/security/privilege.c +++ b/source4/libcli/security/privilege.c @@ -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; } /* diff --git a/source4/libcli/security/sddl.c b/source4/libcli/security/sddl.c index d4efab9b64..09522f182a 100644 --- a/source4/libcli/security/sddl.c +++ b/source4/libcli/security/sddl.c @@ -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 */ diff --git a/source4/libcli/security/security_descriptor.c b/source4/libcli/security/security_descriptor.c index 1e33e1950b..7ed619d0c4 100644 --- a/source4/libcli/security/security_descriptor.c +++ b/source4/libcli/security/security_descriptor.c @@ -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; - - return True; + 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; } /* 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; } diff --git a/source4/libcli/security/security_token.c b/source4/libcli/security/security_token.c index 684c3de7e6..e126340c46 100644 --- a/source4/libcli/security/security_token.c +++ b/source4/libcli/security/security_token.c @@ -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); } diff --git a/source4/libcli/smb2/cancel.c b/source4/libcli/smb2/cancel.c index f0a0b01817..096919f177 100644 --- a/source4/libcli/smb2/cancel.c +++ b/source4/libcli/smb2/cancel.c @@ -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; diff --git a/source4/libcli/smb2/close.c b/source4/libcli/smb2/close.c index e83f81b630..04c0c85499 100644 --- a/source4/libcli/smb2/close.c +++ b/source4/libcli/smb2/close.c @@ -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); diff --git a/source4/libcli/smb2/connect.c b/source4/libcli/smb2/connect.c index bb70311c56..6f05d56cd4 100644 --- a/source4/libcli/smb2/connect.c +++ b/source4/libcli/smb2/connect.c @@ -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); diff --git a/source4/libcli/smb2/create.c b/source4/libcli/smb2/create.c index c8ac271f44..ba11c22e87 100644 --- a/source4/libcli/smb2/create.c +++ b/source4/libcli/smb2/create.c @@ -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); diff --git a/source4/libcli/smb2/find.c b/source4/libcli/smb2/find.c index e8643f1868..6d0a9c8072 100644 --- a/source4/libcli/smb2/find.c +++ b/source4/libcli/smb2/find.c @@ -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); diff --git a/source4/libcli/smb2/flush.c b/source4/libcli/smb2/flush.c index 2f1b7bd749..116068ed6e 100644 --- a/source4/libcli/smb2/flush.c +++ b/source4/libcli/smb2/flush.c @@ -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); } diff --git a/source4/libcli/smb2/getinfo.c b/source4/libcli/smb2/getinfo.c index a9a681ea53..0665dd441c 100644 --- a/source4/libcli/smb2/getinfo.c +++ b/source4/libcli/smb2/getinfo.c @@ -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)) { diff --git a/source4/libcli/smb2/ioctl.c b/source4/libcli/smb2/ioctl.c index c13ec7943c..d81bca517f 100644 --- a/source4/libcli/smb2/ioctl.c +++ b/source4/libcli/smb2/ioctl.c @@ -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); diff --git a/source4/libcli/smb2/keepalive.c b/source4/libcli/smb2/keepalive.c index e2b7c83b8a..402b063e81 100644 --- a/source4/libcli/smb2/keepalive.c +++ b/source4/libcli/smb2/keepalive.c @@ -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); } diff --git a/source4/libcli/smb2/lock.c b/source4/libcli/smb2/lock.c index 470648a34c..d71a337d56 100644 --- a/source4/libcli/smb2/lock.c +++ b/source4/libcli/smb2/lock.c @@ -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); diff --git a/source4/libcli/smb2/logoff.c b/source4/libcli/smb2/logoff.c index 00d5e19e82..321a4db1a6 100644 --- a/source4/libcli/smb2/logoff.c +++ b/source4/libcli/smb2/logoff.c @@ -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); } diff --git a/source4/libcli/smb2/negprot.c b/source4/libcli/smb2/negprot.c index 07d06ca2ff..38fe0e7e53 100644 --- a/source4/libcli/smb2/negprot.c +++ b/source4/libcli/smb2/negprot.c @@ -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); diff --git a/source4/libcli/smb2/notify.c b/source4/libcli/smb2/notify.c index 58e2876745..a3bea41eb0 100644 --- a/source4/libcli/smb2/notify.c +++ b/source4/libcli/smb2/notify.c @@ -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)) { diff --git a/source4/libcli/smb2/read.c b/source4/libcli/smb2/read.c index f78a1a8b0e..b61f918481 100644 --- a/source4/libcli/smb2/read.c +++ b/source4/libcli/smb2/read.c @@ -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)) { diff --git a/source4/libcli/smb2/request.c b/source4/libcli/smb2/request.c index 2d2c8252a1..576e2b6fcf 100644 --- a/source4/libcli/smb2/request.c +++ b/source4/libcli/smb2/request.c @@ -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) diff --git a/source4/libcli/smb2/session.c b/source4/libcli/smb2/session.c index 3f9b3ed55c..462f60d2c2 100644 --- a/source4/libcli/smb2/session.c +++ b/source4/libcli/smb2/session.c @@ -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); diff --git a/source4/libcli/smb2/setinfo.c b/source4/libcli/smb2/setinfo.c index 67d433a48a..d942568a2d 100644 --- a/source4/libcli/smb2/setinfo.c +++ b/source4/libcli/smb2/setinfo.c @@ -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); } diff --git a/source4/libcli/smb2/tcon.c b/source4/libcli/smb2/tcon.c index 4f341d1206..ad1ba4c92d 100644 --- a/source4/libcli/smb2/tcon.c +++ b/source4/libcli/smb2/tcon.c @@ -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); diff --git a/source4/libcli/smb2/tdis.c b/source4/libcli/smb2/tdis.c index 6ad3120740..5adad9dc6e 100644 --- a/source4/libcli/smb2/tdis.c +++ b/source4/libcli/smb2/tdis.c @@ -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); } diff --git a/source4/libcli/smb2/transport.c b/source4/libcli/smb2/transport.c index de08201c8b..83e9436a58 100644 --- a/source4/libcli/smb2/transport.c +++ b/source4/libcli/smb2/transport.c @@ -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); diff --git a/source4/libcli/smb2/write.c b/source4/libcli/smb2/write.c index 3d501dc915..bc283370d7 100644 --- a/source4/libcli/smb2/write.c +++ b/source4/libcli/smb2/write.c @@ -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); diff --git a/source4/libcli/smb_composite/connect.c b/source4/libcli/smb_composite/connect.c index 23974619d6..9f18c0d924 100644 --- a/source4/libcli/smb_composite/connect.c +++ b/source4/libcli/smb_composite/connect.c @@ -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) && diff --git a/source4/libcli/smb_composite/fetchfile.c b/source4/libcli/smb_composite/fetchfile.c index 63a10a667d..2dbaff5a66 100644 --- a/source4/libcli/smb_composite/fetchfile.c +++ b/source4/libcli/smb_composite/fetchfile.c @@ -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); diff --git a/source4/libcli/smb_composite/fsinfo.c b/source4/libcli/smb_composite/fsinfo.c index e81e3a2085..faf3723539 100644 --- a/source4/libcli/smb_composite/fsinfo.c +++ b/source4/libcli/smb_composite/fsinfo.c @@ -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; diff --git a/source4/libcli/smb_composite/loadfile.c b/source4/libcli/smb_composite/loadfile.c index d42d3329b6..952f24b811 100644 --- a/source4/libcli/smb_composite/loadfile.c +++ b/source4/libcli/smb_composite/loadfile.c @@ -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); diff --git a/source4/libcli/util/asn1.c b/source4/libcli/util/asn1.c index f2098de5c5..58cb5f07be 100644 --- a/source4/libcli/util/asn1.c +++ b/source4/libcli/util/asn1.c @@ -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; diff --git a/source4/libcli/util/clilsa.c b/source4/libcli/util/clilsa.c index 0fdf8a8e3a..7c32294648 100644 --- a/source4/libcli/util/clilsa.c +++ b/source4/libcli/util/clilsa.c @@ -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; } diff --git a/source4/libcli/util/errormap.c b/source4/libcli/util/errormap.c index 49384817b6..8d088e1e4b 100644 --- a/source4/libcli/util/errormap.c +++ b/source4/libcli/util/errormap.c @@ -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 diff --git a/source4/libcli/wrepl/winsrepl.c b/source4/libcli/wrepl/winsrepl.c index 5b2a9e1e4a..90714f774b 100644 --- a/source4/libcli/wrepl/winsrepl.c +++ b/source4/libcli/wrepl/winsrepl.c @@ -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); diff --git a/source4/libcli/wrepl/winsrepl.h b/source4/libcli/wrepl/winsrepl.h index 3265024407..8ce8b418a2 100644 --- a/source4/libcli/wrepl/winsrepl.h +++ b/source4/libcli/wrepl/winsrepl.h @@ -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) | \ |