From 2151cde58014ea2e822c13d2f8a369b45dc19ca8 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 6 Oct 2007 22:28:14 +0000 Subject: [PATCH] r25554: Convert last instances of BOOL, True and False to the standard types. (This used to be commit 566aa14139510788548a874e9213d91317f83ca9) --- source4/libcli/auth/credentials.c | 12 +- source4/libcli/auth/session.c | 10 +- source4/libcli/auth/smbencrypt.c | 56 +- source4/libcli/cldap/cldap.c | 6 +- source4/libcli/cliconnect.c | 22 +- source4/libcli/clideltree.c | 8 +- source4/libcli/clifile.c | 9 +- source4/libcli/clilist.c | 32 +- source4/libcli/climessage.c | 18 +- source4/libcli/clireadwrite.c | 2 +- source4/libcli/composite/composite.c | 14 +- source4/libcli/ldap/ldap.c | 30 +- source4/libcli/ldap/ldap_bind.c | 2 +- source4/libcli/ldap/ldap_client.c | 6 +- source4/libcli/ldap/ldap_controls.c | 530 +++++------ source4/libcli/ldap/ldap_ildap.c | 6 +- source4/libcli/ldap/ldap_msg.c | 18 +- source4/libcli/nbt/namequery.c | 4 +- source4/libcli/nbt/namerefresh.c | 4 +- source4/libcli/nbt/nameregister.c | 18 +- source4/libcli/nbt/namerelease.c | 2 +- source4/libcli/nbt/nbtname.c | 2 +- source4/libcli/nbt/nbtsocket.c | 8 +- source4/libcli/raw/clioplock.c | 6 +- source4/libcli/raw/clisession.c | 2 +- source4/libcli/raw/clitransport.c | 17 +- source4/libcli/raw/clitree.c | 4 +- source4/libcli/raw/raweas.c | 6 +- source4/libcli/raw/rawfile.c | 4 +- source4/libcli/raw/rawnegotiate.c | 4 +- source4/libcli/raw/rawreadwrite.c | 10 +- source4/libcli/raw/rawrequest.c | 38 +- source4/libcli/raw/rawsetfileinfo.c | 40 +- source4/libcli/raw/rawshadow.c | 2 +- source4/libcli/raw/rawtrans.c | 8 +- source4/libcli/raw/smb_signing.c | 88 +- source4/libcli/resolve/bcast.c | 2 +- source4/libcli/resolve/nbtlist.c | 6 +- source4/libcli/resolve/wins.c | 2 +- source4/libcli/security/dom_sid.c | 10 +- source4/libcli/security/privilege.c | 10 +- source4/libcli/security/sddl.c | 36 +- source4/libcli/security/security_descriptor.c | 72 +- source4/libcli/security/security_token.c | 32 +- source4/libcli/smb2/cancel.c | 2 +- source4/libcli/smb2/close.c | 4 +- source4/libcli/smb2/connect.c | 4 +- source4/libcli/smb2/create.c | 10 +- source4/libcli/smb2/find.c | 4 +- source4/libcli/smb2/flush.c | 4 +- source4/libcli/smb2/getinfo.c | 4 +- source4/libcli/smb2/ioctl.c | 4 +- source4/libcli/smb2/keepalive.c | 4 +- source4/libcli/smb2/lock.c | 4 +- source4/libcli/smb2/logoff.c | 4 +- source4/libcli/smb2/negprot.c | 4 +- source4/libcli/smb2/notify.c | 4 +- source4/libcli/smb2/read.c | 4 +- source4/libcli/smb2/request.c | 20 +- source4/libcli/smb2/session.c | 6 +- source4/libcli/smb2/setinfo.c | 4 +- source4/libcli/smb2/tcon.c | 6 +- source4/libcli/smb2/tdis.c | 4 +- source4/libcli/smb2/transport.c | 2 +- source4/libcli/smb2/write.c | 4 +- source4/libcli/smb_composite/connect.c | 10 +- source4/libcli/smb_composite/fetchfile.c | 2 +- source4/libcli/smb_composite/fsinfo.c | 2 +- source4/libcli/smb_composite/loadfile.c | 2 +- source4/libcli/util/asn1.c | 294 +++--- source4/libcli/util/clilsa.c | 2 +- source4/libcli/util/errormap.c | 2 +- source4/libcli/wrepl/winsrepl.c | 18 +- source4/libcli/wrepl/winsrepl.h | 2 +- source4/libnet/libnet_group.c | 2 +- source4/libnet/libnet_join.c | 2 +- source4/libnet/libnet_lookup.c | 2 +- source4/libnet/libnet_samsync_ldb.c | 12 +- source4/libnet/libnet_user.c | 12 +- source4/libnet/libnet_vampire.c | 4 +- source4/libnet/prereq_domain.c | 24 +- source4/libnet/userman.c | 4 +- source4/nsswitch/wbinfo.c | 170 ++-- source4/ntvfs/cifs/vfs_cifs.c | 26 +- source4/ntvfs/cifs_posix_cli/vfs_cifs_posix.c | 8 +- source4/ntvfs/common/brlock_tdb.c | 26 +- source4/ntvfs/common/notify.c | 4 +- source4/ntvfs/common/opendb.c | 6 +- source4/ntvfs/common/opendb_tdb.c | 16 +- source4/ntvfs/ipc/vfs_ipc.c | 4 +- source4/ntvfs/nbench/vfs_nbench.c | 4 +- source4/ntvfs/ntvfs_base.c | 18 +- source4/ntvfs/ntvfs_generic.c | 10 +- source4/ntvfs/ntvfs_interface.c | 8 +- source4/ntvfs/ntvfs_util.c | 2 +- source4/ntvfs/posix/pvfs_acl.c | 22 +- source4/ntvfs/posix/pvfs_dirlist.c | 38 +- source4/ntvfs/posix/pvfs_lock.c | 4 +- source4/ntvfs/posix/pvfs_notify.c | 14 +- source4/ntvfs/posix/pvfs_open.c | 60 +- source4/ntvfs/posix/pvfs_resolve.c | 28 +- source4/ntvfs/posix/pvfs_search.c | 18 +- source4/ntvfs/posix/pvfs_setfileinfo.c | 2 +- source4/ntvfs/posix/pvfs_shortname.c | 64 +- source4/ntvfs/posix/pvfs_streams.c | 6 +- source4/ntvfs/posix/pvfs_util.c | 8 +- source4/ntvfs/posix/pvfs_xattr.c | 4 +- source4/ntvfs/posix/vfs_posix.c | 4 +- source4/ntvfs/posix/vfs_posix.h | 4 +- source4/ntvfs/simple/vfs_simple.c | 8 +- source4/ntvfs/sysdep/inotify.c | 14 +- source4/ntvfs/sysdep/sys_notify.c | 4 +- source4/ntvfs/unixuid/vfs_unixuid.c | 4 +- source4/scripting/ejs/ejsnet/net_ctx.c | 8 +- source4/scripting/ejs/ejsrpc.c | 6 +- source4/scripting/ejs/mprutil.c | 2 +- source4/scripting/ejs/smbcalls_auth.c | 14 +- source4/scripting/ejs/smbcalls_cli.c | 8 +- source4/scripting/ejs/smbcalls_config.c | 4 +- source4/scripting/ejs/smbcalls_creds.c | 14 +- source4/scripting/ejs/smbcalls_data.c | 12 +- source4/scripting/ejs/smbcalls_ldb.c | 2 +- source4/scripting/ejs/smbcalls_sys.c | 4 +- source4/torture/basic/base.c | 250 ++--- source4/torture/basic/delaywrite.c | 90 +- source4/torture/basic/delete.c | 172 ++-- source4/torture/basic/denytest.c | 36 +- source4/torture/basic/dir.c | 20 +- source4/torture/basic/disconnect.c | 24 +- source4/torture/basic/locking.c | 114 +-- source4/torture/basic/mangle_test.c | 18 +- source4/torture/basic/misc.c | 78 +- source4/torture/basic/properties.c | 4 +- source4/torture/basic/scanner.c | 52 +- source4/torture/basic/secleak.c | 14 +- source4/torture/basic/unlink.c | 2 +- source4/torture/basic/utable.c | 2 +- source4/torture/gentest.c | 234 ++--- source4/torture/ldap/basic.c | 54 +- source4/torture/ldap/cldap.c | 10 +- source4/torture/ldap/cldapbench.c | 2 +- source4/torture/ldap/schema.c | 52 +- source4/torture/ldap/uptodatevector.c | 6 +- source4/torture/libnet/domain.c | 22 +- source4/torture/libnet/groupinfo.c | 22 +- source4/torture/libnet/groupman.c | 18 +- source4/torture/libnet/libnet_BecomeDC.c | 24 +- source4/torture/libnet/libnet_domain.c | 66 +- source4/torture/libnet/libnet_group.c | 54 +- source4/torture/libnet/libnet_lookup.c | 32 +- source4/torture/libnet/libnet_rpc.c | 52 +- source4/torture/libnet/libnet_share.c | 18 +- source4/torture/libnet/libnet_user.c | 122 +-- source4/torture/libnet/userinfo.c | 41 +- source4/torture/libnet/userman.c | 84 +- source4/torture/libnet/utils.c | 54 +- source4/torture/libnet/utils.h | 10 +- source4/torture/local/dbspeed.c | 20 +- source4/torture/local/iconv.c | 2 +- source4/torture/local/irpc.c | 12 +- source4/torture/local/share.c | 6 +- source4/torture/locktest.c | 42 +- source4/torture/masktest.c | 18 +- source4/torture/nbench/nbench.c | 18 +- source4/torture/nbench/nbio.c | 88 +- source4/torture/nbt/query.c | 4 +- source4/torture/nbt/register.c | 10 +- source4/torture/nbt/wins.c | 8 +- source4/torture/rap/rap.c | 36 +- source4/torture/raw/acls.c | 64 +- source4/torture/raw/chkpath.c | 26 +- source4/torture/raw/composite.c | 48 +- source4/torture/raw/context.c | 68 +- source4/torture/raw/eas.c | 42 +- source4/torture/raw/ioctl.c | 20 +- source4/torture/raw/lock.c | 100 +- source4/torture/raw/lockbench.c | 8 +- source4/torture/raw/mkdir.c | 8 +- source4/torture/raw/mux.c | 28 +- source4/torture/raw/notify.c | 160 ++-- source4/torture/raw/open.c | 220 ++--- source4/torture/raw/openbench.c | 12 +- source4/torture/raw/oplock.c | 40 +- source4/torture/raw/pingpong.c | 10 +- source4/torture/raw/qfileinfo.c | 66 +- source4/torture/raw/qfsinfo.c | 20 +- source4/torture/raw/read.c | 78 +- source4/torture/raw/rename.c | 12 +- source4/torture/raw/samba3hide.c | 78 +- source4/torture/raw/samba3misc.c | 56 +- source4/torture/raw/search.c | 102 +-- source4/torture/raw/seek.c | 18 +- source4/torture/raw/setfileinfo.c | 36 +- source4/torture/raw/streams.c | 24 +- source4/torture/raw/unlink.c | 10 +- source4/torture/raw/write.c | 70 +- source4/torture/rpc/async_bind.c | 20 +- source4/torture/rpc/atsvc.c | 2 +- source4/torture/rpc/autoidl.c | 26 +- source4/torture/rpc/bench.c | 18 +- source4/torture/rpc/bind.c | 12 +- source4/torture/rpc/countcalls.c | 28 +- source4/torture/rpc/dfs.c | 128 +-- source4/torture/rpc/drsuapi.c | 98 +- source4/torture/rpc/drsuapi_cracknames.c | 90 +- source4/torture/rpc/dssync.c | 60 +- source4/torture/rpc/echo.c | 12 +- source4/torture/rpc/epmapper.c | 12 +- source4/torture/rpc/join.c | 12 +- source4/torture/rpc/lsa.c | 458 +++++----- source4/torture/rpc/lsa_lookup.c | 26 +- source4/torture/rpc/mgmt.c | 60 +- source4/torture/rpc/samba3rpc.c | 308 +++---- source4/torture/rpc/samlogon.c | 378 ++++---- source4/torture/rpc/samr.c | 862 +++++++++--------- source4/torture/rpc/samr_accessmask.c | 90 +- source4/torture/rpc/samsync.c | 258 +++--- source4/torture/rpc/scanner.c | 10 +- source4/torture/rpc/schannel.c | 20 +- source4/torture/rpc/spoolss.c | 26 +- source4/torture/rpc/testjoin.c | 2 +- source4/torture/rpc/unixinfo.c | 2 +- source4/torture/smb2/connect.c | 24 +- source4/torture/smb2/find.c | 26 +- source4/torture/smb2/getinfo.c | 24 +- source4/torture/smb2/lock.c | 18 +- source4/torture/smb2/notify.c | 16 +- source4/torture/smb2/scan.c | 36 +- source4/torture/smb2/setinfo.c | 22 +- source4/torture/smb2/util.c | 12 +- source4/torture/smbtorture.c | 4 +- source4/torture/ui.c | 16 +- source4/torture/unix/unix_info2.c | 42 +- source4/torture/unix/whoami.c | 20 +- source4/torture/util.c | 4 +- source4/torture/util_smb.c | 52 +- 236 files changed, 4639 insertions(+), 4638 deletions(-) diff --git a/source4/libcli/auth/credentials.c b/source4/libcli/auth/credentials.c index feb8c92a0bb..a6cb17c12ea 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 7f44b6b5a91..29af7fafe84 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 1f940fb79d1..bfac395ef9e 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 8ef511ed79e..f2f661acaae 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 96946da7fec..a56100fc80c 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 d191bd277a5..2c306e501e2 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 b30b82bd799..e59b7f9af3e 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 14fd3ee4f70..07393a34919 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 35607ba45bb..6002ccfc592 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 89ae1570421..f5ba799bbca 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 3e21c3823cc..67d58854979 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 06ff000acfa..11689fbd799 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; iu.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 cbe87724143..d285735d4e0 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 8476a4977b0..aea95de161b 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 3a5d14c0c93..b7fd1ce1782 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 62019b8cc1e..7b592c65ae9 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 c9643dafda0..12832b8ec43 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 a55d743efb9..755e06e8809 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 3114cb2b100..d723eed9f52 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 b8fe3626944..fd4a94dd44e 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 a72a5c706f3..1b3c9ae17e9 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 416814220b9..37cdf640235 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 174b08ddf6e..7d88c830440 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 12b586aafa7..ae4e58ae01b 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 c6c575b8182..617131c53c7 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 6b2c4c37fe0..0bf805910e0 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 4ff11f3a691..54f8ac95a43 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 06b5b4fc4d4..8ea8e621c9f 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 60a9bf26569..83303cf470d 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 c58ac1f0df4..82d6fe5236c 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 a288b7ec542..b0c49ddab77 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 778b896abdf..6a4f4320880 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 7738e849e80..5fa0c1f2da0 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 8fc81dab4c1..4c58c913835 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 40a30bd0672..53670d22a32 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 59c13bbeb68..e19e81af7ed 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 f356dafdaa6..3193d70789a 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 9720434cb90..baf3874aa4f 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 05a2d4da317..2cbcd5f4836 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 1ba3edd9bf5..f5457e7e0e4 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 103e2e3c14e..2cbef135382 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 d4efab9b641..09522f182a8 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 1e33e1950bb..7ed619d0c4f 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;inum_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 684c3de7e62..e126340c465 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 f0a0b01817c..096919f1775 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 e83f81b6300..04c0c854992 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 bb70311c56a..6f05d56cd47 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 c8ac271f449..ba11c22e87e 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 e8643f18684..6d0a9c80726 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 2f1b7bd7490..116068ed6eb 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 a9a681ea53e..0665dd441ce 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 c13ec7943cf..d81bca517f6 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 e2b7c83b8a1..402b063e81b 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 470648a34c4..d71a337d562 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 00d5e19e829..321a4db1a66 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 07d06ca2ff5..38fe0e7e535 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 58e2876745d..a3bea41eb09 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 f78a1a8b0e5..b61f9184810 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 2d2c8252a1f..576e2b6fcff 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 3f9b3ed55c1..462f60d2c20 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 67d433a48a3..d942568a2d3 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 4f341d12061..ad1ba4c92dc 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 6ad3120740b..5adad9dc6ed 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 de08201c8b2..83e9436a58e 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 3d501dc9154..bc283370d75 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 23974619d61..9f18c0d9243 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 63a10a667db..2dbaff5a662 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 e81e3a20858..faf37235391 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 d42d3329b68..952f24b811e 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 f2098de5c55..58cb5f07bee 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 0fdf8a8e3ab..7c322946487 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 49384817b68..8d088e1e4bf 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 5b2a9e1e4af..90714f774b4 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 3265024407c..8ce8b418a2c 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) | \ diff --git a/source4/libnet/libnet_group.c b/source4/libnet/libnet_group.c index 50615f3946e..39e5e7a4f98 100644 --- a/source4/libnet/libnet_group.c +++ b/source4/libnet/libnet_group.c @@ -57,7 +57,7 @@ struct composite_context* libnet_GroupInfo_send(struct libnet_context *ctx, { struct composite_context *c; struct group_info_state *s; - BOOL prereq_met = False; + bool prereq_met = false; struct composite_context *lookup_req; /* composite context allocation and setup */ diff --git a/source4/libnet/libnet_join.c b/source4/libnet/libnet_join.c index 1fd84146deb..4abd2954f88 100644 --- a/source4/libnet/libnet_join.c +++ b/source4/libnet/libnet_join.c @@ -926,7 +926,7 @@ static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx, r2->in.netbios_name = netbios_name; r2->in.level = LIBNET_JOINDOMAIN_AUTOMATIC; r2->in.acct_type = acct_type; - r2->in.recreate_account = False; + r2->in.recreate_account = false; status = libnet_JoinDomain(ctx, r2, r2); if (!NT_STATUS_IS_OK(status)) { r->out.error_string = talloc_steal(mem_ctx, r2->out.error_string); diff --git a/source4/libnet/libnet_lookup.c b/source4/libnet/libnet_lookup.c index cac7086a60c..459e5b1985a 100644 --- a/source4/libnet/libnet_lookup.c +++ b/source4/libnet/libnet_lookup.c @@ -260,7 +260,7 @@ struct composite_context* libnet_LookupName_send(struct libnet_context *ctx, struct composite_context *c; struct lookup_name_state *s; struct rpc_request *lookup_req; - BOOL prereq_met = False; + bool prereq_met = false; c = composite_create(mem_ctx, ctx->event_ctx); if (c == NULL) return NULL; diff --git a/source4/libnet/libnet_samsync_ldb.c b/source4/libnet/libnet_samsync_ldb.c index c49d800d40c..bdc3341aa68 100644 --- a/source4/libnet/libnet_samsync_ldb.c +++ b/source4/libnet/libnet_samsync_ldb.c @@ -247,7 +247,7 @@ static NTSTATUS samsync_ldb_handle_user(TALLOC_CTX *mem_ctx, struct ldb_message **remote_msgs = NULL; int ret, i; uint32_t acb; - BOOL add = False; + bool add = false; const char *attrs[] = { NULL }; /* we may change this to a global search, then fill in only the things not in ldap later */ const char *remote_attrs[] = { "userPrincipalName", "servicePrincipalName", @@ -275,7 +275,7 @@ static NTSTATUS samsync_ldb_handle_user(TALLOC_CTX *mem_ctx, ldb_errstring(state->sam_ldb)); return NT_STATUS_INTERNAL_DB_CORRUPTION; } else if (ret == 0) { - add = True; + add = true; } else if (ret > 1) { *error_string = talloc_asprintf(mem_ctx, "More than one user with SID: %s in local LDB", dom_sid_string(mem_ctx, user_sid)); @@ -517,7 +517,7 @@ static NTSTATUS samsync_ldb_handle_group(TALLOC_CTX *mem_ctx, struct ldb_message *msg; struct ldb_message **msgs; int ret; - BOOL add = False; + bool add = false; const char *attrs[] = { NULL }; msg = ldb_msg_new(mem_ctx); @@ -534,7 +534,7 @@ static NTSTATUS samsync_ldb_handle_group(TALLOC_CTX *mem_ctx, *error_string = talloc_asprintf(mem_ctx, "gendb_search failed: %s", ldb_errstring(state->sam_ldb)); return NT_STATUS_INTERNAL_DB_CORRUPTION; } else if (ret == 0) { - add = True; + add = true; } else if (ret > 1) { *error_string = talloc_asprintf(mem_ctx, "More than one group/alias with SID: %s", dom_sid_string(mem_ctx, @@ -729,7 +729,7 @@ static NTSTATUS samsync_ldb_handle_alias(TALLOC_CTX *mem_ctx, struct ldb_message *msg; struct ldb_message **msgs; int ret; - BOOL add = False; + bool add = false; const char *attrs[] = { NULL }; msg = ldb_msg_new(mem_ctx); @@ -746,7 +746,7 @@ static NTSTATUS samsync_ldb_handle_alias(TALLOC_CTX *mem_ctx, *error_string = talloc_asprintf(mem_ctx, "gendb_search failed: %s", ldb_errstring(state->sam_ldb)); return NT_STATUS_INTERNAL_DB_CORRUPTION; } else if (ret == 0) { - add = True; + add = true; } else if (ret > 1) { *error_string = talloc_asprintf(mem_ctx, "More than one group/alias with SID: %s", dom_sid_string(mem_ctx, diff --git a/source4/libnet/libnet_user.c b/source4/libnet/libnet_user.c index 28b743b42e5..75fd8f2000a 100644 --- a/source4/libnet/libnet_user.c +++ b/source4/libnet/libnet_user.c @@ -62,7 +62,7 @@ struct composite_context* libnet_CreateUser_send(struct libnet_context *ctx, struct composite_context *c; struct create_user_state *s; struct composite_context *create_req; - BOOL prereq_met = False; + bool prereq_met = false; /* composite context allocation and setup */ c = composite_create(mem_ctx, ctx->event_ctx); @@ -231,7 +231,7 @@ struct composite_context *libnet_DeleteUser_send(struct libnet_context *ctx, struct composite_context *c; struct delete_user_state *s; struct composite_context *delete_req; - BOOL prereq_met = False; + bool prereq_met = false; /* composite context allocation and setup */ c = composite_create(mem_ctx, ctx->event_ctx); @@ -402,7 +402,7 @@ struct composite_context *libnet_ModifyUser_send(struct libnet_context *ctx, struct composite_context *c; struct modify_user_state *s; struct composite_context *userinfo_req; - BOOL prereq_met = False; + bool prereq_met = false; c = composite_create(mem_ctx, ctx->event_ctx); if (c == NULL) return NULL; @@ -629,7 +629,7 @@ struct composite_context* libnet_UserInfo_send(struct libnet_context *ctx, struct composite_context *c; struct user_info_state *s; struct composite_context *lookup_req; - BOOL prereq_met = False; + bool prereq_met = false; /* composite context allocation and setup */ c = composite_create(mem_ctx, ctx->event_ctx); @@ -878,7 +878,7 @@ struct composite_context* libnet_UserList_send(struct libnet_context *ctx, struct composite_context *c; struct userlist_state *s; struct rpc_request *query_req; - BOOL prereq_met = False; + bool prereq_met = false; /* composite context allocation and setup */ c = composite_create(mem_ctx, ctx->event_ctx); @@ -952,7 +952,7 @@ static void continue_domain_queried(struct rpc_request *req) struct composite_context *c; struct userlist_state *s; struct rpc_request *enum_req; - BOOL prereq_met = False; + bool prereq_met = false; c = talloc_get_type(req->async.private_data, struct composite_context); s = talloc_get_type(c->private_data, struct userlist_state); diff --git a/source4/libnet/libnet_vampire.c b/source4/libnet/libnet_vampire.c index c6f85d5b5f4..dff915df71d 100644 --- a/source4/libnet/libnet_vampire.c +++ b/source4/libnet/libnet_vampire.c @@ -81,7 +81,7 @@ static NTSTATUS fix_user(TALLOC_CTX *mem_ctx, } else { user->lmpassword = keys.keys.keys2.lmpassword.pwd; } - user->lm_password_present = True; + user->lm_password_present = true; } if (keys.keys.keys2.ntpassword.length == 16) { if (rid_crypt) { @@ -90,7 +90,7 @@ static NTSTATUS fix_user(TALLOC_CTX *mem_ctx, } else { user->ntpassword = keys.keys.keys2.ntpassword.pwd; } - user->nt_password_present = True; + user->nt_password_present = true; } /* TODO: rid decrypt history fields */ } else { diff --git a/source4/libnet/prereq_domain.c b/source4/libnet/prereq_domain.c index 52f8dcf112b..e10e550585c 100644 --- a/source4/libnet/prereq_domain.c +++ b/source4/libnet/prereq_domain.c @@ -29,7 +29,7 @@ #include "librpc/gen_ndr/ndr_lsa.h" -BOOL samr_domain_opened(struct libnet_context *ctx, const char *domain_name, +bool samr_domain_opened(struct libnet_context *ctx, const char *domain_name, struct composite_context **parent_ctx, struct libnet_DomainOpen *domain_open, void (*continue_fn)(struct composite_context*), @@ -37,7 +37,7 @@ BOOL samr_domain_opened(struct libnet_context *ctx, const char *domain_name, { struct composite_context *domopen_req; - if (parent_ctx == NULL || *parent_ctx == NULL) return False; + if (parent_ctx == NULL || *parent_ctx == NULL) return false; if (domain_name == NULL) { /* @@ -52,7 +52,7 @@ BOOL samr_domain_opened(struct libnet_context *ctx, const char *domain_name, } else { composite_error(*parent_ctx, NT_STATUS_INVALID_PARAMETER); - return True; + return true; } } else { @@ -71,20 +71,20 @@ BOOL samr_domain_opened(struct libnet_context *ctx, const char *domain_name, } else { /* domain has already been opened and it's the same domain as requested */ - return True; + return true; } } /* send request to open the domain */ domopen_req = libnet_DomainOpen_send(ctx, domain_open, monitor); - if (composite_nomem(domopen_req, *parent_ctx)) return False; + if (composite_nomem(domopen_req, *parent_ctx)) return false; composite_continue(*parent_ctx, domopen_req, continue_fn, *parent_ctx); - return False; + return false; } -BOOL lsa_domain_opened(struct libnet_context *ctx, const char *domain_name, +bool lsa_domain_opened(struct libnet_context *ctx, const char *domain_name, struct composite_context **parent_ctx, struct libnet_DomainOpen *domain_open, void (*continue_fn)(struct composite_context*), @@ -92,7 +92,7 @@ BOOL lsa_domain_opened(struct libnet_context *ctx, const char *domain_name, { struct composite_context *domopen_req; - if (parent_ctx == NULL || *parent_ctx == NULL) return False; + if (parent_ctx == NULL || *parent_ctx == NULL) return false; if (domain_name == NULL) { /* @@ -109,7 +109,7 @@ BOOL lsa_domain_opened(struct libnet_context *ctx, const char *domain_name, composite_error(*parent_ctx, NT_STATUS_INVALID_PARAMETER); /* this ensures the calling function exits and composite function error gets noticed quickly */ - return True; + return true; } } else { @@ -128,15 +128,15 @@ BOOL lsa_domain_opened(struct libnet_context *ctx, const char *domain_name, } else { /* domain has already been opened and it's the same domain as requested */ - return True; + return true; } } /* send request to open the domain */ domopen_req = libnet_DomainOpen_send(ctx, domain_open, monitor); /* see the comment above to find out why true is returned here */ - if (composite_nomem(domopen_req, *parent_ctx)) return True; + if (composite_nomem(domopen_req, *parent_ctx)) return true; composite_continue(*parent_ctx, domopen_req, continue_fn, *parent_ctx); - return False; + return false; } diff --git a/source4/libnet/userman.c b/source4/libnet/userman.c index fd2f75bc646..25ed4775cb3 100644 --- a/source4/libnet/userman.c +++ b/source4/libnet/userman.c @@ -662,7 +662,7 @@ static NTSTATUS usermod_change(struct composite_context *c, uint16_t level = 27; /* prepare UserInfo level and data based on bitmask field */ - do_set = usermod_setfields(s, &level, i, False); + do_set = usermod_setfields(s, &level, i, false); if (level < 1 || level > 26) { /* apparently there's a field that the setfields routine @@ -752,7 +752,7 @@ static void continue_usermod_user_queried(struct rpc_request *req) of many) */ s->info = *s->queryuser.out.info; - usermod_setfields(s, &level, i, True); + usermod_setfields(s, &level, i, true); /* prepare rpc call arguments */ s->setuser.in.user_handle = &s->user_handle; diff --git a/source4/nsswitch/wbinfo.c b/source4/nsswitch/wbinfo.c index cf4dceec6d0..4538911f97b 100644 --- a/source4/nsswitch/wbinfo.c +++ b/source4/nsswitch/wbinfo.c @@ -32,10 +32,10 @@ extern int winbindd_fd; -static char winbind_separator_int(BOOL strict) +static char winbind_separator_int(bool strict) { struct winbindd_response response; - static BOOL got_sep; + static bool got_sep; static char sep; if (got_sep) @@ -56,7 +56,7 @@ static char winbind_separator_int(BOOL strict) } sep = response.data.info.winbind_separator; - got_sep = True; + got_sep = true; if (!sep) { d_fprintf(stderr, "winbind separator was NULL!\n"); @@ -72,7 +72,7 @@ static char winbind_separator_int(BOOL strict) static char winbind_separator(void) { - return winbind_separator_int(False); + return winbind_separator_int(false); } static const char *get_winbind_domain(void) @@ -101,7 +101,7 @@ static const char *get_winbind_domain(void) /* Copy of parse_domain_user from winbindd_util.c. Parse a string of the form DOMAIN/user into a domain and a user */ -static BOOL parse_wbinfo_domain_user(const char *domuser, fstring domain, +static bool parse_wbinfo_domain_user(const char *domuser, fstring domain, fstring user) { @@ -110,7 +110,7 @@ static BOOL parse_wbinfo_domain_user(const char *domuser, fstring domain, if (!p) { fstrcpy(user, domuser); fstrcpy(domain, get_winbind_domain()); - return True; + return true; } fstrcpy(user, p+1); @@ -118,12 +118,12 @@ static BOOL parse_wbinfo_domain_user(const char *domuser, fstring domain, domain[PTR_DIFF(p, domuser)] = 0; strupper_m(domain); - return True; + return true; } /* pull pwent info for a given user */ -static BOOL wbinfo_get_userinfo(char *user) +static bool wbinfo_get_userinfo(char *user) { struct winbindd_request request; struct winbindd_response response; @@ -139,7 +139,7 @@ static BOOL wbinfo_get_userinfo(char *user) result = winbindd_request_response(WINBINDD_GETPWNAM, &request, &response); if (result != NSS_STATUS_SUCCESS) - return False; + return false; d_printf( "%s:%s:%d:%d:%s:%s:%s\n", response.data.pw.pw_name, @@ -150,11 +150,11 @@ static BOOL wbinfo_get_userinfo(char *user) response.data.pw.pw_dir, response.data.pw.pw_shell ); - return True; + return true; } /* pull pwent info for a given uid */ -static BOOL wbinfo_get_uidinfo(int uid) +static bool wbinfo_get_uidinfo(int uid) { struct winbindd_request request; struct winbindd_response response; @@ -168,7 +168,7 @@ static BOOL wbinfo_get_uidinfo(int uid) result = winbindd_request_response(WINBINDD_GETPWUID, &request, &response); if (result != NSS_STATUS_SUCCESS) - return False; + return false; d_printf( "%s:%s:%d:%d:%s:%s:%s\n", response.data.pw.pw_name, @@ -179,11 +179,11 @@ static BOOL wbinfo_get_uidinfo(int uid) response.data.pw.pw_dir, response.data.pw.pw_shell ); - return True; + return true; } /* pull grent for a given group */ -static BOOL wbinfo_get_groupinfo(char *group) +static bool wbinfo_get_groupinfo(char *group) { struct winbindd_request request; struct winbindd_response response; @@ -200,19 +200,19 @@ static BOOL wbinfo_get_groupinfo(char *group) &response); if ( result != NSS_STATUS_SUCCESS) - return False; + return false; d_printf( "%s:%s:%d\n", response.data.gr.gr_name, response.data.gr.gr_passwd, response.data.gr.gr_gid ); - return True; + return true; } /* List groups a user is a member of */ -static BOOL wbinfo_get_usergroups(char *user) +static bool wbinfo_get_usergroups(char *user) { struct winbindd_request request; struct winbindd_response response; @@ -229,19 +229,19 @@ static BOOL wbinfo_get_usergroups(char *user) result = winbindd_request_response(WINBINDD_GETGROUPS, &request, &response); if (result != NSS_STATUS_SUCCESS) - return False; + return false; for (i = 0; i < response.data.num_entries; i++) d_printf("%d\n", (int)((gid_t *)response.extra_data.data)[i]); SAFE_FREE(response.extra_data.data); - return True; + return true; } /* List group SIDs a user SID is a member of */ -static BOOL wbinfo_get_usersids(char *user_sid) +static bool wbinfo_get_usersids(char *user_sid) { struct winbindd_request request; struct winbindd_response response; @@ -258,7 +258,7 @@ static BOOL wbinfo_get_usersids(char *user_sid) result = winbindd_request_response(WINBINDD_GETUSERSIDS, &request, &response); if (result != NSS_STATUS_SUCCESS) - return False; + return false; s = (const char *)response.extra_data.data; for (i = 0; i < response.data.num_entries; i++) { @@ -268,10 +268,10 @@ static BOOL wbinfo_get_usersids(char *user_sid) SAFE_FREE(response.extra_data.data); - return True; + return true; } -static BOOL wbinfo_get_userdomgroups(const char *user_sid) +static bool wbinfo_get_userdomgroups(const char *user_sid) { struct winbindd_request request; struct winbindd_response response; @@ -287,19 +287,19 @@ static BOOL wbinfo_get_userdomgroups(const char *user_sid) &response); if (result != NSS_STATUS_SUCCESS) - return False; + return false; if (response.data.num_entries != 0) printf("%s", (char *)response.extra_data.data); SAFE_FREE(response.extra_data.data); - return True; + return true; } /* Convert NetBIOS name to IP */ -static BOOL wbinfo_wins_byname(char *name) +static bool wbinfo_wins_byname(char *name) { struct winbindd_request request; struct winbindd_response response; @@ -313,19 +313,19 @@ static BOOL wbinfo_wins_byname(char *name) if (winbindd_request_response(WINBINDD_WINS_BYNAME, &request, &response) != NSS_STATUS_SUCCESS) { - return False; + return false; } /* Display response */ d_printf("%s\n", response.data.winsresp); - return True; + return true; } /* Convert IP to NetBIOS name */ -static BOOL wbinfo_wins_byip(char *ip) +static bool wbinfo_wins_byip(char *ip) { struct winbindd_request request; struct winbindd_response response; @@ -339,19 +339,19 @@ static BOOL wbinfo_wins_byip(char *ip) if (winbindd_request_response(WINBINDD_WINS_BYIP, &request, &response) != NSS_STATUS_SUCCESS) { - return False; + return false; } /* Display response */ d_printf("%s\n", response.data.winsresp); - return True; + return true; } /* List trusted domains */ -static BOOL wbinfo_list_domains(BOOL list_all_domains) +static bool wbinfo_list_domains(bool list_all_domains) { struct winbindd_request request; struct winbindd_response response; @@ -365,7 +365,7 @@ static BOOL wbinfo_list_domains(BOOL list_all_domains) if (winbindd_request_response(WINBINDD_LIST_TRUSTDOM, &request, &response) != NSS_STATUS_SUCCESS) - return False; + return false; /* Display response */ @@ -379,7 +379,7 @@ static BOOL wbinfo_list_domains(BOOL list_all_domains) if (p == 0) { d_fprintf(stderr, "Got invalid response: %s\n", extra_data); - return False; + return false; } *p = 0; d_printf("%s\n", name); @@ -388,20 +388,20 @@ static BOOL wbinfo_list_domains(BOOL list_all_domains) SAFE_FREE(response.extra_data.data); } - return True; + return true; } /* List own domain */ -static BOOL wbinfo_list_own_domain(void) +static bool wbinfo_list_own_domain(void) { d_printf("%s\n", get_winbind_domain()); - return True; + return true; } /* show sequence numbers */ -static BOOL wbinfo_show_sequence(const char *domain) +static bool wbinfo_show_sequence(const char *domain) { struct winbindd_request request; struct winbindd_response response; @@ -416,7 +416,7 @@ static BOOL wbinfo_show_sequence(const char *domain) if (winbindd_request_response(WINBINDD_SHOW_SEQUENCE, &request, &response) != NSS_STATUS_SUCCESS) - return False; + return false; /* Display response */ @@ -426,12 +426,12 @@ static BOOL wbinfo_show_sequence(const char *domain) SAFE_FREE(response.extra_data.data); } - return True; + return true; } /* Show domain info */ -static BOOL wbinfo_domain_info(const char *domain_name) +static bool wbinfo_domain_info(const char *domain_name) { struct winbindd_request request; struct winbindd_response response; @@ -448,7 +448,7 @@ static BOOL wbinfo_domain_info(const char *domain_name) if (winbindd_request_response(WINBINDD_DOMAIN_INFO, &request, &response) != NSS_STATUS_SUCCESS) - return False; + return false; /* Display response */ @@ -465,11 +465,11 @@ static BOOL wbinfo_domain_info(const char *domain_name) d_printf("Primary : %s\n", response.data.domain_info.primary ? "Yes" : "No"); - return True; + return true; } /* Get a foreign DC's name */ -static BOOL wbinfo_getdcname(const char *domain_name) +static bool wbinfo_getdcname(const char *domain_name) { struct winbindd_request request; struct winbindd_response response; @@ -484,19 +484,19 @@ static BOOL wbinfo_getdcname(const char *domain_name) if (winbindd_request_response(WINBINDD_GETDCNAME, &request, &response) != NSS_STATUS_SUCCESS) { d_fprintf(stderr, "Could not get dc name for %s\n", domain_name); - return False; + return false; } /* Display response */ d_printf("%s\n", response.data.dc_name); - return True; + return true; } /* Check trust account password */ -static BOOL wbinfo_check_secret(void) +static bool wbinfo_check_secret(void) { struct winbindd_response response; NSS_STATUS result; @@ -518,7 +518,7 @@ static BOOL wbinfo_check_secret(void) /* Convert uid to sid */ -static BOOL wbinfo_uid_to_sid(uid_t uid) +static bool wbinfo_uid_to_sid(uid_t uid) { struct winbindd_request request; struct winbindd_response response; @@ -532,18 +532,18 @@ static BOOL wbinfo_uid_to_sid(uid_t uid) if (winbindd_request_response(WINBINDD_UID_TO_SID, &request, &response) != NSS_STATUS_SUCCESS) - return False; + return false; /* Display response */ d_printf("%s\n", response.data.sid.sid); - return True; + return true; } /* Convert gid to sid */ -static BOOL wbinfo_gid_to_sid(gid_t gid) +static bool wbinfo_gid_to_sid(gid_t gid) { struct winbindd_request request; struct winbindd_response response; @@ -557,18 +557,18 @@ static BOOL wbinfo_gid_to_sid(gid_t gid) if (winbindd_request_response(WINBINDD_GID_TO_SID, &request, &response) != NSS_STATUS_SUCCESS) - return False; + return false; /* Display response */ d_printf("%s\n", response.data.sid.sid); - return True; + return true; } /* Convert sid to uid */ -static BOOL wbinfo_sid_to_uid(char *sid) +static bool wbinfo_sid_to_uid(char *sid) { struct winbindd_request request; struct winbindd_response response; @@ -582,16 +582,16 @@ static BOOL wbinfo_sid_to_uid(char *sid) if (winbindd_request_response(WINBINDD_SID_TO_UID, &request, &response) != NSS_STATUS_SUCCESS) - return False; + return false; /* Display response */ d_printf("%d\n", (int)response.data.uid); - return True; + return true; } -static BOOL wbinfo_sid_to_gid(char *sid) +static bool wbinfo_sid_to_gid(char *sid) { struct winbindd_request request; struct winbindd_response response; @@ -605,18 +605,18 @@ static BOOL wbinfo_sid_to_gid(char *sid) if (winbindd_request_response(WINBINDD_SID_TO_GID, &request, &response) != NSS_STATUS_SUCCESS) - return False; + return false; /* Display response */ d_printf("%d\n", (int)response.data.gid); - return True; + return true; } /* Convert sid to string */ -static BOOL wbinfo_lookupsid(char *sid) +static bool wbinfo_lookupsid(char *sid) { struct winbindd_request request; struct winbindd_response response; @@ -630,7 +630,7 @@ static BOOL wbinfo_lookupsid(char *sid) if (winbindd_request_response(WINBINDD_LOOKUPSID, &request, &response) != NSS_STATUS_SUCCESS) - return False; + return false; /* Display response */ @@ -638,7 +638,7 @@ static BOOL wbinfo_lookupsid(char *sid) winbind_separator(), response.data.name.name, response.data.name.type); - return True; + return true; } static const char *sid_type_lookup(enum lsa_SidType r) @@ -659,7 +659,7 @@ static const char *sid_type_lookup(enum lsa_SidType r) /* Convert string to sid */ -static BOOL wbinfo_lookupname(char *name) +static bool wbinfo_lookupname(char *name) { struct winbindd_request request; struct winbindd_response response; @@ -674,18 +674,18 @@ static BOOL wbinfo_lookupname(char *name) if (winbindd_request_response(WINBINDD_LOOKUPNAME, &request, &response) != NSS_STATUS_SUCCESS) - return False; + return false; /* Display response */ d_printf("%s %s (%d)\n", response.data.sid.sid, sid_type_lookup(response.data.sid.type), response.data.sid.type); - return True; + return true; } /* Authenticate a user with a plaintext password */ -static BOOL wbinfo_auth_krb5(char *username, const char *cctype, uint32_t flags) +static bool wbinfo_auth_krb5(char *username, const char *cctype, uint32_t flags) { struct winbindd_request request; struct winbindd_response response; @@ -746,7 +746,7 @@ static BOOL wbinfo_auth_krb5(char *username, const char *cctype, uint32_t flags) /* Authenticate a user with a plaintext password */ -static BOOL wbinfo_auth(char *username) +static bool wbinfo_auth(char *username) { struct winbindd_request request; struct winbindd_response response; @@ -786,7 +786,7 @@ static BOOL wbinfo_auth(char *username) /* Authenticate a user with a challenge/response */ -static BOOL wbinfo_auth_crap(char *username) +static bool wbinfo_auth_crap(char *username) { struct winbindd_request request; struct winbindd_response response; @@ -830,7 +830,7 @@ static BOOL wbinfo_auth_crap(char *username) mem_ctx = talloc_new(NULL); if (mem_ctx == NULL) { d_printf("talloc_new failed\n"); - return False; + return false; } server_chal = data_blob(request.data.auth_crap.chal, 8); @@ -843,7 +843,7 @@ static BOOL wbinfo_auth_crap(char *username) &lm_response, &nt_response, NULL, NULL)) { data_blob_free(&names_blob); data_blob_free(&server_chal); - return False; + return false; } data_blob_free(&names_blob); data_blob_free(&server_chal); @@ -893,7 +893,7 @@ static BOOL wbinfo_auth_crap(char *username) /* Print domain users */ -static BOOL print_domain_users(const char *domain) +static bool print_domain_users(const char *domain) { struct winbindd_request request; struct winbindd_response response; @@ -915,12 +915,12 @@ static BOOL print_domain_users(const char *domain) if (winbindd_request_response(WINBINDD_LIST_USERS, &request, &response) != NSS_STATUS_SUCCESS) - return False; + return false; /* Look through extra data */ if (!response.extra_data.data) - return False; + return false; extra_data = (const char *)response.extra_data.data; @@ -929,12 +929,12 @@ static BOOL print_domain_users(const char *domain) SAFE_FREE(response.extra_data.data); - return True; + return true; } /* Print domain groups */ -static BOOL print_domain_groups(const char *domain) +static bool print_domain_groups(const char *domain) { struct winbindd_request request; struct winbindd_response response; @@ -953,12 +953,12 @@ static BOOL print_domain_groups(const char *domain) if (winbindd_request_response(WINBINDD_LIST_GROUPS, &request, &response) != NSS_STATUS_SUCCESS) - return False; + return false; /* Look through extra data */ if (!response.extra_data.data) - return False; + return false; extra_data = (const char *)response.extra_data.data; @@ -967,10 +967,10 @@ static BOOL print_domain_groups(const char *domain) SAFE_FREE(response.extra_data.data); - return True; + return true; } -static BOOL wbinfo_ping(void) +static bool wbinfo_ping(void) { NSS_STATUS result; @@ -1150,7 +1150,7 @@ int main(int argc, char **argv, char **envp) } break; case 'm': - if (!wbinfo_list_domains(False)) { + if (!wbinfo_list_domains(false)) { d_fprintf(stderr, "Could not list trusted domains\n"); goto done; } @@ -1210,18 +1210,18 @@ int main(int argc, char **argv, char **envp) } break; case 'a': { - BOOL got_error = False; + bool got_error = false; if (!wbinfo_auth(string_arg)) { d_fprintf(stderr, "Could not authenticate user %s with " "plaintext password\n", string_arg); - got_error = True; + got_error = true; } if (!wbinfo_auth_crap(string_arg)) { d_fprintf(stderr, "Could not authenticate user %s with " "challenge/response\n", string_arg); - got_error = True; + got_error = true; } if (got_error) @@ -1253,7 +1253,7 @@ int main(int argc, char **argv, char **envp) } break; case OPT_SEPARATOR: { - const char sep = winbind_separator_int(True); + const char sep = winbind_separator_int(true); if ( !sep ) { goto done; } @@ -1261,7 +1261,7 @@ int main(int argc, char **argv, char **envp) break; } case OPT_LIST_ALL_DOMAINS: - if (!wbinfo_list_domains(True)) { + if (!wbinfo_list_domains(true)) { goto done; } break; diff --git a/source4/ntvfs/cifs/vfs_cifs.c b/source4/ntvfs/cifs/vfs_cifs.c index ed7065b3bda..cd4e3639066 100644 --- a/source4/ntvfs/cifs/vfs_cifs.c +++ b/source4/ntvfs/cifs/vfs_cifs.c @@ -46,8 +46,8 @@ struct cvfs_private { struct ntvfs_module_context *ntvfs; struct async_info *pending; struct cvfs_file *files; - BOOL map_generic; - BOOL map_trans2; + bool map_generic; + bool map_trans2; }; @@ -84,15 +84,15 @@ struct async_info { #define CIFS_MAP_GENERIC "cifs:map-generic" #define CIFS_MAP_TRANS2 "cifs:map-trans2" -#define CIFS_USE_MACHINE_ACCT_DEFAULT False -#define CIFS_MAP_GENERIC_DEFAULT False -#define CIFS_MAP_TRANS2_DEFAULT True +#define CIFS_USE_MACHINE_ACCT_DEFAULT false +#define CIFS_MAP_GENERIC_DEFAULT false +#define CIFS_MAP_TRANS2_DEFAULT true /* a handler for oplock break events from the server - these need to be passed along to the client */ -static BOOL oplock_handler(struct smbcli_transport *transport, uint16_t tid, uint16_t fnum, uint8_t level, void *p_private) +static bool oplock_handler(struct smbcli_transport *transport, uint16_t tid, uint16_t fnum, uint8_t level, void *p_private) { struct cvfs_private *private = p_private; NTSTATUS status; @@ -107,13 +107,13 @@ static BOOL oplock_handler(struct smbcli_transport *transport, uint16_t tid, uin if (!h) { DEBUG(5,("vfs_cifs: ignoring oplock break level %d for fnum %d\n", level, fnum)); - return True; + return true; } DEBUG(5,("vfs_cifs: sending oplock break level %d for fnum %d\n", level, fnum)); status = ntvfs_send_oplock_break(private->ntvfs, h, level); - if (!NT_STATUS_IS_OK(status)) return False; - return True; + if (!NT_STATUS_IS_OK(status)) return false; + return true; } /* @@ -130,7 +130,7 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs, struct share_config *scfg = ntvfs->ctx->config; struct cli_credentials *credentials; - BOOL machine_account; + bool machine_account; /* Here we need to determine which server to connect to. * For now we use parametric options, type cifs. @@ -197,7 +197,7 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs, io.in.port = 0; io.in.called_name = host; io.in.credentials = credentials; - io.in.fallback_to_anonymous = False; + io.in.fallback_to_anonymous = false; io.in.workgroup = lp_workgroup(global_loadparm); io.in.service = remote_share; io.in.service_type = "?????"; @@ -922,7 +922,7 @@ static NTSTATUS cvfs_lpq(struct ntvfs_module_context *ntvfs, static NTSTATUS cvfs_search_first(struct ntvfs_module_context *ntvfs, struct ntvfs_request *req, union smb_search_first *io, void *search_private, - BOOL (*callback)(void *, const union smb_search_data *)) + bool (*callback)(void *, const union smb_search_data *)) { struct cvfs_private *private = ntvfs->private_data; @@ -935,7 +935,7 @@ static NTSTATUS cvfs_search_first(struct ntvfs_module_context *ntvfs, static NTSTATUS cvfs_search_next(struct ntvfs_module_context *ntvfs, struct ntvfs_request *req, union smb_search_next *io, void *search_private, - BOOL (*callback)(void *, const union smb_search_data *)) + bool (*callback)(void *, const union smb_search_data *)) { struct cvfs_private *private = ntvfs->private_data; diff --git a/source4/ntvfs/cifs_posix_cli/vfs_cifs_posix.c b/source4/ntvfs/cifs_posix_cli/vfs_cifs_posix.c index 088d1644d3b..a61ac16669b 100644 --- a/source4/ntvfs/cifs_posix_cli/vfs_cifs_posix.c +++ b/source4/ntvfs/cifs_posix_cli/vfs_cifs_posix.c @@ -39,7 +39,7 @@ #define O_DIRECTORY 0 #endif -#define CHECK_READ_ONLY(req) do { if (share_bool_option(ntvfs->ctx->config, SHARE_READONLY, True)) return NT_STATUS_ACCESS_DENIED; } while (0) +#define CHECK_READ_ONLY(req) do { if (share_bool_option(ntvfs->ctx->config, SHARE_READONLY, true)) return NT_STATUS_ACCESS_DENIED; } while (0) /* connect to a share - used when a tree_connect operation comes @@ -311,7 +311,7 @@ static NTSTATUS cifspsx_open(struct ntvfs_module_context *ntvfs, int fd, flags; struct cifspsx_file *f; int create_flags, rdwr_flags; - BOOL readonly; + bool readonly; NTSTATUS status; struct ntvfs_handle *handle; @@ -829,7 +829,7 @@ static NTSTATUS cifspsx_lpq(struct ntvfs_module_context *ntvfs, static NTSTATUS cifspsx_search_first(struct ntvfs_module_context *ntvfs, struct ntvfs_request *req, union smb_search_first *io, void *search_private, - BOOL (*callback)(void *, const union smb_search_data *)) + bool (*callback)(void *, const union smb_search_data *)) { struct cifspsx_dir *dir; int i; @@ -903,7 +903,7 @@ static NTSTATUS cifspsx_search_first(struct ntvfs_module_context *ntvfs, static NTSTATUS cifspsx_search_next(struct ntvfs_module_context *ntvfs, struct ntvfs_request *req, union smb_search_next *io, void *search_private, - BOOL (*callback)(void *, const union smb_search_data *)) + bool (*callback)(void *, const union smb_search_data *)) { struct cifspsx_dir *dir; int i; diff --git a/source4/ntvfs/common/brlock_tdb.c b/source4/ntvfs/common/brlock_tdb.c index 0bca9d2590a..2b81521a2c8 100644 --- a/source4/ntvfs/common/brlock_tdb.c +++ b/source4/ntvfs/common/brlock_tdb.c @@ -126,7 +126,7 @@ static struct brl_handle *brl_tdb_create_handle(TALLOC_CTX *mem_ctx, struct ntvf /* see if two locking contexts are equal */ -static BOOL brl_tdb_same_context(struct lock_context *ctx1, struct lock_context *ctx2) +static bool brl_tdb_same_context(struct lock_context *ctx1, struct lock_context *ctx2) { return (cluster_id_equal(&ctx1->server, &ctx2->server) && ctx1->smbpid == ctx2->smbpid && @@ -139,7 +139,7 @@ static BOOL brl_tdb_same_context(struct lock_context *ctx1, struct lock_context lck1 is the existing lock. lck2 is the new lock we are looking at adding */ -static BOOL brl_tdb_overlap(struct lock_struct *lck1, +static bool brl_tdb_overlap(struct lock_struct *lck1, struct lock_struct *lck2) { /* this extra check is not redundent - it copes with locks @@ -147,12 +147,12 @@ static BOOL brl_tdb_overlap(struct lock_struct *lck1, if (lck1->size != 0 && lck1->start == lck2->start && lck1->size == lck2->size) { - return True; + return true; } if (lck1->start >= (lck2->start+lck2->size) || lck2->start >= (lck1->start+lck1->size)) { - return False; + return false; } /* we have a conflict. Now check to see if lck1 really still @@ -163,28 +163,28 @@ static BOOL brl_tdb_overlap(struct lock_struct *lck1, * hasn't been written yet. When clustered this will need to * call into ctdb */ - return True; + return true; } /* See if lock2 can be added when lock1 is in place. */ -static BOOL brl_tdb_conflict(struct lock_struct *lck1, +static bool brl_tdb_conflict(struct lock_struct *lck1, struct lock_struct *lck2) { /* pending locks don't conflict with anything */ if (lck1->lock_type >= PENDING_READ_LOCK || lck2->lock_type >= PENDING_READ_LOCK) { - return False; + return false; } if (lck1->lock_type == READ_LOCK && lck2->lock_type == READ_LOCK) { - return False; + return false; } if (brl_tdb_same_context(&lck1->context, &lck2->context) && lck2->lock_type == READ_LOCK && lck1->ntvfs == lck2->ntvfs) { - return False; + return false; } return brl_tdb_overlap(lck1, lck2); @@ -195,16 +195,16 @@ static BOOL brl_tdb_conflict(struct lock_struct *lck1, Check to see if this lock conflicts, but ignore our own locks on the same fnum only. */ -static BOOL brl_tdb_conflict_other(struct lock_struct *lck1, struct lock_struct *lck2) +static bool brl_tdb_conflict_other(struct lock_struct *lck1, struct lock_struct *lck2) { /* pending locks don't conflict with anything */ if (lck1->lock_type >= PENDING_READ_LOCK || lck2->lock_type >= PENDING_READ_LOCK) { - return False; + return false; } if (lck1->lock_type == READ_LOCK && lck2->lock_type == READ_LOCK) - return False; + return false; /* * note that incoming write calls conflict with existing READ @@ -214,7 +214,7 @@ static BOOL brl_tdb_conflict_other(struct lock_struct *lck1, struct lock_struct if (brl_tdb_same_context(&lck1->context, &lck2->context) && lck1->ntvfs == lck2->ntvfs && (lck2->lock_type == READ_LOCK || lck1->lock_type == WRITE_LOCK)) { - return False; + return false; } return brl_tdb_overlap(lck1, lck2); diff --git a/source4/ntvfs/common/notify.c b/source4/ntvfs/common/notify.c index 0d36a20a60c..0214c39b2d7 100644 --- a/source4/ntvfs/common/notify.c +++ b/source4/ntvfs/common/notify.c @@ -58,7 +58,7 @@ struct notify_list { #define NOTIFY_KEY "notify array" #define NOTIFY_ENABLE "notify:enable" -#define NOTIFY_ENABLE_DEFAULT True +#define NOTIFY_ENABLE_DEFAULT true static NTSTATUS notify_remove_all(struct notify_context *notify); static void notify_handler(struct messaging_context *msg_ctx, void *private_data, @@ -86,7 +86,7 @@ struct notify_context *notify_init(TALLOC_CTX *mem_ctx, struct server_id server, { struct notify_context *notify; - if (share_bool_option(scfg, NOTIFY_ENABLE, NOTIFY_ENABLE_DEFAULT) != True) { + if (share_bool_option(scfg, NOTIFY_ENABLE, NOTIFY_ENABLE_DEFAULT) != true) { return NULL; } diff --git a/source4/ntvfs/common/opendb.c b/source4/ntvfs/common/opendb.c index 112de1d7d44..59990d2fc14 100644 --- a/source4/ntvfs/common/opendb.c +++ b/source4/ntvfs/common/opendb.c @@ -91,7 +91,7 @@ _PUBLIC_ struct odb_lock *odb_lock(TALLOC_CTX *mem_ctx, */ _PUBLIC_ NTSTATUS odb_open_file(struct odb_lock *lck, void *file_handle, uint32_t stream_id, uint32_t share_access, - uint32_t access_mask, BOOL delete_on_close, + uint32_t access_mask, bool delete_on_close, const char *path, uint32_t oplock_level, uint32_t *oplock_granted) { @@ -139,7 +139,7 @@ _PUBLIC_ NTSTATUS odb_rename(struct odb_lock *lck, const char *path) /* update delete on close flag on an open file */ -_PUBLIC_ NTSTATUS odb_set_delete_on_close(struct odb_lock *lck, BOOL del_on_close) +_PUBLIC_ NTSTATUS odb_set_delete_on_close(struct odb_lock *lck, bool del_on_close) { return ops->odb_set_delete_on_close(lck, del_on_close); } @@ -149,7 +149,7 @@ _PUBLIC_ NTSTATUS odb_set_delete_on_close(struct odb_lock *lck, BOOL del_on_clos people still have the file open */ _PUBLIC_ NTSTATUS odb_get_delete_on_close(struct odb_context *odb, - DATA_BLOB *key, BOOL *del_on_close, + DATA_BLOB *key, bool *del_on_close, int *open_count, char **path) { return ops->odb_get_delete_on_close(odb, key, del_on_close, open_count, path); diff --git a/source4/ntvfs/common/opendb_tdb.c b/source4/ntvfs/common/opendb_tdb.c index 60ab11b96a5..a037e7e47ea 100644 --- a/source4/ntvfs/common/opendb_tdb.c +++ b/source4/ntvfs/common/opendb_tdb.c @@ -52,7 +52,7 @@ struct odb_context { struct tdb_wrap *w; struct ntvfs_context *ntvfs_ctx; - BOOL oplocks; + bool oplocks; }; /* @@ -266,7 +266,7 @@ static NTSTATUS odb_oplock_break_send(struct odb_context *odb, struct opendb_ent */ static NTSTATUS odb_tdb_open_file(struct odb_lock *lck, void *file_handle, uint32_t stream_id, uint32_t share_access, - uint32_t access_mask, BOOL delete_on_close, + uint32_t access_mask, bool delete_on_close, const char *path, uint32_t oplock_level, uint32_t *oplock_granted) { @@ -276,7 +276,7 @@ static NTSTATUS odb_tdb_open_file(struct odb_lock *lck, void *file_handle, struct opendb_file file; NTSTATUS status; - if (odb->oplocks == False) { + if (odb->oplocks == false) { oplock_level = OPLOCK_NONE; } @@ -407,7 +407,7 @@ static NTSTATUS odb_tdb_close_file(struct odb_lock *lck, void *file_handle) if (file_handle == file.entries[i].file_handle && cluster_id_equal(&odb->ntvfs_ctx->server_id, &file.entries[i].server)) { if (file.entries[i].delete_on_close) { - file.delete_on_close = True; + file.delete_on_close = true; } if (i < file.num_entries-1) { memmove(file.entries+i, file.entries+i+1, @@ -494,7 +494,7 @@ static NTSTATUS odb_tdb_rename(struct odb_lock *lck, const char *path) /* update delete on close flag on an open file */ -static NTSTATUS odb_tdb_set_delete_on_close(struct odb_lock *lck, BOOL del_on_close) +static NTSTATUS odb_tdb_set_delete_on_close(struct odb_lock *lck, bool del_on_close) { NTSTATUS status; struct opendb_file file; @@ -512,7 +512,7 @@ static NTSTATUS odb_tdb_set_delete_on_close(struct odb_lock *lck, BOOL del_on_cl people still have the file open */ static NTSTATUS odb_tdb_get_delete_on_close(struct odb_context *odb, - DATA_BLOB *key, BOOL *del_on_close, + DATA_BLOB *key, bool *del_on_close, int *open_count, char **path) { NTSTATUS status; @@ -525,7 +525,7 @@ static NTSTATUS odb_tdb_get_delete_on_close(struct odb_context *odb, status = odb_pull_record(lck, &file); if (NT_STATUS_EQUAL(NT_STATUS_OBJECT_NAME_NOT_FOUND, status)) { talloc_free(lck); - (*del_on_close) = False; + (*del_on_close) = false; return NT_STATUS_OK; } if (!NT_STATUS_IS_OK(status)) { @@ -541,7 +541,7 @@ static NTSTATUS odb_tdb_get_delete_on_close(struct odb_context *odb, *path = talloc_strdup(odb, file.path); NT_STATUS_HAVE_NO_MEMORY(*path); if (file.num_entries == 1 && file.entries[0].delete_on_close) { - (*del_on_close) = True; + (*del_on_close) = true; } } diff --git a/source4/ntvfs/ipc/vfs_ipc.c b/source4/ntvfs/ipc/vfs_ipc.c index fbac82a3057..fc3c74ca6c7 100644 --- a/source4/ntvfs/ipc/vfs_ipc.c +++ b/source4/ntvfs/ipc/vfs_ipc.c @@ -669,7 +669,7 @@ static NTSTATUS ipc_lpq(struct ntvfs_module_context *ntvfs, static NTSTATUS ipc_search_first(struct ntvfs_module_context *ntvfs, struct ntvfs_request *req, union smb_search_first *io, void *search_private, - BOOL (*callback)(void *, const union smb_search_data *)) + bool (*callback)(void *, const union smb_search_data *)) { return NT_STATUS_ACCESS_DENIED; } @@ -680,7 +680,7 @@ static NTSTATUS ipc_search_first(struct ntvfs_module_context *ntvfs, static NTSTATUS ipc_search_next(struct ntvfs_module_context *ntvfs, struct ntvfs_request *req, union smb_search_next *io, void *search_private, - BOOL (*callback)(void *, const union smb_search_data *)) + bool (*callback)(void *, const union smb_search_data *)) { return NT_STATUS_ACCESS_DENIED; } diff --git a/source4/ntvfs/nbench/vfs_nbench.c b/source4/ntvfs/nbench/vfs_nbench.c index 9379419c50d..987227a0b7d 100644 --- a/source4/ntvfs/nbench/vfs_nbench.c +++ b/source4/ntvfs/nbench/vfs_nbench.c @@ -841,7 +841,7 @@ static void nbench_search_first_send(struct ntvfs_request *req) static NTSTATUS nbench_search_first(struct ntvfs_module_context *ntvfs, struct ntvfs_request *req, union smb_search_first *io, void *search_private, - BOOL (*callback)(void *, const union smb_search_data *)) + bool (*callback)(void *, const union smb_search_data *)) { NTSTATUS status; @@ -863,7 +863,7 @@ static void nbench_search_next_send(struct ntvfs_request *req) static NTSTATUS nbench_search_next(struct ntvfs_module_context *ntvfs, struct ntvfs_request *req, union smb_search_next *io, void *search_private, - BOOL (*callback)(void *, const union smb_search_data *)) + bool (*callback)(void *, const union smb_search_data *)) { NTSTATUS status; diff --git a/source4/ntvfs/ntvfs_base.c b/source4/ntvfs/ntvfs_base.c index c837e5898b7..20197a4ba9f 100644 --- a/source4/ntvfs/ntvfs_base.c +++ b/source4/ntvfs/ntvfs_base.c @@ -113,7 +113,7 @@ _PUBLIC_ const struct ntvfs_critical_sizes *ntvfs_interface_version(void) return &critical_sizes; } -_PUBLIC_ BOOL ntvfs_interface_differs(const struct ntvfs_critical_sizes *const iface) +_PUBLIC_ bool ntvfs_interface_differs(const struct ntvfs_critical_sizes *const iface) { /* The comparison would be easier with memcmp, but compiler-interset * alignment padding is not guaranteed to be zeroed. @@ -122,28 +122,28 @@ _PUBLIC_ BOOL ntvfs_interface_differs(const struct ntvfs_critical_sizes *const i #define FIELD_DIFFERS(field) (iface->field != critical_sizes.field) if (FIELD_DIFFERS(interface_version)) - return True; + return true; if (FIELD_DIFFERS(sizeof_ntvfs_critical_sizes)) - return True; + return true; if (FIELD_DIFFERS(sizeof_ntvfs_context)) - return True; + return true; if (FIELD_DIFFERS(sizeof_ntvfs_module_context)) - return True; + return true; if (FIELD_DIFFERS(sizeof_ntvfs_ops)) - return True; + return true; if (FIELD_DIFFERS(sizeof_ntvfs_async_state)) - return True; + return true; if (FIELD_DIFFERS(sizeof_ntvfs_request)) - return True; + return true; /* Versions match. */ - return False; + return false; #undef FIELD_DIFFERS } diff --git a/source4/ntvfs/ntvfs_generic.c b/source4/ntvfs/ntvfs_generic.c index 8ed99ce3f18..7708f4fc807 100644 --- a/source4/ntvfs/ntvfs_generic.c +++ b/source4/ntvfs/ntvfs_generic.c @@ -116,21 +116,21 @@ static NTSTATUS ntvfs_map_async_finish(struct ntvfs_request *req, NTSTATUS statu see if a filename ends in EXE COM DLL or SYM. This is needed for the DENY_DOS mapping for OpenX */ -BOOL is_exe_filename(const char *fname) +bool is_exe_filename(const char *fname) { char *p; p = strrchr(fname, '.'); if (!p) { - return False; + return false; } p++; if (strcasecmp(p, "EXE") == 0 || strcasecmp(p, "COM") == 0 || strcasecmp(p, "DLL") == 0 || strcasecmp(p, "SYM") == 0) { - return True; + return true; } - return False; + return false; } @@ -1247,7 +1247,7 @@ _PUBLIC_ NTSTATUS ntvfs_map_read(struct ntvfs_module_context *ntvfs, } rd2->readx.level = RAW_READ_READX; - rd2->readx.in.read_for_execute = False; + rd2->readx.in.read_for_execute = false; switch (rd->generic.level) { case RAW_READ_READX: diff --git a/source4/ntvfs/ntvfs_interface.c b/source4/ntvfs/ntvfs_interface.c index 74fb815359d..3bd2859388e 100644 --- a/source4/ntvfs/ntvfs_interface.c +++ b/source4/ntvfs/ntvfs_interface.c @@ -149,7 +149,7 @@ _PUBLIC_ NTSTATUS ntvfs_copy(struct ntvfs_request *req, struct smb_copy *cp) /* directory search */ _PUBLIC_ NTSTATUS ntvfs_search_first(struct ntvfs_request *req, union smb_search_first *io, void *private, - BOOL ntvfs_callback(void *private, const union smb_search_data *file)) + bool ntvfs_callback(void *private, const union smb_search_data *file)) { struct ntvfs_module_context *ntvfs = req->ctx->modules; if (!ntvfs->ops->search_first) { @@ -159,7 +159,7 @@ _PUBLIC_ NTSTATUS ntvfs_search_first(struct ntvfs_request *req, union smb_search } _PUBLIC_ NTSTATUS ntvfs_search_next(struct ntvfs_request *req, union smb_search_next *io, void *private, - BOOL ntvfs_callback(void *private, const union smb_search_data *file)) + bool ntvfs_callback(void *private, const union smb_search_data *file)) { struct ntvfs_module_context *ntvfs = req->ctx->modules; if (!ntvfs->ops->search_next) { @@ -469,7 +469,7 @@ _PUBLIC_ NTSTATUS ntvfs_next_open(struct ntvfs_module_context *ntvfs, _PUBLIC_ NTSTATUS ntvfs_next_search_first(struct ntvfs_module_context *ntvfs, struct ntvfs_request *req, union smb_search_first *io, void *private, - BOOL (*callback)(void *private, const union smb_search_data *file)) + bool (*callback)(void *private, const union smb_search_data *file)) { if (!ntvfs->next || !ntvfs->next->ops->search_first) { return NT_STATUS_NOT_IMPLEMENTED; @@ -480,7 +480,7 @@ _PUBLIC_ NTSTATUS ntvfs_next_search_first(struct ntvfs_module_context *ntvfs, _PUBLIC_ NTSTATUS ntvfs_next_search_next(struct ntvfs_module_context *ntvfs, struct ntvfs_request *req, union smb_search_next *io, void *private, - BOOL (*callback)(void *private, const union smb_search_data *file)) + bool (*callback)(void *private, const union smb_search_data *file)) { if (!ntvfs->next || !ntvfs->next->ops->search_next) { return NT_STATUS_NOT_IMPLEMENTED; diff --git a/source4/ntvfs/ntvfs_util.c b/source4/ntvfs/ntvfs_util.c index 3158bdf1fd2..7432ac2c13d 100644 --- a/source4/ntvfs/ntvfs_util.c +++ b/source4/ntvfs/ntvfs_util.c @@ -112,7 +112,7 @@ _PUBLIC_ NTSTATUS ntvfs_handle_set_backend_data(struct ntvfs_handle *h, TALLOC_CTX *private_data) { struct ntvfs_handle_data *d; - BOOL first_time = h->backend_data?False:True; + bool first_time = h->backend_data?false:true; for (d=h->backend_data; d; d = d->next) { if (d->owner != ntvfs) continue; diff --git a/source4/ntvfs/posix/pvfs_acl.c b/source4/ntvfs/posix/pvfs_acl.c index 4302b7f890f..f19dc1f41fa 100644 --- a/source4/ntvfs/posix/pvfs_acl.c +++ b/source4/ntvfs/posix/pvfs_acl.c @@ -365,7 +365,7 @@ NTSTATUS pvfs_acl_query(struct pvfs_state *pvfs, /* check the read only bit against any of the write access bits */ -static BOOL pvfs_read_only(struct pvfs_state *pvfs, uint32_t access_mask) +static bool pvfs_read_only(struct pvfs_state *pvfs, uint32_t access_mask) { if ((pvfs->flags & PVFS_FLAG_READONLY) && (access_mask & (SEC_FILE_WRITE_DATA | @@ -376,9 +376,9 @@ static BOOL pvfs_read_only(struct pvfs_state *pvfs, uint32_t access_mask) SEC_STD_WRITE_DAC | SEC_STD_WRITE_OWNER | SEC_DIR_DELETE_CHILD))) { - return True; + return true; } - return False; + return false; } /* @@ -548,24 +548,24 @@ NTSTATUS pvfs_access_check_parent(struct pvfs_state *pvfs, /* determine if an ACE is inheritable */ -static BOOL pvfs_inheritable_ace(struct pvfs_state *pvfs, +static bool pvfs_inheritable_ace(struct pvfs_state *pvfs, const struct security_ace *ace, - BOOL container) + bool container) { if (!container) { return (ace->flags & SEC_ACE_FLAG_OBJECT_INHERIT) != 0; } if (ace->flags & SEC_ACE_FLAG_CONTAINER_INHERIT) { - return True; + return true; } if ((ace->flags & SEC_ACE_FLAG_OBJECT_INHERIT) && !(ace->flags & SEC_ACE_FLAG_NO_PROPAGATE_INHERIT)) { - return True; + return true; } - return False; + return false; } /* @@ -576,7 +576,7 @@ static BOOL pvfs_inheritable_ace(struct pvfs_state *pvfs, static NTSTATUS pvfs_acl_inherit_aces(struct pvfs_state *pvfs, struct security_descriptor *parent_sd, struct security_descriptor *sd, - BOOL container) + bool container) { int i; @@ -663,7 +663,7 @@ NTSTATUS pvfs_acl_inherit(struct pvfs_state *pvfs, NTSTATUS status; struct pvfs_filename *parent; struct security_descriptor *parent_sd, *sd; - BOOL container; + bool container; /* form the parents path */ status = pvfs_resolve_parent(pvfs, req, name, &parent); @@ -716,7 +716,7 @@ NTSTATUS pvfs_acl_inherit(struct pvfs_state *pvfs, sd->type |= SEC_DESC_DACL_PRESENT; - container = (name->dos.attrib & FILE_ATTRIBUTE_DIRECTORY) ? True:False; + container = (name->dos.attrib & FILE_ATTRIBUTE_DIRECTORY) ? true:false; /* fill in the aces from the parent */ status = pvfs_acl_inherit_aces(pvfs, parent_sd, sd, container); diff --git a/source4/ntvfs/posix/pvfs_dirlist.c b/source4/ntvfs/posix/pvfs_dirlist.c index e54cb847f52..77f19c35850 100644 --- a/source4/ntvfs/posix/pvfs_dirlist.c +++ b/source4/ntvfs/posix/pvfs_dirlist.c @@ -33,13 +33,13 @@ struct name_cache_entry { struct pvfs_dir { struct pvfs_state *pvfs; - BOOL no_wildcard; + bool no_wildcard; char *single_name; const char *pattern; off_t offset; DIR *dir; const char *unix_path; - BOOL end_of_search; + bool end_of_search; struct name_cache_entry *name_cache; uint32_t name_cache_index; }; @@ -69,8 +69,8 @@ static NTSTATUS pvfs_list_no_wildcard(struct pvfs_state *pvfs, struct pvfs_filen } dir->pvfs = pvfs; - dir->no_wildcard = True; - dir->end_of_search = False; + dir->no_wildcard = true; + dir->end_of_search = false; dir->unix_path = talloc_strdup(dir, name->full_name); if (!dir->unix_path) { return NT_STATUS_NO_MEMORY; @@ -145,8 +145,8 @@ NTSTATUS pvfs_list_start(struct pvfs_state *pvfs, struct pvfs_filename *name, } dir->pvfs = pvfs; - dir->no_wildcard = False; - dir->end_of_search = False; + dir->no_wildcard = false; + dir->end_of_search = false; dir->offset = DIR_OFFSET_DOT; dir->name_cache = talloc_zero_array(dir, struct name_cache_entry, @@ -187,7 +187,7 @@ const char *pvfs_list_next(struct pvfs_dir *dir, off_t *ofs) /* non-wildcard searches are easy */ if (dir->no_wildcard) { - dir->end_of_search = True; + dir->end_of_search = true; if (*ofs != 0) return NULL; (*ofs)++; return dir->single_name; @@ -246,7 +246,7 @@ const char *pvfs_list_next(struct pvfs_dir *dir, off_t *ofs) return dname; } - dir->end_of_search = True; + dir->end_of_search = true; return NULL; } @@ -259,9 +259,9 @@ const char *pvfs_list_unix_path(struct pvfs_dir *dir) } /* - return True if end of search has been reached + return true if end of search has been reached */ -BOOL pvfs_list_eos(struct pvfs_dir *dir, off_t ofs) +bool pvfs_list_eos(struct pvfs_dir *dir, off_t ofs) { return dir->end_of_search; } @@ -274,7 +274,7 @@ NTSTATUS pvfs_list_seek(struct pvfs_dir *dir, const char *name, off_t *ofs) struct dirent *de; int i; - dir->end_of_search = False; + dir->end_of_search = false; if (ISDOT(name)) { dir->offset = DIR_OFFSET_DOTDOT; @@ -313,7 +313,7 @@ NTSTATUS pvfs_list_seek(struct pvfs_dir *dir, const char *name, off_t *ofs) } } - dir->end_of_search = True; + dir->end_of_search = true; return NT_STATUS_OBJECT_NAME_NOT_FOUND; } @@ -326,7 +326,7 @@ NTSTATUS pvfs_list_seek_ofs(struct pvfs_dir *dir, uint32_t resume_key, off_t *of struct dirent *de; int i; - dir->end_of_search = False; + dir->end_of_search = false; if (resume_key == DIR_OFFSET_DOT) { *ofs = DIR_OFFSET_DOTDOT; @@ -341,7 +341,7 @@ NTSTATUS pvfs_list_seek_ofs(struct pvfs_dir *dir, uint32_t resume_key, off_t *of if (resume_key == DIR_OFFSET_BASE) { rewinddir(dir->dir); if ((de=readdir(dir->dir)) == NULL) { - dir->end_of_search = True; + dir->end_of_search = true; return NT_STATUS_OBJECT_NAME_NOT_FOUND; } *ofs = telldir(dir->dir) + DIR_OFFSET_BASE; @@ -374,7 +374,7 @@ NTSTATUS pvfs_list_seek_ofs(struct pvfs_dir *dir, uint32_t resume_key, off_t *of } } - dir->end_of_search = True; + dir->end_of_search = true; return NT_STATUS_OBJECT_NAME_NOT_FOUND; } @@ -383,21 +383,21 @@ NTSTATUS pvfs_list_seek_ofs(struct pvfs_dir *dir, uint32_t resume_key, off_t *of /* see if a directory is empty */ -BOOL pvfs_directory_empty(struct pvfs_state *pvfs, struct pvfs_filename *name) +bool pvfs_directory_empty(struct pvfs_state *pvfs, struct pvfs_filename *name) { struct dirent *de; DIR *dir = opendir(name->full_name); if (dir == NULL) { - return True; + return true; } while ((de = readdir(dir))) { if (!ISDOT(de->d_name) && !ISDOTDOT(de->d_name)) { closedir(dir); - return False; + return false; } } closedir(dir); - return True; + return true; } diff --git a/source4/ntvfs/posix/pvfs_lock.c b/source4/ntvfs/posix/pvfs_lock.c index 989e3c56a4f..b9bb58c71de 100644 --- a/source4/ntvfs/posix/pvfs_lock.c +++ b/source4/ntvfs/posix/pvfs_lock.c @@ -104,7 +104,7 @@ static void pvfs_pending_lock_continue(void *private, enum pvfs_wait_notice reas enum brl_type rw; NTSTATUS status; int i; - BOOL timed_out; + bool timed_out; timed_out = (reason != PVFS_WAIT_EVENT); @@ -136,7 +136,7 @@ static void pvfs_pending_lock_continue(void *private, enum pvfs_wait_notice reas } if (NT_STATUS_IS_OK(status)) { f->lock_count++; - timed_out = False; + timed_out = false; } /* if we have failed and timed out, or succeeded, then we diff --git a/source4/ntvfs/posix/pvfs_notify.c b/source4/ntvfs/posix/pvfs_notify.c index 3e289a09485..210f9493956 100644 --- a/source4/ntvfs/posix/pvfs_notify.c +++ b/source4/ntvfs/posix/pvfs_notify.c @@ -58,7 +58,7 @@ static void pvfs_notify_send_next(struct event_context *ev, struct timed_event * send a reply to a pending notify request */ static void pvfs_notify_send(struct pvfs_notify_buffer *notify_buffer, - NTSTATUS status, BOOL immediate) + NTSTATUS status, bool immediate) { struct notify_pending *pending = notify_buffer->pending; struct ntvfs_request *req; @@ -118,7 +118,7 @@ static int pvfs_notify_destructor(struct pvfs_notify_buffer *n) { notify_remove(n->f->pvfs->notify_context, n); n->f->notify_buffer = NULL; - pvfs_notify_send(n, NT_STATUS_OK, True); + pvfs_notify_send(n, NT_STATUS_OK, true); return 0; } @@ -161,7 +161,7 @@ static void pvfs_notify_callback(void *private, const struct notify_event *ev) /* send what we have, unless its the first part of a rename */ if (ev->action != NOTIFY_ACTION_OLD_NAME) { - pvfs_notify_send(n, NT_STATUS_OK, True); + pvfs_notify_send(n, NT_STATUS_OK, true); } } @@ -169,7 +169,7 @@ static void pvfs_notify_callback(void *private, const struct notify_event *ev) setup a notify buffer on a directory handle */ static NTSTATUS pvfs_notify_setup(struct pvfs_state *pvfs, struct pvfs_file *f, - uint32_t buffer_size, uint32_t filter, BOOL recursive) + uint32_t buffer_size, uint32_t filter, bool recursive) { NTSTATUS status; struct notify_entry e; @@ -206,9 +206,9 @@ static void pvfs_notify_end(void *private, enum pvfs_wait_notice reason) struct pvfs_notify_buffer *notify_buffer = talloc_get_type(private, struct pvfs_notify_buffer); if (reason == PVFS_WAIT_CANCEL) { - pvfs_notify_send(notify_buffer, NT_STATUS_CANCELLED, False); + pvfs_notify_send(notify_buffer, NT_STATUS_CANCELLED, false); } else { - pvfs_notify_send(notify_buffer, NT_STATUS_OK, True); + pvfs_notify_send(notify_buffer, NT_STATUS_OK, true); } } @@ -277,7 +277,7 @@ NTSTATUS pvfs_notify(struct ntvfs_module_context *ntvfs, } req->async_states->state |= NTVFS_ASYNC_STATE_ASYNC; - pvfs_notify_send(f->notify_buffer, NT_STATUS_OK, False); + pvfs_notify_send(f->notify_buffer, NT_STATUS_OK, false); return NT_STATUS_OK; } diff --git a/source4/ntvfs/posix/pvfs_open.c b/source4/ntvfs/posix/pvfs_open.c index 269df13069d..8558f0476a9 100644 --- a/source4/ntvfs/posix/pvfs_open.c +++ b/source4/ntvfs/posix/pvfs_open.c @@ -186,7 +186,7 @@ static NTSTATUS pvfs_open_directory(struct pvfs_state *pvfs, uint32_t create_action; uint32_t access_mask = io->generic.in.access_mask; struct odb_lock *lck; - BOOL del_on_close; + bool del_on_close; uint32_t create_options; uint32_t share_access; @@ -268,14 +268,14 @@ static NTSTATUS pvfs_open_directory(struct pvfs_state *pvfs, f->handle->seek_offset = 0; f->handle->position = 0; f->handle->mode = 0; - f->handle->sticky_write_time = False; - f->handle->open_completed = False; + f->handle->sticky_write_time = false; + f->handle->open_completed = false; if ((create_options & NTCREATEX_OPTIONS_DELETE_ON_CLOSE) && pvfs_directory_empty(pvfs, f->handle->name)) { - del_on_close = True; + del_on_close = true; } else { - del_on_close = False; + del_on_close = false; } if (name->exists) { @@ -305,7 +305,7 @@ static NTSTATUS pvfs_open_directory(struct pvfs_state *pvfs, return status; } - f->handle->have_opendb_entry = True; + f->handle->have_opendb_entry = true; } DLIST_ADD(pvfs->files.list, f); @@ -357,7 +357,7 @@ static NTSTATUS pvfs_open_directory(struct pvfs_state *pvfs, goto cleanup_delete; } - f->handle->have_opendb_entry = True; + f->handle->have_opendb_entry = true; create_action = NTCREATEX_ACTION_CREATED; @@ -379,7 +379,7 @@ static NTSTATUS pvfs_open_directory(struct pvfs_state *pvfs, goto cleanup_delete; } - f->handle->open_completed = True; + f->handle->open_completed = true; io->generic.out.oplock_level = OPLOCK_NONE; io->generic.out.file.ntvfs = h; @@ -552,7 +552,7 @@ static NTSTATUS pvfs_create_file(struct pvfs_state *pvfs, uint32_t access_mask = io->generic.in.access_mask; mode_t mode; uint32_t attrib; - BOOL del_on_close; + bool del_on_close; struct pvfs_filename *parent; uint32_t oplock_level = OPLOCK_NONE, oplock_granted; @@ -656,9 +656,9 @@ static NTSTATUS pvfs_create_file(struct pvfs_state *pvfs, } if (create_options & NTCREATEX_OPTIONS_DELETE_ON_CLOSE) { - del_on_close = True; + del_on_close = true; } else { - del_on_close = False; + del_on_close = false; } if (pvfs->flags & PVFS_FLAG_FAKE_OPLOCKS) { @@ -702,9 +702,9 @@ static NTSTATUS pvfs_create_file(struct pvfs_state *pvfs, f->handle->seek_offset = 0; f->handle->position = 0; f->handle->mode = 0; - f->handle->have_opendb_entry = True; - f->handle->sticky_write_time = False; - f->handle->open_completed = False; + f->handle->have_opendb_entry = true; + f->handle->sticky_write_time = false; + f->handle->open_completed = false; DLIST_ADD(pvfs->files.list, f); @@ -733,7 +733,7 @@ static NTSTATUS pvfs_create_file(struct pvfs_state *pvfs, goto cleanup_delete; } - f->handle->open_completed = True; + f->handle->open_completed = true; notify_trigger(pvfs->notify_context, NOTIFY_ACTION_ADDED, @@ -989,8 +989,8 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs, uint32_t create_options; uint32_t share_access; uint32_t access_mask; - BOOL del_on_close; - BOOL stream_existed, stream_truncate=False; + bool del_on_close; + bool stream_existed, stream_truncate=false; uint32_t oplock_level = OPLOCK_NONE, oplock_granted; /* use the generic mapping code to avoid implementing all the @@ -1035,7 +1035,7 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs, if (name->stream_name == NULL) { flags = O_TRUNC; } else { - stream_truncate = True; + stream_truncate = true; } break; @@ -1053,7 +1053,7 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs, if (name->stream_name == NULL) { flags = O_TRUNC; } else { - stream_truncate = True; + stream_truncate = true; } break; @@ -1133,9 +1133,9 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs, f->handle->seek_offset = 0; f->handle->position = 0; f->handle->mode = 0; - f->handle->have_opendb_entry = False; - f->handle->sticky_write_time = False; - f->handle->open_completed = False; + f->handle->have_opendb_entry = false; + f->handle->sticky_write_time = false; + f->handle->open_completed = false; /* form the lock context used for byte range locking and opendb locking */ @@ -1172,9 +1172,9 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs, */ if (create_options & NTCREATEX_OPTIONS_DELETE_ON_CLOSE && req->ctx->protocol == PROTOCOL_SMB2) { - del_on_close = True; + del_on_close = true; } else { - del_on_close = False; + del_on_close = false; } if (pvfs->flags & PVFS_FLAG_FAKE_OPLOCKS) { @@ -1206,7 +1206,7 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs, oplock_granted = OPLOCK_BATCH; } - f->handle->have_opendb_entry = True; + f->handle->have_opendb_entry = true; if (access_mask & (SEC_FILE_WRITE_DATA | SEC_FILE_APPEND_DATA)) { flags |= O_RDWR; @@ -1273,7 +1273,7 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs, /* mark the open as having completed fully, so delete on close can now be used */ - f->handle->open_completed = True; + f->handle->open_completed = true; io->generic.out.oplock_level = oplock_granted; io->generic.out.file.ntvfs = h; @@ -1379,7 +1379,7 @@ NTSTATUS pvfs_exit(struct ntvfs_module_context *ntvfs, */ NTSTATUS pvfs_set_delete_on_close(struct pvfs_state *pvfs, struct ntvfs_request *req, - struct pvfs_file *f, BOOL del_on_close) + struct pvfs_file *f, bool del_on_close) { struct odb_lock *lck; NTSTATUS status; @@ -1532,17 +1532,17 @@ NTSTATUS pvfs_can_stat(struct pvfs_state *pvfs, /* determine if delete on close is set on */ -BOOL pvfs_delete_on_close_set(struct pvfs_state *pvfs, struct pvfs_file_handle *h, +bool pvfs_delete_on_close_set(struct pvfs_state *pvfs, struct pvfs_file_handle *h, int *open_count, char **path) { NTSTATUS status; - BOOL del_on_close; + bool del_on_close; status = odb_get_delete_on_close(pvfs->odb_context, &h->odb_locking_key, &del_on_close, open_count, path); if (!NT_STATUS_IS_OK(status)) { DEBUG(1,("WARNING: unable to determine delete on close status for open file\n")); - return False; + return false; } return del_on_close; diff --git a/source4/ntvfs/posix/pvfs_resolve.c b/source4/ntvfs/posix/pvfs_resolve.c index fae5ec432c2..8a7aa133511 100644 --- a/source4/ntvfs/posix/pvfs_resolve.c +++ b/source4/ntvfs/posix/pvfs_resolve.c @@ -121,7 +121,7 @@ static NTSTATUS pvfs_case_search(struct pvfs_state *pvfs, struct pvfs_filename * talloc_free(partial_name); partial_name = test_name; if (i == num_components - 1) { - name->exists = True; + name->exists = true; } continue; } @@ -166,7 +166,7 @@ static NTSTATUS pvfs_case_search(struct pvfs_state *pvfs, struct pvfs_filename * if (!name->exists) { if (stat(partial_name, &name->st) == 0) { - name->exists = True; + name->exists = true; } } @@ -229,7 +229,7 @@ static NTSTATUS pvfs_unix_path(struct pvfs_state *pvfs, const char *cifs_name, name->original_name = talloc_strdup(name, cifs_name); name->stream_name = NULL; name->stream_id = 0; - name->has_wildcard = False; + name->has_wildcard = false; while (*cifs_name == '\\') { cifs_name++; @@ -291,7 +291,7 @@ static NTSTATUS pvfs_unix_path(struct pvfs_state *pvfs, const char *cifs_name, if (!(flags & PVFS_RESOLVE_WILDCARD)) { return NT_STATUS_OBJECT_NAME_INVALID; } - name->has_wildcard = True; + name->has_wildcard = true; break; case '/': case '|': @@ -456,8 +456,8 @@ NTSTATUS pvfs_resolve_name(struct pvfs_state *pvfs, TALLOC_CTX *mem_ctx, return NT_STATUS_NO_MEMORY; } - (*name)->exists = False; - (*name)->stream_exists = False; + (*name)->exists = false; + (*name)->stream_exists = false; if (!(pvfs->fs_attribs & FS_ATTR_NAMED_STREAMS)) { flags &= ~PVFS_RESOLVE_STREAMS; @@ -519,7 +519,7 @@ NTSTATUS pvfs_resolve_name(struct pvfs_state *pvfs, TALLOC_CTX *mem_ctx, /* if we can stat() the full name now then we are done */ if (stat((*name)->full_name, &(*name)->st) == 0) { - (*name)->exists = True; + (*name)->exists = true; return pvfs_fill_dos_info(pvfs, *name, -1); } @@ -558,9 +558,9 @@ NTSTATUS pvfs_resolve_partial(struct pvfs_state *pvfs, TALLOC_CTX *mem_ctx, return NT_STATUS_OBJECT_NAME_NOT_FOUND; } - (*name)->exists = True; - (*name)->stream_exists = True; - (*name)->has_wildcard = False; + (*name)->exists = true; + (*name)->stream_exists = true; + (*name)->has_wildcard = false; (*name)->original_name = talloc_strdup(*name, fname); (*name)->stream_name = NULL; (*name)->stream_id = 0; @@ -608,7 +608,7 @@ NTSTATUS pvfs_resolve_name_fd(struct pvfs_state *pvfs, int fd, return NT_STATUS_UNEXPECTED_IO_ERROR; } - name->exists = True; + name->exists = true; return pvfs_fill_dos_info(pvfs, name, fd); } @@ -650,9 +650,9 @@ NTSTATUS pvfs_resolve_parent(struct pvfs_state *pvfs, TALLOC_CTX *mem_ctx, return NT_STATUS_OBJECT_NAME_NOT_FOUND; } - (*name)->exists = True; - (*name)->stream_exists = True; - (*name)->has_wildcard = False; + (*name)->exists = true; + (*name)->stream_exists = true; + (*name)->has_wildcard = false; /* we can't get the correct 'original_name', but for the purposes of this call this is close enough */ (*name)->original_name = talloc_reference(*name, child->original_name); diff --git a/source4/ntvfs/posix/pvfs_search.c b/source4/ntvfs/posix/pvfs_search.c index cefcee6155b..e47406dc09e 100644 --- a/source4/ntvfs/posix/pvfs_search.c +++ b/source4/ntvfs/posix/pvfs_search.c @@ -237,7 +237,7 @@ static NTSTATUS pvfs_search_fill(struct pvfs_state *pvfs, TALLOC_CTX *mem_ctx, enum smb_search_data_level level, uint_t *reply_count, void *search_private, - BOOL (*callback)(void *, const union smb_search_data *)) + bool (*callback)(void *, const union smb_search_data *)) { struct pvfs_dir *dir = search->dir; NTSTATUS status; @@ -313,7 +313,7 @@ static void pvfs_search_cleanup(struct pvfs_state *pvfs) static NTSTATUS pvfs_search_first_old(struct ntvfs_module_context *ntvfs, struct ntvfs_request *req, union smb_search_first *io, void *search_private, - BOOL (*callback)(void *, const union smb_search_data *)) + bool (*callback)(void *, const union smb_search_data *)) { struct pvfs_dir *dir; struct pvfs_state *pvfs = ntvfs->private_data; @@ -403,7 +403,7 @@ static NTSTATUS pvfs_search_first_old(struct ntvfs_module_context *ntvfs, static NTSTATUS pvfs_search_next_old(struct ntvfs_module_context *ntvfs, struct ntvfs_request *req, union smb_search_next *io, void *search_private, - BOOL (*callback)(void *, const union smb_search_data *)) + bool (*callback)(void *, const union smb_search_data *)) { struct pvfs_state *pvfs = ntvfs->private_data; struct pvfs_search_state *search; @@ -452,7 +452,7 @@ static NTSTATUS pvfs_search_next_old(struct ntvfs_module_context *ntvfs, static NTSTATUS pvfs_search_first_trans2(struct ntvfs_module_context *ntvfs, struct ntvfs_request *req, union smb_search_first *io, void *search_private, - BOOL (*callback)(void *, const union smb_search_data *)) + bool (*callback)(void *, const union smb_search_data *)) { struct pvfs_dir *dir; struct pvfs_state *pvfs = ntvfs->private_data; @@ -548,7 +548,7 @@ static NTSTATUS pvfs_search_first_trans2(struct ntvfs_module_context *ntvfs, static NTSTATUS pvfs_search_next_trans2(struct ntvfs_module_context *ntvfs, struct ntvfs_request *req, union smb_search_next *io, void *search_private, - BOOL (*callback)(void *, const union smb_search_data *)) + bool (*callback)(void *, const union smb_search_data *)) { struct pvfs_state *pvfs = ntvfs->private_data; struct pvfs_search_state *search; @@ -609,7 +609,7 @@ static NTSTATUS pvfs_search_next_trans2(struct ntvfs_module_context *ntvfs, static NTSTATUS pvfs_search_first_smb2(struct ntvfs_module_context *ntvfs, struct ntvfs_request *req, const struct smb2_find *io, void *search_private, - BOOL (*callback)(void *, const union smb_search_data *)) + bool (*callback)(void *, const union smb_search_data *)) { struct pvfs_dir *dir; struct pvfs_state *pvfs = ntvfs->private_data; @@ -712,7 +712,7 @@ static NTSTATUS pvfs_search_first_smb2(struct ntvfs_module_context *ntvfs, static NTSTATUS pvfs_search_next_smb2(struct ntvfs_module_context *ntvfs, struct ntvfs_request *req, const struct smb2_find *io, void *search_private, - BOOL (*callback)(void *, const union smb_search_data *)) + bool (*callback)(void *, const union smb_search_data *)) { struct pvfs_state *pvfs = ntvfs->private_data; struct pvfs_search_state *search; @@ -765,7 +765,7 @@ static NTSTATUS pvfs_search_next_smb2(struct ntvfs_module_context *ntvfs, NTSTATUS pvfs_search_first(struct ntvfs_module_context *ntvfs, struct ntvfs_request *req, union smb_search_first *io, void *search_private, - BOOL (*callback)(void *, const union smb_search_data *)) + bool (*callback)(void *, const union smb_search_data *)) { switch (io->generic.level) { case RAW_SEARCH_SEARCH: @@ -787,7 +787,7 @@ NTSTATUS pvfs_search_first(struct ntvfs_module_context *ntvfs, NTSTATUS pvfs_search_next(struct ntvfs_module_context *ntvfs, struct ntvfs_request *req, union smb_search_next *io, void *search_private, - BOOL (*callback)(void *, const union smb_search_data *)) + bool (*callback)(void *, const union smb_search_data *)) { switch (io->generic.level) { case RAW_SEARCH_SEARCH: diff --git a/source4/ntvfs/posix/pvfs_setfileinfo.c b/source4/ntvfs/posix/pvfs_setfileinfo.c index f20270c743f..340913cd4dd 100644 --- a/source4/ntvfs/posix/pvfs_setfileinfo.c +++ b/source4/ntvfs/posix/pvfs_setfileinfo.c @@ -323,7 +323,7 @@ NTSTATUS pvfs_setfileinfo(struct ntvfs_module_context *ntvfs, if (!null_nttime(info->basic_info.in.write_time)) { newstats.dos.write_time = info->basic_info.in.write_time; newstats.dos.flags |= XATTR_ATTRIB_FLAG_STICKY_WRITE_TIME; - h->sticky_write_time = True; + h->sticky_write_time = true; } if (!null_nttime(info->basic_info.in.change_time)) { newstats.dos.change_time = info->basic_info.in.change_time; diff --git a/source4/ntvfs/posix/pvfs_shortname.c b/source4/ntvfs/posix/pvfs_shortname.c index 141f5a30a1d..1cbe287a4bd 100644 --- a/source4/ntvfs/posix/pvfs_shortname.c +++ b/source4/ntvfs/posix/pvfs_shortname.c @@ -159,7 +159,7 @@ static const char *cache_lookup(struct pvfs_mangle_context *ctx, uint32_t hash) In this algorithm, mangled names use only pure ascii characters (no multi-byte) so we can avoid doing a UCS2 conversion */ -static BOOL is_mangled_component(struct pvfs_mangle_context *ctx, +static bool is_mangled_component(struct pvfs_mangle_context *ctx, const char *name, size_t len) { unsigned int i; @@ -168,19 +168,19 @@ static BOOL is_mangled_component(struct pvfs_mangle_context *ctx, /* check the length */ if (len > 12 || len < 8) - return False; + return false; /* the best distinguishing characteristic is the ~ */ if (name[6] != '~') - return False; + return false; /* check extension */ if (len > 8) { if (name[8] != '.') - return False; + return false; for (i=9; name[i] && i < len; i++) { if (! FLAG_CHECK(name[i], FLAG_ASCII)) { - return False; + return false; } } } @@ -188,23 +188,23 @@ static BOOL is_mangled_component(struct pvfs_mangle_context *ctx, /* check lead characters */ for (i=0;imangle_prefix;i++) { if (! FLAG_CHECK(name[i], FLAG_ASCII)) { - return False; + return false; } } /* check rest of hash */ if (! FLAG_CHECK(name[7], FLAG_BASECHAR)) { - return False; + return false; } for (i=ctx->mangle_prefix;i<6;i++) { if (! FLAG_CHECK(name[i], FLAG_BASECHAR)) { - return False; + return false; } } M_DEBUG(10,("is_mangled_component %s (len %u) -> yes\n", name, (unsigned int)len)); - return True; + return true; } @@ -220,7 +220,7 @@ static BOOL is_mangled_component(struct pvfs_mangle_context *ctx, directory separators. It should return true if any component is mangled */ -static BOOL is_mangled(struct pvfs_mangle_context *ctx, const char *name) +static bool is_mangled(struct pvfs_mangle_context *ctx, const char *name) { const char *p; const char *s; @@ -229,7 +229,7 @@ static BOOL is_mangled(struct pvfs_mangle_context *ctx, const char *name) for (s=name; (p=strchr(s, '/')); s=p+1) { if (is_mangled_component(ctx, s, PTR_DIFF(p, s))) { - return True; + return true; } } @@ -245,8 +245,8 @@ static BOOL is_mangled(struct pvfs_mangle_context *ctx, const char *name) simplifies things greatly (it means that we know the string won't get larger when converted from UNIX to DOS formats) */ -static BOOL is_8_3(struct pvfs_mangle_context *ctx, - const char *name, BOOL check_case, BOOL allow_wildcards) +static bool is_8_3(struct pvfs_mangle_context *ctx, + const char *name, bool check_case, bool allow_wildcards) { int len, i; char *dot_p; @@ -254,7 +254,7 @@ static BOOL is_8_3(struct pvfs_mangle_context *ctx, /* as a special case, the names '.' and '..' are allowable 8.3 names */ if (name[0] == '.') { if (!name[1] || (name[1] == '.' && !name[2])) { - return True; + return true; } } @@ -265,7 +265,7 @@ static BOOL is_8_3(struct pvfs_mangle_context *ctx, only be slower, it would be incorrect */ len = strlen(name); if (len > 12) - return False; + return false; /* find the '.'. Note that once again we use the non-multibyte function */ @@ -275,7 +275,7 @@ static BOOL is_8_3(struct pvfs_mangle_context *ctx, /* if the name doesn't contain a '.' then its length must be less than 8 */ if (len > 8) { - return False; + return false; } } else { int prefix_len, suffix_len; @@ -286,12 +286,12 @@ static BOOL is_8_3(struct pvfs_mangle_context *ctx, suffix_len = len - (prefix_len+1); if (prefix_len > 8 || suffix_len > 3 || suffix_len == 0) { - return False; + return false; } /* a 8.3 name cannot contain more than 1 '.' */ if (strchr(dot_p+1, '.')) { - return False; + return false; } } @@ -300,12 +300,12 @@ static BOOL is_8_3(struct pvfs_mangle_context *ctx, /* note that we may allow wildcard petterns! */ if (!FLAG_CHECK(name[i], FLAG_ASCII|(allow_wildcards ? FLAG_WILDCARD : 0)) && name[i] != '.') { - return False; + return false; } } /* it is a good 8.3 name */ - return True; + return true; } @@ -361,7 +361,7 @@ static char *check_cache(struct pvfs_mangle_context *ctx, /* look for a DOS reserved name */ -static BOOL is_reserved_name(struct pvfs_mangle_context *ctx, const char *name) +static bool is_reserved_name(struct pvfs_mangle_context *ctx, const char *name) { if (FLAG_CHECK(name[0], FLAG_POSSIBLE1) && FLAG_CHECK(name[1], FLAG_POSSIBLE2) && @@ -371,12 +371,12 @@ static BOOL is_reserved_name(struct pvfs_mangle_context *ctx, const char *name) int i; for (i=0; reserved_names[i]; i++) { if (strcasecmp(name, reserved_names[i]) == 0) { - return True; + return true; } } } - return False; + return false; } @@ -384,13 +384,13 @@ static BOOL is_reserved_name(struct pvfs_mangle_context *ctx, const char *name) See if a filename is a legal long filename. A filename ending in a '.' is not legal unless it's "." or "..". JRA. */ -static BOOL is_legal_name(struct pvfs_mangle_context *ctx, const char *name) +static bool is_legal_name(struct pvfs_mangle_context *ctx, const char *name) { while (*name) { size_t c_size; codepoint_t c = next_codepoint(name, &c_size); if (c == INVALID_CODEPOINT) { - return False; + return false; } /* all high chars are OK */ if (c >= 128) { @@ -398,12 +398,12 @@ static BOOL is_legal_name(struct pvfs_mangle_context *ctx, const char *name) continue; } if (FLAG_CHECK(c, FLAG_ILLEGAL)) { - return False; + return false; } name += c_size; } - return True; + return true; } /* @@ -418,7 +418,7 @@ static BOOL is_legal_name(struct pvfs_mangle_context *ctx, const char *name) return NULL if we don't need to do any conversion */ static char *name_map(struct pvfs_mangle_context *ctx, - const char *name, BOOL need83, BOOL cache83) + const char *name, bool need83, bool cache83) { char *dot_p; char lead_chars[7]; @@ -433,7 +433,7 @@ static char *name_map(struct pvfs_mangle_context *ctx, if (!is_reserved_name(ctx, name)) { /* if the name is already a valid 8.3 name then we don't need to do anything */ - if (is_8_3(ctx, name, False, False)) { + if (is_8_3(ctx, name, false, false)) { return NULL; } @@ -646,7 +646,7 @@ NTSTATUS pvfs_mangle_init(struct pvfs_state *pvfs) */ char *pvfs_short_name_component(struct pvfs_state *pvfs, const char *name) { - return name_map(pvfs->mangle_ctx, name, True, True); + return name_map(pvfs->mangle_ctx, name, true, true); } @@ -679,7 +679,7 @@ char *pvfs_mangled_lookup(struct pvfs_state *pvfs, TALLOC_CTX *mem_ctx, /* look for a DOS reserved name */ -BOOL pvfs_is_reserved_name(struct pvfs_state *pvfs, const char *name) +bool pvfs_is_reserved_name(struct pvfs_state *pvfs, const char *name) { return is_reserved_name(pvfs->mangle_ctx, name); } @@ -689,7 +689,7 @@ BOOL pvfs_is_reserved_name(struct pvfs_state *pvfs, const char *name) see if a component of a filename could be a mangled name from our mangling code */ -BOOL pvfs_is_mangled_component(struct pvfs_state *pvfs, const char *name) +bool pvfs_is_mangled_component(struct pvfs_state *pvfs, const char *name) { return is_mangled_component(pvfs->mangle_ctx, name, strlen(name)); } diff --git a/source4/ntvfs/posix/pvfs_streams.c b/source4/ntvfs/posix/pvfs_streams.c index a3b98feead4..7e6173ef2fa 100644 --- a/source4/ntvfs/posix/pvfs_streams.c +++ b/source4/ntvfs/posix/pvfs_streams.c @@ -79,7 +79,7 @@ NTSTATUS pvfs_stream_info(struct pvfs_state *pvfs, struct pvfs_filename *name, i /* the NULL stream always exists */ if (name->stream_name == NULL) { - name->stream_exists = True; + name->stream_exists = true; return NT_STATUS_OK; } @@ -99,7 +99,7 @@ NTSTATUS pvfs_stream_info(struct pvfs_state *pvfs, struct pvfs_filename *name, i if (strcasecmp_m(s->name, name->stream_name) == 0) { name->dos.alloc_size = pvfs_round_alloc_size(pvfs, s->alloc_size); name->st.st_size = s->size; - name->stream_exists = True; + name->stream_exists = true; talloc_free(streams); return NT_STATUS_OK; } @@ -109,7 +109,7 @@ NTSTATUS pvfs_stream_info(struct pvfs_state *pvfs, struct pvfs_filename *name, i name->dos.alloc_size = 0; name->st.st_size = 0; - name->stream_exists = False; + name->stream_exists = false; return NT_STATUS_OK; } diff --git a/source4/ntvfs/posix/pvfs_util.c b/source4/ntvfs/posix/pvfs_util.c index 895fcd96851..fd9724f7e2b 100644 --- a/source4/ntvfs/posix/pvfs_util.c +++ b/source4/ntvfs/posix/pvfs_util.c @@ -24,14 +24,14 @@ #include "vfs_posix.h" /* - return True if a string contains one of the CIFS wildcard characters + return true if a string contains one of the CIFS wildcard characters */ -BOOL pvfs_has_wildcard(const char *str) +bool pvfs_has_wildcard(const char *str) { if (strpbrk(str, "*?<>\"")) { - return True; + return true; } - return False; + return false; } /* diff --git a/source4/ntvfs/posix/pvfs_xattr.c b/source4/ntvfs/posix/pvfs_xattr.c index 61a95ec8240..ead3585e0d8 100644 --- a/source4/ntvfs/posix/pvfs_xattr.c +++ b/source4/ntvfs/posix/pvfs_xattr.c @@ -158,9 +158,9 @@ NTSTATUS pvfs_dosattrib_load(struct pvfs_state *pvfs, struct pvfs_filename *name struct xattr_DosInfo2 *info2; if (name->stream_name != NULL) { - name->stream_exists = False; + name->stream_exists = false; } else { - name->stream_exists = True; + name->stream_exists = true; } if (!(pvfs->flags & PVFS_FLAG_XATTR_ENABLE)) { diff --git a/source4/ntvfs/posix/vfs_posix.c b/source4/ntvfs/posix/vfs_posix.c index 2c414065cb2..208c9e62b70 100644 --- a/source4/ntvfs/posix/vfs_posix.c +++ b/source4/ntvfs/posix/vfs_posix.c @@ -56,7 +56,7 @@ static void pvfs_setup_options(struct pvfs_state *pvfs) pvfs->flags |= PVFS_FLAG_CI_FILESYSTEM; if (share_bool_option(scfg, PVFS_FAKE_OPLOCKS, PVFS_FAKE_OPLOCKS_DEFAULT)) pvfs->flags |= PVFS_FLAG_FAKE_OPLOCKS; - if (share_bool_option(scfg, PVFS_AIO, False)) + if (share_bool_option(scfg, PVFS_AIO, false)) pvfs->flags |= PVFS_FLAG_LINUX_AIO; /* file perm options */ @@ -234,7 +234,7 @@ static NTSTATUS pvfs_connect(struct ntvfs_module_context *ntvfs, #ifdef SIGXFSZ /* who had the stupid idea to generate a signal on a large file write instead of just failing it!? */ - BlockSignals(True, SIGXFSZ); + BlockSignals(true, SIGXFSZ); #endif return NT_STATUS_OK; diff --git a/source4/ntvfs/posix/vfs_posix.h b/source4/ntvfs/posix/vfs_posix.h index dcf082fd883..a660da329a9 100644 --- a/source4/ntvfs/posix/vfs_posix.h +++ b/source4/ntvfs/posix/vfs_posix.h @@ -237,8 +237,8 @@ enum pvfs_wait_notice {PVFS_WAIT_EVENT, PVFS_WAIT_TIMEOUT, PVFS_WAIT_CANCEL}; #define PVFS_ACL "posix:acl" #define PVFS_AIO "posix:aio" -#define PVFS_XATTR_DEFAULT True -#define PVFS_FAKE_OPLOCKS_DEFAULT False +#define PVFS_XATTR_DEFAULT true +#define PVFS_FAKE_OPLOCKS_DEFAULT false #define PVFS_SHARE_DELAY_DEFAULT 1000000 #define PVFS_ALLOCATION_ROUNDING_DEFAULT 512 #define PVFS_SEARCH_INACTIVITY_DEFAULT 300 diff --git a/source4/ntvfs/simple/vfs_simple.c b/source4/ntvfs/simple/vfs_simple.c index 95ea6d86476..dfc07f34832 100644 --- a/source4/ntvfs/simple/vfs_simple.c +++ b/source4/ntvfs/simple/vfs_simple.c @@ -38,7 +38,7 @@ #define O_DIRECTORY 0 #endif -#define CHECK_READ_ONLY(req) do { if (share_bool_option(ntvfs->ctx->config, SHARE_READONLY, True)) return NT_STATUS_ACCESS_DENIED; } while (0) +#define CHECK_READ_ONLY(req) do { if (share_bool_option(ntvfs->ctx->config, SHARE_READONLY, true)) return NT_STATUS_ACCESS_DENIED; } while (0) /* connect to a share - used when a tree_connect operation comes @@ -308,7 +308,7 @@ static NTSTATUS svfs_open(struct ntvfs_module_context *ntvfs, int fd, flags; struct svfs_file *f; int create_flags, rdwr_flags; - BOOL readonly; + bool readonly; NTSTATUS status; struct ntvfs_handle *handle; @@ -826,7 +826,7 @@ static NTSTATUS svfs_lpq(struct ntvfs_module_context *ntvfs, static NTSTATUS svfs_search_first(struct ntvfs_module_context *ntvfs, struct ntvfs_request *req, union smb_search_first *io, void *search_private, - BOOL (*callback)(void *, const union smb_search_data *)) + bool (*callback)(void *, const union smb_search_data *)) { struct svfs_dir *dir; int i; @@ -900,7 +900,7 @@ static NTSTATUS svfs_search_first(struct ntvfs_module_context *ntvfs, static NTSTATUS svfs_search_next(struct ntvfs_module_context *ntvfs, struct ntvfs_request *req, union smb_search_next *io, void *search_private, - BOOL (*callback)(void *, const union smb_search_data *)) + bool (*callback)(void *, const union smb_search_data *)) { struct svfs_dir *dir; int i; diff --git a/source4/ntvfs/sysdep/inotify.c b/source4/ntvfs/sysdep/inotify.c index 191212580b6..3fa710415b8 100644 --- a/source4/ntvfs/sysdep/inotify.c +++ b/source4/ntvfs/sysdep/inotify.c @@ -83,19 +83,19 @@ struct inotify_watch_context { see if a particular event from inotify really does match a requested notify event in SMB */ -static BOOL filter_match(struct inotify_watch_context *w, +static bool filter_match(struct inotify_watch_context *w, struct inotify_event *e) { if ((e->mask & w->mask) == 0) { /* this happens because inotify_add_watch() coalesces watches on the same path, oring their masks together */ - return False; + return false; } /* SMB separates the filters for files and directories */ if (e->mask & IN_ISDIR) { if ((w->filter & FILE_NOTIFY_CHANGE_DIR_NAME) == 0) { - return False; + return false; } } else { if ((e->mask & IN_ATTRIB) && @@ -104,18 +104,18 @@ static BOOL filter_match(struct inotify_watch_context *w, FILE_NOTIFY_CHANGE_LAST_ACCESS| FILE_NOTIFY_CHANGE_EA| FILE_NOTIFY_CHANGE_SECURITY))) { - return True; + return true; } if ((e->mask & IN_MODIFY) && (w->filter & FILE_NOTIFY_CHANGE_ATTRIBUTES)) { - return True; + return true; } if ((w->filter & FILE_NOTIFY_CHANGE_FILE_NAME) == 0) { - return False; + return false; } } - return True; + return true; } diff --git a/source4/ntvfs/sysdep/sys_notify.c b/source4/ntvfs/sysdep/sys_notify.c index a13d02c12e4..1664461d332 100644 --- a/source4/ntvfs/sysdep/sys_notify.c +++ b/source4/ntvfs/sysdep/sys_notify.c @@ -123,13 +123,13 @@ _PUBLIC_ NTSTATUS sys_notify_register(struct sys_notify_backend *backend) _PUBLIC_ NTSTATUS sys_notify_init(void) { - static BOOL initialized = False; + static bool initialized = false; init_module_fn static_init[] = STATIC_sys_notify_MODULES; init_module_fn *shared_init; if (initialized) return NT_STATUS_OK; - initialized = True; + initialized = true; shared_init = load_samba_modules(NULL, global_loadparm, "sys_notify"); diff --git a/source4/ntvfs/unixuid/vfs_unixuid.c b/source4/ntvfs/unixuid/vfs_unixuid.c index 74bc6309c18..0ad8a8501b6 100644 --- a/source4/ntvfs/unixuid/vfs_unixuid.c +++ b/source4/ntvfs/unixuid/vfs_unixuid.c @@ -591,7 +591,7 @@ static NTSTATUS unixuid_lpq(struct ntvfs_module_context *ntvfs, static NTSTATUS unixuid_search_first(struct ntvfs_module_context *ntvfs, struct ntvfs_request *req, union smb_search_first *io, void *search_private, - BOOL (*callback)(void *, const union smb_search_data *)) + bool (*callback)(void *, const union smb_search_data *)) { NTSTATUS status; @@ -604,7 +604,7 @@ static NTSTATUS unixuid_search_first(struct ntvfs_module_context *ntvfs, static NTSTATUS unixuid_search_next(struct ntvfs_module_context *ntvfs, struct ntvfs_request *req, union smb_search_next *io, void *search_private, - BOOL (*callback)(void *, const union smb_search_data *)) + bool (*callback)(void *, const union smb_search_data *)) { NTSTATUS status; diff --git a/source4/scripting/ejs/ejsnet/net_ctx.c b/source4/scripting/ejs/ejsnet/net_ctx.c index 5fdfe51887f..97a05ab88f6 100644 --- a/source4/scripting/ejs/ejsnet/net_ctx.c +++ b/source4/scripting/ejs/ejsnet/net_ctx.c @@ -166,9 +166,9 @@ static int ejs_net_join_domain(MprVarHandle eid, int argc, struct MprVar **argv) MprVar error_string = mprString(join->out.error_string); mprSetPropertyValue(argv[0], "error_string", error_string); - mpr_Return(eid, mprCreateBoolVar(False)); + mpr_Return(eid, mprCreateBoolVar(false)); } else { - mpr_Return(eid, mprCreateBoolVar(True)); + mpr_Return(eid, mprCreateBoolVar(true)); } talloc_free(mem_ctx); return 0; @@ -214,9 +214,9 @@ static int ejs_net_samsync_ldb(MprVarHandle eid, int argc, struct MprVar **argv) MprVar error_string = mprString(samsync->out.error_string); mprSetPropertyValue(argv[0], "error_string", error_string); - mpr_Return(eid, mprCreateBoolVar(False)); + mpr_Return(eid, mprCreateBoolVar(false)); } else { - mpr_Return(eid, mprCreateBoolVar(True)); + mpr_Return(eid, mprCreateBoolVar(true)); } talloc_free(mem_ctx); return 0; diff --git a/source4/scripting/ejs/ejsrpc.c b/source4/scripting/ejs/ejsrpc.c index a5654e0f00b..3769607949e 100644 --- a/source4/scripting/ejs/ejsrpc.c +++ b/source4/scripting/ejs/ejsrpc.c @@ -315,12 +315,12 @@ bool ejs_pull_null(struct ejs_rpc *ejs, struct MprVar *v, const char *name) { NTSTATUS status = mprGetVar(&v, name); if (!NT_STATUS_IS_OK(status)) { - return False; + return false; } if (v->type == MPR_TYPE_PTR && v->ptr == NULL) { - return True; + return true; } - return False; + return false; } /* diff --git a/source4/scripting/ejs/mprutil.c b/source4/scripting/ejs/mprutil.c index b8271d97c57..9143947fb84 100644 --- a/source4/scripting/ejs/mprutil.c +++ b/source4/scripting/ejs/mprutil.c @@ -134,7 +134,7 @@ struct MprVar mprString(const char *s) if (s == NULL) { return mprCreatePtrVar(NULL); } - return mprCreateStringVar(s, True); + return mprCreateStringVar(s, true); } /* diff --git a/source4/scripting/ejs/smbcalls_auth.c b/source4/scripting/ejs/smbcalls_auth.c index 44059d7537a..b4848d4323f 100644 --- a/source4/scripting/ejs/smbcalls_auth.c +++ b/source4/scripting/ejs/smbcalls_auth.c @@ -65,19 +65,19 @@ static int ejs_doauth(MprVarHandle eid, nt_status = auth_context_create(tmp_ctx, ev, msg, &auth_context); } if (!NT_STATUS_IS_OK(nt_status)) { - mprSetPropertyValue(auth, "result", mprCreateBoolVar(False)); + mprSetPropertyValue(auth, "result", mprCreateBoolVar(false)); mprSetPropertyValue(auth, "report", mprString("Auth System Failure")); goto done; } user_info = talloc(tmp_ctx, struct auth_usersupplied_info); if (!user_info) { - mprSetPropertyValue(auth, "result", mprCreateBoolVar(False)); + mprSetPropertyValue(auth, "result", mprCreateBoolVar(false)); mprSetPropertyValue(auth, "report", mprString("talloc failed")); goto done; } - user_info->mapped_state = True; + user_info->mapped_state = true; user_info->client.account_name = username; user_info->mapped.account_name = username; user_info->client.domain_name = domain; @@ -104,14 +104,14 @@ static int ejs_doauth(MprVarHandle eid, if (!NT_STATUS_IS_OK(nt_status)) { mprSetPropertyValue(auth, "report", mprString(talloc_strdup(mprMemCtx(), get_friendly_nt_error_msg(nt_status)))); - mprSetPropertyValue(auth, "result", mprCreateBoolVar(False)); + mprSetPropertyValue(auth, "result", mprCreateBoolVar(false)); goto done; } nt_status = auth_generate_session_info(tmp_ctx, server_info, &session_info); if (!NT_STATUS_IS_OK(nt_status)) { mprSetPropertyValue(auth, "report", mprString("Session Info generation failed")); - mprSetPropertyValue(auth, "result", mprCreateBoolVar(False)); + mprSetPropertyValue(auth, "result", mprCreateBoolVar(false)); goto done; } @@ -132,13 +132,13 @@ static int ejs_doauth(MprVarHandle eid, if (security_token_is_anonymous(session_info->security_token)) { mprSetPropertyValue(auth, "report", mprString("Anonymous login not permitted")); - mprSetPropertyValue(auth, "result", mprCreateBoolVar(False)); + mprSetPropertyValue(auth, "result", mprCreateBoolVar(false)); goto done; } if (!set) { mprSetPropertyValue(auth, "report", mprString("Session Info generation failed")); - mprSetPropertyValue(auth, "result", mprCreateBoolVar(False)); + mprSetPropertyValue(auth, "result", mprCreateBoolVar(false)); } session_info_obj = mprInitObject(eid, "session_info", 0, NULL); diff --git a/source4/scripting/ejs/smbcalls_cli.c b/source4/scripting/ejs/smbcalls_cli.c index af86be94324..e08a0988338 100644 --- a/source4/scripting/ejs/smbcalls_cli.c +++ b/source4/scripting/ejs/smbcalls_cli.c @@ -61,7 +61,7 @@ static int ejs_cli_connect(MprVarHandle eid, int argc, char **argv) return -1; } - transport = smbcli_transport_init(sock, sock, False); + transport = smbcli_transport_init(sock, sock, false); if (!transport) { ejsSetErrorMsg(eid, "transport init failed"); @@ -192,7 +192,7 @@ static int ejs_cli_ssetup(MprVarHandle eid, int argc, MprVar **argv) /* Do session setup */ - session = smbcli_session_init(transport, transport, False); + session = smbcli_session_init(transport, transport, false); if (!session) { ejsSetErrorMsg(eid, "session init failed"); @@ -252,7 +252,7 @@ static int ejs_cli_tree_connect(MprVarHandle eid, int argc, MprVar **argv) } session = argv[0]->ptr; - tree = smbcli_tree_init(session, session, False); + tree = smbcli_tree_init(session, session, false); if (!tree) { ejsSetErrorMsg(eid, "tree init failed"); @@ -442,7 +442,7 @@ static int ejs_tree_connect(MprVarHandle eid, int argc, char **argv) io.in.service = sharename; io.in.service_type = "?????"; io.in.credentials = creds; - io.in.fallback_to_anonymous = False; + io.in.fallback_to_anonymous = false; io.in.workgroup = lp_workgroup(global_loadparm); result = smb_composite_connect(&io, mem_ctx, NULL); diff --git a/source4/scripting/ejs/smbcalls_config.c b/source4/scripting/ejs/smbcalls_config.c index 6b9c245e7ec..1c76757659b 100644 --- a/source4/scripting/ejs/smbcalls_config.c +++ b/source4/scripting/ejs/smbcalls_config.c @@ -138,7 +138,7 @@ static int ejs_lpGet(MprVarHandle eid, int argc, char **argv) mpr_ReturnString(eid, *(char **)parm_ptr); break; case P_BOOL: - mpr_Return(eid, mprCreateBoolVar(*(BOOL *)parm_ptr)); + mpr_Return(eid, mprCreateBoolVar(*(bool *)parm_ptr)); break; case P_INTEGER: case P_OCTAL: @@ -187,7 +187,7 @@ static int ejs_lpSet(MprVarHandle eid, int argc, char **argv) */ static int ejs_lpReload(MprVarHandle eid, int argc, char **argv) { - BOOL ret = lp_load(lp_configfile(global_loadparm)); + bool ret = lp_load(lp_configfile(global_loadparm)); if (ret) { unload_interfaces(); } diff --git a/source4/scripting/ejs/smbcalls_creds.c b/source4/scripting/ejs/smbcalls_creds.c index 730753d158f..781843371a2 100644 --- a/source4/scripting/ejs/smbcalls_creds.c +++ b/source4/scripting/ejs/smbcalls_creds.c @@ -61,7 +61,7 @@ static int ejs_creds_set_domain(MprVarHandle eid, int argc, char **argv) } cli_credentials_set_domain(creds, argv[0], CRED_SPECIFIED); - mpr_Return(eid, mprCreateBoolVar(True)); + mpr_Return(eid, mprCreateBoolVar(true)); return 0; } @@ -90,7 +90,7 @@ static int ejs_creds_set_username(MprVarHandle eid, int argc, char **argv) } cli_credentials_set_username(creds, argv[0], CRED_SPECIFIED); - mpr_Return(eid, mprCreateBoolVar(True)); + mpr_Return(eid, mprCreateBoolVar(true)); return 0; } @@ -119,7 +119,7 @@ static int ejs_creds_set_password(MprVarHandle eid, int argc, char **argv) } cli_credentials_set_password(creds, argv[0], CRED_SPECIFIED); - mpr_Return(eid, mprCreateBoolVar(True)); + mpr_Return(eid, mprCreateBoolVar(true)); return 0; } @@ -136,7 +136,7 @@ static int ejs_creds_set_realm(MprVarHandle eid, int argc, char **argv) } cli_credentials_set_realm(creds, argv[0], CRED_SPECIFIED); - mpr_Return(eid, mprCreateBoolVar(True)); + mpr_Return(eid, mprCreateBoolVar(true)); return 0; } @@ -165,7 +165,7 @@ static int ejs_creds_set_workstation(MprVarHandle eid, int argc, char **argv) } cli_credentials_set_workstation(creds, argv[0], CRED_SPECIFIED); - mpr_Return(eid, mprCreateBoolVar(True)); + mpr_Return(eid, mprCreateBoolVar(true)); return 0; } @@ -193,9 +193,9 @@ static int ejs_creds_set_machine_account(MprVarHandle eid, int argc, struct MprV } if (NT_STATUS_IS_OK(cli_credentials_set_machine_account(creds))) { - mpr_Return(eid, mprCreateBoolVar(True)); + mpr_Return(eid, mprCreateBoolVar(true)); } else { - mpr_Return(eid, mprCreateBoolVar(False)); + mpr_Return(eid, mprCreateBoolVar(false)); } return 0; } diff --git a/source4/scripting/ejs/smbcalls_data.c b/source4/scripting/ejs/smbcalls_data.c index 60dadc51658..a98266c3da0 100644 --- a/source4/scripting/ejs/smbcalls_data.c +++ b/source4/scripting/ejs/smbcalls_data.c @@ -107,7 +107,7 @@ failed: static int ejs_blobCompare(MprVarHandle eid, int argc, struct MprVar **argv) { DATA_BLOB *blob1, *blob2; - BOOL ret = False; + bool ret = false; if (argc != 2) { ejsSetErrorMsg(eid, "blobCompare invalid arguments"); @@ -118,24 +118,24 @@ static int ejs_blobCompare(MprVarHandle eid, int argc, struct MprVar **argv) blob2 = mprToDataBlob(argv[1]); if (blob1 == blob2) { - ret = True; + ret = true; goto done; } if (blob1 == NULL || blob2 == NULL) { - ret = False; + ret = false; goto done; } if (blob1->length != blob2->length) { - ret = False; + ret = false; goto done; } if (memcmp(blob1->data, blob2->data, blob1->length) != 0) { - ret = False; + ret = false; goto done; } - ret = True; + ret = true; done: mpr_Return(eid, mprCreateBoolVar(ret)); diff --git a/source4/scripting/ejs/smbcalls_ldb.c b/source4/scripting/ejs/smbcalls_ldb.c index 42105e7965e..04162830b4d 100644 --- a/source4/scripting/ejs/smbcalls_ldb.c +++ b/source4/scripting/ejs/smbcalls_ldb.c @@ -483,7 +483,7 @@ static int ejs_ldbClose(MprVarHandle eid, int argc, struct MprVar **argv) } mprSetThisPtr(eid, "db", NULL); - mpr_Return(eid, mprCreateBoolVar(True)); + mpr_Return(eid, mprCreateBoolVar(true)); return 0; } diff --git a/source4/scripting/ejs/smbcalls_sys.c b/source4/scripting/ejs/smbcalls_sys.c index 96e665ab3a9..10de8e162e8 100644 --- a/source4/scripting/ejs/smbcalls_sys.c +++ b/source4/scripting/ejs/smbcalls_sys.c @@ -294,7 +294,7 @@ static int ejs_sys_file_load(MprVarHandle eid, int argc, char **argv) */ static int ejs_sys_file_save(MprVarHandle eid, int argc, char **argv) { - BOOL ret; + bool ret; if (argc != 2) { ejsSetErrorMsg(eid, "sys_file_save invalid arguments"); return -1; @@ -311,7 +311,7 @@ static int ejs_sys_file_save(MprVarHandle eid, int argc, char **argv) */ static int ejs_sys_mkdir(MprVarHandle eid, int argc, struct MprVar **argv) { - BOOL ret; + bool ret; char *name; if (argc != 2) { ejsSetErrorMsg(eid, "sys_mkdir invalid arguments, need mkdir(dirname, mode)"); diff --git a/source4/torture/basic/base.c b/source4/torture/basic/base.c index 303cbee62f9..2c5f3355036 100644 --- a/source4/torture/basic/base.c +++ b/source4/torture/basic/base.c @@ -68,12 +68,12 @@ failed: return NULL; } -static BOOL tcon_devtest(struct torture_context *tctx, +static bool tcon_devtest(struct torture_context *tctx, struct smbcli_state *cli, const char *myshare, const char *devtype, NTSTATUS expected_error) { - BOOL status; + bool status; const char *password = torture_setting_string(tctx, "password", NULL); status = NT_STATUS_IS_OK(smbcli_tconX(cli, myshare, devtype, @@ -158,13 +158,13 @@ static bool run_fdpasstest(struct torture_context *tctx, /** This checks how the getatr calls works */ -static BOOL run_attrtest(struct torture_context *tctx, +static bool run_attrtest(struct torture_context *tctx, struct smbcli_state *cli) { int fnum; time_t t, t2; const char *fname = "\\attrib123456789.tst"; - BOOL correct = True; + bool correct = true; smbcli_unlink(cli->tree, fname); fnum = smbcli_open(cli->tree, fname, @@ -173,7 +173,7 @@ static BOOL run_attrtest(struct torture_context *tctx, if (NT_STATUS_IS_ERR(smbcli_getatr(cli->tree, fname, NULL, NULL, &t))) { torture_comment(tctx, "getatr failed (%s)\n", smbcli_errstr(cli->tree)); - correct = False; + correct = false; } torture_comment(tctx, "New file time is %s", ctime(&t)); @@ -182,7 +182,7 @@ static BOOL run_attrtest(struct torture_context *tctx, torture_comment(tctx, "ERROR: SMBgetatr bug. time is %s", ctime(&t)); t = time(NULL); - correct = False; + correct = false; } t2 = t-60*60*24; /* 1 day ago */ @@ -191,12 +191,12 @@ static BOOL run_attrtest(struct torture_context *tctx, if (NT_STATUS_IS_ERR(smbcli_setatr(cli->tree, fname, 0, t2))) { torture_comment(tctx, "setatr failed (%s)\n", smbcli_errstr(cli->tree)); - correct = True; + correct = true; } if (NT_STATUS_IS_ERR(smbcli_getatr(cli->tree, fname, NULL, NULL, &t))) { torture_comment(tctx, "getatr failed (%s)\n", smbcli_errstr(cli->tree)); - correct = True; + correct = true; } torture_comment(tctx, "Retrieved file time as %s", ctime(&t)); @@ -205,7 +205,7 @@ static BOOL run_attrtest(struct torture_context *tctx, torture_comment(tctx, "ERROR: getatr/setatr bug. times are\n%s", ctime(&t)); torture_comment(tctx, "%s", ctime(&t2)); - correct = True; + correct = true; } smbcli_unlink(cli->tree, fname); @@ -216,7 +216,7 @@ static BOOL run_attrtest(struct torture_context *tctx, /** This checks a couple of trans2 calls */ -static BOOL run_trans2test(struct torture_context *tctx, +static bool run_trans2test(struct torture_context *tctx, struct smbcli_state *cli) { int fnum; @@ -226,7 +226,7 @@ static BOOL run_trans2test(struct torture_context *tctx, const char *dname = "\\trans2"; const char *fname2 = "\\trans2\\trans2.tst"; const char *pname; - BOOL correct = True; + bool correct = true; smbcli_unlink(cli->tree, fname); @@ -237,20 +237,20 @@ static BOOL run_trans2test(struct torture_context *tctx, if (NT_STATUS_IS_ERR(smbcli_qfileinfo(cli->tree, fnum, NULL, &size, &c_time, &a_time, &m_time, NULL, NULL))) { torture_comment(tctx, "ERROR: qfileinfo failed (%s)\n", smbcli_errstr(cli->tree)); - correct = False; + correct = false; } torture_comment(tctx, "Testing NAME_INFO\n"); if (NT_STATUS_IS_ERR(smbcli_qfilename(cli->tree, fnum, &pname))) { torture_comment(tctx, "ERROR: qfilename failed (%s)\n", smbcli_errstr(cli->tree)); - correct = False; + correct = false; } if (!pname || strcmp(pname, fname)) { torture_comment(tctx, "qfilename gave different name? [%s] [%s]\n", fname, pname); - correct = False; + correct = false; } smbcli_close(cli->tree, fnum); @@ -260,7 +260,7 @@ static BOOL run_trans2test(struct torture_context *tctx, O_RDWR | O_CREAT | O_TRUNC, DENY_NONE); if (fnum == -1) { torture_comment(tctx, "open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree)); - return False; + return false; } smbcli_close(cli->tree, fnum); @@ -268,7 +268,7 @@ static BOOL run_trans2test(struct torture_context *tctx, if (NT_STATUS_IS_ERR(smbcli_qpathinfo(cli->tree, fname, &c_time, &a_time, &m_time, &size, NULL))) { torture_comment(tctx, "ERROR: qpathinfo failed (%s)\n", smbcli_errstr(cli->tree)); - correct = False; + correct = false; } else { if (c_time != m_time) { torture_comment(tctx, "create time=%s", ctime(&c_time)); @@ -278,12 +278,12 @@ static BOOL run_trans2test(struct torture_context *tctx, if (a_time % (60*60) == 0) { torture_comment(tctx, "access time=%s", ctime(&a_time)); torture_comment(tctx, "This system appears to set a midnight access time\n"); - correct = False; + correct = false; } if (abs(m_time - time(NULL)) > 60*60*24*7) { torture_comment(tctx, "ERROR: totally incorrect times - maybe word reversed? mtime=%s", ctime(&m_time)); - correct = False; + correct = false; } } @@ -294,12 +294,12 @@ static BOOL run_trans2test(struct torture_context *tctx, smbcli_close(cli->tree, fnum); if (NT_STATUS_IS_ERR(smbcli_qpathinfo2(cli->tree, fname, &c_time, &a_time, &m_time, &w_time, &size, NULL, NULL))) { torture_comment(tctx, "ERROR: qpathinfo2 failed (%s)\n", smbcli_errstr(cli->tree)); - correct = False; + correct = false; } else { if (w_time < 60*60*24*2) { torture_comment(tctx, "write time=%s", ctime(&w_time)); torture_comment(tctx, "This system appears to set a initial 0 write time\n"); - correct = False; + correct = false; } } @@ -310,12 +310,12 @@ static BOOL run_trans2test(struct torture_context *tctx, when creating a new file */ if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, dname))) { torture_comment(tctx, "ERROR: mkdir failed (%s)\n", smbcli_errstr(cli->tree)); - correct = False; + correct = false; } sleep(3); if (NT_STATUS_IS_ERR(smbcli_qpathinfo2(cli->tree, "\\trans2\\", &c_time, &a_time, &m_time, &w_time, &size, NULL, NULL))) { torture_comment(tctx, "ERROR: qpathinfo2 failed (%s)\n", smbcli_errstr(cli->tree)); - correct = False; + correct = false; } fnum = smbcli_open(cli->tree, fname2, @@ -324,11 +324,11 @@ static BOOL run_trans2test(struct torture_context *tctx, smbcli_close(cli->tree, fnum); if (NT_STATUS_IS_ERR(smbcli_qpathinfo2(cli->tree, "\\trans2\\", &c_time, &a_time, &m_time2, &w_time, &size, NULL, NULL))) { torture_comment(tctx, "ERROR: qpathinfo2 failed (%s)\n", smbcli_errstr(cli->tree)); - correct = False; + correct = false; } else { if (m_time2 == m_time) { torture_comment(tctx, "This system does not update directory modification times\n"); - correct = False; + correct = false; } } smbcli_unlink(cli->tree, fname2); @@ -338,17 +338,17 @@ static BOOL run_trans2test(struct torture_context *tctx, } /* send smb negprot commands, not reading the response */ -static BOOL run_negprot_nowait(struct torture_context *tctx) +static bool run_negprot_nowait(struct torture_context *tctx) { int i; struct smbcli_state *cli, *cli2; - BOOL correct = True; + bool correct = true; torture_comment(tctx, "starting negprot nowait test\n"); cli = open_nbt_connection(tctx); if (!cli) { - return False; + return false; } torture_comment(tctx, "Filling send buffer\n"); @@ -364,7 +364,7 @@ static BOOL run_negprot_nowait(struct torture_context *tctx) } else { torture_comment(tctx, "Failed to fill pipe - %s \n", nt_errstr(req->status)); torture_close_connection(cli); - return False; + return false; } } } @@ -372,12 +372,12 @@ static BOOL run_negprot_nowait(struct torture_context *tctx) torture_comment(tctx, "Opening secondary connection\n"); if (!torture_open_connection(&cli2, 1)) { torture_comment(tctx, "Failed to open secondary connection\n"); - correct = False; + correct = false; } if (!torture_close_connection(cli2)) { torture_comment(tctx, "Failed to close secondary connection\n"); - correct = False; + correct = false; } torture_close_connection(cli); @@ -389,14 +389,14 @@ static BOOL run_negprot_nowait(struct torture_context *tctx) this checks to see if a secondary tconx can use open files from an earlier tconx */ -static BOOL run_tcon_test(struct torture_context *tctx, struct smbcli_state *cli) +static bool run_tcon_test(struct torture_context *tctx, struct smbcli_state *cli) { const char *fname = "\\tcontest.tmp"; int fnum1; uint16_t cnum1, cnum2, cnum3; uint16_t vuid1, vuid2; uint8_t buf[4]; - BOOL ret = True; + bool ret = true; struct smbcli_tree *tree1; const char *host = torture_setting_string(tctx, "host", NULL); const char *share = torture_setting_string(tctx, "share", NULL); @@ -409,7 +409,7 @@ static BOOL run_tcon_test(struct torture_context *tctx, struct smbcli_state *cli fnum1 = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); if (fnum1 == -1) { torture_comment(tctx, "open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree)); - return False; + return false; } cnum1 = cli->tree->tid; @@ -418,7 +418,7 @@ static BOOL run_tcon_test(struct torture_context *tctx, struct smbcli_state *cli memset(&buf, 0, 4); /* init buf so valgrind won't complain */ if (smbcli_write(cli->tree, fnum1, 0, buf, 130, 4) != 4) { torture_comment(tctx, "initial write failed (%s)\n", smbcli_errstr(cli->tree)); - return False; + return false; } tree1 = cli->tree; /* save old tree connection */ @@ -426,7 +426,7 @@ static BOOL run_tcon_test(struct torture_context *tctx, struct smbcli_state *cli torture_comment(tctx, "%s refused 2nd tree connect (%s)\n", host, smbcli_errstr(cli->tree)); talloc_free(cli); - return False; + return false; } cnum2 = cli->tree->tid; @@ -438,7 +438,7 @@ static BOOL run_tcon_test(struct torture_context *tctx, struct smbcli_state *cli if (smbcli_write(cli->tree, fnum1, 0, buf, 130, 4) == 4) { torture_comment(tctx, "* server allows write with wrong TID\n"); - ret = False; + ret = false; } else { torture_comment(tctx, "server fails write with wrong TID : %s\n", smbcli_errstr(cli->tree)); } @@ -449,7 +449,7 @@ static BOOL run_tcon_test(struct torture_context *tctx, struct smbcli_state *cli if (smbcli_write(cli->tree, fnum1, 0, buf, 130, 4) == 4) { torture_comment(tctx, "* server allows write with invalid TID\n"); - ret = False; + ret = false; } else { torture_comment(tctx, "server fails write with invalid TID : %s\n", smbcli_errstr(cli->tree)); } @@ -460,7 +460,7 @@ static BOOL run_tcon_test(struct torture_context *tctx, struct smbcli_state *cli if (smbcli_write(cli->tree, fnum1, 0, buf, 130, 4) == 4) { torture_comment(tctx, "* server allows write with invalid VUID\n"); - ret = False; + ret = false; } else { torture_comment(tctx, "server fails write with invalid VUID : %s\n", smbcli_errstr(cli->tree)); } @@ -470,14 +470,14 @@ static BOOL run_tcon_test(struct torture_context *tctx, struct smbcli_state *cli if (NT_STATUS_IS_ERR(smbcli_close(cli->tree, fnum1))) { torture_comment(tctx, "close failed (%s)\n", smbcli_errstr(cli->tree)); - return False; + return false; } cli->tree->tid = cnum2; if (NT_STATUS_IS_ERR(smbcli_tdis(cli))) { torture_comment(tctx, "secondary tdis failed (%s)\n", smbcli_errstr(cli->tree)); - return False; + return false; } cli->tree = tree1; /* restore initial tree */ @@ -491,7 +491,7 @@ static BOOL run_tcon_test(struct torture_context *tctx, struct smbcli_state *cli /** checks for correct tconX support */ -static BOOL run_tcon_devtype_test(struct torture_context *tctx, +static bool run_tcon_devtype_test(struct torture_context *tctx, struct smbcli_state *cli1) { const char *share = torture_setting_string(tctx, "share", NULL); @@ -529,7 +529,7 @@ static BOOL run_tcon_devtype_test(struct torture_context *tctx, return true; } -static BOOL rw_torture2(struct torture_context *tctx, +static bool rw_torture2(struct torture_context *tctx, struct smbcli_state *c1, struct smbcli_state *c2) { const char *lockfname = "\\torture2.lck"; @@ -538,7 +538,7 @@ static BOOL rw_torture2(struct torture_context *tctx, int i; uint8_t buf[131072]; uint8_t buf_rd[131072]; - BOOL correct = True; + bool correct = true; ssize_t bytes_read, bytes_written; torture_assert(tctx, smbcli_deltree(c1->tree, lockfname) != -1, @@ -575,14 +575,14 @@ static BOOL rw_torture2(struct torture_context *tctx, if ((bytes_written = smbcli_write(c1->tree, fnum1, 0, buf, 0, buf_size)) != buf_size) { torture_comment(tctx, "write failed (%s)\n", smbcli_errstr(c1->tree)); torture_comment(tctx, "wrote %d, expected %d\n", (int)bytes_written, (int)buf_size); - correct = False; + correct = false; break; } if ((bytes_read = smbcli_read(c2->tree, fnum2, buf_rd, 0, buf_size)) != buf_size) { torture_comment(tctx, "read failed (%s)\n", smbcli_errstr(c2->tree)); torture_comment(tctx, "read %d, expected %d\n", (int)bytes_read, (int)buf_size); - correct = False; + correct = false; break; } @@ -624,16 +624,16 @@ static bool run_readwritetest(struct torture_context *tctx, /* test the timing of deferred open requests */ -static BOOL run_deferopen(struct torture_context *tctx, struct smbcli_state *cli, int dummy) +static bool run_deferopen(struct torture_context *tctx, struct smbcli_state *cli, int dummy) { const char *fname = "\\defer_open_test.dat"; int retries=4; int i = 0; - BOOL correct = True; + bool correct = true; if (retries <= 0) { torture_comment(tctx, "failed to connect\n"); - return False; + return false; } torture_comment(tctx, "Testing deferred open requests.\n"); @@ -663,7 +663,7 @@ static BOOL run_deferopen(struct torture_context *tctx, struct smbcli_state *cli if (fnum == -1) { torture_comment(tctx,"Failed to open %s, error=%s\n", fname, smbcli_errstr(cli->tree)); - return False; + return false; } torture_comment(tctx, "pid %u open %d\n", (unsigned)getpid(), i); @@ -672,7 +672,7 @@ static BOOL run_deferopen(struct torture_context *tctx, struct smbcli_state *cli i++; if (NT_STATUS_IS_ERR(smbcli_close(cli->tree, fnum))) { torture_comment(tctx,"Failed to close %s, error=%s\n", fname, smbcli_errstr(cli->tree)); - return False; + return false; } sleep(2); } @@ -681,7 +681,7 @@ static BOOL run_deferopen(struct torture_context *tctx, struct smbcli_state *cli /* All until the last unlink will fail with sharing violation. */ if (!NT_STATUS_EQUAL(smbcli_nt_error(cli->tree),NT_STATUS_SHARING_VIOLATION)) { torture_comment(tctx, "unlink of %s failed (%s)\n", fname, smbcli_errstr(cli->tree)); - correct = False; + correct = false; } } @@ -693,7 +693,7 @@ static BOOL run_deferopen(struct torture_context *tctx, struct smbcli_state *cli Try with a wrong vuid and check error message. */ -static BOOL run_vuidtest(struct torture_context *tctx, +static bool run_vuidtest(struct torture_context *tctx, struct smbcli_state *cli) { const char *fname = "\\vuid.tst"; @@ -744,7 +744,7 @@ static BOOL run_vuidtest(struct torture_context *tctx, /* Test open mode returns on read-only files. */ - static BOOL run_opentest(struct torture_context *tctx, struct smbcli_state *cli1, + static bool run_opentest(struct torture_context *tctx, struct smbcli_state *cli1, struct smbcli_state *cli2) { const char *fname = "\\readonly.file"; @@ -752,7 +752,7 @@ static BOOL run_vuidtest(struct torture_context *tctx, int fnum1, fnum2; uint8_t buf[20]; size_t fsize; - BOOL correct = True; + bool correct = true; char *tmp_path; int failures = 0; int i; @@ -787,25 +787,25 @@ static BOOL run_vuidtest(struct torture_context *tctx, fnum1 = smbcli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); if (fnum1 == -1) { torture_comment(tctx, "open of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); - return False; + return false; } if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) { torture_comment(tctx, "close2 failed (%s)\n", smbcli_errstr(cli1->tree)); - return False; + return false; } if (NT_STATUS_IS_ERR(smbcli_setatr(cli1->tree, fname, FILE_ATTRIBUTE_READONLY, 0))) { torture_comment(tctx, "smbcli_setatr failed (%s)\n", smbcli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test1); - return False; + return false; } fnum1 = smbcli_open(cli1->tree, fname, O_RDONLY, DENY_WRITE); if (fnum1 == -1) { torture_comment(tctx, "open of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test1); - return False; + return false; } /* This will fail - but the error should be ERRnoaccess, not ERRbadshare. */ @@ -827,7 +827,7 @@ error_test1: fnum1 = smbcli_open(cli1->tree, fname, O_RDONLY, DENY_WRITE); if (fnum1 == -1) { torture_comment(tctx, "open of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); - return False; + return false; } /* This will fail - but the error should be ERRshare. */ @@ -840,7 +840,7 @@ error_test1: if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) { torture_comment(tctx, "close2 failed (%s)\n", smbcli_errstr(cli1->tree)); - return False; + return false; } smbcli_unlink(cli1->tree, fname); @@ -852,7 +852,7 @@ error_test1: fnum1 = smbcli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); if (fnum1 == -1) { torture_comment(tctx, "(3) open (1) of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); - return False; + return false; } /* write 20 bytes. */ @@ -861,25 +861,25 @@ error_test1: if (smbcli_write(cli1->tree, fnum1, 0, buf, 0, 20) != 20) { torture_comment(tctx, "write failed (%s)\n", smbcli_errstr(cli1->tree)); - correct = False; + correct = false; } if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) { torture_comment(tctx, "(3) close1 failed (%s)\n", smbcli_errstr(cli1->tree)); - return False; + return false; } /* Ensure size == 20. */ if (NT_STATUS_IS_ERR(smbcli_getatr(cli1->tree, fname, NULL, &fsize, NULL))) { torture_comment(tctx, "(3) getatr failed (%s)\n", smbcli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test3); - return False; + return false; } if (fsize != 20) { torture_comment(tctx, "(3) file size != 20\n"); CHECK_MAX_FAILURES(error_test3); - return False; + return false; } /* Now test if we can truncate a file opened for readonly. */ @@ -888,25 +888,25 @@ error_test1: if (fnum1 == -1) { torture_comment(tctx, "(3) open (2) of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test3); - return False; + return false; } if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) { torture_comment(tctx, "close2 failed (%s)\n", smbcli_errstr(cli1->tree)); - return False; + return false; } /* Ensure size == 0. */ if (NT_STATUS_IS_ERR(smbcli_getatr(cli1->tree, fname, NULL, &fsize, NULL))) { torture_comment(tctx, "(3) getatr failed (%s)\n", smbcli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test3); - return False; + return false; } if (fsize != 0) { torture_comment(tctx, "(3) file size != 0\n"); CHECK_MAX_FAILURES(error_test3); - return False; + return false; } torture_comment(tctx, "finished open test 3\n"); error_test3: @@ -918,7 +918,7 @@ error_test3: if (fnum1 == -1) { torture_comment(tctx, "ctemp failed (%s)\n", smbcli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test4); - return False; + return false; } torture_comment(tctx, "ctemp gave path %s\n", tmp_path); if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) { @@ -941,7 +941,7 @@ error_test4: if (fnum1 == -1) { torture_comment(tctx, "test 1 open 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test10); - return False; + return false; } fnum2 = smbcli_nt_create_full(cli2->tree, fname, 0, SEC_FILE_READ_ATTRIBUTE, FILE_ATTRIBUTE_NORMAL, @@ -949,16 +949,16 @@ error_test4: if (fnum2 == -1) { torture_comment(tctx, "test 1 open 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree)); CHECK_MAX_FAILURES(error_test10); - return False; + return false; } if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) { torture_comment(tctx, "test 1 close 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); - return False; + return false; } if (NT_STATUS_IS_ERR(smbcli_close(cli2->tree, fnum2))) { torture_comment(tctx, "test 1 close 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree)); - return False; + return false; } torture_comment(tctx, "non-io open test #1 passed.\n"); @@ -973,7 +973,7 @@ error_test10: if (fnum1 == -1) { torture_comment(tctx, "test 2 open 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test20); - return False; + return false; } fnum2 = smbcli_nt_create_full(cli2->tree, fname, 0, SEC_FILE_READ_ATTRIBUTE, FILE_ATTRIBUTE_NORMAL, @@ -982,16 +982,16 @@ error_test10: if (fnum2 == -1) { torture_comment(tctx, "test 2 open 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree)); CHECK_MAX_FAILURES(error_test20); - return False; + return false; } if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) { torture_comment(tctx, "test 1 close 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); - return False; + return false; } if (NT_STATUS_IS_ERR(smbcli_close(cli2->tree, fnum2))) { torture_comment(tctx, "test 1 close 2 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); - return False; + return false; } torture_comment(tctx, "non-io open test #2 passed.\n"); @@ -1006,7 +1006,7 @@ error_test20: if (fnum1 == -1) { torture_comment(tctx, "test 3 open 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test30); - return False; + return false; } fnum2 = smbcli_nt_create_full(cli2->tree, fname, 0, SEC_STD_DELETE|SEC_FILE_READ_ATTRIBUTE, FILE_ATTRIBUTE_NORMAL, @@ -1015,16 +1015,16 @@ error_test20: if (fnum2 == -1) { torture_comment(tctx, "test 3 open 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree)); CHECK_MAX_FAILURES(error_test30); - return False; + return false; } if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) { torture_comment(tctx, "test 3 close 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); - return False; + return false; } if (NT_STATUS_IS_ERR(smbcli_close(cli2->tree, fnum2))) { torture_comment(tctx, "test 3 close 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree)); - return False; + return false; } torture_comment(tctx, "non-io open test #3 passed.\n"); @@ -1039,7 +1039,7 @@ error_test30: if (fnum1 == -1) { torture_comment(tctx, "test 4 open 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test40); - return False; + return false; } fnum2 = smbcli_nt_create_full(cli2->tree, fname, 0, SEC_STD_DELETE|SEC_FILE_READ_ATTRIBUTE, FILE_ATTRIBUTE_NORMAL, @@ -1048,14 +1048,14 @@ error_test30: if (fnum2 != -1) { torture_comment(tctx, "test 4 open 2 of %s SUCCEEDED - should have failed (%s)\n", fname, smbcli_errstr(cli2->tree)); CHECK_MAX_FAILURES(error_test40); - return False; + return false; } torture_comment(tctx, "test 4 open 2 of %s gave %s (correct error should be %s)\n", fname, smbcli_errstr(cli2->tree), "sharing violation"); if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) { torture_comment(tctx, "test 4 close 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); - return False; + return false; } torture_comment(tctx, "non-io open test #4 passed.\n"); @@ -1070,7 +1070,7 @@ error_test40: if (fnum1 == -1) { torture_comment(tctx, "test 5 open 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test50); - return False; + return false; } fnum2 = smbcli_nt_create_full(cli2->tree, fname, 0, SEC_STD_DELETE|SEC_FILE_READ_ATTRIBUTE, FILE_ATTRIBUTE_NORMAL, @@ -1079,17 +1079,17 @@ error_test40: if (fnum2 == -1) { torture_comment(tctx, "test 5 open 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree)); CHECK_MAX_FAILURES(error_test50); - return False; + return false; } if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) { torture_comment(tctx, "test 5 close 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); - return False; + return false; } if (NT_STATUS_IS_ERR(smbcli_close(cli2->tree, fnum2))) { torture_comment(tctx, "test 5 close 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree)); - return False; + return false; } torture_comment(tctx, "non-io open test #5 passed.\n"); @@ -1104,7 +1104,7 @@ error_test50: if (fnum1 == -1) { torture_comment(tctx, "test 6 open 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test60); - return False; + return false; } fnum2 = smbcli_nt_create_full(cli2->tree, fname, 0, SEC_FILE_READ_ATTRIBUTE, FILE_ATTRIBUTE_NORMAL, @@ -1113,17 +1113,17 @@ error_test50: if (fnum2 == -1) { torture_comment(tctx, "test 6 open 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree)); CHECK_MAX_FAILURES(error_test60); - return False; + return false; } if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) { torture_comment(tctx, "test 6 close 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); - return False; + return false; } if (NT_STATUS_IS_ERR(smbcli_close(cli2->tree, fnum2))) { torture_comment(tctx, "test 6 close 2 of %s failed (%s)\n", fname, smbcli_errstr(cli2->tree)); - return False; + return false; } torture_comment(tctx, "non-io open test #6 passed.\n"); @@ -1138,7 +1138,7 @@ error_test60: if (fnum1 == -1) { torture_comment(tctx, "test 7 open 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test70); - return False; + return false; } fnum2 = smbcli_nt_create_full(cli2->tree, fname, 0, SEC_STD_DELETE|SEC_FILE_READ_ATTRIBUTE, FILE_ATTRIBUTE_NORMAL, @@ -1147,14 +1147,14 @@ error_test60: if (fnum2 != -1) { torture_comment(tctx, "test 7 open 2 of %s SUCCEEDED - should have failed (%s)\n", fname, smbcli_errstr(cli2->tree)); CHECK_MAX_FAILURES(error_test70); - return False; + return false; } torture_comment(tctx, "test 7 open 2 of %s gave %s (correct error should be %s)\n", fname, smbcli_errstr(cli2->tree), "sharing violation"); if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) { torture_comment(tctx, "test 7 close 1 of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); - return False; + return false; } torture_comment(tctx, "non-io open test #7 passed.\n"); @@ -1168,7 +1168,7 @@ error_test70: fnum1 = smbcli_open(cli1->tree, fname, O_RDWR|O_CREAT, DENY_NONE); if (fnum1 == -1) { torture_comment(tctx, "(8) open (1) of %s failed (%s)\n", fname, smbcli_errstr(cli1->tree)); - return False; + return false; } /* write 20 bytes. */ @@ -1177,56 +1177,56 @@ error_test70: if (smbcli_write(cli1->tree, fnum1, 0, buf, 0, 20) != 20) { torture_comment(tctx, "(8) write failed (%s)\n", smbcli_errstr(cli1->tree)); - correct = False; + correct = false; } /* Ensure size == 20. */ if (NT_STATUS_IS_ERR(smbcli_getatr(cli1->tree, fname, NULL, &fsize, NULL))) { torture_comment(tctx, "(8) getatr (1) failed (%s)\n", smbcli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test80); - return False; + return false; } if (fsize != 20) { torture_comment(tctx, "(8) file size != 20\n"); CHECK_MAX_FAILURES(error_test80); - return False; + return false; } /* Get an exclusive lock on the open file. */ if (NT_STATUS_IS_ERR(smbcli_lock(cli1->tree, fnum1, 0, 4, 0, WRITE_LOCK))) { torture_comment(tctx, "(8) lock1 failed (%s)\n", smbcli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test80); - return False; + return false; } fnum2 = smbcli_open(cli1->tree, fname, O_RDWR|O_TRUNC, DENY_NONE); if (fnum1 == -1) { torture_comment(tctx, "(8) open (2) of %s with truncate failed (%s)\n", fname, smbcli_errstr(cli1->tree)); - return False; + return false; } /* Ensure size == 0. */ if (NT_STATUS_IS_ERR(smbcli_getatr(cli1->tree, fname, NULL, &fsize, NULL))) { torture_comment(tctx, "(8) getatr (2) failed (%s)\n", smbcli_errstr(cli1->tree)); CHECK_MAX_FAILURES(error_test80); - return False; + return false; } if (fsize != 0) { torture_comment(tctx, "(8) file size != 0\n"); CHECK_MAX_FAILURES(error_test80); - return False; + return false; } if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) { torture_comment(tctx, "(8) close1 failed (%s)\n", smbcli_errstr(cli1->tree)); - return False; + return false; } if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum2))) { torture_comment(tctx, "(8) close1 failed (%s)\n", smbcli_errstr(cli1->tree)); - return False; + return false; } error_test80: @@ -1315,7 +1315,7 @@ static bool run_iometer(struct torture_context *tctx, ops = 0; - while (True) { + while (true) { int i, num_reads, num_writes; num_reads = random() % 10; @@ -1351,11 +1351,11 @@ static bool run_iometer(struct torture_context *tctx, /** tries variants of chkpath */ -static BOOL torture_chkpath_test(struct torture_context *tctx, +static bool torture_chkpath_test(struct torture_context *tctx, struct smbcli_state *cli) { int fnum; - BOOL ret; + bool ret; torture_comment(tctx, "Testing valid and invalid paths\n"); @@ -1366,29 +1366,29 @@ static BOOL torture_chkpath_test(struct torture_context *tctx, if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, "\\chkpath.dir"))) { torture_comment(tctx, "mkdir1 failed : %s\n", smbcli_errstr(cli->tree)); - return False; + return false; } if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, "\\chkpath.dir\\dir2"))) { torture_comment(tctx, "mkdir2 failed : %s\n", smbcli_errstr(cli->tree)); - return False; + return false; } fnum = smbcli_open(cli->tree, "\\chkpath.dir\\foo.txt", O_RDWR|O_CREAT|O_EXCL, DENY_NONE); if (fnum == -1) { torture_comment(tctx, "open1 failed (%s)\n", smbcli_errstr(cli->tree)); - return False; + return false; } smbcli_close(cli->tree, fnum); if (NT_STATUS_IS_ERR(smbcli_chkpath(cli->tree, "\\chkpath.dir"))) { torture_comment(tctx, "chkpath1 failed: %s\n", smbcli_errstr(cli->tree)); - ret = False; + ret = false; } if (NT_STATUS_IS_ERR(smbcli_chkpath(cli->tree, "\\chkpath.dir\\dir2"))) { torture_comment(tctx, "chkpath2 failed: %s\n", smbcli_errstr(cli->tree)); - ret = False; + ret = false; } if (NT_STATUS_IS_ERR(smbcli_chkpath(cli->tree, "\\chkpath.dir\\foo.txt"))) { @@ -1396,7 +1396,7 @@ static BOOL torture_chkpath_test(struct torture_context *tctx, NT_STATUS_NOT_A_DIRECTORY); } else { torture_comment(tctx, "* chkpath on a file should fail\n"); - ret = False; + ret = false; } if (NT_STATUS_IS_ERR(smbcli_chkpath(cli->tree, "\\chkpath.dir\\bar.txt"))) { @@ -1404,7 +1404,7 @@ static BOOL torture_chkpath_test(struct torture_context *tctx, NT_STATUS_OBJECT_NAME_NOT_FOUND); } else { torture_comment(tctx, "* chkpath on a non existent file should fail\n"); - ret = False; + ret = false; } if (NT_STATUS_IS_ERR(smbcli_chkpath(cli->tree, "\\chkpath.dir\\dirxx\\bar.txt"))) { @@ -1412,7 +1412,7 @@ static BOOL torture_chkpath_test(struct torture_context *tctx, NT_STATUS_OBJECT_PATH_NOT_FOUND); } else { torture_comment(tctx, "* chkpath on a non existent component should fail\n"); - ret = False; + ret = false; } smbcli_rmdir(cli->tree, "\\chkpath.dir\\dir2"); @@ -1426,11 +1426,11 @@ static BOOL torture_chkpath_test(struct torture_context *tctx, * This is a test to excercise some weird Samba3 error paths. */ -static BOOL torture_samba3_errorpaths(struct torture_context *tctx) +static bool torture_samba3_errorpaths(struct torture_context *tctx) { - BOOL nt_status_support; + bool nt_status_support; struct smbcli_state *cli_nt = NULL, *cli_dos = NULL; - BOOL result = False; + bool result = false; int fnum; const char *os2_fname = ".+,;=[]."; const char *dname = "samba3_errordir"; @@ -1440,7 +1440,7 @@ static BOOL torture_samba3_errorpaths(struct torture_context *tctx) if (mem_ctx == NULL) { torture_comment(tctx, "talloc_init failed\n"); - return False; + return false; } nt_status_support = lp_nt_status_support(global_loadparm); @@ -1634,7 +1634,7 @@ static BOOL torture_samba3_errorpaths(struct torture_context *tctx) torture_comment(tctx, "ntcreate as dir gave %s, " "expected NT_STATUS_NOT_A_DIRECTORY\n", nt_errstr(status)); - result = False; + result = false; } if (NT_STATUS_IS_OK(status)) { @@ -1647,7 +1647,7 @@ static BOOL torture_samba3_errorpaths(struct torture_context *tctx) torture_comment(tctx, "ntcreate as dir gave %s, " "expected NT_STATUS_NOT_A_DIRECTORY\n", nt_errstr(status)); - result = False; + result = false; } if (NT_STATUS_IS_OK(status)) { @@ -1658,7 +1658,7 @@ static BOOL torture_samba3_errorpaths(struct torture_context *tctx) smbcli_unlink(cli_nt->tree, fname); } - if (!torture_setting_bool(tctx, "samba3", False)) { + if (!torture_setting_bool(tctx, "samba3", false)) { goto done; } @@ -1697,7 +1697,7 @@ static BOOL torture_samba3_errorpaths(struct torture_context *tctx) } done: - result = True; + result = true; fail: if (cli_dos != NULL) { diff --git a/source4/torture/basic/delaywrite.c b/source4/torture/basic/delaywrite.c index 289e08ae59b..8928754e1a2 100644 --- a/source4/torture/basic/delaywrite.c +++ b/source4/torture/basic/delaywrite.c @@ -31,24 +31,24 @@ #define BASEDIR "\\delaywrite" -static BOOL test_delayed_write_update(struct torture_context *tctx, struct smbcli_state *cli) +static bool test_delayed_write_update(struct torture_context *tctx, struct smbcli_state *cli) { union smb_fileinfo finfo1, finfo2; const char *fname = BASEDIR "\\torture_file.txt"; NTSTATUS status; int fnum1 = -1; - BOOL ret = True; + bool ret = true; ssize_t written; time_t t; if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } fnum1 = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE); if (fnum1 == -1) { torture_comment(tctx, "Failed to open %s\n", fname); - return False; + return false; } finfo1.basic_info.level = RAW_FILEINFO_BASIC_INFO; @@ -59,7 +59,7 @@ static BOOL test_delayed_write_update(struct torture_context *tctx, struct smbcl if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("fileinfo failed: %s\n", nt_errstr(status))); - return False; + return false; } torture_comment(tctx, "Initial write time %s\n", @@ -74,7 +74,7 @@ static BOOL test_delayed_write_update(struct torture_context *tctx, struct smbcl if (written != 1) { torture_comment(tctx, "write failed - wrote %d bytes (%s)\n", (int)written, __location__); - return False; + return false; } t = time(NULL); @@ -84,7 +84,7 @@ static BOOL test_delayed_write_update(struct torture_context *tctx, struct smbcl if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("fileinfo failed: %s\n", nt_errstr(status))); - ret = False; + ret = false; break; } torture_comment(tctx, "write time %s\n", @@ -100,7 +100,7 @@ static BOOL test_delayed_write_update(struct torture_context *tctx, struct smbcl if (finfo1.basic_info.out.write_time == finfo2.basic_info.out.write_time) { torture_comment(tctx, "Server did not update write time?!\n"); - ret = False; + ret = false; } @@ -116,7 +116,7 @@ static BOOL test_delayed_write_update(struct torture_context *tctx, struct smbcl * Do as above, but using 2 connections. */ -static BOOL test_delayed_write_update2(struct torture_context *tctx, struct smbcli_state *cli, +static bool test_delayed_write_update2(struct torture_context *tctx, struct smbcli_state *cli, struct smbcli_state *cli2) { union smb_fileinfo finfo1, finfo2; @@ -124,19 +124,19 @@ static BOOL test_delayed_write_update2(struct torture_context *tctx, struct smbc NTSTATUS status; int fnum1 = -1; int fnum2 = -1; - BOOL ret = True; + bool ret = true; ssize_t written; time_t t; union smb_flush flsh; if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } fnum1 = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE); if (fnum1 == -1) { torture_comment(tctx, "Failed to open %s\n", fname); - return False; + return false; } finfo1.basic_info.level = RAW_FILEINFO_BASIC_INFO; @@ -147,7 +147,7 @@ static BOOL test_delayed_write_update2(struct torture_context *tctx, struct smbc if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("fileinfo failed: %s\n", nt_errstr(status))); - return False; + return false; } torture_comment(tctx, "Initial write time %s\n", @@ -180,7 +180,7 @@ static BOOL test_delayed_write_update2(struct torture_context *tctx, struct smbc if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("sfileinfo failed: %s\n", nt_errstr(status))); - return False; + return false; } } @@ -193,7 +193,7 @@ static BOOL test_delayed_write_update2(struct torture_context *tctx, struct smbc if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("fileinfo failed: %s\n", nt_errstr(status))); - ret = False; + ret = false; break; } torture_comment(tctx, "write time %s\n", @@ -209,7 +209,7 @@ static BOOL test_delayed_write_update2(struct torture_context *tctx, struct smbc if (finfo1.basic_info.out.write_time == finfo2.basic_info.out.write_time) { torture_comment(tctx, "Server did not update write time?!\n"); - ret = False; + ret = false; } /* Now try a write to see if the write time gets reset. */ @@ -222,7 +222,7 @@ static BOOL test_delayed_write_update2(struct torture_context *tctx, struct smbc if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("fileinfo failed: %s\n", nt_errstr(status))); - return False; + return false; } torture_comment(tctx, "Modified write time %s\n", @@ -236,7 +236,7 @@ static BOOL test_delayed_write_update2(struct torture_context *tctx, struct smbc if (written != 10) { torture_comment(tctx, "write failed - wrote %d bytes (%s)\n", (int)written, __location__); - return False; + return false; } /* Just to prove to tridge that the an smbflush has no effect on @@ -249,7 +249,7 @@ static BOOL test_delayed_write_update2(struct torture_context *tctx, struct smbc status = smb_raw_flush(cli->tree, &flsh); if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("smbflush failed: %s\n", nt_errstr(status))); - return False; + return false; } t = time(NULL); @@ -262,7 +262,7 @@ static BOOL test_delayed_write_update2(struct torture_context *tctx, struct smbc if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("fileinfo failed: %s\n", nt_errstr(status))); - ret = False; + ret = false; break; } torture_comment(tctx, "write time %s\n", @@ -283,7 +283,7 @@ static BOOL test_delayed_write_update2(struct torture_context *tctx, struct smbc fnum2 = smbcli_open(cli->tree, fname, O_RDWR, DENY_NONE); if (fnum2 == -1) { torture_comment(tctx, "Failed to open %s\n", fname); - return False; + return false; } torture_comment(tctx, "Doing a 10 byte write to extend the file via second fd and see if this changes the last write time.\n"); @@ -293,14 +293,14 @@ static BOOL test_delayed_write_update2(struct torture_context *tctx, struct smbc if (written != 10) { torture_comment(tctx, "write failed - wrote %d bytes (%s)\n", (int)written, __location__); - return False; + return false; } status = smb_raw_fileinfo(cli->tree, tctx, &finfo2); if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("fileinfo failed: %s\n", nt_errstr(status))); - return False; + return false; } torture_comment(tctx, "write time %s\n", nt_time_string(tctx, finfo2.basic_info.out.write_time)); @@ -319,7 +319,7 @@ static BOOL test_delayed_write_update2(struct torture_context *tctx, struct smbc if (written != 10) { torture_comment(tctx, "write failed - wrote %d bytes (%s)\n", (int)written, __location__); - return False; + return false; } finfo1.basic_info.level = RAW_FILEINFO_BASIC_INFO; @@ -329,7 +329,7 @@ static BOOL test_delayed_write_update2(struct torture_context *tctx, struct smbc if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("fileinfo failed: %s\n", nt_errstr(status))); - return False; + return false; } torture_comment(tctx, "write time %s\n", nt_time_string(tctx, finfo2.basic_info.out.write_time)); @@ -347,7 +347,7 @@ static BOOL test_delayed_write_update2(struct torture_context *tctx, struct smbc if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("fileinfo failed: %s\n", nt_errstr(status))); - ret = False; + ret = false; break; } torture_comment(tctx, "write time %s\n", @@ -373,7 +373,7 @@ static BOOL test_delayed_write_update2(struct torture_context *tctx, struct smbc fnum1 = smbcli_open(cli->tree, fname, O_RDWR, DENY_NONE); if (fnum1 == -1) { torture_comment(tctx, "Failed to open %s\n", fname); - return False; + return false; } finfo1.basic_info.level = RAW_FILEINFO_BASIC_INFO; @@ -384,7 +384,7 @@ static BOOL test_delayed_write_update2(struct torture_context *tctx, struct smbc if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("fileinfo failed: %s\n", nt_errstr(status))); - return False; + return false; } torture_comment(tctx, "Second open initial write time %s\n", @@ -398,7 +398,7 @@ static BOOL test_delayed_write_update2(struct torture_context *tctx, struct smbc if (written != 10) { torture_comment(tctx, "write failed - wrote %d bytes (%s)\n", (int)written, __location__); - return False; + return false; } finfo1.basic_info.level = RAW_FILEINFO_BASIC_INFO; @@ -408,7 +408,7 @@ static BOOL test_delayed_write_update2(struct torture_context *tctx, struct smbc if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("fileinfo failed: %s\n", nt_errstr(status))); - return False; + return false; } torture_comment(tctx, "write time %s\n", nt_time_string(tctx, finfo2.basic_info.out.write_time)); @@ -426,7 +426,7 @@ static BOOL test_delayed_write_update2(struct torture_context *tctx, struct smbc if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("fileinfo failed: %s\n", nt_errstr(status))); - ret = False; + ret = false; break; } torture_comment(tctx, "write time %s\n", @@ -468,7 +468,7 @@ static BOOL test_delayed_write_update2(struct torture_context *tctx, struct smbc * nasty.... */ -static BOOL test_finfo_after_write(struct torture_context *tctx, struct smbcli_state *cli, +static bool test_finfo_after_write(struct torture_context *tctx, struct smbcli_state *cli, struct smbcli_state *cli2) { union smb_fileinfo finfo1, finfo2; @@ -476,16 +476,16 @@ static BOOL test_finfo_after_write(struct torture_context *tctx, struct smbcli_s NTSTATUS status; int fnum1 = -1; int fnum2; - BOOL ret = True; + bool ret = true; ssize_t written; if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } fnum1 = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE); if (fnum1 == -1) { - ret = False; + ret = false; torture_result(tctx, TORTURE_FAIL, __location__": unable to open %s", fname); goto done; } @@ -496,7 +496,7 @@ static BOOL test_finfo_after_write(struct torture_context *tctx, struct smbcli_s status = smb_raw_fileinfo(cli->tree, tctx, &finfo1); if (!NT_STATUS_IS_OK(status)) { - ret = False; + ret = false; torture_result(tctx, TORTURE_FAIL, __location__": fileinfo failed: %s", nt_errstr(status)); goto done; } @@ -507,7 +507,7 @@ static BOOL test_finfo_after_write(struct torture_context *tctx, struct smbcli_s if (written != 1) { torture_result(tctx, TORTURE_FAIL, __location__": written gave %d - should have been 1", (int)written); - ret = False; + ret = false; goto done; } @@ -515,7 +515,7 @@ static BOOL test_finfo_after_write(struct torture_context *tctx, struct smbcli_s if (fnum2 == -1) { torture_result(tctx, TORTURE_FAIL, __location__": failed to open 2nd time - %s", smbcli_errstr(cli2->tree)); - ret = False; + ret = false; goto done; } @@ -524,7 +524,7 @@ static BOOL test_finfo_after_write(struct torture_context *tctx, struct smbcli_s if (written != 1) { torture_result(tctx, TORTURE_FAIL, __location__": written gave %d - should have been 1", (int)written); - ret = False; + ret = false; goto done; } @@ -536,21 +536,21 @@ static BOOL test_finfo_after_write(struct torture_context *tctx, struct smbcli_s if (!NT_STATUS_IS_OK(status)) { torture_result(tctx, TORTURE_FAIL, __location__": fileinfo failed: %s", nt_errstr(status)); - ret = False; + ret = false; goto done; } if (finfo1.basic_info.out.create_time != finfo2.basic_info.out.create_time) { torture_result(tctx, TORTURE_FAIL, __location__": create_time changed"); - ret = False; + ret = false; goto done; } if (finfo1.basic_info.out.access_time != finfo2.basic_info.out.access_time) { torture_result(tctx, TORTURE_FAIL, __location__": access_time changed"); - ret = False; + ret = false; goto done; } @@ -560,14 +560,14 @@ static BOOL test_finfo_after_write(struct torture_context *tctx, struct smbcli_s "write time conn 1 = %s, conn 2 = %s", nt_time_string(tctx, finfo1.basic_info.out.write_time), nt_time_string(tctx, finfo2.basic_info.out.write_time)); - ret = False; + ret = false; goto done; } if (finfo1.basic_info.out.change_time != finfo2.basic_info.out.change_time) { torture_result(tctx, TORTURE_FAIL, __location__": change_time changed"); - ret = False; + ret = false; goto done; } @@ -587,7 +587,7 @@ static BOOL test_finfo_after_write(struct torture_context *tctx, struct smbcli_s if (!NT_STATUS_IS_OK(status)) { torture_result(tctx, TORTURE_FAIL, __location__": fileinfo failed: %s", nt_errstr(status)); - ret = False; + ret = false; goto done; } diff --git a/source4/torture/basic/delete.c b/source4/torture/basic/delete.c index 93b282272fb..38528cd8456 100644 --- a/source4/torture/basic/delete.c +++ b/source4/torture/basic/delete.c @@ -144,7 +144,7 @@ static bool deltest1(struct torture_context *tctx, struct smbcli_state *cli1, st torture_assert(tctx, fnum1 == -1, talloc_asprintf(tctx, "open of %s succeeded (should fail)", fname)); - return True; + return true; } /* Test 2 - this should delete the file on close. */ @@ -163,7 +163,7 @@ static bool deltest2(struct torture_context *tctx, struct smbcli_state *cli1, st talloc_asprintf(tctx, "open of %s failed (%s)", fname, smbcli_errstr(cli1->tree))); - torture_assert_ntstatus_ok(tctx, smbcli_nt_delete_on_close(cli1->tree, fnum1, True), + torture_assert_ntstatus_ok(tctx, smbcli_nt_delete_on_close(cli1->tree, fnum1, true), talloc_asprintf(tctx, "setting delete_on_close failed (%s)", smbcli_errstr(cli1->tree))); @@ -178,7 +178,7 @@ static bool deltest2(struct torture_context *tctx, struct smbcli_state *cli1, st if (NT_STATUS_IS_ERR(smbcli_close(cli1->tree, fnum1))) { printf("(%s) close failed (%s)\n", __location__, smbcli_errstr(cli1->tree)); - return False; + return false; } smbcli_unlink(cli1->tree, fname); } @@ -227,7 +227,7 @@ static bool deltest3(struct torture_context *tctx, struct smbcli_state *cli1, st fname, smbcli_errstr(cli1->tree))); torture_assert_ntstatus_ok(tctx, - smbcli_nt_delete_on_close(cli1->tree, fnum1, True), + smbcli_nt_delete_on_close(cli1->tree, fnum1, true), talloc_asprintf(tctx, "setting delete_on_close failed (%s)", smbcli_errstr(cli1->tree))); @@ -250,9 +250,9 @@ static bool deltest3(struct torture_context *tctx, struct smbcli_state *cli1, st __location__, smbcli_errstr(cli1->tree)); } smbcli_unlink(cli1->tree, fname); - return False; + return false; } - return True; + return true; } /* Test 4 ... */ @@ -260,7 +260,7 @@ static bool deltest4(struct torture_context *tctx, struct smbcli_state *cli1, st { int fnum1 = -1; int fnum2 = -1; - bool correct = True; + bool correct = true; del_clean_area(cli1, cli2); @@ -292,7 +292,7 @@ static bool deltest4(struct torture_context *tctx, struct smbcli_state *cli1, st smbcli_errstr(cli1->tree))); torture_assert_ntstatus_ok(tctx, - smbcli_nt_delete_on_close(cli1->tree, fnum1, True), + smbcli_nt_delete_on_close(cli1->tree, fnum1, true), talloc_asprintf(tctx, "setting delete_on_close failed (%s)", smbcli_errstr(cli1->tree))); @@ -328,13 +328,13 @@ static bool deltest5(struct torture_context *tctx, struct smbcli_state *cli1, st /* This should fail - only allowed on NT opens with DELETE access. */ - torture_assert(tctx, !NT_STATUS_IS_OK(smbcli_nt_delete_on_close(cli1->tree, fnum1, True)), + torture_assert(tctx, !NT_STATUS_IS_OK(smbcli_nt_delete_on_close(cli1->tree, fnum1, true)), "setting delete_on_close on OpenX file succeeded - should fail !"); torture_assert_ntstatus_ok(tctx, smbcli_close(cli1->tree, fnum1), talloc_asprintf(tctx, "close - 2 failed (%s)", smbcli_errstr(cli1->tree))); - return True; + return true; } /* Test 6 ... */ @@ -358,7 +358,7 @@ static bool deltest6(struct torture_context *tctx, struct smbcli_state *cli1, st /* This should fail - only allowed on NT opens with DELETE access. */ torture_assert(tctx, - !NT_STATUS_IS_OK(smbcli_nt_delete_on_close(cli1->tree, fnum1, True)), + !NT_STATUS_IS_OK(smbcli_nt_delete_on_close(cli1->tree, fnum1, true)), "setting delete_on_close on file with no delete access succeeded - should fail !"); torture_assert_ntstatus_ok(tctx, @@ -366,14 +366,14 @@ static bool deltest6(struct torture_context *tctx, struct smbcli_state *cli1, st talloc_asprintf(tctx, "close - 2 failed (%s)", smbcli_errstr(cli1->tree))); - return True; + return true; } /* Test 7 ... */ static bool deltest7(struct torture_context *tctx, struct smbcli_state *cli1, struct smbcli_state *cli2) { int fnum1 = -1; - bool correct = True; + bool correct = true; del_clean_area(cli1, cli2); @@ -387,16 +387,16 @@ static bool deltest7(struct torture_context *tctx, struct smbcli_state *cli1, st torture_assert(tctx, fnum1 != -1, talloc_asprintf(tctx, "open of %s failed (%s)", fname, smbcli_errstr(cli1->tree))); - torture_assert_ntstatus_ok(tctx, smbcli_nt_delete_on_close(cli1->tree, fnum1, True), + torture_assert_ntstatus_ok(tctx, smbcli_nt_delete_on_close(cli1->tree, fnum1, true), "setting delete_on_close on file failed !"); - correct &= check_delete_on_close(tctx, cli1, fnum1, fname, True, __location__); + correct &= check_delete_on_close(tctx, cli1, fnum1, fname, true, __location__); torture_assert_ntstatus_ok(tctx, - smbcli_nt_delete_on_close(cli1->tree, fnum1, False), + smbcli_nt_delete_on_close(cli1->tree, fnum1, false), "unsetting delete_on_close on file failed !"); - correct &= check_delete_on_close(tctx, cli1, fnum1, fname, False, __location__); + correct &= check_delete_on_close(tctx, cli1, fnum1, fname, false, __location__); torture_assert_ntstatus_ok(tctx, smbcli_close(cli1->tree, fnum1), talloc_asprintf(tctx, "close - 2 failed (%s)", smbcli_errstr(cli1->tree))); @@ -419,7 +419,7 @@ static bool deltest8(struct torture_context *tctx, struct smbcli_state *cli1, st { int fnum1 = -1; int fnum2 = -1; - bool correct = True; + bool correct = true; del_clean_area(cli1, cli2); @@ -447,18 +447,18 @@ static bool deltest8(struct torture_context *tctx, struct smbcli_state *cli1, st fname, smbcli_errstr(cli1->tree))); torture_assert_ntstatus_ok(tctx, - smbcli_nt_delete_on_close(cli1->tree, fnum1, True), + smbcli_nt_delete_on_close(cli1->tree, fnum1, true), "setting delete_on_close on file failed !"); - correct &= check_delete_on_close(tctx, cli1, fnum1, fname, True, __location__); - correct &= check_delete_on_close(tctx, cli2, fnum2, fname, True, __location__); + correct &= check_delete_on_close(tctx, cli1, fnum1, fname, true, __location__); + correct &= check_delete_on_close(tctx, cli2, fnum2, fname, true, __location__); torture_assert_ntstatus_ok(tctx, smbcli_close(cli1->tree, fnum1), talloc_asprintf(tctx, "close - 1 failed (%s)", smbcli_errstr(cli1->tree))); - correct &= check_delete_on_close(tctx, cli1, -1, fname, True, __location__); - correct &= check_delete_on_close(tctx, cli2, fnum2, fname, True, __location__); + correct &= check_delete_on_close(tctx, cli1, -1, fname, true, __location__); + correct &= check_delete_on_close(tctx, cli2, fnum2, fname, true, __location__); torture_assert_ntstatus_ok(tctx, smbcli_close(cli2->tree, fnum2), talloc_asprintf(tctx, "close - 2 failed (%s)", smbcli_errstr(cli2->tree))); @@ -490,7 +490,7 @@ static bool deltest9(struct torture_context *tctx, struct smbcli_state *cli1, st talloc_asprintf(tctx, "open of %s succeeded should have failed!", fname)); - return True; + return true; } /* Test 10 ... */ @@ -544,7 +544,7 @@ static bool deltest11(struct torture_context *tctx, struct smbcli_state *cli1, s torture_assert(tctx, fnum1 != -1, talloc_asprintf(tctx, "open of %s failed (%s)", fname, smbcli_errstr(cli1->tree))); - status = smbcli_nt_delete_on_close(cli1->tree, fnum1, True); + status = smbcli_nt_delete_on_close(cli1->tree, fnum1, true); torture_assert_ntstatus_equal(tctx, status, NT_STATUS_CANNOT_DELETE, talloc_asprintf(tctx, "setting delete_on_close should fail with NT_STATUS_CANNOT_DELETE. Got %s instead)", smbcli_errstr(cli1->tree))); @@ -553,7 +553,7 @@ static bool deltest11(struct torture_context *tctx, struct smbcli_state *cli1, s talloc_asprintf(tctx, "close failed (%s)", smbcli_errstr(cli1->tree))); - return True; + return true; } /* Test 12 ... */ @@ -593,7 +593,7 @@ static bool deltest13(struct torture_context *tctx, struct smbcli_state *cli1, s { int fnum1 = -1; int fnum2 = -1; - bool correct = True; + bool correct = true; del_clean_area(cli1, cli2); @@ -631,18 +631,18 @@ static bool deltest13(struct torture_context *tctx, struct smbcli_state *cli1, s torture_assert_ntstatus_ok(tctx, smbcli_nt_delete_on_close(cli1->tree, fnum1, - True), + true), "setting delete_on_close on file failed !"); - correct &= check_delete_on_close(tctx, cli1, fnum1, fname, True, __location__); - correct &= check_delete_on_close(tctx, cli2, fnum2, fname, True, __location__); + correct &= check_delete_on_close(tctx, cli1, fnum1, fname, true, __location__); + correct &= check_delete_on_close(tctx, cli2, fnum2, fname, true, __location__); torture_assert_ntstatus_ok(tctx, smbcli_nt_delete_on_close(cli2->tree, fnum2, - False), + false), "setting delete_on_close on file failed !"); - correct &= check_delete_on_close(tctx, cli1, fnum1, fname, False, __location__); - correct &= check_delete_on_close(tctx, cli2, fnum2, fname, False, __location__); + correct &= check_delete_on_close(tctx, cli1, fnum1, fname, false, __location__); + correct &= check_delete_on_close(tctx, cli2, fnum2, fname, false, __location__); torture_assert_ntstatus_ok(tctx, smbcli_close(cli1->tree, fnum1), talloc_asprintf(tctx, "close - 1 failed (%s)", @@ -684,10 +684,10 @@ static bool deltest14(struct torture_context *tctx, struct smbcli_state *cli1, s torture_assert(tctx, dnum1 != -1, talloc_asprintf(tctx, "open of %s failed: %s!", dname, smbcli_errstr(cli1->tree))); - correct &= check_delete_on_close(tctx, cli1, dnum1, dname, False, __location__); - torture_assert_ntstatus_ok(tctx, smbcli_nt_delete_on_close(cli1->tree, dnum1, True), + correct &= check_delete_on_close(tctx, cli1, dnum1, dname, false, __location__); + torture_assert_ntstatus_ok(tctx, smbcli_nt_delete_on_close(cli1->tree, dnum1, true), "setting delete_on_close on file failed !"); - correct &= check_delete_on_close(tctx, cli1, dnum1, dname, True, __location__); + correct &= check_delete_on_close(tctx, cli1, dnum1, dname, true, __location__); smbcli_close(cli1->tree, dnum1); /* Now it should be gone... */ @@ -751,7 +751,7 @@ static bool deltest15(struct torture_context *tctx, struct smbcli_state *cli1, s talloc_asprintf(tctx, "open - 1 of %s failed (%s)", fname_new, smbcli_errstr(cli1->tree))); - status = smbcli_nt_delete_on_close(cli2->tree, fnum2, True); + status = smbcli_nt_delete_on_close(cli2->tree, fnum2, true); torture_assert_ntstatus_ok(tctx, status, "setting delete_on_close on file failed !"); @@ -761,7 +761,7 @@ static bool deltest15(struct torture_context *tctx, struct smbcli_state *cli1, s /* The file should be around under the new name, there's a second * handle open */ - correct &= check_delete_on_close(tctx, cli1, fnum1, fname_new, True, __location__); + correct &= check_delete_on_close(tctx, cli1, fnum1, fname_new, true, __location__); fnum2 = smbcli_nt_create_full(cli2->tree, fname, 0, SEC_GENERIC_ALL, @@ -775,7 +775,7 @@ static bool deltest15(struct torture_context *tctx, struct smbcli_state *cli1, s torture_assert(tctx, fnum2 != -1, talloc_asprintf(tctx, "open - 1 of %s failed (%s)", fname, smbcli_errstr(cli1->tree))); - correct &= check_delete_on_close(tctx, cli2, fnum2, fname, False, __location__); + correct &= check_delete_on_close(tctx, cli2, fnum2, fname, false, __location__); smbcli_close(cli2->tree, fnum2); smbcli_close(cli1->tree, fnum1); @@ -840,11 +840,11 @@ static bool deltest16(struct torture_context *tctx, struct smbcli_state *cli1, s torture_assert (tctx, fnum1 != -1, talloc_asprintf(tctx, "open - 1 of %s failed (%s)", fname, smbcli_errstr(cli1->tree))); /* The delete on close bit is *not* reported as being set. */ - correct &= check_delete_on_close(tctx, cli1, fnum1, fname, False, __location__); + correct &= check_delete_on_close(tctx, cli1, fnum1, fname, false, __location__); /* The delete on close bit is *not* reported as being set. */ - correct &= check_delete_on_close(tctx, cli1, -1, fname, False, __location__); - correct &= check_delete_on_close(tctx, cli2, -1, fname, False, __location__); + correct &= check_delete_on_close(tctx, cli1, -1, fname, false, __location__); + correct &= check_delete_on_close(tctx, cli2, -1, fname, false, __location__); /* Now try opening again for read-only. */ fnum2 = smbcli_nt_create_full(cli2->tree, fname, 0, @@ -860,15 +860,15 @@ static bool deltest16(struct torture_context *tctx, struct smbcli_state *cli1, s torture_assert(tctx, fnum2 != -1, talloc_asprintf(tctx, "open - 1 of %s failed (%s)", fname, smbcli_errstr(cli1->tree))); - correct &= check_delete_on_close(tctx, cli1, fnum1, fname, False, __location__); - correct &= check_delete_on_close(tctx, cli1, -1, fname, False, __location__); - correct &= check_delete_on_close(tctx, cli2, fnum2, fname, False, __location__); - correct &= check_delete_on_close(tctx, cli2, -1, fname, False, __location__); + correct &= check_delete_on_close(tctx, cli1, fnum1, fname, false, __location__); + correct &= check_delete_on_close(tctx, cli1, -1, fname, false, __location__); + correct &= check_delete_on_close(tctx, cli2, fnum2, fname, false, __location__); + correct &= check_delete_on_close(tctx, cli2, -1, fname, false, __location__); smbcli_close(cli1->tree, fnum1); - correct &= check_delete_on_close(tctx, cli2, fnum2, fname, True, __location__); - correct &= check_delete_on_close(tctx, cli2, -1, fname, True, __location__); + correct &= check_delete_on_close(tctx, cli2, fnum2, fname, true, __location__); + correct &= check_delete_on_close(tctx, cli2, -1, fname, true, __location__); smbcli_close(cli2->tree, fnum2); @@ -885,7 +885,7 @@ static bool deltest17(struct torture_context *tctx, struct smbcli_state *cli1, s { int fnum1 = -1; int fnum2 = -1; - bool correct = True; + bool correct = true; del_clean_area(cli1, cli2); @@ -926,7 +926,7 @@ static bool deltest17(struct torture_context *tctx, struct smbcli_state *cli1, s fname, smbcli_errstr(cli1->tree))); /* The delete on close bit is *not* reported as being set. */ - correct &= check_delete_on_close(tctx, cli1, fnum1, fname, False, __location__); + correct &= check_delete_on_close(tctx, cli1, fnum1, fname, false, __location__); /* Now try opening again for read-only. */ fnum2 = smbcli_nt_create_full(cli1->tree, fname, 0, @@ -944,12 +944,12 @@ static bool deltest17(struct torture_context *tctx, struct smbcli_state *cli1, s fname, smbcli_errstr(cli1->tree))); /* still not reported as being set on either */ - correct &= check_delete_on_close(tctx, cli1, fnum1, fname, False, __location__); - correct &= check_delete_on_close(tctx, cli1, fnum2, fname, False, __location__); + correct &= check_delete_on_close(tctx, cli1, fnum1, fname, false, __location__); + correct &= check_delete_on_close(tctx, cli1, fnum2, fname, false, __location__); smbcli_close(cli1->tree, fnum1); - correct &= check_delete_on_close(tctx, cli1, fnum2, fname, False, __location__); + correct &= check_delete_on_close(tctx, cli1, fnum2, fname, false, __location__); smbcli_close(cli1->tree, fnum2); @@ -966,7 +966,7 @@ static bool deltest18(struct torture_context *tctx, struct smbcli_state *cli1, s { int fnum1 = -1; int fnum2 = -1; - bool correct = True; + bool correct = true; del_clean_area(cli1, cli2); @@ -994,7 +994,7 @@ static bool deltest18(struct torture_context *tctx, struct smbcli_state *cli1, s dname, smbcli_errstr(cli1->tree))); /* The delete on close bit is *not* reported as being set. */ - correct &= check_delete_on_close(tctx, cli1, fnum1, dname, False, __location__); + correct &= check_delete_on_close(tctx, cli1, fnum1, dname, false, __location__); /* Now try opening again for read-only. */ fnum2 = smbcli_nt_create_full(cli1->tree, dname, 0, @@ -1011,12 +1011,12 @@ static bool deltest18(struct torture_context *tctx, struct smbcli_state *cli1, s torture_assert(tctx, fnum2 != -1, talloc_asprintf(tctx, "open - 1 of %s failed (%s)", dname, smbcli_errstr(cli1->tree))); - correct &= check_delete_on_close(tctx, cli1, fnum1, dname, False, __location__); - correct &= check_delete_on_close(tctx, cli1, fnum2, dname, False, __location__); + correct &= check_delete_on_close(tctx, cli1, fnum1, dname, false, __location__); + correct &= check_delete_on_close(tctx, cli1, fnum2, dname, false, __location__); smbcli_close(cli1->tree, fnum1); - correct &= check_delete_on_close(tctx, cli1, fnum2, dname, True, __location__); + correct &= check_delete_on_close(tctx, cli1, fnum2, dname, true, __location__); smbcli_close(cli1->tree, fnum2); @@ -1040,7 +1040,7 @@ static bool deltest19(struct torture_context *tctx, struct smbcli_state *cli1, s { int fnum1 = -1; int fnum2 = -1; - bool correct = True; + bool correct = true; del_clean_area(cli1, cli2); @@ -1082,7 +1082,7 @@ static bool deltest19(struct torture_context *tctx, struct smbcli_state *cli1, s talloc_asprintf(tctx, "open - 1 of %s failed (%s)", fname, smbcli_errstr(cli1->tree))); /* The delete on close bit is *not* reported as being set. */ - correct &= check_delete_on_close(tctx, cli1, fnum1, dname, False, __location__); + correct &= check_delete_on_close(tctx, cli1, fnum1, dname, false, __location__); /* Now try opening again for read-only. */ fnum2 = smbcli_nt_create_full(cli1->tree, dname, 0, @@ -1100,7 +1100,7 @@ static bool deltest19(struct torture_context *tctx, struct smbcli_state *cli1, s smbcli_close(cli1->tree, fnum1); - correct &= check_delete_on_close(tctx, cli1, fnum2, dname, True, __location__); + correct &= check_delete_on_close(tctx, cli1, fnum2, dname, true, __location__); smbcli_close(cli1->tree, fnum2); @@ -1127,15 +1127,15 @@ static bool deltest20(struct torture_context *tctx, struct smbcli_state *cli1, s { int fnum1 = -1; int dnum1 = -1; - bool correct = True; + bool correct = true; NTSTATUS status; del_clean_area(cli1, cli2); /* Test 20 -- non-empty directory hardest to get right... */ - if (torture_setting_bool(tctx, "samba3", False)) { - return True; + if (torture_setting_bool(tctx, "samba3", false)) { + return true; } smbcli_deltree(cli1->tree, dname); @@ -1153,8 +1153,8 @@ static bool deltest20(struct torture_context *tctx, struct smbcli_state *cli1, s torture_assert(tctx, dnum1 != -1, talloc_asprintf(tctx, "open of %s failed: %s!", dname, smbcli_errstr(cli1->tree))); - correct &= check_delete_on_close(tctx, cli1, dnum1, dname, False, __location__); - status = smbcli_nt_delete_on_close(cli1->tree, dnum1, True); + correct &= check_delete_on_close(tctx, cli1, dnum1, dname, false, __location__); + status = smbcli_nt_delete_on_close(cli1->tree, dnum1, true); { char *fullname; @@ -1172,7 +1172,7 @@ static bool deltest20(struct torture_context *tctx, struct smbcli_state *cli1, s "smbcli_open failed"); } - status = smbcli_nt_delete_on_close(cli1->tree, dnum1, False); + status = smbcli_nt_delete_on_close(cli1->tree, dnum1, false); torture_assert_ntstatus_ok(tctx, status, "setting delete_on_close on file failed !"); @@ -1187,7 +1187,7 @@ static bool deltest20(struct torture_context *tctx, struct smbcli_state *cli1, s smbcli_close(cli1->tree, fnum1); } - status = smbcli_nt_delete_on_close(cli1->tree, dnum1, True); + status = smbcli_nt_delete_on_close(cli1->tree, dnum1, true); torture_assert_ntstatus_equal(tctx, status, NT_STATUS_DIRECTORY_NOT_EMPTY, "setting delete_on_close failed"); @@ -1201,7 +1201,7 @@ static bool deltest20a(struct torture_context *tctx, struct smbcli_state *cli1, { int fnum1 = -1; int fnum2 = -1; - bool correct = True; + bool correct = true; del_clean_area(cli1, cli2); @@ -1239,12 +1239,12 @@ static bool deltest20a(struct torture_context *tctx, struct smbcli_state *cli1, fname, smbcli_errstr(cli2->tree))); /* The delete on close bit is *not* reported as being set. */ - correct &= check_delete_on_close(tctx, cli1, fnum1, fname, False, __location__); - correct &= check_delete_on_close(tctx, cli2, fnum2, fname, False, __location__); + correct &= check_delete_on_close(tctx, cli1, fnum1, fname, false, __location__); + correct &= check_delete_on_close(tctx, cli2, fnum2, fname, false, __location__); smbcli_close(cli1->tree, fnum1); - correct &= check_delete_on_close(tctx, cli2, fnum2, fname, False, __location__); + correct &= check_delete_on_close(tctx, cli2, fnum2, fname, false, __location__); smbcli_close(cli2->tree, fnum2); @@ -1267,7 +1267,7 @@ static bool deltest20b(struct torture_context *tctx, struct smbcli_state *cli1, { int fnum1 = -1; int fnum2 = -1; - bool correct = True; + bool correct = true; del_clean_area(cli1, cli2); @@ -1322,12 +1322,12 @@ static bool deltest20b(struct torture_context *tctx, struct smbcli_state *cli1, fname, smbcli_errstr(cli2->tree))); /* The delete on close bit is *not* reported as being set. */ - correct &= check_delete_on_close(tctx, cli1, fnum1, fname, False, __location__); - correct &= check_delete_on_close(tctx, cli2, fnum2, fname, False, __location__); + correct &= check_delete_on_close(tctx, cli1, fnum1, fname, false, __location__); + correct &= check_delete_on_close(tctx, cli2, fnum2, fname, false, __location__); smbcli_close(cli1->tree, fnum1); - correct &= check_delete_on_close(tctx, cli2, fnum2, fname, False, __location__); + correct &= check_delete_on_close(tctx, cli2, fnum2, fname, false, __location__); /* Rename the file by handle. */ @@ -1349,7 +1349,7 @@ static bool deltest20b(struct torture_context *tctx, struct smbcli_state *cli1, fname, fname_new, smbcli_errstr(cli2->tree))); } - correct &= check_delete_on_close(tctx, cli2, fnum2, fname_new, False, __location__); + correct &= check_delete_on_close(tctx, cli2, fnum2, fname_new, false, __location__); smbcli_close(cli2->tree, fnum2); @@ -1371,13 +1371,13 @@ static bool deltest21(struct torture_context *tctx) int fnum1 = -1; struct smbcli_state *cli1; struct smbcli_state *cli2; - bool correct = True; + bool correct = true; if (!torture_open_connection(&cli1, 0)) - return False; + return false; if (!torture_open_connection(&cli2, 1)) - return False; + return false; del_clean_area(cli1, cli2); @@ -1392,12 +1392,12 @@ static bool deltest21(struct torture_context *tctx) fname, smbcli_errstr(cli1->tree))); torture_assert_ntstatus_ok(tctx, - smbcli_nt_delete_on_close(cli1->tree, fnum1, True), + smbcli_nt_delete_on_close(cli1->tree, fnum1, true), talloc_asprintf(tctx, "setting delete_on_close failed (%s)", smbcli_errstr(cli1->tree))); /* Ensure delete on close is set. */ - correct &= check_delete_on_close(tctx, cli1, fnum1, fname, True, __location__); + correct &= check_delete_on_close(tctx, cli1, fnum1, fname, true, __location__); /* Now yank the rug from under cli1. */ smbcli_transport_dead(cli1->transport, NT_STATUS_LOCAL_DISCONNECT); @@ -1405,7 +1405,7 @@ static bool deltest21(struct torture_context *tctx) fnum1 = -1; if (!torture_open_connection(&cli1, 0)) { - return False; + return false; } /* On slow build farm machines it might happen that they are not fast @@ -1438,10 +1438,10 @@ static bool deltest22(struct torture_context *tctx) int dnum1 = -1; int dnum2 = -1; struct smbcli_state *cli1; - bool correct = True; + bool correct = true; if (!torture_open_connection(&cli1, 0)) - return False; + return false; smbcli_deltree(cli1->tree, dname); @@ -1480,7 +1480,7 @@ static bool deltest22(struct torture_context *tctx) dname, smbcli_errstr(cli1->tree))); torture_assert_ntstatus_ok( - tctx, smbcli_nt_delete_on_close(cli1->tree, dnum1, True), + tctx, smbcli_nt_delete_on_close(cli1->tree, dnum1, true), talloc_asprintf(tctx, "setting delete_on_close failed (%s)", smbcli_errstr(cli1->tree))); diff --git a/source4/torture/basic/denytest.c b/source4/torture/basic/denytest.c index 7709ccebcae..bc64d4b2ffc 100644 --- a/source4/torture/basic/denytest.c +++ b/source4/torture/basic/denytest.c @@ -1415,7 +1415,7 @@ bool torture_denytest1(struct torture_context *tctx, { int fnum1, fnum2; int i; - BOOL correct = True; + bool correct = true; struct timeval tv, tv_start; const char *fnames[2] = {"\\denytest1.dat", "\\denytest1.exe"}; int failures=0; @@ -1461,7 +1461,7 @@ bool torture_denytest1(struct torture_context *tctx, } } - if (torture_setting_bool(tctx, "showall", False) || + if (torture_setting_bool(tctx, "showall", false) || res != denytable1[i].result) { int64_t tdif; GetTimeOfDay(&tv); @@ -1479,7 +1479,7 @@ bool torture_denytest1(struct torture_context *tctx, } if (res != denytable1[i].result) { - correct = False; + correct = false; CHECK_MAX_FAILURES(failed); } @@ -1506,7 +1506,7 @@ bool torture_denytest2(struct torture_context *tctx, { int fnum1, fnum2; int i; - BOOL correct = True; + bool correct = true; const char *fnames[2] = {"\\denytest2.dat", "\\denytest2.exe"}; struct timeval tv, tv_start; int failures=0; @@ -1548,7 +1548,7 @@ bool torture_denytest2(struct torture_context *tctx, } } - if (torture_setting_bool(tctx, "showall", False) || + if (torture_setting_bool(tctx, "showall", false) || res != denytable2[i].result) { int64_t tdif; GetTimeOfDay(&tv); @@ -1566,7 +1566,7 @@ bool torture_denytest2(struct torture_context *tctx, } if (res != denytable2[i].result) { - correct = False; + correct = false; CHECK_MAX_FAILURES(failed); } @@ -1616,7 +1616,7 @@ bool torture_denytest3(struct torture_context *tctx, smbcli_unlink(cli1->tree, fname); torture_comment(tctx, "fnum1=%d fnum2=%d\n", fnum1, fnum2); - return True; + return true; } struct bit_value { @@ -1658,7 +1658,7 @@ static const char *bit_string(TALLOC_CTX *mem_ctx, const struct bit_value *bv, i determine if two opens conflict */ static NTSTATUS predict_share_conflict(uint32_t sa1, uint32_t am1, uint32_t sa2, uint32_t am2, - BOOL read_for_execute, enum deny_result *res) + bool read_for_execute, enum deny_result *res) { #define CHECK_MASK(am, sa, right, share) do { \ if (((am) & (right)) && !((sa) & (share))) { \ @@ -1721,7 +1721,7 @@ static NTSTATUS predict_share_conflict(uint32_t sa1, uint32_t am1, uint32_t sa2, /* a denytest for ntcreatex */ -static BOOL torture_ntdenytest(struct torture_context *tctx, +static bool torture_ntdenytest(struct torture_context *tctx, struct smbcli_state *cli1, struct smbcli_state *cli2, int client) { const struct bit_value share_access_bits[] = { @@ -1741,7 +1741,7 @@ static BOOL torture_ntdenytest(struct torture_context *tctx, }; int fnum1; int i; - BOOL correct = True; + bool correct = true; struct timeval tv, tv_start; const char *fname; int nbits1 = ARRAY_SIZE(share_access_bits); @@ -1787,7 +1787,7 @@ static BOOL torture_ntdenytest(struct torture_context *tctx, int b_am1 = random() & ((1<tree, mem_ctx, &io2); if (random() % 2 == 0) { - read_for_execute = True; + read_for_execute = true; } else { - read_for_execute = False; + read_for_execute = false; } if (!NT_STATUS_IS_OK(status1)) { @@ -1853,7 +1853,7 @@ static BOOL torture_ntdenytest(struct torture_context *tctx, GetTimeOfDay(&tv); tdif = usec_time_diff(&tv, &tv_start); tdif /= 1000; - if (torture_setting_bool(tctx, "showall", False) || + if (torture_setting_bool(tctx, "showall", false) || !NT_STATUS_EQUAL(status2, status2_p) || res != res2) { torture_comment(tctx, "\n%-20s %-70s\n%-20s %-70s %4s %4s %s/%s\n", @@ -1871,7 +1871,7 @@ static BOOL torture_ntdenytest(struct torture_context *tctx, if (res != res2 || !NT_STATUS_EQUAL(status2, status2_p)) { CHECK_MAX_FAILURES(failed); - correct = False; + correct = false; } talloc_free(mem_ctx); @@ -1916,7 +1916,7 @@ bool torture_ntdenytest2(struct torture_context *torture, if (!NT_STATUS_EQUAL(status, correct)) { \ torture_comment(tctx, "(%s) Incorrect status %s - should be %s\n", \ __location__, nt_errstr(status), nt_errstr(correct)); \ - ret = False; \ + ret = false; \ goto done; \ }} while (0) @@ -1924,7 +1924,7 @@ bool torture_ntdenytest2(struct torture_context *torture, if ((v) != (correct)) { \ torture_comment(tctx, "(%s) wrong value for %s 0x%x - should be 0x%x\n", \ __location__, #v, (int)(v), (int)correct); \ - ret = False; \ + ret = false; \ }} while (0) /* @@ -1938,7 +1938,7 @@ bool torture_denydos_sharing(struct torture_context *tctx, const char *fname = "\\torture_denydos.txt"; NTSTATUS status; int fnum1 = -1, fnum2 = -1; - BOOL ret = True; + bool ret = true; union smb_setfileinfo sfinfo; TALLOC_CTX *mem_ctx; diff --git a/source4/torture/basic/dir.c b/source4/torture/basic/dir.c index 9f9122fe327..9a1ae2f744f 100644 --- a/source4/torture/basic/dir.c +++ b/source4/torture/basic/dir.c @@ -38,7 +38,7 @@ bool torture_dirtest1(struct torture_context *tctx, { int i; int fnum; - BOOL correct = True; + bool correct = true; extern int torture_numops; struct timeval tv; @@ -53,7 +53,7 @@ bool torture_dirtest1(struct torture_context *tctx, if (fnum == -1) { fprintf(stderr,"(%s) Failed to open %s\n", __location__, fname); - return False; + return false; } smbcli_close(cli->tree, fnum); free(fname); @@ -81,11 +81,11 @@ bool torture_dirtest2(struct torture_context *tctx, { int i; int fnum, num_seen; - BOOL correct = True; + bool correct = true; extern int torture_entries; if (!torture_setup_dir(cli, "\\LISTDIR")) { - return False; + return false; } torture_comment(tctx, "Creating %d files\n", torture_entries); @@ -102,7 +102,7 @@ bool torture_dirtest2(struct torture_context *tctx, if (fnum == -1) { fprintf(stderr,"(%s) Failed to open %s, error=%s\n", __location__, fname, smbcli_errstr(cli->tree)); - return False; + return false; } free(fname); smbcli_close(cli->tree, fnum); @@ -113,7 +113,7 @@ bool torture_dirtest2(struct torture_context *tctx, if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, fname))) { fprintf(stderr,"(%s) Failed to open %s, error=%s\n", __location__, fname, smbcli_errstr(cli->tree)); - return False; + return false; } free(fname); } @@ -123,7 +123,7 @@ bool torture_dirtest2(struct torture_context *tctx, torture_comment(tctx, "num_seen = %d\n", num_seen ); /* We should see (torture_entries) each of files & directories + . and .. */ if (num_seen != (2*torture_entries)+2) { - correct = False; + correct = false; fprintf(stderr,"(%s) entry count mismatch, should be %d, was %d\n", __location__, (2*torture_entries)+2, num_seen); } @@ -135,7 +135,7 @@ bool torture_dirtest2(struct torture_context *tctx, num_seen = smbcli_list_old(cli->tree, "\\LISTDIR\\*", (FILE_ATTRIBUTE_DIRECTORY<<8)|FILE_ATTRIBUTE_DIRECTORY, list_fn, NULL); torture_comment(tctx, "num_seen = %d\n", num_seen ); if (num_seen != torture_entries+2) { - correct = False; + correct = false; fprintf(stderr,"(%s) entry count mismatch, should be %d, was %d\n", __location__, torture_entries+2, num_seen); } @@ -143,7 +143,7 @@ bool torture_dirtest2(struct torture_context *tctx, num_seen = smbcli_list_old(cli->tree, "\\LISTDIR\\*", (FILE_ATTRIBUTE_ARCHIVE<<8)|FILE_ATTRIBUTE_DIRECTORY, list_fn, NULL); torture_comment(tctx, "num_seen = %d\n", num_seen ); if (num_seen != torture_entries) { - correct = False; + correct = false; fprintf(stderr,"(%s) entry count mismatch, should be %d, was %d\n", __location__, torture_entries, num_seen); } @@ -152,7 +152,7 @@ bool torture_dirtest2(struct torture_context *tctx, if (smbcli_deltree(cli->tree, "\\LISTDIR") == -1) { fprintf(stderr,"(%s) Failed to deltree %s, error=%s\n", "\\LISTDIR", __location__, smbcli_errstr(cli->tree)); - return False; + return false; } #if 0 diff --git a/source4/torture/basic/disconnect.c b/source4/torture/basic/disconnect.c index 1dab4b0cae5..cb77bfe984d 100644 --- a/source4/torture/basic/disconnect.c +++ b/source4/torture/basic/disconnect.c @@ -33,13 +33,13 @@ printf("(%s) Incorrect status %s - should be %s\n", \ __location__, nt_errstr(status), nt_errstr(correct)); \ talloc_free(cli); \ - return False; \ + return false; \ }} while (0) /* test disconnect after async open */ -static BOOL test_disconnect_open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_disconnect_open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { union smb_open io; NTSTATUS status; @@ -71,14 +71,14 @@ static BOOL test_disconnect_open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) talloc_free(cli); - return True; + return true; } /* test disconnect with timed lock */ -static BOOL test_disconnect_lock(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_disconnect_lock(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { union smb_lock io; NTSTATUS status; @@ -92,7 +92,7 @@ static BOOL test_disconnect_lock(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) O_RDWR | O_CREAT, DENY_NONE); if (fnum == -1) { printf("open failed in mux_write - %s\n", smbcli_errstr(cli->tree)); - return False; + return false; } io.lockx.level = RAW_LOCK_LOCKX; @@ -118,7 +118,7 @@ static BOOL test_disconnect_lock(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) talloc_free(cli); - return True; + return true; } @@ -128,7 +128,7 @@ static BOOL test_disconnect_lock(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) */ bool torture_disconnect(struct torture_context *torture) { - BOOL ret = True; + bool ret = true; TALLOC_CTX *mem_ctx; int i; extern int torture_numops; @@ -137,25 +137,25 @@ bool torture_disconnect(struct torture_context *torture) mem_ctx = talloc_init("torture_raw_mux"); if (!torture_open_connection(&cli, 0)) { - return False; + return false; } if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } for (i=0;itree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); @@ -71,14 +71,14 @@ static bool torture_locktest1(struct torture_context *tctx, "lock2 succeeded! This is a locking bug\n"); if (!check_error(__location__, cli2, ERRDOS, ERRlock, - NT_STATUS_LOCK_NOT_GRANTED)) return False; + NT_STATUS_LOCK_NOT_GRANTED)) return false; torture_assert(tctx, !NT_STATUS_IS_OK(smbcli_lock(cli2->tree, fnum3, 0, 4, 0, WRITE_LOCK)), "lock2 succeeded! This is a locking bug\n"); if (!check_error(__location__, cli2, ERRDOS, ERRlock, - NT_STATUS_FILE_LOCK_CONFLICT)) return False; + NT_STATUS_FILE_LOCK_CONFLICT)) return false; torture_assert_ntstatus_ok(tctx, smbcli_lock(cli1->tree, fnum1, 5, 9, 0, WRITE_LOCK), @@ -90,21 +90,21 @@ static bool torture_locktest1(struct torture_context *tctx, "lock2 succeeded! This is a locking bug"); if (!check_error(__location__, cli2, ERRDOS, ERRlock, - NT_STATUS_LOCK_NOT_GRANTED)) return False; + NT_STATUS_LOCK_NOT_GRANTED)) return false; torture_assert(tctx, !NT_STATUS_IS_OK(smbcli_lock(cli2->tree, fnum3, 0, 4, 0, WRITE_LOCK)), "lock2 succeeded! This is a locking bug"); if (!check_error(__location__, cli2, ERRDOS, ERRlock, - NT_STATUS_LOCK_NOT_GRANTED)) return False; + NT_STATUS_LOCK_NOT_GRANTED)) return false; torture_assert(tctx, !NT_STATUS_IS_OK(smbcli_lock(cli2->tree, fnum3, 0, 4, 0, WRITE_LOCK)), "lock2 succeeded! This is a locking bug"); if (!check_error(__location__, cli2, ERRDOS, ERRlock, - NT_STATUS_FILE_LOCK_CONFLICT)) return False; + NT_STATUS_FILE_LOCK_CONFLICT)) return false; lock_timeout = (6 + (random() % 20)); torture_comment(tctx, "Testing lock timeout with timeout=%u\n", @@ -115,7 +115,7 @@ static bool torture_locktest1(struct torture_context *tctx, "lock3 succeeded! This is a locking bug\n"); if (!check_error(__location__, cli2, ERRDOS, ERRlock, - NT_STATUS_FILE_LOCK_CONFLICT)) return False; + NT_STATUS_FILE_LOCK_CONFLICT)) return false; t2 = time(NULL); if (t2 - t1 < 5) { @@ -133,7 +133,7 @@ static bool torture_locktest1(struct torture_context *tctx, "lock4 succeeded! This is a locking bug"); if (!check_error(__location__, cli2, ERRDOS, ERRlock, - NT_STATUS_FILE_LOCK_CONFLICT)) return False; + NT_STATUS_FILE_LOCK_CONFLICT)) return false; torture_assert_ntstatus_ok(tctx, smbcli_close(cli1->tree, fnum1), talloc_asprintf(tctx, "close2 failed (%s)", smbcli_errstr(cli1->tree))); @@ -166,7 +166,7 @@ static bool torture_locktest2(struct torture_context *tctx, int fnum1, fnum2, fnum3; if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } torture_comment(tctx, "Testing pid context\n"); @@ -202,21 +202,21 @@ static bool torture_locktest2(struct torture_context *tctx, "WRITE lock1 succeeded! This is a locking bug"); if (!check_error(__location__, cli, ERRDOS, ERRlock, - NT_STATUS_LOCK_NOT_GRANTED)) return False; + NT_STATUS_LOCK_NOT_GRANTED)) return false; torture_assert(tctx, !NT_STATUS_IS_OK(smbcli_lock(cli->tree, fnum2, 0, 4, 0, WRITE_LOCK)), "WRITE lock2 succeeded! This is a locking bug"); if (!check_error(__location__, cli, ERRDOS, ERRlock, - NT_STATUS_LOCK_NOT_GRANTED)) return False; + NT_STATUS_LOCK_NOT_GRANTED)) return false; torture_assert(tctx, !NT_STATUS_IS_OK(smbcli_lock(cli->tree, fnum2, 0, 4, 0, READ_LOCK)), "READ lock2 succeeded! This is a locking bug"); if (!check_error(__location__, cli, ERRDOS, ERRlock, - NT_STATUS_FILE_LOCK_CONFLICT)) return False; + NT_STATUS_FILE_LOCK_CONFLICT)) return false; torture_assert_ntstatus_ok(tctx, smbcli_lock(cli->tree, fnum1, 100, 4, 0, WRITE_LOCK), @@ -235,7 +235,7 @@ static bool torture_locktest2(struct torture_context *tctx, if (!check_error(__location__, cli, ERRDOS, ERRnotlocked, - NT_STATUS_RANGE_NOT_LOCKED)) return False; + NT_STATUS_RANGE_NOT_LOCKED)) return false; torture_assert(tctx, !NT_STATUS_IS_OK(smbcli_unlock(cli->tree, fnum1, 0, 8)), @@ -243,13 +243,13 @@ static bool torture_locktest2(struct torture_context *tctx, if (!check_error(__location__, cli, ERRDOS, ERRnotlocked, - NT_STATUS_RANGE_NOT_LOCKED)) return False; + NT_STATUS_RANGE_NOT_LOCKED)) return false; torture_assert(tctx, !NT_STATUS_IS_OK(smbcli_lock(cli->tree, fnum3, 0, 4, 0, WRITE_LOCK)), "lock3 succeeded! This is a locking bug"); - if (!check_error(__location__, cli, ERRDOS, ERRlock, NT_STATUS_LOCK_NOT_GRANTED)) return False; + if (!check_error(__location__, cli, ERRDOS, ERRlock, NT_STATUS_LOCK_NOT_GRANTED)) return false; cli->session->pid = 1; @@ -285,7 +285,7 @@ static bool torture_locktest3(struct torture_context *tctx, torture_comment(tctx, "Testing 32 bit offset ranges"); if (!torture_setup_dir(cli1, BASEDIR)) { - return False; + return false; } fnum1 = smbcli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); @@ -362,7 +362,7 @@ static bool torture_locktest3(struct torture_context *tctx, } #define EXPECTED(ret, v) if ((ret) != (v)) { \ - torture_comment(tctx, "** "); correct = False; \ + torture_comment(tctx, "** "); correct = false; \ } /* @@ -374,12 +374,12 @@ static bool torture_locktest4(struct torture_context *tctx, { const char *fname = BASEDIR "\\lockt4.lck"; int fnum1, fnum2, f; - BOOL ret; + bool ret; uint8_t buf[1000]; - BOOL correct = True; + bool correct = true; if (!torture_setup_dir(cli1, BASEDIR)) { - return False; + return false; } fnum1 = smbcli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); @@ -389,80 +389,80 @@ static bool torture_locktest4(struct torture_context *tctx, if (smbcli_write(cli1->tree, fnum1, 0, buf, 0, sizeof(buf)) != sizeof(buf)) { torture_comment(tctx, "Failed to create file\n"); - correct = False; + correct = false; goto fail; } ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 0, 4, 0, WRITE_LOCK)) && NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 2, 4, 0, WRITE_LOCK)); - EXPECTED(ret, False); + EXPECTED(ret, false); torture_comment(tctx, "the same process %s set overlapping write locks\n", ret?"can":"cannot"); ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 10, 4, 0, READ_LOCK)) && NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 12, 4, 0, READ_LOCK)); - EXPECTED(ret, True); + EXPECTED(ret, true); torture_comment(tctx, "the same process %s set overlapping read locks\n", ret?"can":"cannot"); ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 20, 4, 0, WRITE_LOCK)) && NT_STATUS_IS_OK(smbcli_lock(cli2->tree, fnum2, 22, 4, 0, WRITE_LOCK)); - EXPECTED(ret, False); + EXPECTED(ret, false); torture_comment(tctx, "a different connection %s set overlapping write locks\n", ret?"can":"cannot"); ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 30, 4, 0, READ_LOCK)) && NT_STATUS_IS_OK(smbcli_lock(cli2->tree, fnum2, 32, 4, 0, READ_LOCK)); - EXPECTED(ret, True); + EXPECTED(ret, true); torture_comment(tctx, "a different connection %s set overlapping read locks\n", ret?"can":"cannot"); ret = NT_STATUS_IS_OK((cli1->session->pid = 1, smbcli_lock(cli1->tree, fnum1, 40, 4, 0, WRITE_LOCK))) && NT_STATUS_IS_OK((cli1->session->pid = 2, smbcli_lock(cli1->tree, fnum1, 42, 4, 0, WRITE_LOCK))); - EXPECTED(ret, False); + EXPECTED(ret, false); torture_comment(tctx, "a different pid %s set overlapping write locks\n", ret?"can":"cannot"); ret = NT_STATUS_IS_OK((cli1->session->pid = 1, smbcli_lock(cli1->tree, fnum1, 50, 4, 0, READ_LOCK))) && NT_STATUS_IS_OK((cli1->session->pid = 2, smbcli_lock(cli1->tree, fnum1, 52, 4, 0, READ_LOCK))); - EXPECTED(ret, True); + EXPECTED(ret, true); torture_comment(tctx, "a different pid %s set overlapping read locks\n", ret?"can":"cannot"); ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 60, 4, 0, READ_LOCK)) && NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 60, 4, 0, READ_LOCK)); - EXPECTED(ret, True); + EXPECTED(ret, true); torture_comment(tctx, "the same process %s set the same read lock twice\n", ret?"can":"cannot"); ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 70, 4, 0, WRITE_LOCK)) && NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 70, 4, 0, WRITE_LOCK)); - EXPECTED(ret, False); + EXPECTED(ret, false); torture_comment(tctx, "the same process %s set the same write lock twice\n", ret?"can":"cannot"); ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 80, 4, 0, READ_LOCK)) && NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 80, 4, 0, WRITE_LOCK)); - EXPECTED(ret, False); + EXPECTED(ret, false); torture_comment(tctx, "the same process %s overlay a read lock with a write lock\n", ret?"can":"cannot"); ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 90, 4, 0, WRITE_LOCK)) && NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 90, 4, 0, READ_LOCK)); - EXPECTED(ret, True); + EXPECTED(ret, true); torture_comment(tctx, "the same process %s overlay a write lock with a read lock\n", ret?"can":"cannot"); ret = NT_STATUS_IS_OK((cli1->session->pid = 1, smbcli_lock(cli1->tree, fnum1, 100, 4, 0, WRITE_LOCK))) && NT_STATUS_IS_OK((cli1->session->pid = 2, smbcli_lock(cli1->tree, fnum1, 100, 4, 0, READ_LOCK))); - EXPECTED(ret, False); + EXPECTED(ret, false); torture_comment(tctx, "a different pid %s overlay a write lock with a read lock\n", ret?"can":"cannot"); ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 110, 4, 0, READ_LOCK)) && NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 112, 4, 0, READ_LOCK)) && NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 110, 6)); - EXPECTED(ret, False); + EXPECTED(ret, false); torture_comment(tctx, "the same process %s coalesce read locks\n", ret?"can":"cannot"); ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 120, 4, 0, WRITE_LOCK)) && (smbcli_read(cli2->tree, fnum2, buf, 120, 4) == 4); - EXPECTED(ret, False); + EXPECTED(ret, false); torture_comment(tctx, "this server %s strict write locking\n", ret?"doesn't do":"does"); ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 130, 4, 0, READ_LOCK)) && (smbcli_write(cli2->tree, fnum2, 0, buf, 130, 4) == 4); - EXPECTED(ret, False); + EXPECTED(ret, false); torture_comment(tctx, "this server %s strict read locking\n", ret?"doesn't do":"does"); @@ -470,7 +470,7 @@ static bool torture_locktest4(struct torture_context *tctx, NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 140, 4, 0, READ_LOCK)) && NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 140, 4)) && NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 140, 4)); - EXPECTED(ret, True); + EXPECTED(ret, true); torture_comment(tctx, "this server %s do recursive read locking\n", ret?"does":"doesn't"); @@ -480,21 +480,21 @@ static bool torture_locktest4(struct torture_context *tctx, (smbcli_read(cli2->tree, fnum2, buf, 150, 4) == 4) && !(smbcli_write(cli2->tree, fnum2, 0, buf, 150, 4) == 4) && NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 150, 4)); - EXPECTED(ret, True); + EXPECTED(ret, true); torture_comment(tctx, "this server %s do recursive lock overlays\n", ret?"does":"doesn't"); ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 160, 4, 0, READ_LOCK)) && NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 160, 4)) && (smbcli_write(cli2->tree, fnum2, 0, buf, 160, 4) == 4) && (smbcli_read(cli2->tree, fnum2, buf, 160, 4) == 4); - EXPECTED(ret, True); + EXPECTED(ret, true); torture_comment(tctx, "the same process %s remove a read lock using write locking\n", ret?"can":"cannot"); ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 170, 4, 0, WRITE_LOCK)) && NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 170, 4)) && (smbcli_write(cli2->tree, fnum2, 0, buf, 170, 4) == 4) && (smbcli_read(cli2->tree, fnum2, buf, 170, 4) == 4); - EXPECTED(ret, True); + EXPECTED(ret, true); torture_comment(tctx, "the same process %s remove a write lock using read locking\n", ret?"can":"cannot"); ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 190, 4, 0, WRITE_LOCK)) && @@ -502,7 +502,7 @@ static bool torture_locktest4(struct torture_context *tctx, NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 190, 4)) && !(smbcli_write(cli2->tree, fnum2, 0, buf, 190, 4) == 4) && (smbcli_read(cli2->tree, fnum2, buf, 190, 4) == 4); - EXPECTED(ret, True); + EXPECTED(ret, true); torture_comment(tctx, "the same process %s remove the first lock first\n", ret?"does":"doesn't"); smbcli_close(cli1->tree, fnum1); @@ -516,7 +516,7 @@ static bool torture_locktest4(struct torture_context *tctx, NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 7, 1, 0, WRITE_LOCK)); smbcli_close(cli1->tree, f); smbcli_close(cli1->tree, fnum1); - EXPECTED(ret, True); + EXPECTED(ret, true); torture_comment(tctx, "the server %s have the NT byte range lock bug\n", !ret?"does":"doesn't"); fail: @@ -535,12 +535,12 @@ static bool torture_locktest5(struct torture_context *tctx, struct smbcli_state { const char *fname = BASEDIR "\\lockt5.lck"; int fnum1, fnum2, fnum3; - BOOL ret; + bool ret; uint8_t buf[1000]; - BOOL correct = True; + bool correct = true; if (!torture_setup_dir(cli1, BASEDIR)) { - return False; + return false; } fnum1 = smbcli_open(cli1->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); @@ -558,7 +558,7 @@ static bool torture_locktest5(struct torture_context *tctx, struct smbcli_state smbcli_close(cli1->tree, fnum1); fnum1 = smbcli_open(cli1->tree, fname, O_RDWR, DENY_NONE); ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 7, 1, 0, WRITE_LOCK)); - EXPECTED(ret, True); + EXPECTED(ret, true); torture_comment(tctx, "this server %s the NT locking bug\n", ret ? "doesn't have" : "has"); smbcli_close(cli1->tree, fnum1); fnum1 = smbcli_open(cli1->tree, fname, O_RDWR, DENY_NONE); @@ -566,11 +566,11 @@ static bool torture_locktest5(struct torture_context *tctx, struct smbcli_state ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 0, 4, 0, WRITE_LOCK)) && NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 1, 1, 0, READ_LOCK)); - EXPECTED(ret, True); + EXPECTED(ret, true); torture_comment(tctx, "the same process %s overlay a write with a read lock\n", ret?"can":"cannot"); ret = NT_STATUS_IS_OK(smbcli_lock(cli2->tree, fnum2, 0, 4, 0, READ_LOCK)); - EXPECTED(ret, False); + EXPECTED(ret, false); torture_comment(tctx, "a different processs %s get a read lock on the first process lock stack\n", ret?"can":"cannot"); @@ -578,7 +578,7 @@ static bool torture_locktest5(struct torture_context *tctx, struct smbcli_state smbcli_unlock(cli2->tree, fnum2, 0, 4); ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum3, 0, 4, 0, READ_LOCK)); - EXPECTED(ret, False); + EXPECTED(ret, false); torture_comment(tctx, "the same processs on a different fnum %s get a read lock\n", ret?"can":"cannot"); @@ -589,7 +589,7 @@ static bool torture_locktest5(struct torture_context *tctx, struct smbcli_state ret = NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 0, 4, 0, READ_LOCK)) && NT_STATUS_IS_OK(smbcli_lock(cli1->tree, fnum1, 0, 4, 0, READ_LOCK)); - EXPECTED(ret, True); + EXPECTED(ret, true); torture_comment(tctx, "the same process %s stack read locks\n", ret?"can":"cannot"); /* Unlock the first process lock, then check this was the WRITE lock that was @@ -598,7 +598,7 @@ static bool torture_locktest5(struct torture_context *tctx, struct smbcli_state ret = NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 0, 4)) && NT_STATUS_IS_OK(smbcli_lock(cli2->tree, fnum2, 0, 4, 0, READ_LOCK)); - EXPECTED(ret, True); + EXPECTED(ret, true); torture_comment(tctx, "the first unlock removes the %s lock\n", ret?"WRITE":"READ"); /* Unlock the process 2 lock. */ @@ -610,17 +610,17 @@ ret = NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 0, 4)) && NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 0, 4)) && NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 0, 4)); - EXPECTED(ret, True); + EXPECTED(ret, true); torture_comment(tctx, "the same process %s unlock the stack of 4 locks\n", ret?"can":"cannot"); /* Ensure the next unlock fails. */ ret = NT_STATUS_IS_OK(smbcli_unlock(cli1->tree, fnum1, 0, 4)); - EXPECTED(ret, False); + EXPECTED(ret, false); torture_comment(tctx, "the same process %s count the lock stack\n", !ret?"can":"cannot"); /* Ensure connection 2 can get a write lock. */ ret = NT_STATUS_IS_OK(smbcli_lock(cli2->tree, fnum2, 0, 4, 0, WRITE_LOCK)); - EXPECTED(ret, True); + EXPECTED(ret, true); torture_comment(tctx, "a different processs %s get a write lock on the unlocked stack\n", ret?"can":"cannot"); @@ -644,7 +644,7 @@ static bool torture_locktest6(struct torture_context *tctx, NTSTATUS status; if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } for (i=0;i<1;i++) { @@ -665,7 +665,7 @@ static bool torture_locktest6(struct torture_context *tctx, smbcli_unlink(cli->tree, fname[i]); } - return True; + return true; } static bool torture_locktest7(struct torture_context *tctx, @@ -676,7 +676,7 @@ static bool torture_locktest7(struct torture_context *tctx, int fnum2 = -1; size_t size; uint8_t buf[200]; - BOOL correct = False; + bool correct = false; torture_assert(tctx, torture_setup_dir(cli1, BASEDIR), talloc_asprintf(tctx, "Unable to set up %s", BASEDIR)); @@ -785,7 +785,7 @@ static bool torture_locktest7(struct torture_context *tctx, cli1->session->pid = 1; smbcli_unlock(cli1->tree, fnum1, 130, 4); - correct = True; + correct = true; fail: smbcli_close(cli1->tree, fnum1); diff --git a/source4/torture/basic/mangle_test.c b/source4/torture/basic/mangle_test.c index dc7bc21a558..58d7098972d 100644 --- a/source4/torture/basic/mangle_test.c +++ b/source4/torture/basic/mangle_test.c @@ -58,25 +58,25 @@ static bool test_one(struct torture_context *tctx ,struct smbcli_state *cli, status = smbcli_qpathinfo_alt_name(cli->tree, name, &shortname); if (!NT_STATUS_IS_OK(status)) { printf("query altname of %s failed (%s)\n", name, smbcli_errstr(cli->tree)); - return False; + return false; } name2 = talloc_asprintf(tctx, "\\mangle_test\\%s", shortname); if (NT_STATUS_IS_ERR(smbcli_unlink(cli->tree, name2))) { printf("unlink of %s (%s) failed (%s)\n", name2, name, smbcli_errstr(cli->tree)); - return False; + return false; } /* recreate by short name */ fnum = smbcli_open(cli->tree, name2, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); if (fnum == -1) { printf("open2 of %s failed (%s)\n", name2, smbcli_errstr(cli->tree)); - return False; + return false; } if (NT_STATUS_IS_ERR(smbcli_close(cli->tree, fnum))) { printf("close of %s failed (%s)\n", name, smbcli_errstr(cli->tree)); - return False; + return false; } /* and unlink by long name */ @@ -85,7 +85,7 @@ static bool test_one(struct torture_context *tctx ,struct smbcli_state *cli, name, name2, smbcli_errstr(cli->tree)); failures++; smbcli_unlink(cli->tree, name2); - return True; + return true; } /* see if the short name is already in the tdb */ @@ -108,7 +108,7 @@ static bool test_one(struct torture_context *tctx ,struct smbcli_state *cli, tdb_store_bystring(tdb, shortname, namedata, TDB_REPLACE); } - return True; + return true; } @@ -170,11 +170,11 @@ bool torture_mangle(struct torture_context *torture, tdb = tdb_open(NULL, 100000, TDB_INTERNAL, 0, 0); if (!tdb) { printf("ERROR: Failed to open tdb\n"); - return False; + return false; } if (!torture_setup_dir(cli, "\\mangle_test")) { - return False; + return false; } for (i=0;itree, "\\mangle_test\\*"); if (NT_STATUS_IS_ERR(smbcli_rmdir(cli->tree, "\\mangle_test"))) { printf("ERROR: Failed to remove directory\n"); - return False; + return false; } printf("\nTotal collisions %u/%u - %.2f%% (%u failures)\n", diff --git a/source4/torture/basic/misc.c b/source4/torture/basic/misc.c index 19eef87f6f4..f0d5ef55368 100644 --- a/source4/torture/basic/misc.c +++ b/source4/torture/basic/misc.c @@ -37,16 +37,16 @@ extern struct cli_credentials *cmdline_credentials; -static BOOL wait_lock(struct smbcli_state *c, int fnum, uint32_t offset, uint32_t len) +static bool wait_lock(struct smbcli_state *c, int fnum, uint32_t offset, uint32_t len) { while (NT_STATUS_IS_ERR(smbcli_lock(c->tree, fnum, offset, len, -1, WRITE_LOCK))) { - if (!check_error(__location__, c, ERRDOS, ERRlock, NT_STATUS_LOCK_NOT_GRANTED)) return False; + if (!check_error(__location__, c, ERRDOS, ERRlock, NT_STATUS_LOCK_NOT_GRANTED)) return false; } - return True; + return true; } -static BOOL rw_torture(struct torture_context *tctx, struct smbcli_state *c) +static bool rw_torture(struct torture_context *tctx, struct smbcli_state *c) { const char *lockfname = "\\torture.lck"; char *fname; @@ -55,7 +55,7 @@ static BOOL rw_torture(struct torture_context *tctx, struct smbcli_state *c) pid_t pid2, pid = getpid(); int i, j; uint8_t buf[1024]; - BOOL correct = True; + bool correct = true; fnum2 = smbcli_open(c->tree, lockfname, O_RDWR | O_CREAT | O_EXCL, DENY_NONE); @@ -63,7 +63,7 @@ static BOOL rw_torture(struct torture_context *tctx, struct smbcli_state *c) fnum2 = smbcli_open(c->tree, lockfname, O_RDWR, DENY_NONE); if (fnum2 == -1) { torture_comment(tctx, "open of %s failed (%s)\n", lockfname, smbcli_errstr(c->tree)); - return False; + return false; } generate_random_buffer(buf, sizeof(buf)); @@ -79,19 +79,19 @@ static BOOL rw_torture(struct torture_context *tctx, struct smbcli_state *c) asprintf(&fname, "\\torture.%u", n); if (!wait_lock(c, fnum2, n*sizeof(int), sizeof(int))) { - return False; + return false; } fnum = smbcli_open(c->tree, fname, O_RDWR | O_CREAT | O_TRUNC, DENY_ALL); if (fnum == -1) { torture_comment(tctx, "open failed (%s)\n", smbcli_errstr(c->tree)); - correct = False; + correct = false; break; } if (smbcli_write(c->tree, fnum, 0, &pid, 0, sizeof(pid)) != sizeof(pid)) { torture_comment(tctx, "write failed (%s)\n", smbcli_errstr(c->tree)); - correct = False; + correct = false; } for (j=0;j<50;j++) { @@ -99,7 +99,7 @@ static BOOL rw_torture(struct torture_context *tctx, struct smbcli_state *c) sizeof(pid)+(j*sizeof(buf)), sizeof(buf)) != sizeof(buf)) { torture_comment(tctx, "write failed (%s)\n", smbcli_errstr(c->tree)); - correct = False; + correct = false; } } @@ -107,27 +107,27 @@ static BOOL rw_torture(struct torture_context *tctx, struct smbcli_state *c) if (smbcli_read(c->tree, fnum, &pid2, 0, sizeof(pid)) != sizeof(pid)) { torture_comment(tctx, "read failed (%s)\n", smbcli_errstr(c->tree)); - correct = False; + correct = false; } if (pid2 != pid) { torture_comment(tctx, "data corruption!\n"); - correct = False; + correct = false; } if (NT_STATUS_IS_ERR(smbcli_close(c->tree, fnum))) { torture_comment(tctx, "close failed (%s)\n", smbcli_errstr(c->tree)); - correct = False; + correct = false; } if (NT_STATUS_IS_ERR(smbcli_unlink(c->tree, fname))) { torture_comment(tctx, "unlink failed (%s)\n", smbcli_errstr(c->tree)); - correct = False; + correct = false; } if (NT_STATUS_IS_ERR(smbcli_unlock(c->tree, fnum2, n*sizeof(int), sizeof(int)))) { torture_comment(tctx, "unlock failed (%s)\n", smbcli_errstr(c->tree)); - correct = False; + correct = false; } free(fname); } @@ -140,7 +140,7 @@ static BOOL rw_torture(struct torture_context *tctx, struct smbcli_state *c) return correct; } -BOOL run_torture(struct torture_context *tctx, struct smbcli_state *cli, int dummy) +bool run_torture(struct torture_context *tctx, struct smbcli_state *cli, int dummy) { return rw_torture(tctx, cli); } @@ -149,7 +149,7 @@ BOOL run_torture(struct torture_context *tctx, struct smbcli_state *cli, int dum /* see how many RPC pipes we can open at once */ -BOOL run_pipe_number(struct torture_context *tctx, +bool run_pipe_number(struct torture_context *tctx, struct smbcli_state *cli1) { const char *pipe_name = "\\WKSSVC"; @@ -172,7 +172,7 @@ BOOL run_pipe_number(struct torture_context *tctx, } torture_comment(tctx, "pipe_number test - we can open %d %s pipes.\n", num_pipes, pipe_name ); - return True; + return true; } @@ -183,7 +183,7 @@ BOOL run_pipe_number(struct torture_context *tctx, used for testing performance when there are N idle users already connected */ -BOOL torture_holdcon(struct torture_context *tctx) +bool torture_holdcon(struct torture_context *tctx) { int i; struct smbcli_state **cli; @@ -195,7 +195,7 @@ BOOL torture_holdcon(struct torture_context *tctx) for (i=0;itree, "\\maxfid") == -1) { torture_comment(tctx, "Failed to deltree \\maxfid - %s\n", smbcli_errstr(cli->tree)); - return False; + return false; } if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, "\\maxfid"))) { torture_comment(tctx, "Failed to mkdir \\maxfid, error=%s\n", smbcli_errstr(cli->tree)); - return False; + return false; } torture_comment(tctx, "Testing maximum number of open files\n"); @@ -266,7 +266,7 @@ BOOL run_maxfidtest(struct torture_context *tctx, struct smbcli_state *cli, int if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, fname))) { torture_comment(tctx, "Failed to mkdir %s, error=%s\n", fname, smbcli_errstr(cli->tree)); - return False; + return false; } free(fname); } @@ -299,7 +299,7 @@ BOOL run_maxfidtest(struct torture_context *tctx, struct smbcli_state *cli, int if (NT_STATUS_IS_ERR(smbcli_unlink(cli->tree, fname))) { torture_comment(tctx, "unlink of %s failed (%s)\n", fname, smbcli_errstr(cli->tree)); - correct = False; + correct = false; } free(fname); @@ -310,7 +310,7 @@ BOOL run_maxfidtest(struct torture_context *tctx, struct smbcli_state *cli, int if (NT_STATUS_IS_ERR(smbcli_unlink(cli->tree, fname))) { torture_comment(tctx, "unlink of %s failed (%s)\n", fname, smbcli_errstr(cli->tree)); - correct = False; + correct = false; } free(fname); @@ -324,12 +324,12 @@ BOOL run_maxfidtest(struct torture_context *tctx, struct smbcli_state *cli, int if (smbcli_deltree(cli->tree, "\\maxfid") == -1) { torture_comment(tctx, "Failed to deltree \\maxfid - %s\n", smbcli_errstr(cli->tree)); - return False; + return false; } torture_comment(tctx, "maxfid test finished\n"); if (!torture_close_connection(cli)) { - correct = False; + correct = false; } return correct; #undef MAXFID_TEMPLATE @@ -340,7 +340,7 @@ BOOL run_maxfidtest(struct torture_context *tctx, struct smbcli_state *cli, int /* sees what IOCTLs are supported */ -BOOL torture_ioctl_test(struct torture_context *tctx, +bool torture_ioctl_test(struct torture_context *tctx, struct smbcli_state *cli) { uint16_t device, function; @@ -357,7 +357,7 @@ BOOL torture_ioctl_test(struct torture_context *tctx, fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); if (fnum == -1) { torture_comment(tctx, "open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree)); - return False; + return false; } parms.ioctl.level = RAW_IOCTL_IOCTL; @@ -379,7 +379,7 @@ BOOL torture_ioctl_test(struct torture_context *tctx, } } - return True; + return true; } static void benchrw_callback(struct smbcli_request *req); @@ -582,7 +582,7 @@ static NTSTATUS benchrw_readwrite(struct torture_context *tctx, rd.readx.in.maxcnt = rd.readx.in.mincnt; rd.readx.in.remaining = 0 ; rd.readx.out.data = state->buffer; - rd.readx.in.read_for_execute = False; + rd.readx.in.read_for_execute = false; if(state->readcnt < state->lp_params->writeblocks){ state->readcnt++; }else{ @@ -819,13 +819,13 @@ static struct composite_context *torture_connect_async( smb->in.called_name = strupper_talloc(mem_ctx, host); smb->in.service_type=NULL; smb->in.credentials=cmdline_credentials; - smb->in.fallback_to_anonymous=False; + smb->in.fallback_to_anonymous=false; smb->in.workgroup=workgroup; return smb_composite_connect_send(smb,mem_ctx,ev); } -BOOL run_benchrw(struct torture_context *tctx) +bool run_benchrw(struct torture_context *tctx) { struct smb_composite_connect *smb_con; const char *fname = "\\rwtest.dat"; @@ -837,7 +837,7 @@ BOOL run_benchrw(struct torture_context *tctx) struct params lpparams; union smb_mkdir parms; int finished = 0; - BOOL success=True; + bool success=true; int torture_nprocs = torture_setting_int(tctx, "nprocs", 4); torture_comment(tctx, "Start BENCH-READWRITE num_ops=%d " @@ -911,7 +911,7 @@ BOOL run_benchrw(struct torture_context *tctx) /* error occured , finish */ case ERROR: finished++; - success=False; + success=false; break; /* cleanup , close connection */ case CLEANUP: diff --git a/source4/torture/basic/properties.c b/source4/torture/basic/properties.c index f389fa35f91..1825dff993b 100644 --- a/source4/torture/basic/properties.c +++ b/source4/torture/basic/properties.c @@ -91,7 +91,7 @@ static void show_bits(const struct bitmapping *bm, uint32_t value) bool torture_test_properties(struct torture_context *torture, struct smbcli_state *cli) { - BOOL correct = True; + bool correct = true; union smb_fsinfo fs; NTSTATUS status; @@ -103,7 +103,7 @@ bool torture_test_properties(struct torture_context *torture, status = smb_raw_fsinfo(cli->tree, cli, &fs); if (!NT_STATUS_IS_OK(status)) { d_printf("qfsinfo failed - %s\n", nt_errstr(status)); - correct = False; + correct = false; } else { d_printf("Filesystem attributes: 0x%08x\n", fs.attribute_info.out.fs_attr); diff --git a/source4/torture/basic/scanner.c b/source4/torture/basic/scanner.c index f68674911f4..dd596c9ee36 100644 --- a/source4/torture/basic/scanner.c +++ b/source4/torture/basic/scanner.c @@ -122,7 +122,7 @@ static NTSTATUS try_trans2_len(struct smbcli_state *cli, /**************************************************************************** check whether a trans2 opnum exists at all ****************************************************************************/ -static BOOL trans2_op_exists(struct smbcli_state *cli, int op) +static bool trans2_op_exists(struct smbcli_state *cli, int op) { int data_len = 0; int param_len = 0; @@ -146,17 +146,17 @@ static BOOL trans2_op_exists(struct smbcli_state *cli, int op) status2 = try_trans2(cli, op, param, data, param_len, data_len, &rparam_len, &rdata_len); - if (NT_STATUS_EQUAL(status1, status2)) return False; + if (NT_STATUS_EQUAL(status1, status2)) return false; printf("Found op %d (status=%s)\n", op, nt_errstr(status2)); - return True; + return true; } /**************************************************************************** check for existance of a trans2 call ****************************************************************************/ -static BOOL scan_trans2(struct smbcli_state *cli, int op, int level, +static bool scan_trans2(struct smbcli_state *cli, int op, int level, int fnum, int dnum, int qfnum, const char *fname) { int data_len = 0; @@ -173,7 +173,7 @@ static BOOL scan_trans2(struct smbcli_state *cli, int op, int level, SSVAL(param, 0, level); status = try_trans2_len(cli, "void", op, level, param, data, param_len, &data_len, &rparam_len, &rdata_len); - if (NT_STATUS_IS_OK(status)) return True; + if (NT_STATUS_IS_OK(status)) return true; /* try with a file descriptor */ param_len = 6; @@ -182,7 +182,7 @@ static BOOL scan_trans2(struct smbcli_state *cli, int op, int level, SSVAL(param, 4, 0); status = try_trans2_len(cli, "fnum", op, level, param, data, param_len, &data_len, &rparam_len, &rdata_len); - if (NT_STATUS_IS_OK(status)) return True; + if (NT_STATUS_IS_OK(status)) return true; /* try with a quota file descriptor */ param_len = 6; @@ -191,7 +191,7 @@ static BOOL scan_trans2(struct smbcli_state *cli, int op, int level, SSVAL(param, 4, 0); status = try_trans2_len(cli, "qfnum", op, level, param, data, param_len, &data_len, &rparam_len, &rdata_len); - if (NT_STATUS_IS_OK(status)) return True; + if (NT_STATUS_IS_OK(status)) return true; /* try with a notify style */ param_len = 6; @@ -200,7 +200,7 @@ static BOOL scan_trans2(struct smbcli_state *cli, int op, int level, SSVAL(param, 4, level); status = try_trans2_len(cli, "notify", op, level, param, data, param_len, &data_len, &rparam_len, &rdata_len); - if (NT_STATUS_IS_OK(status)) return True; + if (NT_STATUS_IS_OK(status)) return true; /* try with a file name */ param_len = 6; @@ -211,7 +211,7 @@ static BOOL scan_trans2(struct smbcli_state *cli, int op, int level, status = try_trans2_len(cli, "fname", op, level, param, data, param_len, &data_len, &rparam_len, &rdata_len); - if (NT_STATUS_IS_OK(status)) return True; + if (NT_STATUS_IS_OK(status)) return true; /* try with a new file name */ param_len = 6; @@ -224,7 +224,7 @@ static BOOL scan_trans2(struct smbcli_state *cli, int op, int level, &rparam_len, &rdata_len); smbcli_unlink(cli->tree, "\\newfile.dat"); smbcli_rmdir(cli->tree, "\\newfile.dat"); - if (NT_STATUS_IS_OK(status)) return True; + if (NT_STATUS_IS_OK(status)) return true; /* try dfs style */ smbcli_mkdir(cli->tree, "\\testdir"); @@ -235,13 +235,13 @@ static BOOL scan_trans2(struct smbcli_state *cli, int op, int level, status = try_trans2_len(cli, "dfs", op, level, param, data, param_len, &data_len, &rparam_len, &rdata_len); smbcli_rmdir(cli->tree, "\\testdir"); - if (NT_STATUS_IS_OK(status)) return True; + if (NT_STATUS_IS_OK(status)) return true; - return False; + return false; } -BOOL torture_trans2_scan(struct torture_context *torture, +bool torture_trans2_scan(struct torture_context *torture, struct smbcli_state *cli) { int op, level; @@ -292,7 +292,7 @@ BOOL torture_trans2_scan(struct torture_context *torture, } } - return True; + return true; } @@ -396,7 +396,7 @@ static NTSTATUS try_nttrans_len(struct smbcli_state *cli, /**************************************************************************** check for existance of a nttrans call ****************************************************************************/ -static BOOL scan_nttrans(struct smbcli_state *cli, int op, int level, +static bool scan_nttrans(struct smbcli_state *cli, int op, int level, int fnum, int dnum, const char *fname) { int data_len = 0; @@ -413,7 +413,7 @@ static BOOL scan_nttrans(struct smbcli_state *cli, int op, int level, SSVAL(param, 0, level); status = try_nttrans_len(cli, "void", op, level, param, data, param_len, &data_len, &rparam_len, &rdata_len); - if (NT_STATUS_IS_OK(status)) return True; + if (NT_STATUS_IS_OK(status)) return true; /* try with a file descriptor */ param_len = 6; @@ -422,7 +422,7 @@ static BOOL scan_nttrans(struct smbcli_state *cli, int op, int level, SSVAL(param, 4, 0); status = try_nttrans_len(cli, "fnum", op, level, param, data, param_len, &data_len, &rparam_len, &rdata_len); - if (NT_STATUS_IS_OK(status)) return True; + if (NT_STATUS_IS_OK(status)) return true; /* try with a notify style */ @@ -432,7 +432,7 @@ static BOOL scan_nttrans(struct smbcli_state *cli, int op, int level, SSVAL(param, 4, level); status = try_nttrans_len(cli, "notify", op, level, param, data, param_len, &data_len, &rparam_len, &rdata_len); - if (NT_STATUS_IS_OK(status)) return True; + if (NT_STATUS_IS_OK(status)) return true; /* try with a file name */ param_len = 6; @@ -443,7 +443,7 @@ static BOOL scan_nttrans(struct smbcli_state *cli, int op, int level, status = try_nttrans_len(cli, "fname", op, level, param, data, param_len, &data_len, &rparam_len, &rdata_len); - if (NT_STATUS_IS_OK(status)) return True; + if (NT_STATUS_IS_OK(status)) return true; /* try with a new file name */ param_len = 6; @@ -456,7 +456,7 @@ static BOOL scan_nttrans(struct smbcli_state *cli, int op, int level, &rparam_len, &rdata_len); smbcli_unlink(cli->tree, "\\newfile.dat"); smbcli_rmdir(cli->tree, "\\newfile.dat"); - if (NT_STATUS_IS_OK(status)) return True; + if (NT_STATUS_IS_OK(status)) return true; /* try dfs style */ smbcli_mkdir(cli->tree, "\\testdir"); @@ -467,9 +467,9 @@ static BOOL scan_nttrans(struct smbcli_state *cli, int op, int level, status = try_nttrans_len(cli, "dfs", op, level, param, data, param_len, &data_len, &rparam_len, &rdata_len); smbcli_rmdir(cli->tree, "\\testdir"); - if (NT_STATUS_IS_OK(status)) return True; + if (NT_STATUS_IS_OK(status)) return true; - return False; + return false; } @@ -500,12 +500,12 @@ bool torture_nttrans_scan(struct torture_context *torture, } printf("nttrans scan finished\n"); - return True; + return true; } /* scan for valid base SMB requests */ -BOOL torture_smb_scan(struct torture_context *torture) +bool torture_smb_scan(struct torture_context *torture) { static struct smbcli_state *cli; int op; @@ -516,7 +516,7 @@ BOOL torture_smb_scan(struct torture_context *torture) if (op == SMBreadbraw) continue; if (!torture_open_connection(&cli, 0)) { - return False; + return false; } req = smbcli_request_setup(cli->tree, op, 0, 0); @@ -551,5 +551,5 @@ BOOL torture_smb_scan(struct torture_context *torture) printf("smb scan finished\n"); - return True; + return true; } diff --git a/source4/torture/basic/secleak.c b/source4/torture/basic/secleak.c index 75d3117967e..3d4aeea956e 100644 --- a/source4/torture/basic/secleak.c +++ b/source4/torture/basic/secleak.c @@ -29,13 +29,13 @@ #include "auth/credentials/credentials.h" #include "param/param.h" -static BOOL try_failed_login(struct smbcli_state *cli) +static bool try_failed_login(struct smbcli_state *cli) { NTSTATUS status; struct smb_composite_sesssetup setup; struct smbcli_session *session; - session = smbcli_session_init(cli->transport, cli, False); + session = smbcli_session_init(cli->transport, cli, false); setup.in.sesskey = cli->transport->negotiate.sesskey; setup.in.capabilities = cli->transport->negotiate.capabilities; setup.in.workgroup = lp_workgroup(global_loadparm); @@ -50,23 +50,23 @@ static BOOL try_failed_login(struct smbcli_state *cli) talloc_free(session); if (NT_STATUS_IS_OK(status)) { printf("Allowed session setup with invalid credentials?!\n"); - return False; + return false; } - return True; + return true; } -BOOL torture_sec_leak(struct torture_context *tctx, struct smbcli_state *cli) +bool torture_sec_leak(struct torture_context *tctx, struct smbcli_state *cli) { time_t t1 = time(NULL); int timelimit = torture_setting_int(tctx, "timelimit", 20); while (time(NULL) < t1+timelimit) { if (!try_failed_login(cli)) { - return False; + return false; } talloc_report(NULL, stdout); } - return True; + return true; } diff --git a/source4/torture/basic/unlink.c b/source4/torture/basic/unlink.c index bb829051a20..9e13021d205 100644 --- a/source4/torture/basic/unlink.c +++ b/source4/torture/basic/unlink.c @@ -37,7 +37,7 @@ bool torture_unlinktest(struct torture_context *tctx, struct smbcli_state *cli) { const char *fname = BASEDIR "\\unlink.tst"; int fnum; - BOOL correct = True; + bool correct = true; union smb_open io; NTSTATUS status; diff --git a/source4/torture/basic/utable.c b/source4/torture/basic/utable.c index 52babe4d539..82511aa8f97 100644 --- a/source4/torture/basic/utable.c +++ b/source4/torture/basic/utable.c @@ -166,7 +166,7 @@ bool torture_casetable(struct torture_context *tctx, torture_comment(tctx, "too many chars match?? size=%d c=0x%04x\n", (int)size, c); smbcli_close(cli->tree, fnum); - return False; + return false; } smbcli_read(cli->tree, fnum, c2, 0, size); diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c index a03f8a08253..79eb7eb0e90 100644 --- a/source4/torture/gentest.c +++ b/source4/torture/gentest.c @@ -34,23 +34,23 @@ /* global options */ static struct gentest_options { - BOOL showall; - BOOL analyze; - BOOL analyze_always; - BOOL analyze_continuous; + bool showall; + bool analyze; + bool analyze_always; + bool analyze_continuous; uint_t max_open_handles; uint_t seed; uint_t numops; - BOOL use_oplocks; + bool use_oplocks; char **ignore_patterns; const char *seeds_file; - BOOL use_preset_seeds; - BOOL fast_reconnect; + bool use_preset_seeds; + bool fast_reconnect; } options; /* mapping between open handles on the server and local handles */ static struct { - BOOL active; + bool active; uint_t instance; uint_t server_fnum[NSERVERS]; const char *name; @@ -69,17 +69,17 @@ static struct { /* the seeds and flags for each operation */ static struct { uint_t seed; - BOOL disabled; + bool disabled; } *op_parms; /* oplock break info */ static struct { - BOOL got_break; + bool got_break; uint16_t fnum; uint16_t handle; uint8_t level; - BOOL do_close; + bool do_close; } oplocks[NSERVERS][NINSTANCES]; /* change notify reply info */ @@ -102,32 +102,32 @@ static struct { #define BAD_HANDLE 0xFFFE -static BOOL oplock_handler(struct smbcli_transport *transport, uint16_t tid, uint16_t fnum, uint8_t level, void *private); +static bool oplock_handler(struct smbcli_transport *transport, uint16_t tid, uint16_t fnum, uint8_t level, void *private); static void idle_func(struct smbcli_transport *transport, void *private); /* check if a string should be ignored. This is used as the basis for all error ignore settings */ -static BOOL ignore_pattern(const char *str) +static bool ignore_pattern(const char *str) { int i; - if (!options.ignore_patterns) return False; + if (!options.ignore_patterns) return false; for (i=0;options.ignore_patterns[i];i++) { if (strcmp(options.ignore_patterns[i], str) == 0 || gen_fnmatch(options.ignore_patterns[i], str) == 0) { DEBUG(2,("Ignoring '%s'\n", str)); - return True; + return true; } } - return False; + return false; } /***************************************************** connect to the servers *******************************************************/ -static BOOL connect_servers_fast(void) +static bool connect_servers_fast(void) { int h, i; @@ -137,13 +137,13 @@ static BOOL connect_servers_fast(void) for (i=0;itree, open_handles[h].server_fnum[i])))) { - return False; + return false; } - open_handles[h].active = False; + open_handles[h].active = false; } } - return True; + return true; } @@ -152,13 +152,13 @@ static BOOL connect_servers_fast(void) /***************************************************** connect to the servers *******************************************************/ -static BOOL connect_servers(void) +static bool connect_servers(void) { int i, j; if (options.fast_reconnect && servers[0].cli[0]) { if (connect_servers_fast()) { - return True; + return true; } } @@ -191,7 +191,7 @@ static BOOL connect_servers(void) printf("Failed to connect to \\\\%s\\%s - %s\n", servers[i].server_name, servers[i].share_name, nt_errstr(status)); - return False; + return false; } smbcli_oplock_handler(servers[i].cli[j]->transport, oplock_handler, NULL); @@ -199,7 +199,7 @@ static BOOL connect_servers(void) } } - return True; + return true; } /* @@ -256,7 +256,7 @@ static void gen_add_handle(int instance, const char *name, uint16_t fnums[NSERVE for (i=0;itransport && tid == servers[i].cli[j]->tree->tid) { - oplocks[i][j].got_break = True; + oplocks[i][j].got_break = true; oplocks[i][j].fnum = fnum; oplocks[i][j].handle = fnum_to_handle(i, j, fnum); oplocks[i][j].level = level; @@ -754,7 +754,7 @@ static BOOL oplock_handler(struct smbcli_transport *transport, uint16_t tid, uin if (!tree) { printf("Oplock break not for one of our trees!?\n"); - return False; + return false; } if (!do_close) { @@ -771,13 +771,13 @@ static BOOL oplock_handler(struct smbcli_transport *transport, uint16_t tid, uin if (req == NULL) { printf("WARNING: close failed in oplock_handler_close\n"); - return False; + return false; } req->async.fn = oplock_handler_close_recv; req->async.private = NULL; - return True; + return true; } @@ -804,19 +804,19 @@ static void idle_func(struct smbcli_transport *transport, void *private) /* compare NTSTATUS, using checking ignored patterns */ -static BOOL compare_status(NTSTATUS status1, NTSTATUS status2) +static bool compare_status(NTSTATUS status1, NTSTATUS status2) { - if (NT_STATUS_EQUAL(status1, status2)) return True; + if (NT_STATUS_EQUAL(status1, status2)) return true; /* one code being an error and the other OK is always an error */ - if (NT_STATUS_IS_OK(status1) || NT_STATUS_IS_OK(status2)) return False; + if (NT_STATUS_IS_OK(status1) || NT_STATUS_IS_OK(status2)) return false; /* if we are ignoring one of the status codes then consider this a match */ if (ignore_pattern(nt_errstr(status1)) || ignore_pattern(nt_errstr(status2))) { - return True; + return true; } - return False; + return false; } @@ -839,7 +839,7 @@ static void check_pending(void) /* check that the same oplock breaks have been received by all instances */ -static BOOL check_oplocks(const char *call) +static bool check_oplocks(const char *call) { int i, j; int tries = 0; @@ -860,7 +860,7 @@ again: oplocks[i][j].got_break, oplocks[i][j].handle, oplocks[i][j].level); - return False; + return false; } } } @@ -877,14 +877,14 @@ again: break; } } - return True; + return true; } /* check that the same change notify info has been received by all instances */ -static BOOL check_notifies(const char *call) +static bool check_notifies(const char *call) { int i, j; int tries = 0; @@ -902,7 +902,7 @@ again: printf("Notify count inconsistent %d %d\n", notifies[0][j].notify_count, notifies[i][j].notify_count); - return False; + return false; } if (notifies[0][j].notify_count == 0) continue; @@ -912,7 +912,7 @@ again: printf("Notify status mismatch - %s - %s\n", nt_errstr(notifies[0][j].status), nt_errstr(notifies[i][j].status)); - return False; + return false; } if (!NT_STATUS_IS_OK(notifies[0][j].status)) { @@ -928,21 +928,21 @@ again: printf("Notify action %d inconsistent %d %d\n", n, not1.nttrans.out.changes[n].action, not2.nttrans.out.changes[n].action); - return False; + return false; } if (strcmp(not1.nttrans.out.changes[n].name.s, not2.nttrans.out.changes[n].name.s)) { printf("Notify name %d inconsistent %s %s\n", n, not1.nttrans.out.changes[n].name.s, not2.nttrans.out.changes[n].name.s); - return False; + return false; } if (not1.nttrans.out.changes[n].name.private_length != not2.nttrans.out.changes[n].name.private_length) { printf("Notify name length %d inconsistent %d %d\n", n, not1.nttrans.out.changes[n].name.private_length, not2.nttrans.out.changes[n].name.private_length); - return False; + return false; } } } @@ -950,7 +950,7 @@ again: ZERO_STRUCT(notifies); - return True; + return true; } @@ -974,13 +974,13 @@ again: if (!compare_status(status[i], status[0])) { \ printf("status different in %s - %s %s\n", #call, \ nt_errstr(status[0]), nt_errstr(status[i])); \ - return False; \ + return false; \ } \ } \ - if (!check_oplocks(#call)) return False; \ - if (!check_notifies(#call)) return False; \ + if (!check_oplocks(#call)) return false; \ + if (!check_notifies(#call)) return false; \ if (!NT_STATUS_IS_OK(status[0])) { \ - return True; \ + return true; \ } \ } while(0) @@ -1013,19 +1013,19 @@ again: if (parm[0].field != parm[1].field && !ignore_pattern(#field)) { \ printf("Mismatch in %s - 0x%x 0x%x\n", #field, \ (int)parm[0].field, (int)parm[1].field); \ - return False; \ + return false; \ } \ } while(0) #define CHECK_WSTR_EQUAL(field) do { \ if ((!parm[0].field.s && parm[1].field.s) || (parm[0].field.s && !parm[1].field.s)) { \ printf("%s is NULL!\n", #field); \ - return False; \ + return false; \ } \ if (parm[0].field.s && strcmp(parm[0].field.s, parm[1].field.s) != 0 && !ignore_pattern(#field)) { \ printf("Mismatch in %s - %s %s\n", #field, \ parm[0].field.s, parm[1].field.s); \ - return False; \ + return false; \ } \ CHECK_EQUAL(field.private_length); \ } while(0) @@ -1033,7 +1033,7 @@ again: #define CHECK_BLOB_EQUAL(field) do { \ if (memcmp(parm[0].field.data, parm[1].field.data, parm[0].field.length) != 0 && !ignore_pattern(#field)) { \ printf("Mismatch in %s\n", #field); \ - return False; \ + return false; \ } \ CHECK_EQUAL(field.length); \ } while(0) @@ -1043,7 +1043,7 @@ again: !ignore_pattern(#field)) { \ printf("Mismatch in %s - 0x%x 0x%x\n", #field, \ (int)parm[0].field, (int)parm[1].field); \ - return False; \ + return false; \ } \ } while(0) @@ -1054,14 +1054,14 @@ again: printf("Mismatch in %s - 0x%x 0x%x\n", #field, \ (int)nt_time_to_unix(parm[0].field), \ (int)nt_time_to_unix(parm[1].field)); \ - return False; \ + return false; \ } \ } while(0) /* generate openx operations */ -static BOOL handler_openx(int instance) +static bool handler_openx(int instance) { union smb_open parm[NSERVERS]; NTSTATUS status[NSERVERS]; @@ -1099,14 +1099,14 @@ static BOOL handler_openx(int instance) /* open creates a new file handle */ ADD_HANDLE(parm[0].openx.in.fname, openx.out.file.fnum); - return True; + return true; } /* generate open operations */ -static BOOL handler_open(int instance) +static bool handler_open(int instance) { union smb_open parm[NSERVERS]; NTSTATUS status[NSERVERS]; @@ -1133,14 +1133,14 @@ static BOOL handler_open(int instance) /* open creates a new file handle */ ADD_HANDLE(parm[0].openold.in.fname, openold.out.file.fnum); - return True; + return true; } /* generate ntcreatex operations */ -static BOOL handler_ntcreatex(int instance) +static bool handler_ntcreatex(int instance) { union smb_open parm[NSERVERS]; NTSTATUS status[NSERVERS]; @@ -1186,13 +1186,13 @@ static BOOL handler_ntcreatex(int instance) /* ntcreatex creates a new file handle */ ADD_HANDLE(parm[0].ntcreatex.in.fname, ntcreatex.out.file.fnum); - return True; + return true; } /* generate close operations */ -static BOOL handler_close(int instance) +static bool handler_close(int instance) { union smb_close parm[NSERVERS]; NTSTATUS status[NSERVERS]; @@ -1207,13 +1207,13 @@ static BOOL handler_close(int instance) REMOVE_HANDLE(close.in.file.fnum); - return True; + return true; } /* generate unlink operations */ -static BOOL handler_unlink(int instance) +static bool handler_unlink(int instance) { union smb_unlink parm[NSERVERS]; NTSTATUS status[NSERVERS]; @@ -1224,13 +1224,13 @@ static BOOL handler_unlink(int instance) GEN_COPY_PARM; GEN_CALL(smb_raw_unlink(tree, &parm[i])); - return True; + return true; } /* generate chkpath operations */ -static BOOL handler_chkpath(int instance) +static bool handler_chkpath(int instance) { union smb_chkpath parm[NSERVERS]; NTSTATUS status[NSERVERS]; @@ -1240,13 +1240,13 @@ static BOOL handler_chkpath(int instance) GEN_COPY_PARM; GEN_CALL(smb_raw_chkpath(tree, &parm[i])); - return True; + return true; } /* generate mkdir operations */ -static BOOL handler_mkdir(int instance) +static bool handler_mkdir(int instance) { union smb_mkdir parm[NSERVERS]; NTSTATUS status[NSERVERS]; @@ -1257,13 +1257,13 @@ static BOOL handler_mkdir(int instance) GEN_COPY_PARM; GEN_CALL(smb_raw_mkdir(tree, &parm[i])); - return True; + return true; } /* generate rmdir operations */ -static BOOL handler_rmdir(int instance) +static bool handler_rmdir(int instance) { struct smb_rmdir parm[NSERVERS]; NTSTATUS status[NSERVERS]; @@ -1273,13 +1273,13 @@ static BOOL handler_rmdir(int instance) GEN_COPY_PARM; GEN_CALL(smb_raw_rmdir(tree, &parm[i])); - return True; + return true; } /* generate rename operations */ -static BOOL handler_rename(int instance) +static bool handler_rename(int instance) { union smb_rename parm[NSERVERS]; NTSTATUS status[NSERVERS]; @@ -1292,13 +1292,13 @@ static BOOL handler_rename(int instance) GEN_COPY_PARM; GEN_CALL(smb_raw_rename(tree, &parm[i])); - return True; + return true; } /* generate ntrename operations */ -static BOOL handler_ntrename(int instance) +static bool handler_ntrename(int instance) { union smb_rename parm[NSERVERS]; NTSTATUS status[NSERVERS]; @@ -1313,14 +1313,14 @@ static BOOL handler_ntrename(int instance) GEN_COPY_PARM; GEN_CALL(smb_raw_rename(tree, &parm[i])); - return True; + return true; } /* generate seek operations */ -static BOOL handler_seek(int instance) +static bool handler_seek(int instance) { union smb_seek parm[NSERVERS]; NTSTATUS status[NSERVERS]; @@ -1335,14 +1335,14 @@ static BOOL handler_seek(int instance) CHECK_EQUAL(lseek.out.offset); - return True; + return true; } /* generate readx operations */ -static BOOL handler_readx(int instance) +static bool handler_readx(int instance) { union smb_read parm[NSERVERS]; NTSTATUS status[NSERVERS]; @@ -1365,13 +1365,13 @@ static BOOL handler_readx(int instance) CHECK_EQUAL(readx.out.compaction_mode); CHECK_EQUAL(readx.out.nread); - return True; + return true; } /* generate writex operations */ -static BOOL handler_writex(int instance) +static bool handler_writex(int instance) { union smb_write parm[NSERVERS]; NTSTATUS status[NSERVERS]; @@ -1391,13 +1391,13 @@ static BOOL handler_writex(int instance) CHECK_EQUAL(writex.out.nwritten); CHECK_EQUAL(writex.out.remaining); - return True; + return true; } /* generate lockingx operations */ -static BOOL handler_lockingx(int instance) +static bool handler_lockingx(int instance) { union smb_lock parm[NSERVERS]; NTSTATUS status[NSERVERS]; @@ -1430,7 +1430,7 @@ static BOOL handler_lockingx(int instance) GEN_SET_FNUM(lockx.in.file.fnum); GEN_CALL(smb_raw_lock(tree, &parm[i])); - return True; + return true; } /* @@ -1465,7 +1465,7 @@ static void gen_fileinfo(int instance, union smb_fileinfo *info) /* compare returned fileinfo structures */ -static BOOL cmp_fileinfo(int instance, +static bool cmp_fileinfo(int instance, union smb_fileinfo parm[NSERVERS], NTSTATUS status[NSERVERS]) { @@ -1473,7 +1473,7 @@ static BOOL cmp_fileinfo(int instance, switch (parm[0].generic.level) { case RAW_FILEINFO_GENERIC: - return False; + return false; case RAW_FILEINFO_GETATTR: CHECK_EQUAL(getattr.out.attrib); @@ -1635,13 +1635,13 @@ static BOOL cmp_fileinfo(int instance, break; } - return True; + return true; } /* generate qpathinfo operations */ -static BOOL handler_qpathinfo(int instance) +static bool handler_qpathinfo(int instance) { union smb_fileinfo parm[NSERVERS]; NTSTATUS status[NSERVERS]; @@ -1659,7 +1659,7 @@ static BOOL handler_qpathinfo(int instance) /* generate qfileinfo operations */ -static BOOL handler_qfileinfo(int instance) +static bool handler_qfileinfo(int instance) { union smb_fileinfo parm[NSERVERS]; NTSTATUS status[NSERVERS]; @@ -1777,7 +1777,7 @@ static void gen_setfileinfo(int instance, union smb_setfileinfo *info) /* generate setpathinfo operations */ -static BOOL handler_spathinfo(int instance) +static bool handler_spathinfo(int instance) { union smb_setfileinfo parm[NSERVERS]; NTSTATUS status[NSERVERS]; @@ -1796,14 +1796,14 @@ static BOOL handler_spathinfo(int instance) GEN_CALL(smb_raw_setpathinfo(tree, &parm[i])); - return True; + return true; } /* generate setfileinfo operations */ -static BOOL handler_sfileinfo(int instance) +static bool handler_sfileinfo(int instance) { union smb_setfileinfo parm[NSERVERS]; NTSTATUS status[NSERVERS]; @@ -1816,14 +1816,14 @@ static BOOL handler_sfileinfo(int instance) GEN_SET_FNUM(generic.in.file.fnum); GEN_CALL(smb_raw_setfileinfo(tree, &parm[i])); - return True; + return true; } /* generate change notify operations */ -static BOOL handler_notify(int instance) +static bool handler_notify(int instance) { union smb_notify parm[NSERVERS]; int n; @@ -1844,7 +1844,7 @@ static BOOL handler_notify(int instance) req->async.fn = async_notify; } - return True; + return true; } /* @@ -1898,7 +1898,7 @@ static void dump_seeds(void) */ static struct { const char *name; - BOOL (*handler)(int instance); + bool (*handler)(int instance); int count, success_count; } gen_ops[] = { {"OPEN", handler_open}, @@ -1952,7 +1952,7 @@ static int run_test(void) for (op=0; optype = LDAP_TAG_SearchRequest; @@ -99,7 +99,7 @@ static BOOL test_search_rootDSE(struct ldap_connection *conn, char **basedn) msg->r.SearchRequest.deref = LDAP_DEREFERENCE_NEVER; msg->r.SearchRequest.timelimit = 0; msg->r.SearchRequest.sizelimit = 0; - msg->r.SearchRequest.attributesonly = False; + msg->r.SearchRequest.attributesonly = false; msg->r.SearchRequest.tree = ldb_parse_tree(msg, "(objectclass=*)"); msg->r.SearchRequest.num_attributes = 0; msg->r.SearchRequest.attributes = NULL; @@ -107,13 +107,13 @@ static BOOL test_search_rootDSE(struct ldap_connection *conn, char **basedn) req = ldap_request_send(conn, msg); if (req == NULL) { printf("Could not setup ldap search\n"); - return False; + return false; } status = ldap_result_one(req, &result, LDAP_TAG_SearchResultEntry); if (!NT_STATUS_IS_OK(status)) { printf("search failed - %s\n", nt_errstr(status)); - return False; + return false; } printf("received %d replies\n", req->num_replies); @@ -142,7 +142,7 @@ static BOOL test_search_rootDSE(struct ldap_connection *conn, char **basedn) return ret; } -static BOOL test_compare_sasl(struct ldap_connection *conn, const char *basedn) +static bool test_compare_sasl(struct ldap_connection *conn, const char *basedn) { struct ldap_message *msg, *rep; struct ldap_request *req; @@ -152,12 +152,12 @@ static BOOL test_compare_sasl(struct ldap_connection *conn, const char *basedn) printf("Testing SASL Compare: %s\n", basedn); if (!basedn) { - return False; + return false; } msg = new_ldap_message(conn); if (!msg) { - return False; + return false; } msg->type = LDAP_TAG_CompareRequest; @@ -168,13 +168,13 @@ static BOOL test_compare_sasl(struct ldap_connection *conn, const char *basedn) req = ldap_request_send(conn, msg); if (!req) { - return False; + return false; } status = ldap_result_one(req, &rep, LDAP_TAG_CompareResponse); if (!NT_STATUS_IS_OK(status)) { printf("error in ldap compare request - %s\n", nt_errstr(status)); - return False; + return false; } DEBUG(5,("Code: %d DN: [%s] ERROR:[%s] REFERRAL:[%s]\n", @@ -183,16 +183,16 @@ static BOOL test_compare_sasl(struct ldap_connection *conn, const char *basedn) rep->r.CompareResponse.errormessage, rep->r.CompareResponse.referral)); - return True; + return true; } -BOOL torture_ldap_basic(struct torture_context *torture) +bool torture_ldap_basic(struct torture_context *torture) { NTSTATUS status; struct ldap_connection *conn; TALLOC_CTX *mem_ctx; - BOOL ret = True; + bool ret = true; const char *host = torture_setting_string(torture, "host", NULL); const char *userdn = torture_setting_string(torture, "ldap_userdn", NULL); const char *secret = torture_setting_string(torture, "ldap_secret", NULL); @@ -205,25 +205,25 @@ BOOL torture_ldap_basic(struct torture_context *torture) status = torture_ldap_connection(mem_ctx, &conn, url); if (!NT_STATUS_IS_OK(status)) { - return False; + return false; } if (!test_search_rootDSE(conn, &basedn)) { - ret = False; + ret = false; } /* other basic tests here */ if (!test_multibind(conn, userdn, secret)) { - ret = False; + ret = false; } if (!test_bind_sasl(conn, cmdline_credentials)) { - ret = False; + ret = false; } if (!test_compare_sasl(conn, basedn)) { - ret = False; + ret = false; } /* no more test we are closing */ diff --git a/source4/torture/ldap/cldap.c b/source4/torture/ldap/cldap.c index 585cab9b277..f258a1c32f6 100644 --- a/source4/torture/ldap/cldap.c +++ b/source4/torture/ldap/cldap.c @@ -31,7 +31,7 @@ if (!NT_STATUS_EQUAL(status, correct)) { \ printf("(%s) Incorrect status %s - should be %s\n", \ __location__, nt_errstr(status), nt_errstr(correct)); \ - ret = False; \ + ret = false; \ goto done; \ } \ } while (0) @@ -39,7 +39,7 @@ /* test netlogon operations */ -static BOOL test_cldap_netlogon(TALLOC_CTX *mem_ctx, const char *dest) +static bool test_cldap_netlogon(TALLOC_CTX *mem_ctx, const char *dest) { struct cldap_socket *cldap = cldap_socket_init(mem_ctx, NULL); NTSTATUS status; @@ -47,7 +47,7 @@ static BOOL test_cldap_netlogon(TALLOC_CTX *mem_ctx, const char *dest) union nbt_cldap_netlogon n1; struct GUID guid; int i; - BOOL ret = True; + bool ret = true; ZERO_STRUCT(search); search.in.dest_address = dest; @@ -203,12 +203,12 @@ static void cldap_dump_results(struct cldap_search *search) /* test generic cldap operations */ -static BOOL test_cldap_generic(TALLOC_CTX *mem_ctx, const char *dest) +static bool test_cldap_generic(TALLOC_CTX *mem_ctx, const char *dest) { struct cldap_socket *cldap = cldap_socket_init(mem_ctx, NULL); NTSTATUS status; struct cldap_search search; - BOOL ret = True; + bool ret = true; const char *attrs1[] = { "currentTime", "highestCommittedUSN", NULL }; const char *attrs2[] = { "currentTime", "highestCommittedUSN", "netlogon", NULL }; const char *attrs3[] = { "netlogon", NULL }; diff --git a/source4/torture/ldap/cldapbench.c b/source4/torture/ldap/cldapbench.c index 52d86899274..9f860f98d91 100644 --- a/source4/torture/ldap/cldapbench.c +++ b/source4/torture/ldap/cldapbench.c @@ -53,7 +53,7 @@ static bool bench_cldap(struct torture_context *tctx, const char *address) struct cldap_socket *cldap = cldap_socket_init(tctx, NULL); int num_sent=0; struct timeval tv = timeval_current(); - BOOL ret = True; + bool ret = true; int timelimit = torture_setting_int(tctx, "timelimit", 10); struct cldap_netlogon search; struct bench_state *state; diff --git a/source4/torture/ldap/schema.c b/source4/torture/ldap/schema.c index 4da758cac46..30fd9877e63 100644 --- a/source4/torture/ldap/schema.c +++ b/source4/torture/ldap/schema.c @@ -43,13 +43,13 @@ struct test_rootDSE { struct test_schema_ctx { struct ldb_paged_control *ctrl; uint32_t count; - BOOL pending; + bool pending; int (*callback)(void *, struct ldb_context *ldb, struct ldb_message *); void *private_data; }; -static BOOL test_search_rootDSE(struct ldb_context *ldb, struct test_rootDSE *root) +static bool test_search_rootDSE(struct ldb_context *ldb, struct test_rootDSE *root) { int ret; struct ldb_message *msg; @@ -60,10 +60,10 @@ static BOOL test_search_rootDSE(struct ldb_context *ldb, struct test_rootDSE *ro ret = ldb_search(ldb, ldb_dn_new(ldb, ldb, NULL), LDB_SCOPE_BASE, NULL, NULL, &r); if (ret != LDB_SUCCESS) { - return False; + return false; } else if (r->count != 1) { talloc_free(r); - return False; + return false; } msg = r->msgs[0]; @@ -79,7 +79,7 @@ static BOOL test_search_rootDSE(struct ldb_context *ldb, struct test_rootDSE *ro talloc_free(r); - return True; + return true; } static int test_schema_search_callback(struct ldb_context *ldb, void *context, struct ldb_reply *ares) @@ -115,7 +115,7 @@ static int test_schema_search_callback(struct ldb_context *ldb, void *context, s actx->ctrl->cookie_len = ctrl->cookie_len; if (actx->ctrl->cookie_len > 0) { - actx->pending = True; + actx->pending = true; } } break; @@ -138,7 +138,7 @@ static int test_schema_search_callback(struct ldb_context *ldb, void *context, s return LDB_SUCCESS; } -static BOOL test_create_schema_type(struct ldb_context *ldb, struct test_rootDSE *root, +static bool test_create_schema_type(struct ldb_context *ldb, struct test_rootDSE *root, const char *filter, int (*callback)(void *, struct ldb_context *ldb, struct ldb_message *), void *private_data) @@ -155,7 +155,7 @@ static BOOL test_create_schema_type(struct ldb_context *ldb, struct test_rootDSE ctrl = talloc_array(req, struct ldb_control *, 2); ctrl[0] = talloc(ctrl, struct ldb_control); ctrl[0]->oid = LDB_CONTROL_PAGED_RESULTS_OID; - ctrl[0]->critical = True; + ctrl[0]->critical = true; control = talloc(ctrl[0], struct ldb_paged_control); control->size = 1000; control->cookie = NULL; @@ -179,25 +179,25 @@ static BOOL test_create_schema_type(struct ldb_context *ldb, struct test_rootDSE actx->callback = callback; actx->private_data = private_data; again: - actx->pending = False; + actx->pending = false; ret = ldb_request(ldb, req); if (ret != LDB_SUCCESS) { d_printf("search failed - %s\n", ldb_errstring(ldb)); - return False; + return false; } ret = ldb_wait(req->handle, LDB_WAIT_ALL); if (ret != LDB_SUCCESS) { d_printf("search error - %s\n", ldb_errstring(ldb)); - return False; + return false; } if (actx->pending) goto again; d_printf("filter[%s] count[%u]\n", filter, actx->count); - return True; + return true; } static int test_add_attribute(void *ptr, struct ldb_context *ldb, struct ldb_message *msg) @@ -245,9 +245,9 @@ failed: return LDB_ERR_OTHER; } -static BOOL test_create_schema(struct ldb_context *ldb, struct test_rootDSE *root, struct dsdb_schema **_schema) +static bool test_create_schema(struct ldb_context *ldb, struct test_rootDSE *root, struct dsdb_schema **_schema) { - BOOL ret = True; + bool ret = true; struct dsdb_schema *schema; schema = talloc_zero(ldb, struct dsdb_schema); @@ -259,13 +259,13 @@ static BOOL test_create_schema(struct ldb_context *ldb, struct test_rootDSE *roo ret &= test_create_schema_type(ldb, root, "(objectClass=classSchema)", test_add_class, schema); - if (ret == True) { + if (ret == true) { *_schema = schema; } return ret; } -static BOOL test_dump_not_replicated(struct ldb_context *ldb, struct test_rootDSE *root, struct dsdb_schema *schema) +static bool test_dump_not_replicated(struct ldb_context *ldb, struct test_rootDSE *root, struct dsdb_schema *schema) { struct dsdb_attribute *a; uint32_t a_i = 1; @@ -278,10 +278,10 @@ static BOOL test_dump_not_replicated(struct ldb_context *ldb, struct test_rootDS a->lDAPDisplayName); } - return True; + return true; } -static BOOL test_dump_partial(struct ldb_context *ldb, struct test_rootDSE *root, struct dsdb_schema *schema) +static bool test_dump_partial(struct ldb_context *ldb, struct test_rootDSE *root, struct dsdb_schema *schema) { struct dsdb_attribute *a; uint32_t a_i = 1; @@ -295,10 +295,10 @@ static BOOL test_dump_partial(struct ldb_context *ldb, struct test_rootDSE *root a->lDAPDisplayName); } - return True; + return true; } -static BOOL test_dump_contructed(struct ldb_context *ldb, struct test_rootDSE *root, struct dsdb_schema *schema) +static bool test_dump_contructed(struct ldb_context *ldb, struct test_rootDSE *root, struct dsdb_schema *schema) { struct dsdb_attribute *a; uint32_t a_i = 1; @@ -311,10 +311,10 @@ static BOOL test_dump_contructed(struct ldb_context *ldb, struct test_rootDSE *r a->lDAPDisplayName); } - return True; + return true; } -static BOOL test_dump_sorted_syntax(struct ldb_context *ldb, struct test_rootDSE *root, struct dsdb_schema *schema) +static bool test_dump_sorted_syntax(struct ldb_context *ldb, struct test_rootDSE *root, struct dsdb_schema *schema) { struct dsdb_attribute *a; uint32_t a_i = 1; @@ -350,7 +350,7 @@ static BOOL test_dump_sorted_syntax(struct ldb_context *ldb, struct test_rootDSE om_hex = data_blob_hex_string(ldb, &a->oMObjectClass); if (!om_hex) { - return False; + return false; } d_printf("attr[%4u]: %s %u '%s' '%s'\n", a_i++, @@ -360,13 +360,13 @@ static BOOL test_dump_sorted_syntax(struct ldb_context *ldb, struct test_rootDSE } } - return True; + return true; } -BOOL torture_ldap_schema(struct torture_context *torture) +bool torture_ldap_schema(struct torture_context *torture) { struct ldb_context *ldb; - BOOL ret = True; + bool ret = true; const char *host = torture_setting_string(torture, "host", NULL); char *url; struct test_rootDSE rootDSE; diff --git a/source4/torture/ldap/uptodatevector.c b/source4/torture/ldap/uptodatevector.c index f8d00eaa4d8..b3c6e8d5559 100644 --- a/source4/torture/ldap/uptodatevector.c +++ b/source4/torture/ldap/uptodatevector.c @@ -150,10 +150,10 @@ static bool test_check_uptodatevector(struct torture_context *torture, return ok; } -BOOL torture_ldap_uptodatevector(struct torture_context *torture) +bool torture_ldap_uptodatevector(struct torture_context *torture) { struct ldb_context *ldb; - BOOL ret = True; + bool ret = true; const char *host = torture_setting_string(torture, "host", NULL); char *url; @@ -172,5 +172,5 @@ BOOL torture_ldap_uptodatevector(struct torture_context *torture) return ret; failed: - return False; + return false; } diff --git a/source4/torture/libnet/domain.c b/source4/torture/libnet/domain.c index 329c8a1d239..daf9012e0c7 100644 --- a/source4/torture/libnet/domain.c +++ b/source4/torture/libnet/domain.c @@ -25,7 +25,7 @@ #include "librpc/gen_ndr/ndr_samr_c.h" #include "param/param.h" -static BOOL test_domainopen(struct libnet_context *net_ctx, TALLOC_CTX *mem_ctx, +static bool test_domainopen(struct libnet_context *net_ctx, TALLOC_CTX *mem_ctx, struct lsa_String *domname, struct policy_handle *domain_handle) { @@ -40,15 +40,15 @@ static BOOL test_domainopen(struct libnet_context *net_ctx, TALLOC_CTX *mem_ctx, status = libnet_DomainOpen(net_ctx, mem_ctx, &io); if (!NT_STATUS_IS_OK(status)) { printf("Composite domain open failed - %s\n", nt_errstr(status)); - return False; + return false; } *domain_handle = io.out.domain_handle; - return True; + return true; } -static BOOL test_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *domain_handle) { NTSTATUS status; @@ -63,20 +63,20 @@ static BOOL test_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_Close(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("Close failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } -BOOL torture_domainopen(struct torture_context *torture) +bool torture_domainopen(struct torture_context *torture) { NTSTATUS status; struct libnet_context *net_ctx; struct event_context *evt_ctx; TALLOC_CTX *mem_ctx; - BOOL ret = True; + bool ret = true; struct policy_handle h; struct lsa_String name; @@ -90,7 +90,7 @@ BOOL torture_domainopen(struct torture_context *torture) &ndr_table_samr); if (!NT_STATUS_IS_OK(status)) { - return False; + return false; } name.string = lp_workgroup(global_loadparm); @@ -99,12 +99,12 @@ BOOL torture_domainopen(struct torture_context *torture) * Testing synchronous version */ if (!test_domainopen(net_ctx, mem_ctx, &name, &h)) { - ret = False; + ret = false; goto done; } if (!test_cleanup(net_ctx->samr.pipe, mem_ctx, &h)) { - ret = False; + ret = false; goto done; } diff --git a/source4/torture/libnet/groupinfo.c b/source4/torture/libnet/groupinfo.c index 31b49ef70ef..bff2f405cdd 100644 --- a/source4/torture/libnet/groupinfo.c +++ b/source4/torture/libnet/groupinfo.c @@ -29,7 +29,7 @@ #define TEST_GROUPNAME "libnetgroupinfotest" -static BOOL test_groupinfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_groupinfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *domain_handle, struct dom_sid2 *domain_sid, const char* group_name, uint32_t *rid) @@ -49,7 +49,7 @@ static BOOL test_groupinfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = libnet_rpc_groupinfo(p, mem_ctx, &group); if (!NT_STATUS_IS_OK(status)) { printf("Failed to call sync libnet_rpc_userinfo - %s\n", nt_errstr(status)); - return False; + return false; } ZERO_STRUCT(group); @@ -63,19 +63,19 @@ static BOOL test_groupinfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = libnet_rpc_groupinfo(p, mem_ctx, &group); if (!NT_STATUS_IS_OK(status)) { printf("Failed to call sync libnet_rpc_groupinfo - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } -BOOL torture_groupinfo(struct torture_context *torture) +bool torture_groupinfo(struct torture_context *torture) { NTSTATUS status; struct dcerpc_pipe *p; TALLOC_CTX *mem_ctx; - BOOL ret = True; + bool ret = true; struct policy_handle h; struct lsa_String name; struct dom_sid2 sid; @@ -88,7 +88,7 @@ BOOL torture_groupinfo(struct torture_context *torture) &ndr_table_samr); if (!NT_STATUS_IS_OK(status)) { - return False; + return false; } name.string = lp_workgroup(global_loadparm); @@ -97,22 +97,22 @@ BOOL torture_groupinfo(struct torture_context *torture) * Testing synchronous version */ if (!test_opendomain(p, mem_ctx, &h, &name, &sid)) { - ret = False; + ret = false; goto done; } if (!test_group_create(p, mem_ctx, &h, TEST_GROUPNAME, &rid)) { - ret = False; + ret = false; goto done; } if (!test_groupinfo(p, mem_ctx, &h, &sid, TEST_GROUPNAME, &rid)) { - ret = False; + ret = false; goto done; } if (!test_group_cleanup(p, mem_ctx, &h, TEST_GROUPNAME)) { - ret = False; + ret = false; goto done; } diff --git a/source4/torture/libnet/groupman.c b/source4/torture/libnet/groupman.c index a812f59aead..552e02c420c 100644 --- a/source4/torture/libnet/groupman.c +++ b/source4/torture/libnet/groupman.c @@ -27,12 +27,12 @@ #include "torture/libnet/utils.h" -static BOOL test_groupadd(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_groupadd(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *domain_handle, const char *name) { NTSTATUS status; - BOOL ret = True; + bool ret = true; struct libnet_rpc_groupadd group; group.in.domain_handle = *domain_handle; @@ -43,14 +43,14 @@ static BOOL test_groupadd(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = libnet_rpc_groupadd(p, mem_ctx, &group); if (!NT_STATUS_IS_OK(status)) { printf("Failed to call sync libnet_rpc_groupadd - %s\n", nt_errstr(status)); - return False; + return false; } return ret; } -BOOL torture_groupadd(struct torture_context *torture) +bool torture_groupadd(struct torture_context *torture) { NTSTATUS status; struct dcerpc_pipe *p; @@ -59,7 +59,7 @@ BOOL torture_groupadd(struct torture_context *torture) struct dom_sid2 sid; const char *name = TEST_GROUPNAME; TALLOC_CTX *mem_ctx; - BOOL ret = True; + bool ret = true; mem_ctx = talloc_init("test_groupadd"); @@ -68,22 +68,22 @@ BOOL torture_groupadd(struct torture_context *torture) &ndr_table_samr); if (!NT_STATUS_IS_OK(status)) { - return False; + return false; } domain_name.string = lp_workgroup(global_loadparm); if (!test_opendomain(p, mem_ctx, &h, &domain_name, &sid)) { - ret = False; + ret = false; goto done; } if (!test_groupadd(p, mem_ctx, &h, name)) { - ret = False; + ret = false; goto done; } if (!test_group_cleanup(p, mem_ctx, &h, name)) { - ret = False; + ret = false; goto done; } diff --git a/source4/torture/libnet/libnet_BecomeDC.c b/source4/torture/libnet/libnet_BecomeDC.c index 5738e5c620a..edcf92b8ec5 100644 --- a/source4/torture/libnet/libnet_BecomeDC.c +++ b/source4/torture/libnet/libnet_BecomeDC.c @@ -712,9 +712,9 @@ static NTSTATUS test_become_dc_store_chunk(void *private_data, return NT_STATUS_OK; } -BOOL torture_net_become_dc(struct torture_context *torture) +bool torture_net_become_dc(struct torture_context *torture) { - BOOL ret = True; + bool ret = true; NTSTATUS status; struct libnet_BecomeDC b; struct libnet_UnbecomeDC u; @@ -724,7 +724,7 @@ BOOL torture_net_become_dc(struct torture_context *torture) uint32_t i; s = talloc_zero(torture, struct test_become_dc_state); - if (!s) return False; + if (!s) return false; s->netbios_name = lp_parm_string(global_loadparm, NULL, "become dc", "smbtorture dc"); if (!s->netbios_name || !s->netbios_name[0]) { @@ -751,7 +751,7 @@ BOOL torture_net_become_dc(struct torture_context *torture) if (!s->tj) { DEBUG(0, ("%s failed to join domain as workstation\n", s->netbios_name)); - return False; + return false; } s->ctx = libnet_context_init(torture->ev); @@ -776,27 +776,27 @@ BOOL torture_net_become_dc(struct torture_context *torture) status = libnet_BecomeDC(s->ctx, s, &b); if (!NT_STATUS_IS_OK(status)) { printf("libnet_BecomeDC() failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; goto cleanup; } msg = ldb_msg_new(s); if (!msg) { printf("ldb_msg_new() failed\n"); - ret = False; + ret = false; goto cleanup; } msg->dn = ldb_dn_new(msg, s->ldb, "cn=ROOTDSE"); if (!msg->dn) { printf("ldb_msg_new(cn=ROOTDSE) failed\n"); - ret = False; + ret = false; goto cleanup; } ldb_ret = ldb_msg_add_string(msg, "isSynchronized", "TRUE"); if (ldb_ret != LDB_SUCCESS) { printf("ldb_msg_add_string(msg, isSynchronized, TRUE) failed: %d\n", ldb_ret); - ret = False; + ret = false; goto cleanup; } @@ -808,7 +808,7 @@ BOOL torture_net_become_dc(struct torture_context *torture) ldb_ret = ldb_modify(s->ldb, msg); if (ldb_ret != LDB_SUCCESS) { printf("ldb_modify() failed: %d\n", ldb_ret); - ret = False; + ret = false; goto cleanup; } @@ -823,14 +823,14 @@ BOOL torture_net_become_dc(struct torture_context *torture) if (!s->ldb) { DEBUG(0,("Failed to open '%s'\n", s->path.samdb_ldb)); - ret = False; + ret = false; goto cleanup; } s->schema = dsdb_get_schema(s->ldb); if (!s->schema) { DEBUG(0,("Failed to get loaded dsdb_schema\n")); - ret = False; + ret = false; goto cleanup; } @@ -849,7 +849,7 @@ cleanup: status = libnet_UnbecomeDC(s->ctx, s, &u); if (!NT_STATUS_IS_OK(status)) { printf("libnet_UnbecomeDC() failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } /* Leave domain. */ diff --git a/source4/torture/libnet/libnet_domain.c b/source4/torture/libnet/libnet_domain.c index a2c0967faaa..379cca19bec 100644 --- a/source4/torture/libnet/libnet_domain.c +++ b/source4/torture/libnet/libnet_domain.c @@ -33,7 +33,7 @@ #include "param/param.h" -static BOOL test_opendomain_samr(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_opendomain_samr(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String *domname, uint32_t *access_mask, struct dom_sid **sid) { @@ -54,7 +54,7 @@ static BOOL test_opendomain_samr(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_Connect(p, mem_ctx, &r1); if (!NT_STATUS_IS_OK(status)) { printf("Connect failed - %s\n", nt_errstr(status)); - return False; + return false; } r2.in.connect_handle = &h; @@ -65,7 +65,7 @@ static BOOL test_opendomain_samr(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_LookupDomain(p, mem_ctx, &r2); if (!NT_STATUS_IS_OK(status)) { printf("LookupDomain failed - %s\n", nt_errstr(status)); - return False; + return false; } r3.in.connect_handle = &h; @@ -78,16 +78,16 @@ static BOOL test_opendomain_samr(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_OpenDomain(p, mem_ctx, &r3); if (!NT_STATUS_IS_OK(status)) { printf("OpenDomain failed - %s\n", nt_errstr(status)); - return False; + return false; } else { *handle = domain_handle; } - return True; + return true; } -static BOOL test_opendomain_lsa(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_opendomain_lsa(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String *domname, uint32_t *access_mask) { @@ -115,16 +115,16 @@ static BOOL test_opendomain_lsa(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_lsa_OpenPolicy2(p, mem_ctx, &open); if (!NT_STATUS_IS_OK(status)) { - return False; + return false; } - return True; + return true; } bool torture_domain_open_lsa(struct torture_context *torture) { NTSTATUS status; - BOOL ret = True; + bool ret = true; struct libnet_context *ctx; struct libnet_DomainOpen r; struct lsa_Close lsa_close; @@ -139,7 +139,7 @@ bool torture_domain_open_lsa(struct torture_context *torture) ctx = libnet_context_init(NULL); if (ctx == NULL) { d_printf("failed to create libnet context\n"); - return False; + return false; } ctx->cred = cmdline_credentials; @@ -152,7 +152,7 @@ bool torture_domain_open_lsa(struct torture_context *torture) status = libnet_DomainOpen(ctx, torture, &r); if (!NT_STATUS_IS_OK(status)) { d_printf("failed to open domain on lsa service: %s\n", nt_errstr(status)); - ret = False; + ret = false; goto done; } @@ -163,7 +163,7 @@ bool torture_domain_open_lsa(struct torture_context *torture) status = dcerpc_lsa_Close(ctx->lsa.pipe, ctx, &lsa_close); if (!NT_STATUS_IS_OK(status)) { d_printf("failed to close domain on lsa service: %s\n", nt_errstr(status)); - ret = False; + ret = false; } done: @@ -172,9 +172,9 @@ done: } -BOOL torture_domain_close_lsa(struct torture_context *torture) +bool torture_domain_close_lsa(struct torture_context *torture) { - BOOL ret = True; + bool ret = true; NTSTATUS status; TALLOC_CTX *mem_ctx=NULL; struct libnet_context *ctx; @@ -193,7 +193,7 @@ BOOL torture_domain_close_lsa(struct torture_context *torture) ctx = libnet_context_init(NULL); if (ctx == NULL) { d_printf("failed to create libnet context\n"); - ret = False; + ret = false; goto done; } @@ -204,7 +204,7 @@ BOOL torture_domain_close_lsa(struct torture_context *torture) cmdline_credentials, NULL); if (!NT_STATUS_IS_OK(status)) { d_printf("failed to connect to server: %s\n", nt_errstr(status)); - ret = False; + ret = false; goto done; } @@ -212,7 +212,7 @@ BOOL torture_domain_close_lsa(struct torture_context *torture) if (!test_opendomain_lsa(p, torture, &h, &domain_name, &access_mask)) { d_printf("failed to open domain on lsa service\n"); - ret = False; + ret = false; goto done; } @@ -230,7 +230,7 @@ BOOL torture_domain_close_lsa(struct torture_context *torture) status = libnet_DomainClose(ctx, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { - ret = False; + ret = false; goto done; } @@ -241,7 +241,7 @@ done: } -BOOL torture_domain_open_samr(struct torture_context *torture) +bool torture_domain_open_samr(struct torture_context *torture) { NTSTATUS status; struct libnet_context *ctx; @@ -251,7 +251,7 @@ BOOL torture_domain_open_samr(struct torture_context *torture) struct libnet_DomainOpen io; struct samr_Close r; const char *domain_name; - BOOL ret = True; + bool ret = true; mem_ctx = talloc_init("test_domainopen_lsa"); @@ -275,7 +275,7 @@ BOOL torture_domain_open_samr(struct torture_context *torture) status = libnet_DomainOpen(ctx, mem_ctx, &io); if (!NT_STATUS_IS_OK(status)) { printf("Composite domain open failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; goto done; } @@ -289,7 +289,7 @@ BOOL torture_domain_open_samr(struct torture_context *torture) status = dcerpc_samr_Close(ctx->samr.pipe, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("Close failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; goto done; } @@ -301,9 +301,9 @@ done: } -BOOL torture_domain_close_samr(struct torture_context *torture) +bool torture_domain_close_samr(struct torture_context *torture) { - BOOL ret = True; + bool ret = true; NTSTATUS status; TALLOC_CTX *mem_ctx = NULL; struct libnet_context *ctx; @@ -323,7 +323,7 @@ BOOL torture_domain_close_samr(struct torture_context *torture) ctx = libnet_context_init(NULL); if (ctx == NULL) { d_printf("failed to create libnet context\n"); - ret = False; + ret = false; goto done; } @@ -334,7 +334,7 @@ BOOL torture_domain_close_samr(struct torture_context *torture) ctx->cred, NULL); if (!NT_STATUS_IS_OK(status)) { d_printf("failed to connect to server: %s\n", nt_errstr(status)); - ret = False; + ret = false; goto done; } @@ -342,7 +342,7 @@ BOOL torture_domain_close_samr(struct torture_context *torture) if (!test_opendomain_samr(p, torture, &h, &domain_name, &access_mask, &sid)) { d_printf("failed to open domain on samr service\n"); - ret = False; + ret = false; goto done; } @@ -362,7 +362,7 @@ BOOL torture_domain_close_samr(struct torture_context *torture) status = libnet_DomainClose(ctx, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { - ret = False; + ret = false; goto done; } @@ -373,9 +373,9 @@ done: } -BOOL torture_domain_list(struct torture_context *torture) +bool torture_domain_list(struct torture_context *torture) { - BOOL ret = True; + bool ret = true; NTSTATUS status; TALLOC_CTX *mem_ctx = NULL; struct dcerpc_binding *binding; @@ -391,7 +391,7 @@ BOOL torture_domain_list(struct torture_context *torture) ctx = libnet_context_init(NULL); if (ctx == NULL) { d_printf("failed to create libnet context\n"); - ret = False; + ret = false; goto done; } @@ -408,7 +408,7 @@ BOOL torture_domain_list(struct torture_context *torture) status = libnet_DomainList(ctx, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { - ret = False; + ret = false; goto done; } @@ -429,7 +429,7 @@ BOOL torture_domain_list(struct torture_context *torture) status = libnet_DomainList(ctx, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { - ret = False; + ret = false; goto done; } diff --git a/source4/torture/libnet/libnet_group.c b/source4/torture/libnet/libnet_group.c index 7089bd83fc5..a4489d376d1 100644 --- a/source4/torture/libnet/libnet_group.c +++ b/source4/torture/libnet/libnet_group.c @@ -32,7 +32,7 @@ #define TEST_GROUPNAME "libnetgrouptest" -static BOOL test_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *domain_handle, const char *groupname) { NTSTATUS status; @@ -54,7 +54,7 @@ static BOOL test_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_LookupNames(p, mem_ctx, &r1); if (!NT_STATUS_IS_OK(status)) { printf("LookupNames failed - %s\n", nt_errstr(status)); - return False; + return false; } rid = r1.out.rids.ids[0]; @@ -69,7 +69,7 @@ static BOOL test_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_OpenGroup(p, mem_ctx, &r2); if (!NT_STATUS_IS_OK(status)) { printf("OpenGroup failed - %s\n", nt_errstr(status)); - return False; + return false; } r3.in.group_handle = &group_handle; @@ -80,14 +80,14 @@ static BOOL test_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_DeleteDomainGroup(p, mem_ctx, &r3); if (!NT_STATUS_IS_OK(status)) { printf("DeleteGroup failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } -static BOOL test_creategroup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_creategroup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, const char *name) { NTSTATUS status; @@ -113,7 +113,7 @@ static BOOL test_creategroup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (NT_STATUS_EQUAL(status, NT_STATUS_GROUP_EXISTS)) { printf("Group (%s) already exists - attempting to delete and recreate group again\n", name); if (!test_cleanup(p, mem_ctx, handle, TEST_GROUPNAME)) { - return False; + return false; } printf("creating group account\n"); @@ -121,18 +121,18 @@ static BOOL test_creategroup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_CreateDomainGroup(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("CreateGroup failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } - return False; + return false; } - return True; + return true; } -static BOOL test_opendomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_opendomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String *domname) { NTSTATUS status; @@ -150,7 +150,7 @@ static BOOL test_opendomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_Connect(p, mem_ctx, &r1); if (!NT_STATUS_IS_OK(status)) { printf("Connect failed - %s\n", nt_errstr(status)); - return False; + return false; } r2.in.connect_handle = &h; @@ -161,7 +161,7 @@ static BOOL test_opendomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_LookupDomain(p, mem_ctx, &r2); if (!NT_STATUS_IS_OK(status)) { printf("LookupDomain failed - %s\n", nt_errstr(status)); - return False; + return false; } r3.in.connect_handle = &h; @@ -174,16 +174,16 @@ static BOOL test_opendomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_OpenDomain(p, mem_ctx, &r3); if (!NT_STATUS_IS_OK(status)) { printf("OpenDomain failed - %s\n", nt_errstr(status)); - return False; + return false; } else { *handle = domain_handle; } - return True; + return true; } -static BOOL test_samr_close(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_samr_close(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *domain_handle) { NTSTATUS status; @@ -195,17 +195,17 @@ static BOOL test_samr_close(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_Close(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("Close samr domain failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } -BOOL torture_groupinfo_api(struct torture_context *torture) +bool torture_groupinfo_api(struct torture_context *torture) { const char *name = TEST_GROUPNAME; - BOOL ret = True; + bool ret = true; NTSTATUS status; TALLOC_CTX *mem_ctx = NULL, *prep_mem_ctx; struct libnet_context *ctx; @@ -223,17 +223,17 @@ BOOL torture_groupinfo_api(struct torture_context *torture) &p, &ndr_table_samr); if (!NT_STATUS_IS_OK(status)) { - return False; + return false; } domain_name.string = lp_workgroup(global_loadparm); if (!test_opendomain(p, prep_mem_ctx, &h, &domain_name)) { - ret = False; + ret = false; goto done; } if (!test_creategroup(p, prep_mem_ctx, &h, name)) { - ret = False; + ret = false; goto done; } @@ -247,20 +247,20 @@ BOOL torture_groupinfo_api(struct torture_context *torture) status = libnet_GroupInfo(ctx, mem_ctx, &req); if (!NT_STATUS_IS_OK(status)) { printf("libnet_GroupInfo call failed: %s\n", nt_errstr(status)); - ret = False; + ret = false; talloc_free(mem_ctx); goto done; } if (!test_cleanup(ctx->samr.pipe, mem_ctx, &ctx->samr.handle, TEST_GROUPNAME)) { printf("cleanup failed\n"); - ret = False; + ret = false; goto done; } if (!test_samr_close(ctx->samr.pipe, mem_ctx, &ctx->samr.handle)) { printf("domain close failed\n"); - ret = False; + ret = false; } talloc_free(ctx); diff --git a/source4/torture/libnet/libnet_lookup.c b/source4/torture/libnet/libnet_lookup.c index 0d4389c54a6..4734ec50884 100644 --- a/source4/torture/libnet/libnet_lookup.c +++ b/source4/torture/libnet/libnet_lookup.c @@ -29,9 +29,9 @@ #include "param/param.h" -BOOL torture_lookup(struct torture_context *torture) +bool torture_lookup(struct torture_context *torture) { - BOOL ret; + bool ret; NTSTATUS status; TALLOC_CTX *mem_ctx; struct libnet_context *ctx; @@ -59,11 +59,11 @@ BOOL torture_lookup(struct torture_context *torture) if (!NT_STATUS_IS_OK(status)) { printf("Couldn't lookup name %s: %s\n", lookup.in.hostname, nt_errstr(status)); - ret = False; + ret = false; goto done; } - ret = True; + ret = true; printf("Name [%s] found at address: %s.\n", lookup.in.hostname, *lookup.out.address); @@ -73,9 +73,9 @@ done: } -BOOL torture_lookup_host(struct torture_context *torture) +bool torture_lookup_host(struct torture_context *torture) { - BOOL ret; + bool ret; NTSTATUS status; TALLOC_CTX *mem_ctx; struct libnet_context *ctx; @@ -102,11 +102,11 @@ BOOL torture_lookup_host(struct torture_context *torture) if (!NT_STATUS_IS_OK(status)) { printf("Couldn't lookup host %s: %s\n", lookup.in.hostname, nt_errstr(status)); - ret = False; + ret = false; goto done; } - ret = True; + ret = true; printf("Host [%s] found at address: %s.\n", lookup.in.hostname, *lookup.out.address); @@ -116,9 +116,9 @@ done: } -BOOL torture_lookup_pdc(struct torture_context *torture) +bool torture_lookup_pdc(struct torture_context *torture) { - BOOL ret; + bool ret; NTSTATUS status; TALLOC_CTX *mem_ctx; struct libnet_context *ctx; @@ -134,7 +134,7 @@ BOOL torture_lookup_pdc(struct torture_context *torture) lookup = talloc(mem_ctx, struct libnet_LookupDCs); if (!lookup) { - ret = False; + ret = false; goto done; } @@ -146,11 +146,11 @@ BOOL torture_lookup_pdc(struct torture_context *torture) if (!NT_STATUS_IS_OK(status)) { printf("Couldn't lookup pdc %s: %s\n", lookup->in.domain_name, nt_errstr(status)); - ret = False; + ret = false; goto done; } - ret = True; + ret = true; printf("DCs of domain [%s] found.\n", lookup->in.domain_name); for (i = 0; i < lookup->out.num_dcs; i++) { @@ -164,7 +164,7 @@ done: } -BOOL torture_lookup_sam_name(struct torture_context *torture) +bool torture_lookup_sam_name(struct torture_context *torture) { NTSTATUS status; TALLOC_CTX *mem_ctx; @@ -175,7 +175,7 @@ BOOL torture_lookup_sam_name(struct torture_context *torture) ctx->cred = cmdline_credentials; mem_ctx = talloc_init("torture lookup sam name"); - if (mem_ctx == NULL) return False; + if (mem_ctx == NULL) return false; r.in.name = "Administrator"; r.in.domain_name = lp_workgroup(global_loadparm); @@ -185,5 +185,5 @@ BOOL torture_lookup_sam_name(struct torture_context *torture) talloc_free(mem_ctx); talloc_free(ctx); - return True; + return true; } diff --git a/source4/torture/libnet/libnet_rpc.c b/source4/torture/libnet/libnet_rpc.c index bb9a8d2f34c..5ca927a1e38 100644 --- a/source4/torture/libnet/libnet_rpc.c +++ b/source4/torture/libnet/libnet_rpc.c @@ -33,12 +33,12 @@ #include "param/param.h" -static BOOL test_connect_service(struct libnet_context *ctx, +static bool test_connect_service(struct libnet_context *ctx, const struct ndr_interface_table *iface, const char *binding_string, const char *hostname, const enum libnet_RpcConnect_level level, - BOOL badcreds, NTSTATUS expected_status) + bool badcreds, NTSTATUS expected_status) { NTSTATUS status; struct libnet_RpcConnect connect; @@ -62,7 +62,7 @@ static BOOL test_connect_service(struct libnet_context *ctx, connect.in.dcerpc_iface->name, connect.in.binding, nt_errstr(expected_status), nt_errstr(status)); - return False; + return false; } d_printf("PASSED. Expected: %s, received: %s\n", nt_errstr(expected_status), @@ -79,11 +79,11 @@ static BOOL test_connect_service(struct libnet_context *ctx, d_printf("Error string: %s\n", connect.out.error_string); } - return True; + return true; } -static BOOL torture_rpc_connect(struct torture_context *torture, +static bool torture_rpc_connect(struct torture_context *torture, const enum libnet_RpcConnect_level level, const char *bindstr, const char *hostname) { @@ -94,46 +94,46 @@ static BOOL torture_rpc_connect(struct torture_context *torture, d_printf("Testing connection to LSA interface\n"); if (!test_connect_service(ctx, &ndr_table_lsarpc, bindstr, - hostname, level, False, NT_STATUS_OK)) { + hostname, level, false, NT_STATUS_OK)) { d_printf("failed to connect LSA interface\n"); - return False; + return false; } d_printf("Testing connection to SAMR interface\n"); if (!test_connect_service(ctx, &ndr_table_samr, bindstr, - hostname, level, False, NT_STATUS_OK)) { + hostname, level, false, NT_STATUS_OK)) { d_printf("failed to connect SAMR interface\n"); - return False; + return false; } d_printf("Testing connection to SRVSVC interface\n"); if (!test_connect_service(ctx, &ndr_table_srvsvc, bindstr, - hostname, level, False, NT_STATUS_OK)) { + hostname, level, false, NT_STATUS_OK)) { d_printf("failed to connect SRVSVC interface\n"); - return False; + return false; } d_printf("Testing connection to LSA interface with wrong credentials\n"); if (!test_connect_service(ctx, &ndr_table_lsarpc, bindstr, - hostname, level, True, NT_STATUS_LOGON_FAILURE)) { + hostname, level, true, NT_STATUS_LOGON_FAILURE)) { d_printf("failed to test wrong credentials on LSA interface\n"); - return False; + return false; } d_printf("Testing connection to SAMR interface with wrong credentials\n"); if (!test_connect_service(ctx, &ndr_table_samr, bindstr, - hostname, level, True, NT_STATUS_LOGON_FAILURE)) { + hostname, level, true, NT_STATUS_LOGON_FAILURE)) { d_printf("failed to test wrong credentials on SAMR interface\n"); - return False; + return false; } talloc_free(ctx); - return True; + return true; } -BOOL torture_rpc_connect_srv(struct torture_context *torture) +bool torture_rpc_connect_srv(struct torture_context *torture) { const enum libnet_RpcConnect_level level = LIBNET_RPC_CONNECT_SERVER; NTSTATUS status; @@ -141,14 +141,14 @@ BOOL torture_rpc_connect_srv(struct torture_context *torture) status = torture_rpc_binding(torture, &binding); if (!NT_STATUS_IS_OK(status)) { - return False; + return false; } return torture_rpc_connect(torture, level, NULL, binding->host); } -BOOL torture_rpc_connect_pdc(struct torture_context *torture) +bool torture_rpc_connect_pdc(struct torture_context *torture) { const enum libnet_RpcConnect_level level = LIBNET_RPC_CONNECT_PDC; NTSTATUS status; @@ -157,7 +157,7 @@ BOOL torture_rpc_connect_pdc(struct torture_context *torture) status = torture_rpc_binding(torture, &binding); if (!NT_STATUS_IS_OK(status)) { - return False; + return false; } /* we're accessing domain controller so the domain name should be @@ -168,7 +168,7 @@ BOOL torture_rpc_connect_pdc(struct torture_context *torture) } -BOOL torture_rpc_connect_dc(struct torture_context *torture) +bool torture_rpc_connect_dc(struct torture_context *torture) { const enum libnet_RpcConnect_level level = LIBNET_RPC_CONNECT_DC; NTSTATUS status; @@ -177,7 +177,7 @@ BOOL torture_rpc_connect_dc(struct torture_context *torture) status = torture_rpc_binding(torture, &binding); if (!NT_STATUS_IS_OK(status)) { - return False; + return false; } /* we're accessing domain controller so the domain name should be @@ -188,7 +188,7 @@ BOOL torture_rpc_connect_dc(struct torture_context *torture) } -BOOL torture_rpc_connect_dc_info(struct torture_context *torture) +bool torture_rpc_connect_dc_info(struct torture_context *torture) { const enum libnet_RpcConnect_level level = LIBNET_RPC_CONNECT_DC_INFO; NTSTATUS status; @@ -197,7 +197,7 @@ BOOL torture_rpc_connect_dc_info(struct torture_context *torture) status = torture_rpc_binding(torture, &binding); if (!NT_STATUS_IS_OK(status)) { - return False; + return false; } /* we're accessing domain controller so the domain name should be @@ -208,7 +208,7 @@ BOOL torture_rpc_connect_dc_info(struct torture_context *torture) } -BOOL torture_rpc_connect_binding(struct torture_context *torture) +bool torture_rpc_connect_binding(struct torture_context *torture) { const enum libnet_RpcConnect_level level = LIBNET_RPC_CONNECT_BINDING; NTSTATUS status; @@ -217,7 +217,7 @@ BOOL torture_rpc_connect_binding(struct torture_context *torture) status = torture_rpc_binding(torture, &binding); if (!NT_STATUS_IS_OK(status)) { - return False; + return false; } bindstr = dcerpc_binding_string(torture, binding); diff --git a/source4/torture/libnet/libnet_share.c b/source4/torture/libnet/libnet_share.c index b1657c0922c..d18e6ea9db9 100644 --- a/source4/torture/libnet/libnet_share.c +++ b/source4/torture/libnet/libnet_share.c @@ -113,13 +113,13 @@ static void test_displayshares(struct libnet_ListShares s) } -BOOL torture_listshares(struct torture_context *torture) +bool torture_listshares(struct torture_context *torture) { struct libnet_ListShares share; NTSTATUS status; uint32_t levels[] = { 0, 1, 2, 501, 502 }; int i; - BOOL ret = True; + bool ret = true; struct libnet_context* libnetctx; struct dcerpc_binding *bind; TALLOC_CTX *mem_ctx; @@ -127,14 +127,14 @@ BOOL torture_listshares(struct torture_context *torture) mem_ctx = talloc_init("test_listshares"); status = torture_rpc_binding(torture, &bind); if (!NT_STATUS_IS_OK(status)) { - ret = False; + ret = false; goto done; } libnetctx = libnet_context_init(NULL); if (!libnetctx) { printf("Couldn't allocate libnet context\n"); - ret = False; + ret = false; goto done; } @@ -151,7 +151,7 @@ BOOL torture_listshares(struct torture_context *torture) status = libnet_ListShares(libnetctx, mem_ctx, &share); if (!NT_STATUS_IS_OK(status)) { printf("libnet_ListShare level %u failed - %s\n", share.in.level, share.out.error_string); - ret = False; + ret = false; goto done; } @@ -165,7 +165,7 @@ done: } -static BOOL test_addshare(struct dcerpc_pipe *svc_pipe, TALLOC_CTX *mem_ctx, const char *host, +static bool test_addshare(struct dcerpc_pipe *svc_pipe, TALLOC_CTX *mem_ctx, const char *host, const char* share) { NTSTATUS status; @@ -187,11 +187,11 @@ static BOOL test_addshare(struct dcerpc_pipe *svc_pipe, TALLOC_CTX *mem_ctx, con status = dcerpc_srvsvc_NetShareAdd(svc_pipe, mem_ctx, &add); if (!NT_STATUS_IS_OK(status)) { printf("Failed to add a new share\n"); - return False; + return false; } printf("share added\n"); - return True; + return true; } @@ -202,7 +202,7 @@ bool torture_delshare(struct torture_context *torture) struct libnet_context* libnetctx; const char *host; NTSTATUS status; - BOOL ret = True; + bool ret = true; struct libnet_DelShare share; host = torture_setting_string(torture, "host", NULL); diff --git a/source4/torture/libnet/libnet_user.c b/source4/torture/libnet/libnet_user.c index 640816b891a..b3aadc776eb 100644 --- a/source4/torture/libnet/libnet_user.c +++ b/source4/torture/libnet/libnet_user.c @@ -30,7 +30,7 @@ #include "param/param.h" -static BOOL test_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *domain_handle, const char *username) { NTSTATUS status; @@ -52,7 +52,7 @@ static BOOL test_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_LookupNames(p, mem_ctx, &r1); if (!NT_STATUS_IS_OK(status)) { printf("LookupNames failed - %s\n", nt_errstr(status)); - return False; + return false; } rid = r1.out.rids.ids[0]; @@ -67,7 +67,7 @@ static BOOL test_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_OpenUser(p, mem_ctx, &r2); if (!NT_STATUS_IS_OK(status)) { printf("OpenUser failed - %s\n", nt_errstr(status)); - return False; + return false; } r3.in.user_handle = &user_handle; @@ -78,14 +78,14 @@ static BOOL test_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_DeleteUser(p, mem_ctx, &r3); if (!NT_STATUS_IS_OK(status)) { printf("DeleteUser failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } -static BOOL test_opendomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_opendomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String *domname) { NTSTATUS status; @@ -103,7 +103,7 @@ static BOOL test_opendomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_Connect(p, mem_ctx, &r1); if (!NT_STATUS_IS_OK(status)) { printf("Connect failed - %s\n", nt_errstr(status)); - return False; + return false; } r2.in.connect_handle = &h; @@ -114,7 +114,7 @@ static BOOL test_opendomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_LookupDomain(p, mem_ctx, &r2); if (!NT_STATUS_IS_OK(status)) { printf("LookupDomain failed - %s\n", nt_errstr(status)); - return False; + return false; } r3.in.connect_handle = &h; @@ -127,16 +127,16 @@ static BOOL test_opendomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_OpenDomain(p, mem_ctx, &r3); if (!NT_STATUS_IS_OK(status)) { printf("OpenDomain failed - %s\n", nt_errstr(status)); - return False; + return false; } else { *handle = domain_handle; } - return True; + return true; } -static BOOL test_samr_close(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_samr_close(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *domain_handle) { NTSTATUS status; @@ -148,14 +148,14 @@ static BOOL test_samr_close(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_Close(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("Close samr domain failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } -static BOOL test_lsa_close(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_lsa_close(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *domain_handle) { NTSTATUS status; @@ -167,14 +167,14 @@ static BOOL test_lsa_close(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_lsa_Close(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("Close lsa domain failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } -static BOOL test_createuser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_createuser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, const char* user) { NTSTATUS status; @@ -201,7 +201,7 @@ static BOOL test_createuser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) { printf("User (%s) already exists - attempting to delete and recreate account again\n", user); if (!test_cleanup(p, mem_ctx, handle, TEST_USERNAME)) { - return False; + return false; } printf("creating user account\n"); @@ -209,11 +209,11 @@ static BOOL test_createuser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_CreateUser(p, mem_ctx, &r1); if (!NT_STATUS_IS_OK(status)) { printf("CreateUser failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } - return False; + return false; } r2.in.handle = &user_handle; @@ -224,20 +224,20 @@ static BOOL test_createuser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_Close(p, mem_ctx, &r2); if (!NT_STATUS_IS_OK(status)) { printf("Close failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } -BOOL torture_createuser(struct torture_context *torture) +bool torture_createuser(struct torture_context *torture) { NTSTATUS status; TALLOC_CTX *mem_ctx; struct libnet_context *ctx; struct libnet_CreateUser req; - BOOL ret = True; + bool ret = true; mem_ctx = talloc_init("test_createuser"); @@ -251,19 +251,19 @@ BOOL torture_createuser(struct torture_context *torture) status = libnet_CreateUser(ctx, mem_ctx, &req); if (!NT_STATUS_IS_OK(status)) { printf("libnet_CreateUser call failed: %s\n", nt_errstr(status)); - ret = False; + ret = false; goto done; } if (!test_cleanup(ctx->samr.pipe, mem_ctx, &ctx->samr.handle, TEST_USERNAME)) { printf("cleanup failed\n"); - ret = False; + ret = false; goto done; } if (!test_samr_close(ctx->samr.pipe, mem_ctx, &ctx->samr.handle)) { printf("domain close failed\n"); - ret = False; + ret = false; } done: @@ -273,7 +273,7 @@ done: } -BOOL torture_deleteuser(struct torture_context *torture) +bool torture_deleteuser(struct torture_context *torture) { NTSTATUS status; struct dcerpc_pipe *p; @@ -283,7 +283,7 @@ BOOL torture_deleteuser(struct torture_context *torture) const char *name = TEST_USERNAME; struct libnet_context *ctx; struct libnet_DeleteUser req; - BOOL ret = True; + bool ret = true; prep_mem_ctx = talloc_init("prepare test_deleteuser"); @@ -297,18 +297,18 @@ BOOL torture_deleteuser(struct torture_context *torture) &p, &ndr_table_samr); if (!NT_STATUS_IS_OK(status)) { - ret = False; + ret = false; goto done; } domain_name.string = lp_workgroup(global_loadparm); if (!test_opendomain(p, prep_mem_ctx, &h, &domain_name)) { - ret = False; + ret = false; goto done; } if (!test_createuser(p, prep_mem_ctx, &h, name)) { - ret = False; + ret = false; goto done; } @@ -317,7 +317,7 @@ BOOL torture_deleteuser(struct torture_context *torture) status = libnet_DeleteUser(ctx, mem_ctx, &req); if (!NT_STATUS_IS_OK(status)) { printf("libnet_DeleteUser call failed: %s\n", nt_errstr(status)); - ret = False; + ret = false; } talloc_free(mem_ctx); @@ -439,26 +439,26 @@ static void set_test_changes(TALLOC_CTX *mem_ctx, struct libnet_ModifyUser *r, #define TEST_STR_FLD(fld) \ if (!strequal(req.in.fld, user_req.out.fld)) { \ printf("failed to change '%s'\n", #fld); \ - ret = False; \ + ret = false; \ goto cleanup; \ } #define TEST_TIME_FLD(fld) \ if (timeval_compare(req.in.fld, user_req.out.fld)) { \ printf("failed to change '%s'\n", #fld); \ - ret = False; \ + ret = false; \ goto cleanup; \ } #define TEST_NUM_FLD(fld) \ if (req.in.fld != user_req.out.fld) { \ printf("failed to change '%s'\n", #fld); \ - ret = False; \ + ret = false; \ goto cleanup; \ } -BOOL torture_modifyuser(struct torture_context *torture) +bool torture_modifyuser(struct torture_context *torture) { NTSTATUS status; struct dcerpc_binding *bind; @@ -471,7 +471,7 @@ BOOL torture_modifyuser(struct torture_context *torture) struct libnet_ModifyUser req; struct libnet_UserInfo user_req; int fld; - BOOL ret = True; + bool ret = true; prep_mem_ctx = talloc_init("prepare test_deleteuser"); @@ -482,7 +482,7 @@ BOOL torture_modifyuser(struct torture_context *torture) &p, &ndr_table_samr); if (!NT_STATUS_IS_OK(status)) { - ret = False; + ret = false; goto done; } @@ -490,12 +490,12 @@ BOOL torture_modifyuser(struct torture_context *torture) domain_name.string = lp_workgroup(global_loadparm); if (!test_opendomain(p, prep_mem_ctx, &h, &domain_name)) { - ret = False; + ret = false; goto done; } if (!test_createuser(p, prep_mem_ctx, &h, name)) { - ret = False; + ret = false; goto done; } @@ -503,7 +503,7 @@ BOOL torture_modifyuser(struct torture_context *torture) status = torture_rpc_binding(mem_ctx, &bind); if (!NT_STATUS_IS_OK(status)) { - ret = False; + ret = false; goto done; } @@ -519,7 +519,7 @@ BOOL torture_modifyuser(struct torture_context *torture) status = libnet_ModifyUser(ctx, mem_ctx, &req); if (!NT_STATUS_IS_OK(status)) { printf("libnet_ModifyUser call failed: %s\n", nt_errstr(status)); - ret = False; + ret = false; continue; } @@ -530,7 +530,7 @@ BOOL torture_modifyuser(struct torture_context *torture) status = libnet_UserInfo(ctx, mem_ctx, &user_req); if (!NT_STATUS_IS_OK(status)) { printf("libnet_UserInfo call failed: %s\n", nt_errstr(status)); - ret = False; + ret = false; continue; } @@ -571,7 +571,7 @@ BOOL torture_modifyuser(struct torture_context *torture) if (!NT_STATUS_IS_OK(status)) { printf("libnet_ModifyUser call failed: %s\n", nt_errstr(status)); talloc_free(mem_ctx); - ret = False; + ret = false; goto done; } @@ -582,13 +582,13 @@ BOOL torture_modifyuser(struct torture_context *torture) cleanup: if (!test_cleanup(ctx->samr.pipe, mem_ctx, &ctx->samr.handle, name)) { printf("cleanup failed\n"); - ret = False; + ret = false; goto done; } if (!test_samr_close(ctx->samr.pipe, mem_ctx, &ctx->samr.handle)) { printf("domain close failed\n"); - ret = False; + ret = false; } talloc_free(mem_ctx); @@ -600,10 +600,10 @@ done: } -BOOL torture_userinfo_api(struct torture_context *torture) +bool torture_userinfo_api(struct torture_context *torture) { const char *name = TEST_USERNAME; - BOOL ret = True; + bool ret = true; NTSTATUS status; TALLOC_CTX *mem_ctx = NULL, *prep_mem_ctx; struct libnet_context *ctx; @@ -621,17 +621,17 @@ BOOL torture_userinfo_api(struct torture_context *torture) &p, &ndr_table_samr); if (!NT_STATUS_IS_OK(status)) { - return False; + return false; } domain_name.string = lp_workgroup(global_loadparm); if (!test_opendomain(p, prep_mem_ctx, &h, &domain_name)) { - ret = False; + ret = false; goto done; } if (!test_createuser(p, prep_mem_ctx, &h, name)) { - ret = False; + ret = false; goto done; } @@ -645,20 +645,20 @@ BOOL torture_userinfo_api(struct torture_context *torture) status = libnet_UserInfo(ctx, mem_ctx, &req); if (!NT_STATUS_IS_OK(status)) { printf("libnet_UserInfo call failed: %s\n", nt_errstr(status)); - ret = False; + ret = false; talloc_free(mem_ctx); goto done; } if (!test_cleanup(ctx->samr.pipe, mem_ctx, &ctx->samr.handle, TEST_USERNAME)) { printf("cleanup failed\n"); - ret = False; + ret = false; goto done; } if (!test_samr_close(ctx->samr.pipe, mem_ctx, &ctx->samr.handle)) { printf("domain close failed\n"); - ret = False; + ret = false; } talloc_free(ctx); @@ -669,9 +669,9 @@ done: } -BOOL torture_userlist(struct torture_context *torture) +bool torture_userlist(struct torture_context *torture) { - BOOL ret = True; + bool ret = true; NTSTATUS status; TALLOC_CTX *mem_ctx = NULL; struct libnet_context *ctx; @@ -707,19 +707,19 @@ BOOL torture_userlist(struct torture_context *torture) if (!(NT_STATUS_IS_OK(status) || NT_STATUS_EQUAL(status, NT_STATUS_NO_MORE_ENTRIES))) { printf("libnet_UserList call failed: %s\n", nt_errstr(status)); - ret = False; + ret = false; goto done; } if (!test_samr_close(ctx->samr.pipe, mem_ctx, &ctx->samr.handle)) { printf("samr domain close failed\n"); - ret = False; + ret = false; goto done; } if (!test_lsa_close(ctx->lsa.pipe, mem_ctx, &ctx->lsa.handle)) { printf("lsa domain close failed\n"); - ret = False; + ret = false; } talloc_free(ctx); diff --git a/source4/torture/libnet/userinfo.c b/source4/torture/libnet/userinfo.c index 731731865b0..46a9a6a0155 100644 --- a/source4/torture/libnet/userinfo.c +++ b/source4/torture/libnet/userinfo.c @@ -29,8 +29,7 @@ #define TEST_USERNAME "libnetuserinfotest" - -static BOOL test_userinfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_userinfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *domain_handle, struct dom_sid2 *domain_sid, const char* user_name, uint32_t *rid) @@ -50,7 +49,7 @@ static BOOL test_userinfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = libnet_rpc_userinfo(p, mem_ctx, &user); if (!NT_STATUS_IS_OK(status)) { printf("Failed to call sync libnet_rpc_userinfo - %s\n", nt_errstr(status)); - return False; + return false; } ZERO_STRUCT(user); @@ -64,14 +63,14 @@ static BOOL test_userinfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = libnet_rpc_userinfo(p, mem_ctx, &user); if (!NT_STATUS_IS_OK(status)) { printf("Failed to call sync libnet_rpc_userinfo - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } -static BOOL test_userinfo_async(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_userinfo_async(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *domain_handle, struct dom_sid2 *domain_sid, const char* user_name, uint32_t *rid) @@ -93,13 +92,13 @@ static BOOL test_userinfo_async(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, c = libnet_rpc_userinfo_send(p, &user, msg_handler); if (!c) { printf("Failed to call sync libnet_rpc_userinfo_send\n"); - return False; + return false; } status = libnet_rpc_userinfo_recv(c, mem_ctx, &user); if (!NT_STATUS_IS_OK(status)) { printf("Calling async libnet_rpc_userinfo failed - %s\n", nt_errstr(status)); - return False; + return false; } ZERO_STRUCT(user); @@ -114,16 +113,16 @@ static BOOL test_userinfo_async(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, c = libnet_rpc_userinfo_send(p, &user, msg_handler); if (!c) { printf("Failed to call sync libnet_rpc_userinfo_send\n"); - return False; + return false; } status = libnet_rpc_userinfo_recv(c, mem_ctx, &user); if (!NT_STATUS_IS_OK(status)) { printf("Calling async libnet_rpc_userinfo failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } @@ -132,7 +131,7 @@ bool torture_userinfo(struct torture_context *torture) NTSTATUS status; struct dcerpc_pipe *p; TALLOC_CTX *mem_ctx; - BOOL ret = True; + bool ret = true; struct policy_handle h; struct lsa_String name; struct dom_sid2 sid; @@ -145,7 +144,7 @@ bool torture_userinfo(struct torture_context *torture) &ndr_table_samr); if (!NT_STATUS_IS_OK(status)) { - return False; + return false; } name.string = lp_workgroup(global_loadparm); @@ -154,22 +153,22 @@ bool torture_userinfo(struct torture_context *torture) * Testing synchronous version */ if (!test_opendomain(p, mem_ctx, &h, &name, &sid)) { - ret = False; + ret = false; goto done; } if (!test_user_create(p, mem_ctx, &h, TEST_USERNAME, &rid)) { - ret = False; + ret = false; goto done; } if (!test_userinfo(p, mem_ctx, &h, &sid, TEST_USERNAME, &rid)) { - ret = False; + ret = false; goto done; } if (!test_user_cleanup(p, mem_ctx, &h, TEST_USERNAME)) { - ret = False; + ret = false; goto done; } @@ -177,22 +176,22 @@ bool torture_userinfo(struct torture_context *torture) * Testing asynchronous version and monitor messages */ if (!test_opendomain(p, mem_ctx, &h, &name, &sid)) { - ret = False; + ret = false; goto done; } if (!test_user_create(p, mem_ctx, &h, TEST_USERNAME, &rid)) { - ret = False; + ret = false; goto done; } if (!test_userinfo_async(p, mem_ctx, &h, &sid, TEST_USERNAME, &rid)) { - ret = False; + ret = false; goto done; } if (!test_user_cleanup(p, mem_ctx, &h, TEST_USERNAME)) { - ret = False; + ret = false; goto done; } diff --git a/source4/torture/libnet/userman.c b/source4/torture/libnet/userman.c index ff2f2d52654..e834938bc57 100644 --- a/source4/torture/libnet/userman.c +++ b/source4/torture/libnet/userman.c @@ -24,15 +24,16 @@ #include "libnet/libnet.h" #include "librpc/gen_ndr/ndr_samr_c.h" #include "param/param.h" + #include "torture/libnet/utils.h" -static BOOL test_useradd(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_useradd(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *domain_handle, const char *name) { NTSTATUS status; - BOOL ret = True; + bool ret = true; struct libnet_rpc_useradd user; user.in.domain_handle = *domain_handle; @@ -43,14 +44,14 @@ static BOOL test_useradd(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = libnet_rpc_useradd(p, mem_ctx, &user); if (!NT_STATUS_IS_OK(status)) { printf("Failed to call libnet_rpc_useradd - %s\n", nt_errstr(status)); - return False; + return false; } return ret; } -static BOOL test_useradd_async(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_useradd_async(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, const char* username) { NTSTATUS status; @@ -65,21 +66,20 @@ static BOOL test_useradd_async(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, c = libnet_rpc_useradd_send(p, &user, msg_handler); if (!c) { printf("Failed to call async libnet_rpc_useradd\n"); - return False; + return false; } status = libnet_rpc_useradd_recv(c, mem_ctx, &user); if (!NT_STATUS_IS_OK(status)) { printf("Calling async libnet_rpc_useradd failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } - -static BOOL test_usermod(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_usermod(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, int num_changes, struct libnet_rpc_usermod *mod, char **username) { @@ -206,14 +206,14 @@ static BOOL test_usermod(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = libnet_rpc_usermod(p, mem_ctx, mod); if (!NT_STATUS_IS_OK(status)) { printf("Failed to call sync libnet_rpc_usermod - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } -static BOOL test_userdel(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_userdel(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, const char *username) { NTSTATUS status; @@ -225,10 +225,10 @@ static BOOL test_userdel(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = libnet_rpc_userdel(p, mem_ctx, &user); if (!NT_STATUS_IS_OK(status)) { printf("Failed to call sync libnet_rpc_userdel - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } @@ -238,7 +238,7 @@ static BOOL test_userdel(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("'%s' field does not match\n", #fld); \ printf("received: '%s'\n", i->fld.string); \ printf("expected: '%s'\n", mod->in.change.fld); \ - return False; \ + return false; \ } @@ -252,7 +252,7 @@ static BOOL test_userdel(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("expected: '%s (+%ld us)'\n", \ timestring(mem_ctx, mod->in.change.fld->tv_sec), \ mod->in.change.fld->tv_usec); \ - return False; \ + return false; \ } \ } @@ -262,11 +262,11 @@ static BOOL test_userdel(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("'%s' field does not match\n", #fld); \ printf("received: '%04x'\n", i->fld); \ printf("expected: '%04x'\n", mod->in.change.fld); \ - return False; \ + return false; \ } -static BOOL test_compare(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_compare(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct libnet_rpc_usermod *mod, const char *username) { @@ -284,7 +284,7 @@ static BOOL test_compare(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = libnet_rpc_userinfo(p, mem_ctx, &info); if (!NT_STATUS_IS_OK(status)) { printf("Failed to call sync libnet_rpc_userinfo - %s\n", nt_errstr(status)); - return False; + return false; } i = &info.out.info.info21; @@ -300,11 +300,11 @@ static BOOL test_compare(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, CMP_TIME_FLD(acct_expiry, USERMOD_FIELD_ACCT_EXPIRY); CMP_NUM_FLD(acct_flags, USERMOD_FIELD_ACCT_FLAGS) - return True; + return true; } -BOOL torture_useradd(struct torture_context *torture) +bool torture_useradd(struct torture_context *torture) { NTSTATUS status; struct dcerpc_pipe *p; @@ -313,7 +313,7 @@ BOOL torture_useradd(struct torture_context *torture) struct dom_sid2 sid; const char *name = TEST_USERNAME; TALLOC_CTX *mem_ctx; - BOOL ret = True; + bool ret = true; mem_ctx = talloc_init("test_useradd"); @@ -322,37 +322,37 @@ BOOL torture_useradd(struct torture_context *torture) &ndr_table_samr); if (!NT_STATUS_IS_OK(status)) { - return False; + return false; } domain_name.string = lp_workgroup(global_loadparm); if (!test_opendomain(p, mem_ctx, &h, &domain_name, &sid)) { - ret = False; + ret = false; goto done; } if (!test_useradd(p, mem_ctx, &h, name)) { - ret = False; + ret = false; goto done; } if (!test_user_cleanup(p, mem_ctx, &h, name)) { - ret = False; + ret = false; goto done; } if (!test_opendomain(p, mem_ctx, &h, &domain_name, &sid)) { - ret = False; + ret = false; goto done; } if (!test_useradd_async(p, mem_ctx, &h, name)) { - ret = False; + ret = false; goto done; } if (!test_user_cleanup(p, mem_ctx, &h, name)) { - ret = False; + ret = false; goto done; } @@ -372,7 +372,7 @@ bool torture_userdel(struct torture_context *torture) uint32_t rid; const char *name = TEST_USERNAME; TALLOC_CTX *mem_ctx; - BOOL ret = True; + bool ret = true; mem_ctx = talloc_init("test_userdel"); @@ -381,22 +381,22 @@ bool torture_userdel(struct torture_context *torture) &ndr_table_samr); if (!NT_STATUS_IS_OK(status)) { - return False; + return false; } domain_name.string = lp_workgroup(global_loadparm); if (!test_opendomain(p, mem_ctx, &h, &domain_name, &sid)) { - ret = False; + ret = false; goto done; } if (!test_user_create(p, mem_ctx, &h, name, &rid)) { - ret = False; + ret = false; goto done; } if (!test_userdel(p, mem_ctx, &h, name)) { - ret = False; + ret = false; goto done; } @@ -406,7 +406,7 @@ done: } -BOOL torture_usermod(struct torture_context *torture) +bool torture_usermod(struct torture_context *torture) { NTSTATUS status; struct dcerpc_pipe *p; @@ -417,7 +417,7 @@ BOOL torture_usermod(struct torture_context *torture) int i; char *name; TALLOC_CTX *mem_ctx; - BOOL ret = True; + bool ret = true; mem_ctx = talloc_init("test_userdel"); @@ -426,7 +426,7 @@ BOOL torture_usermod(struct torture_context *torture) &ndr_table_samr); if (!NT_STATUS_IS_OK(status)) { - ret = False; + ret = false; goto done; } @@ -434,12 +434,12 @@ BOOL torture_usermod(struct torture_context *torture) name = talloc_strdup(mem_ctx, TEST_USERNAME); if (!test_opendomain(p, mem_ctx, &h, &domain_name, &sid)) { - ret = False; + ret = false; goto done; } if (!test_user_create(p, mem_ctx, &h, name, &rid)) { - ret = False; + ret = false; goto done; } @@ -447,19 +447,19 @@ BOOL torture_usermod(struct torture_context *torture) struct libnet_rpc_usermod m; if (!test_usermod(p, mem_ctx, &h, i, &m, &name)) { - ret = False; + ret = false; goto cleanup; } if (!test_compare(p, mem_ctx, &h, &m, name)) { - ret = False; + ret = false; goto cleanup; } } cleanup: if (!test_user_cleanup(p, mem_ctx, &h, name)) { - ret = False; + ret = false; goto done; } diff --git a/source4/torture/libnet/utils.c b/source4/torture/libnet/utils.c index dd84b45a930..47bb9315c73 100644 --- a/source4/torture/libnet/utils.c +++ b/source4/torture/libnet/utils.c @@ -29,7 +29,7 @@ #include "param/param.h" -BOOL test_opendomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +bool test_opendomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String *domname, struct dom_sid2 *sid) { @@ -48,7 +48,7 @@ BOOL test_opendomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_Connect(p, mem_ctx, &r1); if (!NT_STATUS_IS_OK(status)) { printf("Connect failed - %s\n", nt_errstr(status)); - return False; + return false; } r2.in.connect_handle = &h; @@ -59,7 +59,7 @@ BOOL test_opendomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_LookupDomain(p, mem_ctx, &r2); if (!NT_STATUS_IS_OK(status)) { printf("LookupDomain failed - %s\n", nt_errstr(status)); - return False; + return false; } r3.in.connect_handle = &h; @@ -72,17 +72,17 @@ BOOL test_opendomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_OpenDomain(p, mem_ctx, &r3); if (!NT_STATUS_IS_OK(status)) { printf("OpenDomain failed - %s\n", nt_errstr(status)); - return False; + return false; } else { *handle = domain_handle; } *sid = *r2.out.sid; - return True; + return true; } -BOOL test_user_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +bool test_user_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *domain_handle, const char *name) { @@ -105,7 +105,7 @@ BOOL test_user_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_LookupNames(p, mem_ctx, &r1); if (!NT_STATUS_IS_OK(status)) { printf("LookupNames failed - %s\n", nt_errstr(status)); - return False; + return false; } rid = r1.out.rids.ids[0]; @@ -120,7 +120,7 @@ BOOL test_user_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_OpenUser(p, mem_ctx, &r2); if (!NT_STATUS_IS_OK(status)) { printf("OpenUser failed - %s\n", nt_errstr(status)); - return False; + return false; } r3.in.user_handle = &user_handle; @@ -131,14 +131,14 @@ BOOL test_user_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_DeleteUser(p, mem_ctx, &r3); if (!NT_STATUS_IS_OK(status)) { printf("DeleteUser failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } -BOOL test_user_create(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +bool test_user_create(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, const char *name, uint32_t *rid) { @@ -164,7 +164,7 @@ BOOL test_user_create(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) { printf("User (%s) already exists - attempting to delete and recreate account again\n", name); if (!test_user_cleanup(p, mem_ctx, handle, name)) { - return False; + return false; } printf("creating user account\n"); @@ -172,18 +172,18 @@ BOOL test_user_create(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_CreateUser(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("CreateUser failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } - return False; + return false; } - return True; + return true; } -BOOL test_group_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +bool test_group_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *domain_handle, const char *name) { @@ -206,7 +206,7 @@ BOOL test_group_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_LookupNames(p, mem_ctx, &r1); if (!NT_STATUS_IS_OK(status)) { printf("LookupNames failed - %s\n", nt_errstr(status)); - return False; + return false; } rid = r1.out.rids.ids[0]; @@ -221,7 +221,7 @@ BOOL test_group_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_OpenGroup(p, mem_ctx, &r2); if (!NT_STATUS_IS_OK(status)) { printf("OpenGroup failed - %s\n", nt_errstr(status)); - return False; + return false; } r3.in.group_handle = &group_handle; @@ -232,14 +232,14 @@ BOOL test_group_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_DeleteDomainGroup(p, mem_ctx, &r3); if (!NT_STATUS_IS_OK(status)) { printf("DeleteGroup failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } -BOOL test_group_create(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +bool test_group_create(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, const char *name, uint32_t *rid) { @@ -265,7 +265,7 @@ BOOL test_group_create(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) { printf("Group (%s) already exists - attempting to delete and recreate account again\n", name); if (!test_group_cleanup(p, mem_ctx, handle, name)) { - return False; + return false; } printf("creating group account\n"); @@ -273,14 +273,14 @@ BOOL test_group_create(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_CreateDomainGroup(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("CreateGroup failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } - return False; + return false; } - return True; + return true; } diff --git a/source4/torture/libnet/utils.h b/source4/torture/libnet/utils.h index 3111c38f1e8..ff94ec49e95 100644 --- a/source4/torture/libnet/utils.h +++ b/source4/torture/libnet/utils.h @@ -19,23 +19,23 @@ */ -BOOL test_opendomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +bool test_opendomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String *domname, struct dom_sid2 *sid); -BOOL test_user_create(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +bool test_user_create(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, const char *name, uint32_t *rid); -BOOL test_user_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +bool test_user_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *domain_handle, const char *name); -BOOL test_group_create(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +bool test_group_create(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, const char *name, uint32_t *rid); -BOOL test_group_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +bool test_group_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *domain_handle, const char *name); diff --git a/source4/torture/local/dbspeed.c b/source4/torture/local/dbspeed.c index b6c1a43d483..34458123650 100644 --- a/source4/torture/local/dbspeed.c +++ b/source4/torture/local/dbspeed.c @@ -50,7 +50,7 @@ static bool tdb_add_record(struct tdb_wrap *tdbw, const char *fmt1, /* test tdb speed */ -static BOOL test_tdb_speed(struct torture_context *torture, const void *_data) +static bool test_tdb_speed(struct torture_context *torture, const void *_data) { struct timeval tv; struct tdb_wrap *tdbw; @@ -120,32 +120,32 @@ static BOOL test_tdb_speed(struct torture_context *torture, const void *_data) unlink("test.tdb"); talloc_free(tmp_ctx); - return True; + return true; failed: unlink("test.tdb"); talloc_free(tmp_ctx); - return False; + return false; } -static BOOL ldb_add_record(struct ldb_context *ldb, unsigned rid) +static bool ldb_add_record(struct ldb_context *ldb, unsigned rid) { struct ldb_message *msg; int ret; msg = ldb_msg_new(ldb); if (msg == NULL) { - return False; + return false; } msg->dn = ldb_dn_new_fmt(msg, ldb, "SID=S-1-5-21-53173311-3623041448-2049097239-%u", rid); if (msg->dn == NULL) { - return False; + return false; } if (ldb_msg_add_fmt(msg, "UID", "%u", rid) != 0) { - return False; + return false; } ret = ldb_add(ldb, msg); @@ -159,7 +159,7 @@ static BOOL ldb_add_record(struct ldb_context *ldb, unsigned rid) /* test ldb speed */ -static BOOL test_ldb_speed(struct torture_context *torture, const void *_data) +static bool test_ldb_speed(struct torture_context *torture, const void *_data) { struct timeval tv; struct ldb_context *ldb; @@ -241,12 +241,12 @@ static BOOL test_ldb_speed(struct torture_context *torture, const void *_data) unlink("./test.ldb"); talloc_free(tmp_ctx); - return True; + return true; failed: unlink("./test.ldb"); talloc_free(tmp_ctx); - return False; + return false; } struct torture_suite *torture_local_dbspeed(TALLOC_CTX *mem_ctx) diff --git a/source4/torture/local/iconv.c b/source4/torture/local/iconv.c index e9d270b3a8e..259769d60f2 100644 --- a/source4/torture/local/iconv.c +++ b/source4/torture/local/iconv.c @@ -340,7 +340,7 @@ static bool test_first_1m(struct torture_context *tctx) } if (codepoint % 1000 == 0) { - if (torture_setting_bool(tctx, "progress", True)) { + if (torture_setting_bool(tctx, "progress", true)) { torture_comment(tctx, "codepoint=%u \r", codepoint); fflush(stdout); } diff --git a/source4/torture/local/irpc.c b/source4/torture/local/irpc.c index 70f9ac1e5f2..aae6b4882ee 100644 --- a/source4/torture/local/irpc.c +++ b/source4/torture/local/irpc.c @@ -29,7 +29,7 @@ const uint32_t MSG_ID1 = 1, MSG_ID2 = 2; -static BOOL test_debug; +static bool test_debug; struct irpc_test_data { @@ -72,7 +72,7 @@ static void deferred_echodata(struct event_context *ev, struct timed_event *te, */ static NTSTATUS irpc_EchoData(struct irpc_message *irpc, struct echo_EchoData *r) { - irpc->defer_reply = True; + irpc->defer_reply = true; event_add_timed(irpc->ev, irpc, timeval_zero(), deferred_echodata, irpc); return NT_STATUS_OK; } @@ -92,10 +92,10 @@ static bool test_addone(struct torture_context *test, const void *_data, /* make the call */ r.in.in_data = value; - test_debug = True; + test_debug = true; status = IRPC_CALL(data->msg_ctx1, cluster_id(MSG_ID2), rpcecho, ECHO_ADDONE, &r, test); - test_debug = False; + test_debug = false; torture_assert_ntstatus_ok(test, status, "AddOne failed"); /* check the answer */ @@ -209,7 +209,7 @@ static bool test_speed(struct torture_context *tctx, } -static BOOL irpc_setup(struct torture_context *tctx, void **_data) +static bool irpc_setup(struct torture_context *tctx, void **_data) { struct irpc_test_data *data; @@ -237,7 +237,7 @@ static BOOL irpc_setup(struct torture_context *tctx, void **_data) IRPC_REGISTER(data->msg_ctx1, rpcecho, ECHO_ECHODATA, irpc_EchoData, NULL); IRPC_REGISTER(data->msg_ctx2, rpcecho, ECHO_ECHODATA, irpc_EchoData, NULL); - return True; + return true; } struct torture_suite *torture_local_irpc(TALLOC_CTX *mem_ctx) diff --git a/source4/torture/local/share.c b/source4/torture/local/share.c index a4250bccf9f..de93e3c591a 100644 --- a/source4/torture/local/share.c +++ b/source4/torture/local/share.c @@ -175,17 +175,17 @@ static void tcase_add_share_tests(struct torture_tcase *tcase) torture_tcase_add_test(tcase, "share_double_create", test_double_create, NULL); } -static BOOL setup_ldb(struct torture_context *tctx, void **data) +static bool setup_ldb(struct torture_context *tctx, void **data) { return NT_STATUS_IS_OK(share_get_context_by_name(tctx, "ldb", (struct share_context **)data)); } -static BOOL setup_classic(struct torture_context *tctx, void **data) +static bool setup_classic(struct torture_context *tctx, void **data) { return NT_STATUS_IS_OK(share_get_context_by_name(tctx, "classic", (struct share_context **)data)); } -static BOOL teardown(struct torture_context *tctx, void *data) +static bool teardown(struct torture_context *tctx, void *data) { talloc_free(data); return true; diff --git a/source4/torture/locktest.c b/source4/torture/locktest.c index 562defe09e3..24b96069610 100644 --- a/source4/torture/locktest.c +++ b/source4/torture/locktest.c @@ -28,15 +28,15 @@ #include "dynconfig.h" static int numops = 1000; -static BOOL showall; -static BOOL analyze; -static BOOL hide_unlock_fails; -static BOOL use_oplocks; +static bool showall; +static bool analyze; +static bool hide_unlock_fails; +static bool use_oplocks; static uint_t lock_range = 100; static uint_t lock_base = 0; static uint_t min_length = 0; -static BOOL exact_error_codes; -static BOOL zero_zero; +static bool exact_error_codes; +static bool zero_zero; #define FILENAME "\\locktest.dat" @@ -203,7 +203,7 @@ static bool test_one(struct smbcli_state *cli[NSERVERS][NCONNECTIONS], uint64_t len = rec->len; enum brl_type op = rec->lock_type; int server; - BOOL ret[NSERVERS]; + bool ret[NSERVERS]; NTSTATUS status[NSERVERS]; switch (rec->lock_op) { @@ -253,7 +253,7 @@ static bool test_one(struct smbcli_state *cli[NSERVERS][NCONNECTIONS], op==READ_LOCK?"READ_LOCK":"WRITE_LOCK", nt_errstr(status[0]), nt_errstr(status[1])); } - if (!NT_STATUS_EQUAL(status[0],status[1])) return False; + if (!NT_STATUS_EQUAL(status[0],status[1])) return false; break; case OP_UNLOCK: @@ -295,7 +295,7 @@ static bool test_one(struct smbcli_state *cli[NSERVERS][NCONNECTIONS], nt_errstr(status[0]), nt_errstr(status[1])); } if (!hide_unlock_fails && !NT_STATUS_EQUAL(status[0],status[1])) - return False; + return false; break; case OP_REOPEN: @@ -310,7 +310,7 @@ static bool test_one(struct smbcli_state *cli[NSERVERS][NCONNECTIONS], DENY_NONE); if (fnum[server][conn][f] == -1) { printf("failed to reopen on share%d\n", server); - return False; + return false; } } if (showall) { @@ -320,7 +320,7 @@ static bool test_one(struct smbcli_state *cli[NSERVERS][NCONNECTIONS], break; } - return True; + return true; } static void close_files(struct smbcli_state *cli[NSERVERS][NCONNECTIONS], @@ -427,7 +427,7 @@ static void test_locks(char *share[NSERVERS]) } else { recorded[n].lock_op = OP_REOPEN; } - recorded[n].needed = True; + recorded[n].needed = true; if (!zero_zero && recorded[n].start==0 && recorded[n].len==0) { recorded[n].len = 1; } @@ -456,7 +456,7 @@ static void test_locks(char *share[NSERVERS]) int m, j; printf("excluding %d-%d\n", i, i+skip-1); for (j=i;jname); pstrcpy(last_hit.short_name, f->short_name); - f_info_hit = True; + f_info_hit = true; } static void get_real_name(struct smbcli_state *cli, @@ -126,7 +126,7 @@ static void get_real_name(struct smbcli_state *cli, mask = "\\masktest\\*"; } - f_info_hit = False; + f_info_hit = false; smbcli_list_new(cli->tree, mask, FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_DIRECTORY, @@ -350,7 +350,7 @@ static void usage(void) showall = 1; break; case 'o': - old_list = True; + old_list = true; break; default: printf("Unknown option %c (%d)\n", (char)opt, opt); diff --git a/source4/torture/nbench/nbench.c b/source4/torture/nbench/nbench.c index d01c5a7ecdf..ddedd102f9f 100644 --- a/source4/torture/nbench/nbench.c +++ b/source4/torture/nbench/nbench.c @@ -56,14 +56,14 @@ static void do_reconnect(struct smbcli_state **cli, int client) } /* run a test that simulates an approximate netbench client load */ -static BOOL run_netbench(struct torture_context *tctx, struct smbcli_state *cli, int client) +static bool run_netbench(struct torture_context *tctx, struct smbcli_state *cli, int client) { int torture_nprocs = torture_setting_int(tctx, "nprocs", 4); int i; pstring line; char *cname; FILE *f; - BOOL correct = True; + bool correct = true; double target_rate = torture_setting_double(tctx, "targetrate", 0); int n; @@ -85,7 +85,7 @@ static BOOL run_netbench(struct torture_context *tctx, struct smbcli_state *cli, if (!f) { perror(loadfile); - return False; + return false; } again: @@ -212,7 +212,7 @@ done: smbcli_deltree(cli->tree, "\\clients"); } if (!torture_close_connection(cli)) { - correct = False; + correct = false; } return correct; @@ -220,14 +220,14 @@ done: /* run a test that simulates an approximate netbench client load */ -BOOL torture_nbench(struct torture_context *torture) +bool torture_nbench(struct torture_context *torture) { - BOOL correct = True; + bool correct = true; int torture_nprocs = torture_setting_int(torture, "nprocs", 4); struct smbcli_state *cli; const char *p; - read_only = torture_setting_bool(torture, "readonly", False); + read_only = torture_setting_bool(torture, "readonly", false); nb_max_retries = torture_setting_int(torture, "nretries", 1); @@ -245,11 +245,11 @@ BOOL torture_nbench(struct torture_context *torture) if (torture_nprocs > 1) { if (!torture_open_connection(&cli, 0)) { - return False; + return false; } if (!read_only && !torture_setup_dir(cli, "\\clients")) { - return False; + return false; } } diff --git a/source4/torture/nbench/nbio.c b/source4/torture/nbench/nbio.c index e35b9d14ab8..5de903ff789 100644 --- a/source4/torture/nbench/nbio.c +++ b/source4/torture/nbench/nbio.c @@ -36,7 +36,7 @@ extern int nbench_line_count; static int nbio_id = -1; static int nprocs; -static BOOL bypass_io; +static bool bypass_io; static struct timeval tv_start, tv_end; static int warmup, timelimit; static int in_cleanup; @@ -117,13 +117,13 @@ static bool nb_reestablish_locks(struct ftable *f) if (!nb_do_lockx(true, f->handle, linfo->offset, linfo->size, NT_STATUS_OK)) { printf("nb_reestablish_locks: failed to get lock for file %s at %lu\n", f->cp.fname, (unsigned long) linfo->offset); - return False; + return false; } linfo = linfo->next; } - return True; + return true; } static bool nb_reopen_all_files(void) @@ -140,21 +140,21 @@ static bool nb_reopen_all_files(void) f->cp.create_disposition, f->cp.handle, NT_STATUS_OK, - True)) + true)) { printf("-- nb_reopen_all_files: failed to open file %s\n", f->cp.fname); - return False; + return false; } if (!nb_reestablish_locks(f)) { printf("--nb_reopen_all_files: failed to reestablish locks\n"); - return False; + return false; } f = f->next; } - return True; + return true; } bool nb_reconnect(struct smbcli_state **cli, int client) @@ -168,17 +168,17 @@ bool nb_reconnect(struct smbcli_state **cli, int client) if (!torture_open_connection(cli, client)) { printf("nb_reconnect: failed to connect\n"); *cli = NULL; - return False; + return false; } nb_setup(*cli, client); if (!nb_reopen_all_files()) { printf("nb_reconnect: failed to reopen files in client %d\n", client); - return False; + return false; } - return True; + return true; } void nbio_target_rate(double rate) @@ -242,7 +242,7 @@ double nbio_latency(void) return max_latency; } -BOOL nb_tick(void) +bool nb_tick(void) { return children[nbio_id].done; } @@ -383,7 +383,7 @@ static struct smbcli_state *c; /* a handler function for oplock break requests */ -static BOOL oplock_handler(struct smbcli_transport *transport, uint16_t tid, +static bool oplock_handler(struct smbcli_transport *transport, uint16_t tid, uint16_t fnum, uint8_t level, void *private) { struct smbcli_tree *tree = (struct smbcli_tree *)private; @@ -412,7 +412,7 @@ static bool check_status(const char *op, NTSTATUS status, NTSTATUS ret) NT_STATUS_EQUAL(ret, NT_STATUS_CONNECTION_RESET)) && !NT_STATUS_EQUAL (status, ret)) { - return False; + return false; } if (!NT_STATUS_IS_OK(status) && NT_STATUS_IS_OK(ret)) { @@ -432,7 +432,7 @@ static bool check_status(const char *op, NTSTATUS status, NTSTATUS ret) nbench_line_count, nt_errstr(ret), nt_errstr(status)); } - return True; + return true; } @@ -453,7 +453,7 @@ bool nb_unlink(const char *fname, int attr, NTSTATUS status, bool retry) if (!retry) return check_status("Unlink", status, ret); - return True; + return true; } static bool nb_do_createx(struct ftable *f, @@ -515,10 +515,10 @@ static bool nb_do_createx(struct ftable *f, talloc_free(mem_ctx); if (!check_status("NTCreateX", status, ret)) - return False; + return false; if (!NT_STATUS_IS_OK(ret)) - return True; + return true; if (f == NULL) { f = talloc (NULL, struct ftable); @@ -530,14 +530,14 @@ static bool nb_do_createx(struct ftable *f, f->handle = handle; f->fd = io.ntcreatex.out.file.fnum; - return True; + return true; } bool nb_createx(const char *fname, uint_t create_options, uint_t create_disposition, int handle, NTSTATUS status) { - return nb_do_createx(NULL, fname, create_options, create_disposition, handle, status, False); + return nb_do_createx(NULL, fname, create_options, create_disposition, handle, status, false); } bool nb_writex(int handle, off_t offset, int size, int ret_size, NTSTATUS status) @@ -550,7 +550,7 @@ bool nb_writex(int handle, off_t offset, int size, int ret_size, NTSTATUS status i = find_handle(handle, NULL); if (bypass_io) - return True; + return true; buf = malloc(size); memset(buf, 0xab, size); @@ -568,7 +568,7 @@ bool nb_writex(int handle, off_t offset, int size, int ret_size, NTSTATUS status free(buf); if (!check_status("WriteX", status, ret)) - return False; + return false; if (NT_STATUS_IS_OK(ret) && io.writex.out.nwritten != ret_size) { printf("[%d] Warning: WriteX got count %d expected %d\n", @@ -578,7 +578,7 @@ bool nb_writex(int handle, off_t offset, int size, int ret_size, NTSTATUS status children[nbio_id].bytes += ret_size; - return True; + return true; } bool nb_write(int handle, off_t offset, int size, int ret_size, NTSTATUS status) @@ -591,7 +591,7 @@ bool nb_write(int handle, off_t offset, int size, int ret_size, NTSTATUS status) i = find_handle(handle, NULL); if (bypass_io) - return True; + return true; buf = malloc(size); @@ -609,7 +609,7 @@ bool nb_write(int handle, off_t offset, int size, int ret_size, NTSTATUS status) free(buf); if (!check_status("Write", status, ret)) - return False; + return false; if (NT_STATUS_IS_OK(ret) && io.write.out.nwritten != ret_size) { printf("[%d] Warning: Write got count %d expected %d\n", @@ -619,7 +619,7 @@ bool nb_write(int handle, off_t offset, int size, int ret_size, NTSTATUS status) children[nbio_id].bytes += ret_size; - return True; + return true; } static bool nb_do_lockx(bool relock, int handle, off_t offset, int size, NTSTATUS status) @@ -647,7 +647,7 @@ static bool nb_do_lockx(bool relock, int handle, off_t offset, int size, NTSTATU ret = smb_raw_lock(c->tree, &io); if (!check_status("LockX", status, ret)) - return False; + return false; if (f != NULL && !relock) @@ -659,7 +659,7 @@ static bool nb_do_lockx(bool relock, int handle, off_t offset, int size, NTSTATU DLIST_ADD_END(f->locks, linfo, struct lock_info *); } - return True; + return true; } bool nb_lockx(int handle, off_t offset, int size, NTSTATUS status) @@ -692,7 +692,7 @@ bool nb_unlockx(int handle, uint_t offset, int size, NTSTATUS status) ret = smb_raw_lock(c->tree, &io); if (!check_status("UnlockX", status, ret)) - return False; + return false; if (f != NULL) { struct lock_info *linfo; @@ -703,7 +703,7 @@ bool nb_unlockx(int handle, uint_t offset, int size, NTSTATUS status) printf("nb_unlockx: unknown lock (%d)\n", handle); } - return True; + return true; } bool nb_readx(int handle, off_t offset, int size, int ret_size, NTSTATUS status) @@ -716,7 +716,7 @@ bool nb_readx(int handle, off_t offset, int size, int ret_size, NTSTATUS status) i = find_handle(handle, NULL); if (bypass_io) - return True; + return true; buf = malloc(size); @@ -726,7 +726,7 @@ bool nb_readx(int handle, off_t offset, int size, int ret_size, NTSTATUS status) io.readx.in.mincnt = size; io.readx.in.maxcnt = size; io.readx.in.remaining = 0; - io.readx.in.read_for_execute = False; + io.readx.in.read_for_execute = false; io.readx.out.data = buf; ret = smb_raw_read(c->tree, &io); @@ -734,7 +734,7 @@ bool nb_readx(int handle, off_t offset, int size, int ret_size, NTSTATUS status) free(buf); if (!check_status("ReadX", status, ret)) - return False; + return false; if (NT_STATUS_IS_OK(ret) && io.readx.out.nread != ret_size) { printf("[%d] ERROR: ReadX got count %d expected %d\n", @@ -745,7 +745,7 @@ bool nb_readx(int handle, off_t offset, int size, int ret_size, NTSTATUS status) children[nbio_id].bytes += ret_size; - return True; + return true; } bool nb_close(int handle, NTSTATUS status) @@ -763,7 +763,7 @@ bool nb_close(int handle, NTSTATUS status) ret = smb_raw_close(c->tree, &io); if (!check_status("Close", status, ret)) - return False; + return false; if (NT_STATUS_IS_OK(ret)) { struct ftable *f = find_ftable(handle); @@ -771,7 +771,7 @@ bool nb_close(int handle, NTSTATUS status) talloc_free(f); } - return True; + return true; } bool nb_rmdir(const char *dname, NTSTATUS status, bool retry) @@ -786,7 +786,7 @@ bool nb_rmdir(const char *dname, NTSTATUS status, bool retry) if (!retry) return check_status("Rmdir", status, ret); - return True; + return true; } bool nb_mkdir(const char *dname, NTSTATUS status, bool retry) @@ -799,7 +799,7 @@ bool nb_mkdir(const char *dname, NTSTATUS status, bool retry) /* NOTE! no error checking. Used for base fileset creation */ smb_raw_mkdir(c->tree, &io); - return True; + return true; } bool nb_rename(const char *old, const char *new, NTSTATUS status, bool retry) @@ -817,7 +817,7 @@ bool nb_rename(const char *old, const char *new, NTSTATUS status, bool retry) if (!retry) return check_status("Rename", status, ret); - return True; + return true; } @@ -869,7 +869,7 @@ bool nb_sfileinfo(int fnum, int level, NTSTATUS status) if (level != RAW_SFILEINFO_BASIC_INFORMATION) { printf("[%d] Warning: setfileinfo level %d not handled\n", nbench_line_count, level); - return True; + return true; } ZERO_STRUCT(io); @@ -906,9 +906,9 @@ bool nb_qfsinfo(int level, NTSTATUS status) } /* callback function used for trans2 search */ -static BOOL findfirst_callback(void *private, const union smb_search_data *file) +static bool findfirst_callback(void *private, const union smb_search_data *file) { - return True; + return true; } bool nb_findfirst(const char *mask, int level, int maxcnt, int count, NTSTATUS status) @@ -932,7 +932,7 @@ bool nb_findfirst(const char *mask, int level, int maxcnt, int count, NTSTATUS s talloc_free(mem_ctx); if (!check_status("Search", status, ret)) - return False; + return false; if (NT_STATUS_IS_OK(ret) && io.t2ffirst.out.count != count) { printf("[%d] Warning: got count %d expected %d\n", @@ -940,7 +940,7 @@ bool nb_findfirst(const char *mask, int level, int maxcnt, int count, NTSTATUS s io.t2ffirst.out.count, count); } - return True; + return true; } bool nb_flush(int fnum, NTSTATUS status) @@ -984,7 +984,7 @@ bool nb_deltree(const char *dname, bool retry) smbcli_rmdir(c->tree, dname); - return True; + return true; } diff --git a/source4/torture/nbt/query.c b/source4/torture/nbt/query.c index 2f3a51a98cd..1040335227c 100644 --- a/source4/torture/nbt/query.c +++ b/source4/torture/nbt/query.c @@ -61,8 +61,8 @@ static bool bench_namequery(struct torture_context *tctx) io.in.name = name; io.in.dest_addr = address; - io.in.broadcast = False; - io.in.wins_lookup = False; + io.in.broadcast = false; + io.in.wins_lookup = false; io.in.timeout = 1; result = talloc_zero(tctx, struct result_struct); diff --git a/source4/torture/nbt/register.c b/source4/torture/nbt/register.c index 50c7cd33981..9ff22c4bb9f 100644 --- a/source4/torture/nbt/register.c +++ b/source4/torture/nbt/register.c @@ -68,9 +68,9 @@ static bool nbt_register_own(struct torture_context *tctx) io.in.dest_addr = address; io.in.address = myaddress; io.in.nb_flags = NBT_NODE_B | NBT_NM_ACTIVE; - io.in.register_demand = False; - io.in.broadcast = True; - io.in.multi_homed = False; + io.in.register_demand = false; + io.in.broadcast = true; + io.in.multi_homed = false; io.in.ttl = 1234; io.in.timeout = 3; io.in.retries = 0; @@ -86,7 +86,7 @@ static bool nbt_register_own(struct torture_context *tctx) /* check a register demand */ io.in.address = myaddress; - io.in.register_demand = True; + io.in.register_demand = true; status = nbt_name_register(nbtsock, tctx, &io); @@ -134,7 +134,7 @@ static bool nbt_refresh_own(struct torture_context *tctx) io.in.dest_addr = address; io.in.address = myaddress; io.in.nb_flags = NBT_NODE_B | NBT_NM_ACTIVE; - io.in.broadcast = False; + io.in.broadcast = false; io.in.ttl = 1234; io.in.timeout = 3; io.in.retries = 0; diff --git a/source4/torture/nbt/wins.c b/source4/torture/nbt/wins.c index e2c51ab1a84..e25c3e78f09 100644 --- a/source4/torture/nbt/wins.c +++ b/source4/torture/nbt/wins.c @@ -77,7 +77,7 @@ static bool nbt_test_wins_name(struct torture_context *tctx, const char *address release.in.dest_addr = address; release.in.address = myaddress; release.in.nb_flags = nb_flags; - release.in.broadcast = False; + release.in.broadcast = false; release.in.timeout = 3; release.in.retries = 0; @@ -113,8 +113,8 @@ static bool nbt_test_wins_name(struct torture_context *tctx, const char *address torture_comment(tctx, "query the name to make sure its there\n"); query.in.name = *name; query.in.dest_addr = address; - query.in.broadcast = False; - query.in.wins_lookup = True; + query.in.broadcast = false; + query.in.wins_lookup = true; query.in.timeout = 3; query.in.retries = 0; @@ -174,7 +174,7 @@ static bool nbt_test_wins_name(struct torture_context *tctx, const char *address release.in.dest_addr = address; release.in.address = myaddress; release.in.nb_flags = nb_flags; - release.in.broadcast = False; + release.in.broadcast = false; release.in.timeout = 3; release.in.retries = 0; diff --git a/source4/torture/rap/rap.c b/source4/torture/rap/rap.c index f09e79919cc..483b33dc118 100644 --- a/source4/torture/rap/rap.c +++ b/source4/torture/rap/rap.c @@ -287,7 +287,7 @@ static NTSTATUS smbcli_rap_netshareenum(struct smbcli_tree *tree, return result; } -static BOOL test_netshareenum(struct smbcli_tree *tree) +static bool test_netshareenum(struct smbcli_tree *tree) { struct rap_NetShareEnum r; int i; @@ -297,7 +297,7 @@ static BOOL test_netshareenum(struct smbcli_tree *tree) r.in.bufsize = 8192; if (!NT_STATUS_IS_OK(smbcli_rap_netshareenum(tree, tmp_ctx, &r))) - return False; + return false; for (i=0; itree)) { - ret = False; + ret = false; } torture_close_connection(cli); @@ -531,7 +531,7 @@ BOOL torture_rap_basic(struct torture_context *torture) return ret; } -BOOL torture_rap_scan(struct torture_context *torture) +bool torture_rap_scan(struct torture_context *torture) { TALLOC_CTX *mem_ctx; struct smbcli_state *cli; @@ -540,7 +540,7 @@ BOOL torture_rap_scan(struct torture_context *torture) mem_ctx = talloc_init("torture_rap_scan"); if (!torture_open_connection(&cli, 0)) { - return False; + return false; } for (callno = 0; callno < 0xffff; callno++) { @@ -557,7 +557,7 @@ BOOL torture_rap_scan(struct torture_context *torture) torture_close_connection(cli); - return True; + return true; } NTSTATUS torture_rap_init(void) diff --git a/source4/torture/raw/acls.c b/source4/torture/raw/acls.c index ab112658e2a..2c3f4a52c61 100644 --- a/source4/torture/raw/acls.c +++ b/source4/torture/raw/acls.c @@ -35,7 +35,7 @@ if (!NT_STATUS_EQUAL(status, correct)) { \ printf("(%s) Incorrect status %s - should be %s\n", \ __location__, nt_errstr(status), nt_errstr(correct)); \ - ret = False; \ + ret = false; \ goto done; \ }} while (0) @@ -46,7 +46,7 @@ static bool test_sd(struct torture_context *tctx, NTSTATUS status; union smb_open io; const char *fname = BASEDIR "\\sd.txt"; - BOOL ret = True; + bool ret = true; int fnum = -1; union smb_fileinfo q; union smb_setfileinfo set; @@ -113,7 +113,7 @@ static bool test_sd(struct torture_context *tctx, NDR_PRINT_DEBUG(security_descriptor, q.query_secdesc.out.sd); printf("expected:\n"); NDR_PRINT_DEBUG(security_descriptor, sd); - ret = False; + ret = false; } printf("remove it again\n"); @@ -226,7 +226,7 @@ static bool test_nttrans_create(struct torture_context *tctx, NDR_PRINT_DEBUG(security_descriptor, q.query_secdesc.out.sd); printf("expected:\n"); NDR_PRINT_DEBUG(security_descriptor, sd); - ret = False; + ret = false; } done: @@ -243,7 +243,7 @@ done: if (_q.access_information.out.access_flags != (flags)) { \ printf("(%s) Incorrect access_flags 0x%08x - should be 0x%08x\n", \ __location__, _q.access_information.out.access_flags, (flags)); \ - ret = False; \ + ret = false; \ goto done; \ } \ } while (0) @@ -259,7 +259,7 @@ static bool test_creator_sid(struct torture_context *tctx, NTSTATUS status; union smb_open io; const char *fname = BASEDIR "\\creator.txt"; - BOOL ret = True; + bool ret = true; int fnum = -1; union smb_fileinfo q; union smb_setfileinfo set; @@ -358,7 +358,7 @@ static bool test_creator_sid(struct torture_context *tctx, NDR_PRINT_DEBUG(security_descriptor, q.query_secdesc.out.sd); printf("expected:\n"); NDR_PRINT_DEBUG(security_descriptor, sd); - ret = False; + ret = false; } printf("try open for write\n"); @@ -418,7 +418,7 @@ static bool test_creator_sid(struct torture_context *tctx, NDR_PRINT_DEBUG(security_descriptor, q.query_secdesc.out.sd); printf("expected:\n"); NDR_PRINT_DEBUG(security_descriptor, sd2); - ret = False; + ret = false; } @@ -471,7 +471,7 @@ static bool test_generic_bits(struct torture_context *tctx, NTSTATUS status; union smb_open io; const char *fname = BASEDIR "\\generic.txt"; - BOOL ret = True; + bool ret = true; int fnum = -1, i; union smb_fileinfo q; union smb_setfileinfo set; @@ -499,8 +499,8 @@ static bool test_generic_bits(struct torture_context *tctx, { SEC_GENERIC_EXECUTE, SEC_RIGHTS_DIR_EXECUTE }, { SEC_GENERIC_ALL, SEC_RIGHTS_DIR_ALL } }; - BOOL has_restore_privilege; - BOOL has_take_ownership_privilege; + bool has_restore_privilege; + bool has_take_ownership_privilege; printf("TESTING FILE GENERIC BITS\n"); @@ -599,7 +599,7 @@ static bool test_generic_bits(struct torture_context *tctx, NDR_PRINT_DEBUG(security_descriptor, q.query_secdesc.out.sd); printf("expected:\n"); NDR_PRINT_DEBUG(security_descriptor, sd2); - ret = False; + ret = false; } io.ntcreatex.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED; @@ -647,7 +647,7 @@ static bool test_generic_bits(struct torture_context *tctx, NDR_PRINT_DEBUG(security_descriptor, q.query_secdesc.out.sd); printf("expected:\n"); NDR_PRINT_DEBUG(security_descriptor, sd2); - ret = False; + ret = false; } io.ntcreatex.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED; @@ -764,7 +764,7 @@ static bool test_generic_bits(struct torture_context *tctx, NDR_PRINT_DEBUG(security_descriptor, q.query_secdesc.out.sd); printf("expected:\n"); NDR_PRINT_DEBUG(security_descriptor, sd2); - ret = False; + ret = false; } io.ntcreatex.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED; @@ -812,7 +812,7 @@ static bool test_generic_bits(struct torture_context *tctx, NDR_PRINT_DEBUG(security_descriptor, q.query_secdesc.out.sd); printf("expected:\n"); NDR_PRINT_DEBUG(security_descriptor, sd2); - ret = False; + ret = false; } io.ntcreatex.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED; @@ -846,14 +846,14 @@ static bool test_owner_bits(struct torture_context *tctx, NTSTATUS status; union smb_open io; const char *fname = BASEDIR "\\generic.txt"; - BOOL ret = True; + bool ret = true; int fnum = -1, i; union smb_fileinfo q; union smb_setfileinfo set; struct security_descriptor *sd, *sd_orig; const char *owner_sid; - BOOL has_restore_privilege; - BOOL has_take_ownership_privilege; + bool has_restore_privilege; + bool has_take_ownership_privilege; uint32_t expected_bits; printf("TESTING FILE OWNER BITS\n"); @@ -966,7 +966,7 @@ static bool test_inheritance(struct torture_context *tctx, const char *dname = BASEDIR "\\inheritance"; const char *fname1 = BASEDIR "\\inheritance\\testfile"; const char *fname2 = BASEDIR "\\inheritance\\testdir"; - BOOL ret = True; + bool ret = true; int fnum=0, fnum2, i; union smb_fileinfo q; union smb_setfileinfo set; @@ -1175,7 +1175,7 @@ static bool test_inheritance(struct torture_context *tctx, sd_orig->owner_sid)) { printf("Bad sd in child file at %d\n", i); NDR_PRINT_DEBUG(security_descriptor, q.query_secdesc.out.sd); - ret = False; + ret = false; goto check_dir; } @@ -1186,7 +1186,7 @@ static bool test_inheritance(struct torture_context *tctx, test_flags[i].file_flags, test_flags[i].parent_flags, i); - ret = False; + ret = false; } check_dir: @@ -1224,7 +1224,7 @@ static bool test_inheritance(struct torture_context *tctx, printf("Bad sd in child dir at %d (parent 0x%x)\n", i, test_flags[i].parent_flags); NDR_PRINT_DEBUG(security_descriptor, q.query_secdesc.out.sd); - ret = False; + ret = false; continue; } } else if (test_flags[i].parent_flags & SEC_ACE_FLAG_CONTAINER_INHERIT) { @@ -1242,7 +1242,7 @@ static bool test_inheritance(struct torture_context *tctx, printf("Bad sd in child dir at %d (parent 0x%x)\n", i, test_flags[i].parent_flags); NDR_PRINT_DEBUG(security_descriptor, q.query_secdesc.out.sd); - ret = False; + ret = false; continue; } } else { @@ -1255,7 +1255,7 @@ static bool test_inheritance(struct torture_context *tctx, printf("Bad sd in child dir at %d (parent 0x%x)\n", i, test_flags[i].parent_flags); NDR_PRINT_DEBUG(security_descriptor, q.query_secdesc.out.sd); - ret = False; + ret = false; continue; } } @@ -1308,7 +1308,7 @@ static bool test_inheritance(struct torture_context *tctx, NDR_PRINT_DEBUG(security_descriptor, q.query_secdesc.out.sd); printf("expected:\n"); NDR_PRINT_DEBUG(security_descriptor, sd2); - ret = False; + ret = false; } io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN; @@ -1316,7 +1316,7 @@ static bool test_inheritance(struct torture_context *tctx, status = smb_raw_open(cli->tree, tctx, &io); if (NT_STATUS_IS_OK(status)) { printf("failed: w2k3 ACL bug (allowed open when ACL should deny)\n"); - ret = False; + ret = false; fnum2 = io.ntcreatex.out.file.fnum; CHECK_ACCESS_FLAGS(fnum2, SEC_RIGHTS_FILE_ALL); smbcli_close(cli->tree, fnum2); @@ -1382,14 +1382,14 @@ done: /* test dynamic acl inheritance */ -static BOOL test_inheritance_dynamic(struct torture_context *tctx, +static bool test_inheritance_dynamic(struct torture_context *tctx, struct smbcli_state *cli) { NTSTATUS status; union smb_open io; const char *dname = BASEDIR "\\inheritance"; const char *fname1 = BASEDIR "\\inheritance\\testfile"; - BOOL ret = True; + bool ret = true; int fnum=0, fnum2; union smb_fileinfo q; union smb_setfileinfo set; @@ -1399,7 +1399,7 @@ static BOOL test_inheritance_dynamic(struct torture_context *tctx, printf("TESTING DYNAMIC ACL INHERITANCE\n"); if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } io.generic.level = RAW_OPEN_NTCREATEX; @@ -1533,14 +1533,14 @@ done: if (!(granted & access)) {\ printf("(%s) %s but flags 0x%08X are not granted! granted[0x%08X] desired[0x%08X]\n", \ __location__, nt_errstr(status), access, granted, desired); \ - ret = False; \ + ret = false; \ goto done; \ } \ } else { \ if (granted & access) {\ printf("(%s) %s but flags 0x%08X are granted! granted[0x%08X] desired[0x%08X]\n", \ __location__, nt_errstr(status), access, granted, desired); \ - ret = False; \ + ret = false; \ goto done; \ } \ } \ @@ -1552,7 +1552,7 @@ static bool test_sd_get_set(struct torture_context *tctx, struct smbcli_state *cli) { NTSTATUS status; - BOOL ret = True; + bool ret = true; union smb_open io; union smb_fileinfo fi; union smb_setfileinfo si; diff --git a/source4/torture/raw/chkpath.c b/source4/torture/raw/chkpath.c index 6240584a681..42a3c3cebe4 100644 --- a/source4/torture/raw/chkpath.c +++ b/source4/torture/raw/chkpath.c @@ -29,7 +29,7 @@ if (!NT_STATUS_EQUAL(status, correct) && !NT_STATUS_EQUAL(status, dos_correct)) { \ printf("(%d) Incorrect status %s - should be %s\n", \ __LINE__, nt_errstr(status), nt_errstr(correct)); \ - ret = False; \ + ret = false; \ goto done; \ }} while (0) @@ -54,7 +54,7 @@ static NTSTATUS single_search(struct smbcli_state *cli, return status; } -static BOOL test_path(struct smbcli_state *cli, const char *path, NTSTATUS expected, NTSTATUS dos_expected) +static bool test_path(struct smbcli_state *cli, const char *path, NTSTATUS expected, NTSTATUS dos_expected) { union smb_chkpath io; NTSTATUS status; @@ -63,19 +63,19 @@ static BOOL test_path(struct smbcli_state *cli, const char *path, NTSTATUS expec if (!NT_STATUS_EQUAL(status, expected) && !NT_STATUS_EQUAL(status, dos_expected)) { printf("%-40s FAILED %s should be %s or %s\n", path, nt_errstr(status), nt_errstr(expected), nt_errstr(dos_expected)); - return False; + return false; } else { printf("%-40s correct (%s)\n", path, nt_errstr(status)); } - return True; + return true; } -static BOOL test_chkpath(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_chkpath(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { union smb_chkpath io; NTSTATUS status; - BOOL ret = True; + bool ret = true; int fnum = -1; int fnum1 = -1; @@ -89,7 +89,7 @@ static BOOL test_chkpath(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) fnum = create_complex_file(cli, mem_ctx, BASEDIR "\\test.txt.."); if (fnum == -1) { printf("failed to open test.txt - %s\n", smbcli_errstr(cli->tree)); - ret = False; + ret = false; goto done; } @@ -97,7 +97,7 @@ static BOOL test_chkpath(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) if (!torture_set_file_attribute(cli->tree, BASEDIR, FILE_ATTRIBUTE_HIDDEN)) { printf("failed to set basedir hidden\n"); - ret = False; + ret = false; goto done; } @@ -221,28 +221,28 @@ bool torture_raw_chkpath(struct torture_context *torture, int fnum; if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR "\\nt"))) { printf("Failed to create " BASEDIR " - %s\n", smbcli_errstr(cli->tree)); - return False; + return false; } if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR "\\nt\\V S"))) { printf("Failed to create " BASEDIR " - %s\n", smbcli_errstr(cli->tree)); - return False; + return false; } if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR "\\nt\\V S\\VB98"))) { printf("Failed to create " BASEDIR " - %s\n", smbcli_errstr(cli->tree)); - return False; + return false; } fnum = create_complex_file(cli, torture, BASEDIR "\\nt\\V S\\VB98\\vb6.exe"); if (fnum == -1) { printf("failed to open \\nt\\V S\\VB98\\vb6.exe - %s\n", smbcli_errstr(cli->tree)); - ret = False; + ret = false; goto done; } diff --git a/source4/torture/raw/composite.c b/source4/torture/raw/composite.c index d713ff321ee..c6969574a86 100644 --- a/source4/torture/raw/composite.c +++ b/source4/torture/raw/composite.c @@ -43,7 +43,7 @@ static void loadfile_complete(struct composite_context *c) /* test a simple savefile/loadfile combination */ -static BOOL test_loadfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_loadfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { const char *fname = BASEDIR "\\test.txt"; NTSTATUS status; @@ -69,7 +69,7 @@ static BOOL test_loadfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) status = smb_composite_savefile(cli->tree, &io1); if (!NT_STATUS_IS_OK(status)) { printf("(%s) savefile failed: %s\n", __location__,nt_errstr(status)); - return False; + return false; } io2.in.fname = fname; @@ -98,30 +98,30 @@ static BOOL test_loadfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) status = smb_composite_loadfile_recv(c[i], mem_ctx); if (!NT_STATUS_IS_OK(status)) { printf("(%s) loadfile[%d] failed - %s\n", __location__, i, nt_errstr(status)); - return False; + return false; } if (io2.out.size != len) { printf("(%s) wrong length in returned data - %d should be %d\n",__location__, io2.out.size, (int)len); - return False; + return false; } if (memcmp(io2.out.data, data, len) != 0) { printf("(%s) wrong data in loadfile!\n",__location__); - return False; + return false; } } talloc_free(data); - return True; + return true; } /* test a simple savefile/loadfile combination */ -static BOOL test_fetchfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_fetchfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { const char *fname = BASEDIR "\\test.txt"; NTSTATUS status; @@ -134,7 +134,7 @@ static BOOL test_fetchfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) extern int torture_numops; struct event_context *event_ctx; int *count = talloc_zero(mem_ctx, int); - BOOL ret = True; + bool ret = true; data = talloc_array(mem_ctx, uint8_t, len); @@ -149,7 +149,7 @@ static BOOL test_fetchfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) status = smb_composite_savefile(cli->tree, &io1); if (!NT_STATUS_IS_OK(status)) { printf("(%s) savefile failed: %s\n",__location__, nt_errstr(status)); - return False; + return false; } io2.in.dest_host = lp_parm_string(global_loadparm, NULL, "torture", "host"); @@ -189,7 +189,7 @@ static BOOL test_fetchfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) if (!NT_STATUS_IS_OK(status)) { printf("(%s) loadfile[%d] failed - %s\n", __location__, i, nt_errstr(status)); - ret = False; + ret = false; continue; } @@ -197,13 +197,13 @@ static BOOL test_fetchfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("(%s) wrong length in returned data - %d " "should be %d\n", __location__, io2.out.size, (int)len); - ret = False; + ret = false; continue; } if (memcmp(io2.out.data, data, len) != 0) { printf("(%s) wrong data in loadfile!\n", __location__); - ret = False; + ret = false; continue; } } @@ -214,7 +214,7 @@ static BOOL test_fetchfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) /* test setfileacl */ -static BOOL test_appendacl(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_appendacl(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { struct smb_composite_appendacl **io; struct smb_composite_appendacl **io_orig; @@ -244,7 +244,7 @@ static BOOL test_appendacl(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) status = smb_composite_savefile(cli->tree, &io1); if (!NT_STATUS_IS_OK(status)) { printf("(%s) savefile failed: %s\n", __location__, nt_errstr(status)); - return False; + return false; } io_orig[i] = talloc (io_orig, struct smb_composite_appendacl); @@ -253,7 +253,7 @@ static BOOL test_appendacl(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) status = smb_composite_appendacl(cli->tree, io_orig[i], io_orig[i]); if (!NT_STATUS_IS_OK(status)) { printf("(%s) appendacl failed: %s\n", __location__, nt_errstr(status)); - return False; + return false; } } @@ -273,7 +273,7 @@ static BOOL test_appendacl(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) status = security_descriptor_dacl_add(test_sd, ace); if (!NT_STATUS_IS_OK(status)) { printf("(%s) appendacl failed: %s\n", __location__, nt_errstr(status)); - return False; + return false; } /* set parameters for appendacl async call */ @@ -308,13 +308,13 @@ static BOOL test_appendacl(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) status = smb_composite_appendacl_recv(c[i], io[i]); if (!NT_STATUS_IS_OK(status)) { printf("(%s) appendacl[%d] failed - %s\n", __location__, i, nt_errstr(status)); - return False; + return false; } security_descriptor_dacl_add(io_orig[i]->out.sd, ace); if (!security_acl_equal(io_orig[i]->out.sd->dacl, io[i]->out.sd->dacl)) { printf("(%s) appendacl[%d] failed - needed acl isn't set\n", __location__, i); - return False; + return false; } } @@ -323,11 +323,11 @@ static BOOL test_appendacl(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) talloc_free (test_sid); talloc_free (test_sd); - return True; + return true; } /* test a query FS info by asking for share's GUID */ -static BOOL test_fsinfo(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_fsinfo(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { char *guid = NULL; NTSTATUS status; @@ -338,7 +338,7 @@ static BOOL test_fsinfo(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) extern int torture_numops; struct event_context *event_ctx; int *count = talloc_zero(mem_ctx, int); - BOOL ret = True; + bool ret = true; io1.in.dest_host = lp_parm_string(global_loadparm, NULL, "torture", "host"); io1.in.port = 0; @@ -375,7 +375,7 @@ static BOOL test_fsinfo(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) status = smb_composite_fsinfo_recv(c[i], mem_ctx); if (!NT_STATUS_IS_OK(status)) { printf("(%s) fsinfo[%d] failed - %s\n", __location__, i, nt_errstr(status)); - ret = False; + ret = false; continue; } @@ -383,7 +383,7 @@ static BOOL test_fsinfo(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("(%s) wrong level in returned info - %d " "should be %d\n", __location__, io1.out.fsinfo->generic.level, RAW_QFS_OBJECTID_INFORMATION); - ret = False; + ret = false; continue; } @@ -406,7 +406,7 @@ bool torture_raw_composite(struct torture_context *tctx, bool ret = true; if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } ret &= test_fetchfile(cli, tctx); diff --git a/source4/torture/raw/context.c b/source4/torture/raw/context.c index 8c1c14d783e..11ad11ab3fe 100644 --- a/source4/torture/raw/context.c +++ b/source4/torture/raw/context.c @@ -35,7 +35,7 @@ if (!NT_STATUS_EQUAL(status, correct)) { \ printf("(%s) Incorrect status %s - should be %s\n", \ __location__, nt_errstr(status), nt_errstr(correct)); \ - ret = False; \ + ret = false; \ goto done; \ }} while (0) @@ -43,7 +43,7 @@ if ((v) != (correct)) { \ printf("(%s) Incorrect value %s=%d - should be %d\n", \ __location__, #v, v, correct); \ - ret = False; \ + ret = false; \ goto done; \ }} while (0) @@ -51,7 +51,7 @@ if ((v) == (correct)) { \ printf("(%s) Incorrect value %s=%d - should not be %d\n", \ __location__, #v, v, correct); \ - ret = False; \ + ret = false; \ goto done; \ }} while (0) @@ -59,10 +59,10 @@ /* test session ops */ -static BOOL test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { NTSTATUS status; - BOOL ret = True; + bool ret = true; struct smbcli_session *session; struct smbcli_session *session2; struct smbcli_session *session3; @@ -84,11 +84,11 @@ static BOOL test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("TESTING SESSION HANDLING\n"); if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } printf("create a second security context on the same transport\n"); - session = smbcli_session_init(cli->transport, mem_ctx, False); + session = smbcli_session_init(cli->transport, mem_ctx, false); setup.in.sesskey = cli->transport->negotiate.sesskey; setup.in.capabilities = cli->transport->negotiate.capabilities; /* ignored in secondary session setup, except by our libs, which care about the extended security bit */ @@ -102,7 +102,7 @@ static BOOL test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) session->vuid = setup.out.vuid; printf("create a third security context on the same transport, with vuid set\n"); - session2 = smbcli_session_init(cli->transport, mem_ctx, False); + session2 = smbcli_session_init(cli->transport, mem_ctx, false); session2->vuid = session->vuid; setup.in.sesskey = cli->transport->negotiate.sesskey; @@ -129,7 +129,7 @@ static BOOL test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) if (cli->transport->negotiate.capabilities & CAP_EXTENDED_SECURITY) { printf("create a fourth security context on the same transport, without extended security\n"); - session3 = smbcli_session_init(cli->transport, mem_ctx, False); + session3 = smbcli_session_init(cli->transport, mem_ctx, false); session3->vuid = session->vuid; setup.in.sesskey = cli->transport->negotiate.sesskey; @@ -143,7 +143,7 @@ static BOOL test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) CHECK_STATUS(status, NT_STATUS_LOGON_FAILURE); printf("create a fouth anonymous security context on the same transport, without extended security\n"); - session4 = smbcli_session_init(cli->transport, mem_ctx, False); + session4 = smbcli_session_init(cli->transport, mem_ctx, false); session4->vuid = session->vuid; setup.in.sesskey = cli->transport->negotiate.sesskey; @@ -163,7 +163,7 @@ static BOOL test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) } printf("use the same tree as the existing connection\n"); - tree = smbcli_tree_init(session, mem_ctx, False); + tree = smbcli_tree_init(session, mem_ctx, false); tree->tid = cli->tree->tid; printf("create a file using the new vuid\n"); @@ -229,7 +229,7 @@ static BOOL test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) setups[i].in.credentials = cmdline_credentials; - sessions[i] = smbcli_session_init(cli->transport, mem_ctx, False); + sessions[i] = smbcli_session_init(cli->transport, mem_ctx, false); composite_contexts[i] = smb_composite_sesssetup_send(sessions[i], &setups[i]); } @@ -257,10 +257,10 @@ done: /* test tree ops */ -static BOOL test_tree(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_tree(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { NTSTATUS status; - BOOL ret = True; + bool ret = true; const char *share, *host; struct smbcli_tree *tree; union smb_tcon tcon; @@ -274,14 +274,14 @@ static BOOL test_tree(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("TESTING TREE HANDLING\n"); if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } share = lp_parm_string(global_loadparm, NULL, "torture", "share"); host = lp_parm_string(global_loadparm, NULL, "torture", "host"); printf("create a second tree context on the same session\n"); - tree = smbcli_tree_init(cli->session, mem_ctx, False); + tree = smbcli_tree_init(cli->session, mem_ctx, false); tcon.generic.level = RAW_TCON_TCONX; tcon.tconx.in.flags = 0; @@ -362,10 +362,10 @@ done: this demonstrates that a tcon isn't autoclosed by a ulogoff the tcon can be reused using any other valid session later */ -static BOOL test_tree_ulogoff(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_tree_ulogoff(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { NTSTATUS status; - BOOL ret = True; + bool ret = true; const char *share, *host; struct smbcli_session *session1; struct smbcli_session *session2; @@ -382,14 +382,14 @@ static BOOL test_tree_ulogoff(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("TESTING TREE with ulogoff\n"); if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } share = lp_parm_string(global_loadparm, NULL, "torture", "share"); host = lp_parm_string(global_loadparm, NULL, "torture", "host"); printf("create the first new sessions\n"); - session1 = smbcli_session_init(cli->transport, mem_ctx, False); + session1 = smbcli_session_init(cli->transport, mem_ctx, false); setup.in.sesskey = cli->transport->negotiate.sesskey; setup.in.capabilities = cli->transport->negotiate.capabilities; setup.in.workgroup = lp_workgroup(global_loadparm); @@ -400,7 +400,7 @@ static BOOL test_tree_ulogoff(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("vuid1=%d\n", session1->vuid); printf("create a tree context on the with vuid1\n"); - tree = smbcli_tree_init(session1, mem_ctx, False); + tree = smbcli_tree_init(session1, mem_ctx, false); tcon.generic.level = RAW_TCON_TCONX; tcon.tconx.in.flags = 0; tcon.tconx.in.password = data_blob(NULL, 0); @@ -445,7 +445,7 @@ static BOOL test_tree_ulogoff(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) CHECK_STATUS(status, NT_STATUS_OK); printf("create the second new sessions\n"); - session2 = smbcli_session_init(cli->transport, mem_ctx, False); + session2 = smbcli_session_init(cli->transport, mem_ctx, false); setup.in.sesskey = cli->transport->negotiate.sesskey; setup.in.capabilities = cli->transport->negotiate.capabilities; setup.in.workgroup = lp_workgroup(global_loadparm); @@ -512,10 +512,10 @@ done: this test demonstrates that exit() only sees the PID used for the open() calls */ -static BOOL test_pid_exit_only_sees_open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_pid_exit_only_sees_open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { NTSTATUS status; - BOOL ret = True; + bool ret = true; union smb_open io; union smb_write wr; union smb_close cl; @@ -527,7 +527,7 @@ static BOOL test_pid_exit_only_sees_open(struct smbcli_state *cli, TALLOC_CTX *m printf("TESTING PID HANDLING exit() only cares about open() PID\n"); if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } pid1 = cli->session->pid; @@ -620,10 +620,10 @@ done: /* test pid ops with 2 sessions */ -static BOOL test_pid_2sess(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_pid_2sess(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { NTSTATUS status; - BOOL ret = True; + bool ret = true; struct smbcli_session *session; struct smb_composite_sesssetup setup; union smb_open io; @@ -637,11 +637,11 @@ static BOOL test_pid_2sess(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("TESTING PID HANDLING WITH 2 SESSIONS\n"); if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } printf("create a second security context on the same transport\n"); - session = smbcli_session_init(cli->transport, mem_ctx, False); + session = smbcli_session_init(cli->transport, mem_ctx, false); setup.in.sesskey = cli->transport->negotiate.sesskey; setup.in.capabilities = cli->transport->negotiate.capabilities; /* ignored in secondary session setup, except by our libs, which care about the extended security bit */ @@ -724,10 +724,10 @@ done: /* test pid ops with 2 tcons */ -static BOOL test_pid_2tcon(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_pid_2tcon(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { NTSTATUS status; - BOOL ret = True; + bool ret = true; const char *share, *host; struct smbcli_tree *tree; union smb_tcon tcon; @@ -743,14 +743,14 @@ static BOOL test_pid_2tcon(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("TESTING PID HANDLING WITH 2 TCONS\n"); if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } share = lp_parm_string(global_loadparm, NULL, "torture", "share"); host = lp_parm_string(global_loadparm, NULL, "torture", "host"); printf("create a second tree context on the same session\n"); - tree = smbcli_tree_init(cli->session, mem_ctx, False); + tree = smbcli_tree_init(cli->session, mem_ctx, false); tcon.generic.level = RAW_TCON_TCONX; tcon.tconx.in.flags = 0; @@ -869,7 +869,7 @@ done: static bool torture_raw_context_int(struct torture_context *tctx, struct smbcli_state *cli) { - BOOL ret = True; + bool ret = true; ret &= test_session(cli, tctx); ret &= test_tree(cli, tctx); diff --git a/source4/torture/raw/eas.c b/source4/torture/raw/eas.c index 368a24dbae6..b24b98796f1 100644 --- a/source4/torture/raw/eas.c +++ b/source4/torture/raw/eas.c @@ -33,26 +33,26 @@ if (!NT_STATUS_EQUAL(status, correct)) { \ printf("(%s) Incorrect status %s - should be %s\n", \ __location__, nt_errstr(status), nt_errstr(correct)); \ - ret = False; \ + ret = false; \ goto done; \ }} while (0) -static BOOL maxeadebug; /* need that here, to allow no file delete in debug case */ +static bool maxeadebug; /* need that here, to allow no file delete in debug case */ -static BOOL check_ea(struct smbcli_state *cli, +static bool check_ea(struct smbcli_state *cli, const char *fname, const char *eaname, const char *value) { NTSTATUS status = torture_check_ea(cli, fname, eaname, value); return NT_STATUS_IS_OK(status); } -static BOOL test_eas(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_eas(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { NTSTATUS status; union smb_setfileinfo setfile; union smb_open io; const char *fname = BASEDIR "\\ea.txt"; - BOOL ret = True; + bool ret = true; int fnum = -1; printf("TESTING SETFILEINFO EA_SET\n"); @@ -208,7 +208,7 @@ static int test_one_eamax(struct smbcli_state *cli, const int fnum, } i -= (high - low + 1) / 2; } - } while (True); + } while (true); return low; } @@ -222,21 +222,21 @@ static int test_one_eamax(struct smbcli_state *cli, const int fnum, * maxeasize 65536 limit the max. size for a single EA name * maxeanames 101 limit of the number of tested names * maxeastart 1 this EA size is used to test for the 1st EA (atm) - * maxeadebug 0 if set True, further debug output is done - in addition + * maxeadebug 0 if set true, further debug output is done - in addition * the testfile is not deleted for further inspection! * * Set some/all of these options on the cmdline with: * --option torture:maxeasize=1024 --option torture:maxeadebug=1 ... * */ -static BOOL test_max_eas(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_max_eas(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { NTSTATUS status; union smb_open io; const char *fname = BASEDIR "\\ea_max.txt"; int fnum = -1; - BOOL ret = True; - BOOL err = False; + bool ret = true; + bool err = false; int i, j, k, last, total; DATA_BLOB eablob; @@ -255,19 +255,19 @@ static BOOL test_max_eas(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) /* Do some sanity check on possibly passed parms */ if (maxeasize <= 0) { printf("Invalid parameter 'maxeasize=%d'",maxeasize); - err = True; + err = true; } if (maxeanames <= 0) { printf("Invalid parameter 'maxeanames=%d'",maxeanames); - err = True; + err = true; } if (maxeastart <= 0) { printf("Invalid parameter 'maxeastart=%d'",maxeastart); - err = True; + err = true; } if (maxeadebug < 0) { printf("Invalid parameter 'maxeadebug=%d'",maxeadebug); - err = True; + err = true; } if (err) { printf("\n\n"); @@ -353,7 +353,7 @@ static BOOL test_max_eas(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf ("NOTE: More EAs could be available!\n"); } if (total == 0) { - ret = False; + ret = false; } done: smbcli_close(cli->tree, fnum); @@ -363,12 +363,12 @@ done: /* test using NTTRANS CREATE to create a file with an initial EA set */ -static BOOL test_nttrans_create(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_nttrans_create(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { NTSTATUS status; union smb_open io; const char *fname = BASEDIR "\\ea2.txt"; - BOOL ret = True; + bool ret = true; int fnum = -1; struct ea_struct eas[3]; struct smb_ea_list ea_list; @@ -450,7 +450,7 @@ bool torture_raw_eas(struct torture_context *torture, struct smbcli_state *cli) bool ret = true; if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } ret &= test_eas(cli, torture); @@ -467,17 +467,17 @@ bool torture_raw_eas(struct torture_context *torture, struct smbcli_state *cli) bool torture_max_eas(struct torture_context *torture) { struct smbcli_state *cli; - BOOL ret = True; + bool ret = true; TALLOC_CTX *mem_ctx; if (!torture_open_connection(&cli, 0)) { - return False; + return false; } mem_ctx = talloc_init("torture_raw_eas"); if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } ret &= test_max_eas(cli, mem_ctx); diff --git a/source4/torture/raw/ioctl.c b/source4/torture/raw/ioctl.c index 357332c7168..c4dd4c5bf2b 100644 --- a/source4/torture/raw/ioctl.c +++ b/source4/torture/raw/ioctl.c @@ -31,18 +31,18 @@ if (!NT_STATUS_EQUAL(status, correct)) { \ printf("(%d) Incorrect status %s - should be %s\n", \ __LINE__, nt_errstr(status), nt_errstr(correct)); \ - ret = False; \ + ret = false; \ goto done; \ }} while (0) /* test some ioctls */ -static BOOL test_ioctl(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_ioctl(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { union smb_ioctl ctl; int fnum; NTSTATUS status; - BOOL ret = True; + bool ret = true; const char *fname = BASEDIR "\\test.dat"; printf("TESTING IOCTL FUNCTIONS\n"); @@ -50,7 +50,7 @@ static BOOL test_ioctl(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) fnum = create_complex_file(cli, mem_ctx, fname); if (fnum == -1) { printf("Failed to create test.dat - %s\n", smbcli_errstr(cli->tree)); - ret = False; + ret = false; goto done; } @@ -81,11 +81,11 @@ done: } /* test some filesystem control functions */ -static BOOL test_fsctl(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_fsctl(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { int fnum; NTSTATUS status; - BOOL ret = True; + bool ret = true; const char *fname = BASEDIR "\\test.dat"; union smb_ioctl nt; @@ -94,7 +94,7 @@ static BOOL test_fsctl(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) fnum = create_complex_file(cli, mem_ctx, fname); if (fnum == -1) { printf("Failed to create test.dat - %s\n", smbcli_errstr(cli->tree)); - ret = False; + ret = false; goto done; } @@ -102,7 +102,7 @@ static BOOL test_fsctl(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) nt.ioctl.level = RAW_IOCTL_NTIOCTL; nt.ntioctl.in.function = FSCTL_SET_SPARSE; nt.ntioctl.in.file.fnum = fnum; - nt.ntioctl.in.fsctl = True; + nt.ntioctl.in.fsctl = true; nt.ntioctl.in.filter = 0; nt.ntioctl.in.max_data = 0; nt.ntioctl.in.blob = data_blob(NULL, 0); @@ -114,7 +114,7 @@ static BOOL test_fsctl(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) nt.ioctl.level = RAW_IOCTL_NTIOCTL; nt.ntioctl.in.function = FSCTL_REQUEST_BATCH_OPLOCK; nt.ntioctl.in.file.fnum = fnum; - nt.ntioctl.in.fsctl = True; + nt.ntioctl.in.fsctl = true; nt.ntioctl.in.filter = 0; nt.ntioctl.in.max_data = 0; nt.ntioctl.in.blob = data_blob(NULL, 0); @@ -157,7 +157,7 @@ bool torture_raw_ioctl(struct torture_context *torture, bool ret = true; if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } ret &= test_ioctl(cli, torture); diff --git a/source4/torture/raw/lock.c b/source4/torture/raw/lock.c index f55d37330ae..c2d5a778fbd 100644 --- a/source4/torture/raw/lock.c +++ b/source4/torture/raw/lock.c @@ -33,7 +33,7 @@ if (!NT_STATUS_EQUAL(status, correct)) { \ printf("(%s) Incorrect status %s - should be %s\n", \ __location__, nt_errstr(status), nt_errstr(correct)); \ - ret = False; \ + ret = false; \ goto done; \ }} while (0) @@ -47,12 +47,12 @@ static bool test_lock(struct torture_context *tctx, struct smbcli_state *cli) { union smb_lock io; NTSTATUS status; - BOOL ret = True; + bool ret = true; int fnum; const char *fname = BASEDIR "\\test.txt"; if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } printf("Testing RAW_LOCK_LOCK\n"); @@ -61,7 +61,7 @@ static bool test_lock(struct torture_context *tctx, struct smbcli_state *cli) fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE); if (fnum == -1) { printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree)); - ret = False; + ret = false; goto done; } @@ -183,12 +183,12 @@ static bool test_lockx(struct torture_context *tctx, struct smbcli_state *cli) union smb_lock io; struct smb_lock_entry lock[1]; NTSTATUS status; - BOOL ret = True; + bool ret = true; int fnum; const char *fname = BASEDIR "\\test.txt"; if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } printf("Testing RAW_LOCK_LOCKX\n"); @@ -197,7 +197,7 @@ static bool test_lockx(struct torture_context *tctx, struct smbcli_state *cli) fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE); if (fnum == -1) { printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree)); - ret = False; + ret = false; goto done; } @@ -363,13 +363,13 @@ static bool test_pidhigh(struct torture_context *tctx, union smb_lock io; struct smb_lock_entry lock[1]; NTSTATUS status; - BOOL ret = True; + bool ret = true; int fnum; const char *fname = BASEDIR "\\test.txt"; uint8_t c = 1; if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } printf("Testing high pid\n"); @@ -380,13 +380,13 @@ static bool test_pidhigh(struct torture_context *tctx, fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE); if (fnum == -1) { printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree)); - ret = False; + ret = false; goto done; } if (smbcli_write(cli->tree, fnum, 0, &c, 0, 1) != 1) { printf("Failed to write 1 byte - %s\n", smbcli_errstr(cli->tree)); - ret = False; + ret = false; goto done; } @@ -405,7 +405,7 @@ static bool test_pidhigh(struct torture_context *tctx, if (smbcli_read(cli->tree, fnum, &c, 0, 1) != 1) { printf("Failed to read 1 byte - %s\n", smbcli_errstr(cli->tree)); - ret = False; + ret = false; goto done; } @@ -415,7 +415,7 @@ static bool test_pidhigh(struct torture_context *tctx, if (smbcli_read(cli->tree, fnum, &c, 0, 1) == 1) { printf("pid is incorrect handled for read with lock!\n"); - ret = False; + ret = false; goto done; } @@ -423,7 +423,7 @@ static bool test_pidhigh(struct torture_context *tctx, if (smbcli_read(cli->tree, fnum, &c, 0, 1) != 1) { printf("High pid is used on this server!\n"); - ret = False; + ret = false; } else { printf("High pid is not used on this server (correct)\n"); } @@ -450,14 +450,14 @@ static bool test_async(struct torture_context *tctx, union smb_lock io; struct smb_lock_entry lock[2]; NTSTATUS status; - BOOL ret = True; + bool ret = true; int fnum; const char *fname = BASEDIR "\\test.txt"; time_t t; struct smbcli_request *req; if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } printf("Testing LOCKING_ANDX_CANCEL_LOCK\n"); @@ -466,7 +466,7 @@ static bool test_async(struct torture_context *tctx, fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE); if (fnum == -1) { printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree)); - ret = False; + ret = false; goto done; } @@ -492,7 +492,7 @@ static bool test_async(struct torture_context *tctx, req = smb_raw_lock_send(cli->tree, &io); if (req == NULL) { printf("Failed to setup timed lock (%s)\n", __location__); - ret = False; + ret = false; goto done; } @@ -523,7 +523,7 @@ static bool test_async(struct torture_context *tctx, if (time(NULL) > t+2) { printf("lock cancel was not immediate (%s)\n", __location__); - ret = False; + ret = false; goto done; } @@ -539,7 +539,7 @@ static bool test_async(struct torture_context *tctx, req = smb_raw_lock_send(cli->tree, &io); if (req == NULL) { printf("Failed to setup timed lock (%s)\n", __location__); - ret = False; + ret = false; goto done; } @@ -555,7 +555,7 @@ static bool test_async(struct torture_context *tctx, if (time(NULL) > t+2) { printf("lock cancel by unlock was not immediate (%s) - took %d secs\n", __location__, (int)(time(NULL)-t)); - ret = False; + ret = false; goto done; } @@ -572,7 +572,7 @@ static bool test_async(struct torture_context *tctx, req = smb_raw_lock_send(cli->tree, &io); if (req == NULL) { printf("Failed to setup timed lock (%s)\n", __location__); - ret = False; + ret = false; goto done; } @@ -584,12 +584,12 @@ static bool test_async(struct torture_context *tctx, if (time(NULL) > t+2) { printf("lock cancel by close was not immediate (%s)\n", __location__); - ret = False; + ret = false; goto done; } printf("create a new sessions\n"); - session = smbcli_session_init(cli->transport, tctx, False); + session = smbcli_session_init(cli->transport, tctx, false); setup.in.sesskey = cli->transport->negotiate.sesskey; setup.in.capabilities = cli->transport->negotiate.capabilities; setup.in.workgroup = lp_workgroup(global_loadparm); @@ -601,7 +601,7 @@ static bool test_async(struct torture_context *tctx, printf("create new tree context\n"); share = lp_parm_string(global_loadparm, NULL, "torture", "share"); host = lp_parm_string(global_loadparm, NULL, "torture", "host"); - tree = smbcli_tree_init(session, tctx, False); + tree = smbcli_tree_init(session, tctx, false); tcon.generic.level = RAW_TCON_TCONX; tcon.tconx.in.flags = 0; tcon.tconx.in.password = data_blob(NULL, 0); @@ -616,7 +616,7 @@ static bool test_async(struct torture_context *tctx, fnum = smbcli_open(tree, fname, O_RDWR|O_CREAT, DENY_NONE); if (fnum == -1) { printf("Failed to reopen %s - %s\n", fname, smbcli_errstr(tree)); - ret = False; + ret = false; goto done; } io.lockx.level = RAW_LOCK_LOCKX; @@ -644,7 +644,7 @@ static bool test_async(struct torture_context *tctx, req = smb_raw_lock_send(tree, &io); if (req == NULL) { printf("Failed to setup timed lock (%s)\n", __location__); - ret = False; + ret = false; goto done; } @@ -656,7 +656,7 @@ static bool test_async(struct torture_context *tctx, if (time(NULL) > t+2) { printf("lock cancel by exit was not immediate (%s)\n", __location__); - ret = False; + ret = false; goto done; } @@ -665,7 +665,7 @@ static bool test_async(struct torture_context *tctx, fnum = smbcli_open(tree, fname, O_RDWR|O_CREAT, DENY_NONE); if (fnum == -1) { printf("Failed to reopen %s - %s\n", fname, smbcli_errstr(tree)); - ret = False; + ret = false; goto done; } io.lockx.level = RAW_LOCK_LOCKX; @@ -693,7 +693,7 @@ static bool test_async(struct torture_context *tctx, req = smb_raw_lock_send(tree, &io); if (req == NULL) { printf("Failed to setup timed lock (%s)\n", __location__); - ret = False; + ret = false; goto done; } @@ -712,7 +712,7 @@ static bool test_async(struct torture_context *tctx, if (time(NULL) > t+2) { printf("lock cancel by ulogoff was not immediate (%s)\n", __location__); - ret = False; + ret = false; goto done; } @@ -723,7 +723,7 @@ static bool test_async(struct torture_context *tctx, fnum = smbcli_open(tree, fname, O_RDWR|O_CREAT, DENY_NONE); if (fnum == -1) { printf("Failed to reopen %s - %s\n", fname, smbcli_errstr(tree)); - ret = False; + ret = false; goto done; } io.lockx.level = RAW_LOCK_LOCKX; @@ -747,7 +747,7 @@ static bool test_async(struct torture_context *tctx, req = smb_raw_lock_send(tree, &io); if (req == NULL) { printf("Failed to setup timed lock (%s)\n", __location__); - ret = False; + ret = false; goto done; } @@ -759,7 +759,7 @@ static bool test_async(struct torture_context *tctx, if (time(NULL) > t+2) { printf("lock cancel by tdis was not immediate (%s)\n", __location__); - ret = False; + ret = false; goto done; } @@ -779,7 +779,7 @@ static bool test_errorcode(struct torture_context *tctx, union smb_open op; struct smb_lock_entry lock[2]; NTSTATUS status; - BOOL ret = True; + bool ret = true; int fnum, fnum2; const char *fname; struct smbcli_request *req; @@ -787,7 +787,7 @@ static bool test_errorcode(struct torture_context *tctx, int t; if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } printf("Testing LOCK_NOT_GRANTED vs. FILE_LOCK_CONFLICT\n"); @@ -1105,7 +1105,7 @@ next_run: fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE); if (fnum == -1) { printf("Failed to reopen %s - %s\n", fname, smbcli_errstr(cli->tree)); - ret = False; + ret = false; goto done; } io.lockx.level = RAW_LOCK_LOCKX; @@ -1126,7 +1126,7 @@ next_run: req = smb_raw_lock_send(cli->tree, &io); if (req == NULL) { printf("Failed to setup timed lock (%s)\n", __location__); - ret = False; + ret = false; goto done; } @@ -1144,7 +1144,7 @@ next_run: if (time(NULL) < start+1) { printf("lock comes back to early (%s)\n", __location__); - ret = False; + ret = false; goto done; } @@ -1153,7 +1153,7 @@ next_run: fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE); if (fnum == -1) { printf("Failed to reopen %s - %s\n", fname, smbcli_errstr(cli->tree)); - ret = False; + ret = false; goto done; } io.lockx.level = RAW_LOCK_LOCKX; @@ -1174,7 +1174,7 @@ next_run: req = smb_raw_lock_send(cli->tree, &io); if (req == NULL) { printf("Failed to setup timed lock (%s)\n", __location__); - ret = False; + ret = false; goto done; } @@ -1194,7 +1194,7 @@ next_run: if (time(NULL) < start+1) { printf("lock comes back to early (%s)\n", __location__); - ret = False; + ret = false; goto done; } @@ -1203,7 +1203,7 @@ next_run: fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE); if (fnum == -1) { printf("Failed to reopen %s - %s\n", fname, smbcli_errstr(cli->tree)); - ret = False; + ret = false; goto done; } io.lockx.level = RAW_LOCK_LOCKX; @@ -1224,7 +1224,7 @@ next_run: req = smb_raw_lock_send(cli->tree, &io); if (req == NULL) { printf("Failed to setup timed lock (%s)\n", __location__); - ret = False; + ret = false; goto done; } @@ -1240,7 +1240,7 @@ next_run: if (time(NULL) < start+1) { printf("lock comes back to early (%s)\n", __location__); - ret = False; + ret = false; goto done; } @@ -1260,13 +1260,13 @@ static bool test_changetype(struct torture_context *tctx, union smb_lock io; struct smb_lock_entry lock[2]; NTSTATUS status; - BOOL ret = True; + bool ret = true; int fnum; uint8_t c = 0; const char *fname = BASEDIR "\\test.txt"; if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } printf("Testing LOCKING_ANDX_CHANGE_LOCKTYPE\n"); @@ -1275,7 +1275,7 @@ static bool test_changetype(struct torture_context *tctx, fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE); if (fnum == -1) { printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree)); - ret = False; + ret = false; goto done; } @@ -1294,7 +1294,7 @@ static bool test_changetype(struct torture_context *tctx, if (smbcli_write(cli->tree, fnum, 0, &c, 100, 1) == 1) { printf("allowed write on read locked region (%s)\n", __location__); - ret = False; + ret = false; goto done; } @@ -1305,7 +1305,7 @@ static bool test_changetype(struct torture_context *tctx, if (smbcli_write(cli->tree, fnum, 0, &c, 100, 1) == 1) { printf("allowed write after lock change (%s)\n", __location__); - ret = False; + ret = false; goto done; } diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index d55a0a012ec..855364b1697 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -189,7 +189,7 @@ static void reopen_connection(struct event_context *ev, struct timed_event *te, io->in.service = share; io->in.service_type = state->service_type; io->in.credentials = cmdline_credentials; - io->in.fallback_to_anonymous = False; + io->in.fallback_to_anonymous = false; io->in.workgroup = lp_workgroup(global_loadparm); /* kill off the remnants of the old connection */ @@ -303,9 +303,9 @@ static void report_rate(struct event_context *ev, struct timed_event *te, /* benchmark locking calls */ -BOOL torture_bench_lock(struct torture_context *torture) +bool torture_bench_lock(struct torture_context *torture) { - BOOL ret = True; + bool ret = true; TALLOC_CTX *mem_ctx = talloc_new(torture); int i; int timelimit = torture_setting_int(torture, "timelimit", 10); @@ -328,7 +328,7 @@ BOOL torture_bench_lock(struct torture_context *torture) state[i].client_num = i; state[i].ev = ev; if (!torture_open_connection_ev(&cli, i, ev)) { - return False; + return false; } talloc_steal(mem_ctx, state); state[i].tree = cli->tree; diff --git a/source4/torture/raw/mkdir.c b/source4/torture/raw/mkdir.c index ad7027938d2..f502b10a693 100644 --- a/source4/torture/raw/mkdir.c +++ b/source4/torture/raw/mkdir.c @@ -30,23 +30,23 @@ if (!NT_STATUS_EQUAL(status, correct)) { \ printf("(%s) Incorrect status %s - should be %s\n", \ __location__, nt_errstr(status), nt_errstr(correct)); \ - ret = False; \ + ret = false; \ goto done; \ }} while (0) /* test mkdir ops */ -static BOOL test_mkdir(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_mkdir(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { union smb_mkdir md; struct smb_rmdir rd; const char *path = BASEDIR "\\mkdir.dir"; NTSTATUS status; - BOOL ret = True; + bool ret = true; if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } /* diff --git a/source4/torture/raw/mux.c b/source4/torture/raw/mux.c index 95ba319eea2..846a9787cb4 100644 --- a/source4/torture/raw/mux.c +++ b/source4/torture/raw/mux.c @@ -30,7 +30,7 @@ if (!NT_STATUS_EQUAL(status, correct)) { \ printf("(%s) Incorrect status %s - should be %s\n", \ __location__, nt_errstr(status), nt_errstr(correct)); \ - ret = False; \ + ret = false; \ goto done; \ }} while (0) @@ -38,12 +38,12 @@ /* test the delayed reply to a open that leads to a sharing violation */ -static BOOL test_mux_open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_mux_open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { union smb_open io; NTSTATUS status; int fnum1, fnum2; - BOOL ret = True; + bool ret = true; struct smbcli_request *req1, *req2; struct timeval tv; double d; @@ -104,7 +104,7 @@ static BOOL test_mux_open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) d = timeval_elapsed(&tv); if (d > 0.25) { printf("bad timeout after cancel - %.2f should be <0.25\n", d); - ret = False; + ret = false; } printf("close the 2nd sync open\n"); @@ -117,7 +117,7 @@ static BOOL test_mux_open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) d = timeval_elapsed(&tv); if (d > 0.25) { printf("bad timeout for async conflict - %.2f should be <0.25\n", d); - ret = False; + ret = false; } else { printf("async open delay %.2f\n", d); } @@ -141,12 +141,12 @@ done: /* test a write that hits a byte range lock and send the close after the write */ -static BOOL test_mux_write(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_mux_write(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { union smb_write io; NTSTATUS status; int fnum; - BOOL ret = True; + bool ret = true; struct smbcli_request *req; printf("testing multiplexed lock/write/close\n"); @@ -154,7 +154,7 @@ static BOOL test_mux_write(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) fnum = smbcli_open(cli->tree, BASEDIR "\\write.dat", O_RDWR | O_CREAT, DENY_NONE); if (fnum == -1) { printf("open failed in mux_write - %s\n", smbcli_errstr(cli->tree)); - ret = False; + ret = false; goto done; } @@ -163,7 +163,7 @@ static BOOL test_mux_write(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) /* lock a range */ if (NT_STATUS_IS_ERR(smbcli_lock(cli->tree, fnum, 0, 4, 0, WRITE_LOCK))) { printf("lock failed in mux_write - %s\n", smbcli_errstr(cli->tree)); - ret = False; + ret = false; goto done; } @@ -197,12 +197,12 @@ done: /* test a lock that conflicts with an existing lock */ -static BOOL test_mux_lock(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_mux_lock(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { union smb_lock io; NTSTATUS status; int fnum; - BOOL ret = True; + bool ret = true; struct smbcli_request *req; struct smb_lock_entry lock[1]; struct timeval t; @@ -212,7 +212,7 @@ static BOOL test_mux_lock(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) fnum = smbcli_open(cli->tree, BASEDIR "\\write.dat", O_RDWR | O_CREAT, DENY_NONE); if (fnum == -1) { printf("open failed in mux_write - %s\n", smbcli_errstr(cli->tree)); - ret = False; + ret = false; goto done; } @@ -256,7 +256,7 @@ static BOOL test_mux_lock(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("async lock took %.2f msec\n", timeval_elapsed(&t) * 1000); if (timeval_elapsed(&t) > 0.1) { printf("failed to trigger early lock retry\n"); - return False; + return false; } printf("reopening with an exit\n"); @@ -330,7 +330,7 @@ static BOOL test_mux_lock(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("async lock exit took %.2f msec\n", timeval_elapsed(&t) * 1000); if (timeval_elapsed(&t) > 0.1) { printf("failed to trigger early lock failure\n"); - return False; + return false; } done: diff --git a/source4/torture/raw/notify.c b/source4/torture/raw/notify.c index d086dcbfde7..96c7e4f9475 100644 --- a/source4/torture/raw/notify.c +++ b/source4/torture/raw/notify.c @@ -31,7 +31,7 @@ if (!NT_STATUS_EQUAL(status, correct)) { \ printf("(%d) Incorrect status %s - should be %s\n", \ __LINE__, nt_errstr(status), nt_errstr(correct)); \ - ret = False; \ + ret = false; \ goto done; \ }} while (0) @@ -40,14 +40,14 @@ if ((v) != (correct)) { \ printf("(%d) wrong value for %s 0x%x should be 0x%x\n", \ __LINE__, #v, (int)v, (int)correct); \ - ret = False; \ + ret = false; \ goto done; \ }} while (0) #define CHECK_WSTR(field, value, flags) do { \ if (!field.s || strcmp(field.s, value) || wire_bad_flags(&field, flags, cli->transport)) { \ printf("(%d) %s [%s] != %s\n", __LINE__, #field, field.s, value); \ - ret = False; \ + ret = false; \ goto done; \ }} while (0) @@ -55,10 +55,10 @@ /* basic testing of change notify on directories */ -static BOOL test_notify_dir(struct smbcli_state *cli, struct smbcli_state *cli2, +static bool test_notify_dir(struct smbcli_state *cli, struct smbcli_state *cli2, TALLOC_CTX *mem_ctx) { - BOOL ret = True; + bool ret = true; NTSTATUS status; union smb_notify notify; union smb_open io; @@ -99,7 +99,7 @@ static BOOL test_notify_dir(struct smbcli_state *cli, struct smbcli_state *cli2, notify.nttrans.in.buffer_size = 1000; notify.nttrans.in.completion_filter = FILE_NOTIFY_CHANGE_NAME; notify.nttrans.in.file.fnum = fnum; - notify.nttrans.in.recursive = True; + notify.nttrans.in.recursive = true; printf("testing notify cancel\n"); @@ -159,7 +159,7 @@ static BOOL test_notify_dir(struct smbcli_state *cli, struct smbcli_state *cli2, if (fnum3 == -1) { printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree)); - ret = False; + ret = false; goto done; } talloc_free(fname); @@ -267,7 +267,7 @@ done: * pair in any of the three following notify_changes. */ -static BOOL check_rename_reply(struct smbcli_state *cli, +static bool check_rename_reply(struct smbcli_state *cli, int line, struct notify_changes *actions, uint32_t action, const char *name) @@ -282,22 +282,22 @@ static BOOL check_rename_reply(struct smbcli_state *cli, cli->transport))) { printf("(%d) name [%s] != %s\n", line, actions[i].name.s, name); - return False; + return false; } - return True; + return true; } } printf("(%d) expected action %d, not found\n", line, action); - return False; + return false; } /* testing of recursive change notify */ -static BOOL test_notify_recursive(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_notify_recursive(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { - BOOL ret = True; + bool ret = true; NTSTATUS status; union smb_notify notify; union smb_open io; @@ -333,10 +333,10 @@ static BOOL test_notify_recursive(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) notify.nttrans.in.completion_filter = FILE_NOTIFY_CHANGE_NAME | FILE_NOTIFY_CHANGE_ATTRIBUTES | FILE_NOTIFY_CHANGE_CREATION; notify.nttrans.in.file.fnum = fnum; - notify.nttrans.in.recursive = True; + notify.nttrans.in.recursive = true; req1 = smb_raw_changenotify_send(cli->tree, ¬ify); - notify.nttrans.in.recursive = False; + notify.nttrans.in.recursive = false; req2 = smb_raw_changenotify_send(cli->tree, ¬ify); /* cancel initial requests so the buffer is setup */ @@ -357,7 +357,7 @@ static BOOL test_notify_recursive(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) smbcli_rename(cli->tree, BASEDIR "\\subname2-r", BASEDIR "\\subname3-r"); notify.nttrans.in.completion_filter = 0; - notify.nttrans.in.recursive = True; + notify.nttrans.in.recursive = true; msleep(200); req1 = smb_raw_changenotify_send(cli->tree, ¬ify); @@ -365,7 +365,7 @@ static BOOL test_notify_recursive(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) smbcli_rmdir(cli->tree, BASEDIR "\\subdir-name"); smbcli_unlink(cli->tree, BASEDIR "\\subname3-r"); - notify.nttrans.in.recursive = False; + notify.nttrans.in.recursive = false; req2 = smb_raw_changenotify_send(cli->tree, ¬ify); status = smb_raw_changenotify_recv(req1, mem_ctx, ¬ify); @@ -426,9 +426,9 @@ done: /* testing of change notify mask change */ -static BOOL test_notify_mask_change(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_notify_mask_change(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { - BOOL ret = True; + bool ret = true; NTSTATUS status; union smb_notify notify; union smb_open io; @@ -464,10 +464,10 @@ static BOOL test_notify_mask_change(struct smbcli_state *cli, TALLOC_CTX *mem_ct notify.nttrans.in.completion_filter = FILE_NOTIFY_CHANGE_ATTRIBUTES; notify.nttrans.in.file.fnum = fnum; - notify.nttrans.in.recursive = True; + notify.nttrans.in.recursive = true; req1 = smb_raw_changenotify_send(cli->tree, ¬ify); - notify.nttrans.in.recursive = False; + notify.nttrans.in.recursive = false; req2 = smb_raw_changenotify_send(cli->tree, ¬ify); /* cancel initial requests so the buffer is setup */ @@ -479,7 +479,7 @@ static BOOL test_notify_mask_change(struct smbcli_state *cli, TALLOC_CTX *mem_ct status = smb_raw_changenotify_recv(req2, mem_ctx, ¬ify); CHECK_STATUS(status, NT_STATUS_CANCELLED); - notify.nttrans.in.recursive = True; + notify.nttrans.in.recursive = true; req1 = smb_raw_changenotify_send(cli->tree, ¬ify); /* Set to hidden then back again. */ @@ -499,10 +499,10 @@ static BOOL test_notify_mask_change(struct smbcli_state *cli, TALLOC_CTX *mem_ct * fnum it seems to be fixed until the fnum is closed. */ notify.nttrans.in.completion_filter = FILE_NOTIFY_CHANGE_NAME | FILE_NOTIFY_CHANGE_ATTRIBUTES | FILE_NOTIFY_CHANGE_CREATION; - notify.nttrans.in.recursive = True; + notify.nttrans.in.recursive = true; req1 = smb_raw_changenotify_send(cli->tree, ¬ify); - notify.nttrans.in.recursive = False; + notify.nttrans.in.recursive = false; req2 = smb_raw_changenotify_send(cli->tree, ¬ify); smbcli_mkdir(cli->tree, BASEDIR "\\subdir-name"); @@ -544,9 +544,9 @@ done: /* testing of mask bits for change notify */ -static BOOL test_notify_mask(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_notify_mask(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { - BOOL ret = True; + bool ret = true; NTSTATUS status; union smb_notify notify; union smb_open io; @@ -580,7 +580,7 @@ static BOOL test_notify_mask(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) notify.nttrans.level = RAW_NOTIFY_NTTRANS; notify.nttrans.in.buffer_size = 1000; - notify.nttrans.in.recursive = True; + notify.nttrans.in.recursive = true; #define NOTIFY_MASK_TEST(setup, op, cleanup, Action, expected, nchanges) \ do { for (mask=i=0;i<32;i++) { \ @@ -611,21 +611,21 @@ static BOOL test_notify_mask(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) nchanges, \ notify.nttrans.out.changes[0].action, \ notify.nttrans.in.completion_filter); \ - ret = False; \ + ret = false; \ } else if (notify.nttrans.out.changes[0].action != Action) { \ printf("ERROR: nchanges=%d action=%d expectedAction=%d filter=0x%08x\n", \ notify.nttrans.out.num_changes, \ notify.nttrans.out.changes[0].action, \ Action, \ notify.nttrans.in.completion_filter); \ - ret = False; \ + ret = false; \ } else if (strcmp(notify.nttrans.out.changes[0].name.s, "tname1") != 0) { \ printf("ERROR: nchanges=%d action=%d filter=0x%08x name=%s\n", \ notify.nttrans.out.num_changes, \ notify.nttrans.out.changes[0].action, \ notify.nttrans.in.completion_filter, \ notify.nttrans.out.changes[0].name.s); \ - ret = False; \ + ret = false; \ } \ mask |= (1<tree, ¬ify); @@ -898,9 +898,9 @@ done: /* basic testing of change notifies followed by a exit */ -static BOOL test_notify_exit(TALLOC_CTX *mem_ctx) +static bool test_notify_exit(TALLOC_CTX *mem_ctx) { - BOOL ret = True; + bool ret = true; NTSTATUS status; union smb_notify notify; union smb_open io; @@ -911,7 +911,7 @@ static BOOL test_notify_exit(TALLOC_CTX *mem_ctx) printf("TESTING CHANGE NOTIFY FOLLOWED BY EXIT\n"); if (!torture_open_connection(&cli, 0)) { - return False; + return false; } /* @@ -940,7 +940,7 @@ static BOOL test_notify_exit(TALLOC_CTX *mem_ctx) notify.nttrans.in.buffer_size = 1000; notify.nttrans.in.completion_filter = FILE_NOTIFY_CHANGE_NAME; notify.nttrans.in.file.fnum = fnum; - notify.nttrans.in.recursive = True; + notify.nttrans.in.recursive = true; req = smb_raw_changenotify_send(cli->tree, ¬ify); @@ -959,9 +959,9 @@ done: /* basic testing of change notifies followed by a ulogoff */ -static BOOL test_notify_ulogoff(TALLOC_CTX *mem_ctx) +static bool test_notify_ulogoff(TALLOC_CTX *mem_ctx) { - BOOL ret = True; + bool ret = true; NTSTATUS status; union smb_notify notify; union smb_open io; @@ -972,7 +972,7 @@ static BOOL test_notify_ulogoff(TALLOC_CTX *mem_ctx) printf("TESTING CHANGE NOTIFY FOLLOWED BY ULOGOFF\n"); if (!torture_open_connection(&cli, 0)) { - return False; + return false; } /* @@ -1001,7 +1001,7 @@ static BOOL test_notify_ulogoff(TALLOC_CTX *mem_ctx) notify.nttrans.in.buffer_size = 1000; notify.nttrans.in.completion_filter = FILE_NOTIFY_CHANGE_NAME; notify.nttrans.in.file.fnum = fnum; - notify.nttrans.in.recursive = True; + notify.nttrans.in.recursive = true; req = smb_raw_changenotify_send(cli->tree, ¬ify); @@ -1027,9 +1027,9 @@ static void tcp_dis_handler(struct smbcli_transport *t, void *p) /* basic testing of change notifies followed by tcp disconnect */ -static BOOL test_notify_tcp_dis(TALLOC_CTX *mem_ctx) +static bool test_notify_tcp_dis(TALLOC_CTX *mem_ctx) { - BOOL ret = True; + bool ret = true; NTSTATUS status; union smb_notify notify; union smb_open io; @@ -1040,7 +1040,7 @@ static BOOL test_notify_tcp_dis(TALLOC_CTX *mem_ctx) printf("TESTING CHANGE NOTIFY FOLLOWED BY TCP DISCONNECT\n"); if (!torture_open_connection(&cli, 0)) { - return False; + return false; } /* @@ -1069,7 +1069,7 @@ static BOOL test_notify_tcp_dis(TALLOC_CTX *mem_ctx) notify.nttrans.in.buffer_size = 1000; notify.nttrans.in.completion_filter = FILE_NOTIFY_CHANGE_NAME; notify.nttrans.in.file.fnum = fnum; - notify.nttrans.in.recursive = True; + notify.nttrans.in.recursive = true; req = smb_raw_changenotify_send(cli->tree, ¬ify); @@ -1086,9 +1086,9 @@ done: /* test setting up two change notify requests on one handle */ -static BOOL test_notify_double(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_notify_double(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { - BOOL ret = True; + bool ret = true; NTSTATUS status; union smb_notify notify; union smb_open io; @@ -1123,7 +1123,7 @@ static BOOL test_notify_double(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) notify.nttrans.in.buffer_size = 1000; notify.nttrans.in.completion_filter = FILE_NOTIFY_CHANGE_NAME; notify.nttrans.in.file.fnum = fnum; - notify.nttrans.in.recursive = True; + notify.nttrans.in.recursive = true; req1 = smb_raw_changenotify_send(cli->tree, ¬ify); req2 = smb_raw_changenotify_send(cli->tree, ¬ify); @@ -1151,45 +1151,45 @@ done: /* test multiple change notifies at different depths and with/without recursion */ -static BOOL test_notify_tree(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_notify_tree(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { - BOOL ret = True; + bool ret = true; union smb_notify notify; union smb_open io; struct smbcli_request *req; struct timeval tv; struct { const char *path; - BOOL recursive; + bool recursive; uint32_t filter; int expected; int fnum; int counted; } dirs[] = { - {BASEDIR "\\abc", True, FILE_NOTIFY_CHANGE_NAME, 30 }, - {BASEDIR "\\zqy", True, FILE_NOTIFY_CHANGE_NAME, 8 }, - {BASEDIR "\\atsy", True, FILE_NOTIFY_CHANGE_NAME, 4 }, - {BASEDIR "\\abc\\foo", True, FILE_NOTIFY_CHANGE_NAME, 2 }, - {BASEDIR "\\abc\\blah", True, FILE_NOTIFY_CHANGE_NAME, 13 }, - {BASEDIR "\\abc\\blah", False, FILE_NOTIFY_CHANGE_NAME, 7 }, - {BASEDIR "\\abc\\blah\\a", True, FILE_NOTIFY_CHANGE_NAME, 2 }, - {BASEDIR "\\abc\\blah\\b", True, FILE_NOTIFY_CHANGE_NAME, 2 }, - {BASEDIR "\\abc\\blah\\c", True, FILE_NOTIFY_CHANGE_NAME, 2 }, - {BASEDIR "\\abc\\fooblah", True, FILE_NOTIFY_CHANGE_NAME, 2 }, - {BASEDIR "\\zqy\\xx", True, FILE_NOTIFY_CHANGE_NAME, 2 }, - {BASEDIR "\\zqy\\yyy", True, FILE_NOTIFY_CHANGE_NAME, 2 }, - {BASEDIR "\\zqy\\..", True, FILE_NOTIFY_CHANGE_NAME, 40 }, - {BASEDIR, True, FILE_NOTIFY_CHANGE_NAME, 40 }, - {BASEDIR, False,FILE_NOTIFY_CHANGE_NAME, 6 }, - {BASEDIR "\\atsy", False,FILE_NOTIFY_CHANGE_NAME, 4 }, - {BASEDIR "\\abc", True, FILE_NOTIFY_CHANGE_NAME, 24 }, - {BASEDIR "\\abc", False,FILE_NOTIFY_CHANGE_FILE_NAME, 0 }, - {BASEDIR "\\abc", True, FILE_NOTIFY_CHANGE_FILE_NAME, 0 }, - {BASEDIR "\\abc", True, FILE_NOTIFY_CHANGE_NAME, 24 }, + {BASEDIR "\\abc", true, FILE_NOTIFY_CHANGE_NAME, 30 }, + {BASEDIR "\\zqy", true, FILE_NOTIFY_CHANGE_NAME, 8 }, + {BASEDIR "\\atsy", true, FILE_NOTIFY_CHANGE_NAME, 4 }, + {BASEDIR "\\abc\\foo", true, FILE_NOTIFY_CHANGE_NAME, 2 }, + {BASEDIR "\\abc\\blah", true, FILE_NOTIFY_CHANGE_NAME, 13 }, + {BASEDIR "\\abc\\blah", false, FILE_NOTIFY_CHANGE_NAME, 7 }, + {BASEDIR "\\abc\\blah\\a", true, FILE_NOTIFY_CHANGE_NAME, 2 }, + {BASEDIR "\\abc\\blah\\b", true, FILE_NOTIFY_CHANGE_NAME, 2 }, + {BASEDIR "\\abc\\blah\\c", true, FILE_NOTIFY_CHANGE_NAME, 2 }, + {BASEDIR "\\abc\\fooblah", true, FILE_NOTIFY_CHANGE_NAME, 2 }, + {BASEDIR "\\zqy\\xx", true, FILE_NOTIFY_CHANGE_NAME, 2 }, + {BASEDIR "\\zqy\\yyy", true, FILE_NOTIFY_CHANGE_NAME, 2 }, + {BASEDIR "\\zqy\\..", true, FILE_NOTIFY_CHANGE_NAME, 40 }, + {BASEDIR, true, FILE_NOTIFY_CHANGE_NAME, 40 }, + {BASEDIR, false,FILE_NOTIFY_CHANGE_NAME, 6 }, + {BASEDIR "\\atsy", false,FILE_NOTIFY_CHANGE_NAME, 4 }, + {BASEDIR "\\abc", true, FILE_NOTIFY_CHANGE_NAME, 24 }, + {BASEDIR "\\abc", false,FILE_NOTIFY_CHANGE_FILE_NAME, 0 }, + {BASEDIR "\\abc", true, FILE_NOTIFY_CHANGE_FILE_NAME, 0 }, + {BASEDIR "\\abc", true, FILE_NOTIFY_CHANGE_NAME, 24 }, }; int i; NTSTATUS status; - BOOL all_done = False; + bool all_done = false; printf("TESTING CHANGE NOTIFY FOR DIFFERENT DEPTHS\n"); @@ -1248,11 +1248,11 @@ static BOOL test_notify_tree(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) dirs[i].counted += notify.nttrans.out.num_changes; } - all_done = True; + all_done = true; for (i=0;itree)); \ - ret = False; \ + ret = false; \ goto done; \ }} while (0) @@ -84,7 +84,7 @@ static const char *rdwr_string(enum rdwr_mode m) if (m != correct) { \ printf("(%s) Incorrect readwrite mode %s - expected %s\n", \ __location__, rdwr_string(m), rdwr_string(correct)); \ - ret = False; \ + ret = false; \ }} while (0) #define CHECK_TIME(t, field) do { \ @@ -101,7 +101,7 @@ static const char *rdwr_string(enum rdwr_mode m) timestring(mem_ctx, t1), \ timestring(mem_ctx, t2)); \ dump_all_info(mem_ctx, &finfo); \ - ret = False; \ + ret = false; \ }} while (0) #define CHECK_NTTIME(t, field) do { \ @@ -117,7 +117,7 @@ static const char *rdwr_string(enum rdwr_mode m) nt_time_string(mem_ctx, t), \ nt_time_string(mem_ctx, t2)); \ dump_all_info(mem_ctx, &finfo); \ - ret = False; \ + ret = false; \ }} while (0) #define CHECK_ALL_INFO(v, field) do { \ @@ -129,14 +129,14 @@ static const char *rdwr_string(enum rdwr_mode m) printf("(%s) wrong value for field %s 0x%x - 0x%x\n", \ __location__, #field, (int)v, (int)(finfo.all_info.out.field)); \ dump_all_info(mem_ctx, &finfo); \ - ret = False; \ + ret = false; \ }} while (0) #define CHECK_VAL(v, correct) do { \ if ((v) != (correct)) { \ printf("(%s) wrong value for %s 0x%x - should be 0x%x\n", \ __location__, #v, (int)(v), (int)correct); \ - ret = False; \ + ret = false; \ }} while (0) #define SET_ATTRIB(sattrib) do { \ @@ -154,14 +154,14 @@ static const char *rdwr_string(enum rdwr_mode m) /* test RAW_OPEN_OPEN */ -static BOOL test_open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { union smb_open io; union smb_fileinfo finfo; const char *fname = BASEDIR "\\torture_open.txt"; NTSTATUS status; int fnum = -1, fnum2; - BOOL ret = True; + bool ret = true; printf("Checking RAW_OPEN_OPEN\n"); @@ -265,7 +265,7 @@ done: /* test RAW_OPEN_OPENX */ -static BOOL test_openx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_openx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { union smb_open io; union smb_fileinfo finfo; @@ -273,26 +273,26 @@ static BOOL test_openx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) const char *fname_exe = BASEDIR "\\torture_openx.exe"; NTSTATUS status; int fnum = -1, fnum2; - BOOL ret = True; + bool ret = true; int i; struct timeval tv; struct { uint16_t open_func; - BOOL with_file; + bool with_file; NTSTATUS correct_status; } open_funcs[] = { - { OPENX_OPEN_FUNC_OPEN, True, NT_STATUS_OK }, - { OPENX_OPEN_FUNC_OPEN, False, NT_STATUS_OBJECT_NAME_NOT_FOUND }, - { OPENX_OPEN_FUNC_OPEN | OPENX_OPEN_FUNC_CREATE, True, NT_STATUS_OK }, - { OPENX_OPEN_FUNC_OPEN | OPENX_OPEN_FUNC_CREATE, False, NT_STATUS_OK }, - { OPENX_OPEN_FUNC_FAIL, True, NT_STATUS_DOS(ERRDOS, ERRbadaccess) }, - { OPENX_OPEN_FUNC_FAIL, False, NT_STATUS_DOS(ERRDOS, ERRbadaccess) }, - { OPENX_OPEN_FUNC_FAIL | OPENX_OPEN_FUNC_CREATE, True, NT_STATUS_OBJECT_NAME_COLLISION }, - { OPENX_OPEN_FUNC_FAIL | OPENX_OPEN_FUNC_CREATE, False, NT_STATUS_OK }, - { OPENX_OPEN_FUNC_TRUNC, True, NT_STATUS_OK }, - { OPENX_OPEN_FUNC_TRUNC, False, NT_STATUS_OBJECT_NAME_NOT_FOUND }, - { OPENX_OPEN_FUNC_TRUNC | OPENX_OPEN_FUNC_CREATE, True, NT_STATUS_OK }, - { OPENX_OPEN_FUNC_TRUNC | OPENX_OPEN_FUNC_CREATE, False, NT_STATUS_OK }, + { OPENX_OPEN_FUNC_OPEN, true, NT_STATUS_OK }, + { OPENX_OPEN_FUNC_OPEN, false, NT_STATUS_OBJECT_NAME_NOT_FOUND }, + { OPENX_OPEN_FUNC_OPEN | OPENX_OPEN_FUNC_CREATE, true, NT_STATUS_OK }, + { OPENX_OPEN_FUNC_OPEN | OPENX_OPEN_FUNC_CREATE, false, NT_STATUS_OK }, + { OPENX_OPEN_FUNC_FAIL, true, NT_STATUS_DOS(ERRDOS, ERRbadaccess) }, + { OPENX_OPEN_FUNC_FAIL, false, NT_STATUS_DOS(ERRDOS, ERRbadaccess) }, + { OPENX_OPEN_FUNC_FAIL | OPENX_OPEN_FUNC_CREATE, true, NT_STATUS_OBJECT_NAME_COLLISION }, + { OPENX_OPEN_FUNC_FAIL | OPENX_OPEN_FUNC_CREATE, false, NT_STATUS_OK }, + { OPENX_OPEN_FUNC_TRUNC, true, NT_STATUS_OK }, + { OPENX_OPEN_FUNC_TRUNC, false, NT_STATUS_OBJECT_NAME_NOT_FOUND }, + { OPENX_OPEN_FUNC_TRUNC | OPENX_OPEN_FUNC_CREATE, true, NT_STATUS_OK }, + { OPENX_OPEN_FUNC_TRUNC | OPENX_OPEN_FUNC_CREATE, false, NT_STATUS_OK }, }; printf("Checking RAW_OPEN_OPENX\n"); @@ -314,7 +314,7 @@ static BOOL test_openx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) fnum = create_complex_file(cli, mem_ctx, fname); if (fnum == -1) { d_printf("Failed to create file %s - %s\n", fname, smbcli_errstr(cli->tree)); - ret = False; + ret = false; goto done; } smbcli_close(cli->tree, fnum); @@ -325,7 +325,7 @@ static BOOL test_openx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("(%s) incorrect status %s should be %s (i=%d with_file=%d open_func=0x%x)\n", __location__, nt_errstr(status), nt_errstr(open_funcs[i].correct_status), i, (int)open_funcs[i].with_file, (int)open_funcs[i].open_func); - ret = False; + ret = false; } if (NT_STATUS_IS_OK(status)) { smbcli_close(cli->tree, io.openx.out.file.fnum); @@ -358,7 +358,7 @@ static BOOL test_openx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) /* check the fields when the file already existed */ fnum2 = create_complex_file(cli, mem_ctx, fname); if (fnum2 == -1) { - ret = False; + ret = false; goto done; } smbcli_close(cli->tree, fnum2); @@ -426,7 +426,7 @@ static BOOL test_openx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) if (timeval_elapsed(&tv) > 3.0) { printf("(%s) Incorrect timing in openx with timeout - waited %.2f seconds\n", __location__, timeval_elapsed(&tv)); - ret = False; + ret = false; } smbcli_close(cli->tree, fnum); smbcli_unlink(cli->tree, fname); @@ -495,7 +495,7 @@ done: many thanks to kukks for a sniff showing how this works with os2->w2k */ -static BOOL test_t2open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_t2open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { union smb_open io; union smb_fileinfo finfo; @@ -504,31 +504,31 @@ static BOOL test_t2open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) const char *fname = BASEDIR "\\torture_t2open_3.txt"; NTSTATUS status; int fnum; - BOOL ret = True; + bool ret = true; int i; struct { uint16_t open_func; - BOOL with_file; + bool with_file; NTSTATUS correct_status; } open_funcs[] = { - { OPENX_OPEN_FUNC_OPEN, True, NT_STATUS_OK }, - { OPENX_OPEN_FUNC_OPEN, False, NT_STATUS_OBJECT_NAME_NOT_FOUND }, - { OPENX_OPEN_FUNC_OPEN | OPENX_OPEN_FUNC_CREATE, True, NT_STATUS_OK }, - { OPENX_OPEN_FUNC_OPEN | OPENX_OPEN_FUNC_CREATE, False, NT_STATUS_OK }, - { OPENX_OPEN_FUNC_FAIL, True, NT_STATUS_OBJECT_NAME_COLLISION }, - { OPENX_OPEN_FUNC_FAIL, False, NT_STATUS_OBJECT_NAME_COLLISION }, - { OPENX_OPEN_FUNC_FAIL | OPENX_OPEN_FUNC_CREATE, True, NT_STATUS_OBJECT_NAME_COLLISION }, - { OPENX_OPEN_FUNC_FAIL | OPENX_OPEN_FUNC_CREATE, False, NT_STATUS_OBJECT_NAME_COLLISION }, - { OPENX_OPEN_FUNC_TRUNC, True, NT_STATUS_OK }, - { OPENX_OPEN_FUNC_TRUNC, False, NT_STATUS_OK }, - { OPENX_OPEN_FUNC_TRUNC | OPENX_OPEN_FUNC_CREATE, True, NT_STATUS_OK }, - { OPENX_OPEN_FUNC_TRUNC | OPENX_OPEN_FUNC_CREATE, False, NT_STATUS_OK }, + { OPENX_OPEN_FUNC_OPEN, true, NT_STATUS_OK }, + { OPENX_OPEN_FUNC_OPEN, false, NT_STATUS_OBJECT_NAME_NOT_FOUND }, + { OPENX_OPEN_FUNC_OPEN | OPENX_OPEN_FUNC_CREATE, true, NT_STATUS_OK }, + { OPENX_OPEN_FUNC_OPEN | OPENX_OPEN_FUNC_CREATE, false, NT_STATUS_OK }, + { OPENX_OPEN_FUNC_FAIL, true, NT_STATUS_OBJECT_NAME_COLLISION }, + { OPENX_OPEN_FUNC_FAIL, false, NT_STATUS_OBJECT_NAME_COLLISION }, + { OPENX_OPEN_FUNC_FAIL | OPENX_OPEN_FUNC_CREATE, true, NT_STATUS_OBJECT_NAME_COLLISION }, + { OPENX_OPEN_FUNC_FAIL | OPENX_OPEN_FUNC_CREATE, false, NT_STATUS_OBJECT_NAME_COLLISION }, + { OPENX_OPEN_FUNC_TRUNC, true, NT_STATUS_OK }, + { OPENX_OPEN_FUNC_TRUNC, false, NT_STATUS_OK }, + { OPENX_OPEN_FUNC_TRUNC | OPENX_OPEN_FUNC_CREATE, true, NT_STATUS_OK }, + { OPENX_OPEN_FUNC_TRUNC | OPENX_OPEN_FUNC_CREATE, false, NT_STATUS_OK }, }; fnum = create_complex_file(cli, mem_ctx, fname1); if (fnum == -1) { d_printf("Failed to create file %s - %s\n", fname1, smbcli_errstr(cli->tree)); - ret = False; + ret = false; goto done; } smbcli_close(cli->tree, fnum); @@ -580,7 +580,7 @@ static BOOL test_t2open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("(%s) incorrect status %s should be %s (i=%d with_file=%d open_func=0x%x)\n", __location__, nt_errstr(status), nt_errstr(open_funcs[i].correct_status), i, (int)open_funcs[i].with_file, (int)open_funcs[i].open_func); - ret = False; + ret = false; } if (NT_STATUS_IS_OK(status)) { smbcli_close(cli->tree, io.t2open.out.file.fnum); @@ -660,7 +660,7 @@ done: /* test RAW_OPEN_NTCREATEX */ -static BOOL test_ntcreatex(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_ntcreatex(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { union smb_open io; union smb_fileinfo finfo; @@ -668,27 +668,27 @@ static BOOL test_ntcreatex(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) const char *dname = BASEDIR "\\torture_ntcreatex.dir"; NTSTATUS status; int fnum = -1; - BOOL ret = True; + bool ret = true; int i; struct { uint32_t open_disp; - BOOL with_file; + bool with_file; NTSTATUS correct_status; } open_funcs[] = { - { NTCREATEX_DISP_SUPERSEDE, True, NT_STATUS_OK }, - { NTCREATEX_DISP_SUPERSEDE, False, NT_STATUS_OK }, - { NTCREATEX_DISP_OPEN, True, NT_STATUS_OK }, - { NTCREATEX_DISP_OPEN, False, NT_STATUS_OBJECT_NAME_NOT_FOUND }, - { NTCREATEX_DISP_CREATE, True, NT_STATUS_OBJECT_NAME_COLLISION }, - { NTCREATEX_DISP_CREATE, False, NT_STATUS_OK }, - { NTCREATEX_DISP_OPEN_IF, True, NT_STATUS_OK }, - { NTCREATEX_DISP_OPEN_IF, False, NT_STATUS_OK }, - { NTCREATEX_DISP_OVERWRITE, True, NT_STATUS_OK }, - { NTCREATEX_DISP_OVERWRITE, False, NT_STATUS_OBJECT_NAME_NOT_FOUND }, - { NTCREATEX_DISP_OVERWRITE_IF, True, NT_STATUS_OK }, - { NTCREATEX_DISP_OVERWRITE_IF, False, NT_STATUS_OK }, - { 6, True, NT_STATUS_INVALID_PARAMETER }, - { 6, False, NT_STATUS_INVALID_PARAMETER }, + { NTCREATEX_DISP_SUPERSEDE, true, NT_STATUS_OK }, + { NTCREATEX_DISP_SUPERSEDE, false, NT_STATUS_OK }, + { NTCREATEX_DISP_OPEN, true, NT_STATUS_OK }, + { NTCREATEX_DISP_OPEN, false, NT_STATUS_OBJECT_NAME_NOT_FOUND }, + { NTCREATEX_DISP_CREATE, true, NT_STATUS_OBJECT_NAME_COLLISION }, + { NTCREATEX_DISP_CREATE, false, NT_STATUS_OK }, + { NTCREATEX_DISP_OPEN_IF, true, NT_STATUS_OK }, + { NTCREATEX_DISP_OPEN_IF, false, NT_STATUS_OK }, + { NTCREATEX_DISP_OVERWRITE, true, NT_STATUS_OK }, + { NTCREATEX_DISP_OVERWRITE, false, NT_STATUS_OBJECT_NAME_NOT_FOUND }, + { NTCREATEX_DISP_OVERWRITE_IF, true, NT_STATUS_OK }, + { NTCREATEX_DISP_OVERWRITE_IF, false, NT_STATUS_OK }, + { 6, true, NT_STATUS_INVALID_PARAMETER }, + { 6, false, NT_STATUS_INVALID_PARAMETER }, }; printf("Checking RAW_OPEN_NTCREATEX\n"); @@ -713,7 +713,7 @@ static BOOL test_ntcreatex(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) fnum = smbcli_open(cli->tree, fname, O_CREAT|O_RDWR|O_TRUNC, DENY_NONE); if (fnum == -1) { d_printf("Failed to create file %s - %s\n", fname, smbcli_errstr(cli->tree)); - ret = False; + ret = false; goto done; } smbcli_close(cli->tree, fnum); @@ -724,7 +724,7 @@ static BOOL test_ntcreatex(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("(%s) incorrect status %s should be %s (i=%d with_file=%d open_disp=%d)\n", __location__, nt_errstr(status), nt_errstr(open_funcs[i].correct_status), i, (int)open_funcs[i].with_file, (int)open_funcs[i].open_disp); - ret = False; + ret = false; } if (NT_STATUS_IS_OK(status) || open_funcs[i].with_file) { smbcli_close(cli->tree, io.ntcreatex.out.file.fnum); @@ -756,7 +756,7 @@ static BOOL test_ntcreatex(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) smbcli_unlink(cli->tree, fname); fnum = create_complex_file(cli, mem_ctx, fname); if (fnum == -1) { - ret = False; + ret = false; goto done; } smbcli_close(cli->tree, fnum); @@ -833,7 +833,7 @@ done: /* test RAW_OPEN_NTTRANS_CREATE */ -static BOOL test_nttrans_create(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_nttrans_create(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { union smb_open io; union smb_fileinfo finfo; @@ -841,27 +841,27 @@ static BOOL test_nttrans_create(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) const char *dname = BASEDIR "\\torture_ntcreatex.dir"; NTSTATUS status; int fnum = -1; - BOOL ret = True; + bool ret = true; int i; struct { uint32_t open_disp; - BOOL with_file; + bool with_file; NTSTATUS correct_status; } open_funcs[] = { - { NTCREATEX_DISP_SUPERSEDE, True, NT_STATUS_OK }, - { NTCREATEX_DISP_SUPERSEDE, False, NT_STATUS_OK }, - { NTCREATEX_DISP_OPEN, True, NT_STATUS_OK }, - { NTCREATEX_DISP_OPEN, False, NT_STATUS_OBJECT_NAME_NOT_FOUND }, - { NTCREATEX_DISP_CREATE, True, NT_STATUS_OBJECT_NAME_COLLISION }, - { NTCREATEX_DISP_CREATE, False, NT_STATUS_OK }, - { NTCREATEX_DISP_OPEN_IF, True, NT_STATUS_OK }, - { NTCREATEX_DISP_OPEN_IF, False, NT_STATUS_OK }, - { NTCREATEX_DISP_OVERWRITE, True, NT_STATUS_OK }, - { NTCREATEX_DISP_OVERWRITE, False, NT_STATUS_OBJECT_NAME_NOT_FOUND }, - { NTCREATEX_DISP_OVERWRITE_IF, True, NT_STATUS_OK }, - { NTCREATEX_DISP_OVERWRITE_IF, False, NT_STATUS_OK }, - { 6, True, NT_STATUS_INVALID_PARAMETER }, - { 6, False, NT_STATUS_INVALID_PARAMETER }, + { NTCREATEX_DISP_SUPERSEDE, true, NT_STATUS_OK }, + { NTCREATEX_DISP_SUPERSEDE, false, NT_STATUS_OK }, + { NTCREATEX_DISP_OPEN, true, NT_STATUS_OK }, + { NTCREATEX_DISP_OPEN, false, NT_STATUS_OBJECT_NAME_NOT_FOUND }, + { NTCREATEX_DISP_CREATE, true, NT_STATUS_OBJECT_NAME_COLLISION }, + { NTCREATEX_DISP_CREATE, false, NT_STATUS_OK }, + { NTCREATEX_DISP_OPEN_IF, true, NT_STATUS_OK }, + { NTCREATEX_DISP_OPEN_IF, false, NT_STATUS_OK }, + { NTCREATEX_DISP_OVERWRITE, true, NT_STATUS_OK }, + { NTCREATEX_DISP_OVERWRITE, false, NT_STATUS_OBJECT_NAME_NOT_FOUND }, + { NTCREATEX_DISP_OVERWRITE_IF, true, NT_STATUS_OK }, + { NTCREATEX_DISP_OVERWRITE_IF, false, NT_STATUS_OK }, + { 6, true, NT_STATUS_INVALID_PARAMETER }, + { 6, false, NT_STATUS_INVALID_PARAMETER }, }; printf("Checking RAW_OPEN_NTTRANS_CREATE\n"); @@ -888,7 +888,7 @@ static BOOL test_nttrans_create(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) fnum = smbcli_open(cli->tree, fname, O_CREAT|O_RDWR|O_TRUNC, DENY_NONE); if (fnum == -1) { d_printf("Failed to create file %s - %s\n", fname, smbcli_errstr(cli->tree)); - ret = False; + ret = false; goto done; } smbcli_close(cli->tree, fnum); @@ -899,7 +899,7 @@ static BOOL test_nttrans_create(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("(%s) incorrect status %s should be %s (i=%d with_file=%d open_disp=%d)\n", __location__, nt_errstr(status), nt_errstr(open_funcs[i].correct_status), i, (int)open_funcs[i].with_file, (int)open_funcs[i].open_disp); - ret = False; + ret = false; } if (NT_STATUS_IS_OK(status) || open_funcs[i].with_file) { smbcli_close(cli->tree, io.ntcreatex.out.file.fnum); @@ -931,7 +931,7 @@ static BOOL test_nttrans_create(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) smbcli_unlink(cli->tree, fname); fnum = create_complex_file(cli, mem_ctx, fname); if (fnum == -1) { - ret = False; + ret = false; goto done; } smbcli_close(cli->tree, fnum); @@ -1012,14 +1012,14 @@ done: open_disposition==NTCREATEX_DISP_OVERWRITE_IF. Windows 2003 allows the second open. */ -static BOOL test_ntcreatex_brlocked(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_ntcreatex_brlocked(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { union smb_open io, io1; union smb_lock io2; struct smb_lock_entry lock[1]; const char *fname = BASEDIR "\\torture_ntcreatex.txt"; NTSTATUS status; - BOOL ret = True; + bool ret = true; printf("Testing ntcreatex with a byte range locked file\n"); @@ -1082,13 +1082,13 @@ static BOOL test_ntcreatex_brlocked(struct smbcli_state *cli, TALLOC_CTX *mem_ct /* test RAW_OPEN_MKNEW */ -static BOOL test_mknew(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_mknew(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { union smb_open io; const char *fname = BASEDIR "\\torture_mknew.txt"; NTSTATUS status; int fnum = -1; - BOOL ret = True; + bool ret = true; time_t basetime = (time(NULL) + 3600*24*3) & ~1; union smb_fileinfo finfo; @@ -1137,13 +1137,13 @@ done: /* test RAW_OPEN_CREATE */ -static BOOL test_create(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_create(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { union smb_open io; const char *fname = BASEDIR "\\torture_create.txt"; NTSTATUS status; int fnum = -1; - BOOL ret = True; + bool ret = true; time_t basetime = (time(NULL) + 3600*24*3) & ~1; union smb_fileinfo finfo; @@ -1193,12 +1193,12 @@ done: /* test RAW_OPEN_CTEMP */ -static BOOL test_ctemp(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_ctemp(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { union smb_open io; NTSTATUS status; int fnum = -1; - BOOL ret = True; + bool ret = true; time_t basetime = (time(NULL) + 3600*24*3) & ~1; union smb_fileinfo finfo; const char *name, *fname = NULL; @@ -1236,13 +1236,13 @@ done: /* test chained RAW_OPEN_OPENX_READX */ -static BOOL test_chained(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_chained(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { union smb_open io; const char *fname = BASEDIR "\\torture_chained.txt"; NTSTATUS status; int fnum = -1; - BOOL ret = True; + bool ret = true; const char *buf = "test"; char buf2[4]; @@ -1278,7 +1278,7 @@ static BOOL test_chained(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) if (memcmp(buf, buf2, sizeof(buf)) != 0) { d_printf("wrong data in reply buffer\n"); - ret = False; + ret = false; } done: @@ -1293,13 +1293,13 @@ done: NetApp filers are known to fail on this. */ -static BOOL test_no_leading_slash(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_no_leading_slash(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { union smb_open io; const char *fname = BASEDIR "\\torture_no_leading_slash.txt"; NTSTATUS status; int fnum = -1; - BOOL ret = True; + bool ret = true; const char *buf = "test"; printf("Checking RAW_OPEN_OPENX without leading slash on path\n"); @@ -1335,13 +1335,13 @@ done: /* A little torture test to expose a race condition in Samba 3.0.20 ... :-) */ -static BOOL test_raw_open_multi(void) +static bool test_raw_open_multi(void) { struct smbcli_state *cli; TALLOC_CTX *mem_ctx = talloc_init("torture_test_oplock_multi"); const char *fname = "\\test_oplock.dat"; NTSTATUS status; - BOOL ret = True; + bool ret = true; union smb_open io; struct smbcli_state **clients; struct smbcli_request **requests; @@ -1360,11 +1360,11 @@ static BOOL test_raw_open_multi(void) if ((ev == NULL) || (clients == NULL) || (requests == NULL) || (ios == NULL)) { DEBUG(0, ("talloc failed\n")); - return False; + return false; } if (!torture_open_connection_share(mem_ctx, &cli, host, share, ev)) { - return False; + return false; } cli->tree->session->transport->options.request_timeout = 60000; @@ -1373,7 +1373,7 @@ static BOOL test_raw_open_multi(void) if (!torture_open_connection_share(mem_ctx, &(clients[i]), host, share, ev)) { DEBUG(0, ("Could not open %d'th connection\n", i)); - return False; + return false; } clients[i]->tree->session->transport-> options.request_timeout = 60000; @@ -1405,19 +1405,19 @@ static BOOL test_raw_open_multi(void) requests[i] = smb_raw_open_send(clients[i]->tree, &ios[i]); if (requests[i] == NULL) { DEBUG(0, ("could not send %d'th request\n", i)); - return False; + return false; } } DEBUG(10, ("waiting for replies\n")); while (1) { - BOOL unreplied = False; + bool unreplied = false; for (i=0; istate < SMBCLI_REQUEST_DONE) { - unreplied = True; + unreplied = true; break; } status = smb_raw_open_recv(requests[i], mem_ctx, @@ -1443,12 +1443,12 @@ static BOOL test_raw_open_multi(void) if (event_loop_once(ev) != 0) { DEBUG(0, ("event_loop_once failed\n")); - return False; + return false; } } if ((num_ok != 1) || (num_ok + num_collision != num_files)) { - ret = False; + ret = false; } for (i=0; iin.service = share; io->in.service_type = state->service_type; io->in.credentials = cmdline_credentials; - io->in.fallback_to_anonymous = False; + io->in.fallback_to_anonymous = false; io->in.workgroup = lp_workgroup(global_loadparm); /* kill off the remnants of the old connection */ @@ -338,9 +338,9 @@ static void report_rate(struct event_context *ev, struct timed_event *te, /* benchmark open calls */ -BOOL torture_bench_open(struct torture_context *torture) +bool torture_bench_open(struct torture_context *torture) { - BOOL ret = True; + bool ret = true; TALLOC_CTX *mem_ctx = talloc_new(torture); int i; int timelimit = torture_setting_int(torture, "timelimit", 10); @@ -348,7 +348,7 @@ BOOL torture_bench_open(struct torture_context *torture) struct event_context *ev = event_context_find(mem_ctx); struct benchopen_state *state; int total = 0, minops=0; - bool progress=False; + bool progress=false; progress = torture_setting_bool(torture, "progress", true); @@ -362,7 +362,7 @@ BOOL torture_bench_open(struct torture_context *torture) state[i].client_num = i; state[i].ev = ev; if (!torture_open_connection_ev(&state[i].cli, i, ev)) { - return False; + return false; } talloc_steal(mem_ctx, state); state[i].tree = state[i].cli->tree; @@ -438,5 +438,5 @@ BOOL torture_bench_open(struct torture_context *torture) failed: talloc_free(mem_ctx); - return False; + return false; } diff --git a/source4/torture/raw/oplock.c b/source4/torture/raw/oplock.c index ad7676dcac1..1f44f96b44c 100644 --- a/source4/torture/raw/oplock.c +++ b/source4/torture/raw/oplock.c @@ -29,14 +29,14 @@ if ((v) != (correct)) { \ torture_comment(tctx, "(%s): wrong value for %s got 0x%x - should be 0x%x\n", \ __location__, #v, (int)v, (int)correct); \ - ret = False; \ + ret = false; \ }} while (0) #define CHECK_STATUS(tctx, status, correct) do { \ if (!NT_STATUS_EQUAL(status, correct)) { \ torture_result(tctx, TORTURE_FAIL, __location__": Incorrect status %s - should be %s", \ nt_errstr(status), nt_errstr(correct)); \ - ret = False; \ + ret = false; \ goto done; \ }} while (0) @@ -97,7 +97,7 @@ static void oplock_handler_close_recv(struct smbcli_request *req) /* a handler function for oplock break requests - close the file */ -static BOOL oplock_handler_close(struct smbcli_transport *transport, uint16_t tid, +static bool oplock_handler_close(struct smbcli_transport *transport, uint16_t tid, uint16_t fnum, uint8_t level, void *private) { union smb_close io; @@ -114,13 +114,13 @@ static BOOL oplock_handler_close(struct smbcli_transport *transport, uint16_t ti req = smb_raw_close_send(tree, &io); if (req == NULL) { printf("failed to send close in oplock_handler_close\n"); - return False; + return false; } req->async.fn = oplock_handler_close_recv; req->async.private = NULL; - return True; + return true; } static bool test_raw_oplock_normal(struct torture_context *tctx, struct smbcli_state *cli1, struct smbcli_state *cli2) @@ -1309,10 +1309,10 @@ struct torture_suite *torture_raw_oplock(TALLOC_CTX *mem_ctx) /* stress testing of oplocks */ -BOOL torture_bench_oplock(struct torture_context *torture) +bool torture_bench_oplock(struct torture_context *torture) { struct smbcli_state **cli; - BOOL ret = True; + bool ret = true; TALLOC_CTX *mem_ctx = talloc_new(torture); int torture_nprocs = torture_setting_int(torture, "nprocs", 4); int i, count=0; @@ -1326,7 +1326,7 @@ BOOL torture_bench_oplock(struct torture_context *torture) torture_comment(torture, "Opening %d connections\n", torture_nprocs); for (i=0;itransport, oplock_handler_close, @@ -1334,7 +1334,7 @@ BOOL torture_bench_oplock(struct torture_context *torture) } if (!torture_setup_dir(cli[0], BASEDIR)) { - ret = False; + ret = false; goto done; } @@ -1397,13 +1397,13 @@ static struct hold_oplock_info { uint32_t share_access; uint16_t fnum; } hold_info[] = { - { BASEDIR "\\notshared_close", True, + { BASEDIR "\\notshared_close", true, NTCREATEX_SHARE_ACCESS_NONE, }, - { BASEDIR "\\notshared_noclose", False, + { BASEDIR "\\notshared_noclose", false, NTCREATEX_SHARE_ACCESS_NONE, }, - { BASEDIR "\\shared_close", True, + { BASEDIR "\\shared_close", true, NTCREATEX_SHARE_ACCESS_READ|NTCREATEX_SHARE_ACCESS_WRITE|NTCREATEX_SHARE_ACCESS_DELETE, }, - { BASEDIR "\\shared_noclose", False, + { BASEDIR "\\shared_noclose", false, NTCREATEX_SHARE_ACCESS_READ|NTCREATEX_SHARE_ACCESS_WRITE|NTCREATEX_SHARE_ACCESS_DELETE, }, }; @@ -1421,7 +1421,7 @@ static bool oplock_handler_hold(struct smbcli_transport *transport, if (i == ARRAY_SIZE(hold_info)) { printf("oplock break for unknown fnum %u\n", fnum); - return False; + return false; } info = &hold_info[i]; @@ -1430,7 +1430,7 @@ static bool oplock_handler_hold(struct smbcli_transport *transport, printf("oplock break on %s - closing\n", info->fname); oplock_handler_close(transport, tid, fnum, level, private); - return True; + return true; } printf("oplock break on %s - acking break\n", info->fname); @@ -1443,7 +1443,7 @@ static bool oplock_handler_hold(struct smbcli_transport *transport, used for manual testing of oplocks - especially interaction with other filesystems (such as NFS and local access) */ -BOOL torture_hold_oplock(struct torture_context *torture, +bool torture_hold_oplock(struct torture_context *torture, struct smbcli_state *cli) { struct event_context *ev = @@ -1453,7 +1453,7 @@ BOOL torture_hold_oplock(struct torture_context *torture, printf("Setting up open files with oplocks in %s\n", BASEDIR); if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } smbcli_oplock_handler(cli->transport, oplock_handler_hold, cli->tree); @@ -1483,14 +1483,14 @@ BOOL torture_hold_oplock(struct torture_context *torture, if (!NT_STATUS_IS_OK(status)) { printf("Failed to open %s - %s\n", hold_info[i].fname, nt_errstr(status)); - return False; + return false; } if (io.ntcreatex.out.oplock_level != BATCH_OPLOCK_RETURN) { printf("Oplock not granted for %s - expected %d but got %d\n", hold_info[i].fname, BATCH_OPLOCK_RETURN, io.ntcreatex.out.oplock_level); - return False; + return false; } hold_info[i].fnum = io.ntcreatex.out.file.fnum; } @@ -1498,5 +1498,5 @@ BOOL torture_hold_oplock(struct torture_context *torture, printf("Waiting for oplock events\n"); event_loop_wait(ev); - return True; + return true; } diff --git a/source4/torture/raw/pingpong.c b/source4/torture/raw/pingpong.c index 269208b97f6..2e9de28d67e 100755 --- a/source4/torture/raw/pingpong.c +++ b/source4/torture/raw/pingpong.c @@ -37,10 +37,10 @@ over and over until it completes. reading from the file can be enabled with - --option=torture:read=True + --option=torture:read=true writing to the file can be enabled with - --option=torture:write=True + --option=torture:write=true */ #include "includes.h" @@ -148,7 +148,7 @@ static void read_byte(struct smbcli_state *cli, int fd, uint8_t *c, int offset) io.readx.in.maxcnt = 1; io.readx.in.offset = offset; io.readx.in.remaining = 0; - io.readx.in.read_for_execute = False; + io.readx.in.read_for_execute = false; io.readx.out.data = c; status = smb_raw_read(cli->tree, &io); @@ -181,8 +181,8 @@ bool torture_ping_pong(struct torture_context *torture) const char *fn; int num_locks; TALLOC_CTX *mem_ctx = talloc_new(torture); - static BOOL do_reads; - static BOOL do_writes; + static bool do_reads; + static bool do_writes; int lock_timeout; int fd; struct smbcli_state *cli; diff --git a/source4/torture/raw/qfileinfo.c b/source4/torture/raw/qfileinfo.c index af9001c7570..7dcd2000e92 100644 --- a/source4/torture/raw/qfileinfo.c +++ b/source4/torture/raw/qfileinfo.c @@ -186,7 +186,7 @@ static union smb_fileinfo *fname_find(bool is_ipc, const char *name) #n1, #v1, (uint_t)s1->n1.out.v1, \ #n2, #v2, (uint_t)s2->n2.out.v2, \ __FILE__, __LINE__); \ - ret = False; \ + ret = false; \ }} while(0) #define STR_EQUAL(n1, v1, n2, v2) do {if (strcmp_safe(s1->n1.out.v1.s, s2->n2.out.v2.s) || \ @@ -195,7 +195,7 @@ static union smb_fileinfo *fname_find(bool is_ipc, const char *name) #n1, #v1, s1->n1.out.v1.s, s1->n1.out.v1.private_length, \ #n2, #v2, s2->n2.out.v2.s, s2->n2.out.v2.private_length, \ __FILE__, __LINE__); \ - ret = False; \ + ret = false; \ }} while(0) #define STRUCT_EQUAL(n1, v1, n2, v2) do {if (memcmp(&s1->n1.out.v1,&s2->n2.out.v2,sizeof(s1->n1.out.v1))) { \ @@ -203,7 +203,7 @@ static union smb_fileinfo *fname_find(bool is_ipc, const char *name) #n1, #v1, \ #n2, #v2, \ __FILE__, __LINE__); \ - ret = False; \ + ret = false; \ }} while(0) /* used to find hints on unknown values - and to make sure @@ -215,7 +215,7 @@ static union smb_fileinfo *fname_find(bool is_ipc, const char *name) (uint_t)s1->n1.out.v1, \ (uint_t)s1->n1.out.v1, \ __FILE__, __LINE__); \ - ret = False; \ + ret = false; \ }} while(0) #endif @@ -230,14 +230,14 @@ static bool torture_raw_qfileinfo_internals(struct torture_context *torture, bool is_ipc) { int i; - BOOL ret = True; + bool ret = true; int count; union smb_fileinfo *s1, *s2; NTTIME correct_time; uint64_t correct_size; uint32_t correct_attrib; const char *correct_name; - BOOL skip_streams = False; + bool skip_streams = false; /* scan all the fileinfo and pathinfo levels */ for (i=0; levels[i].name; i++) { @@ -293,7 +293,7 @@ static bool torture_raw_qfileinfo_internals(struct torture_context *torture, } if (count != 0) { - ret = False; + ret = false; printf("%d levels failed\n", count); if (count > 35) { torture_fail(torture, "too many level failures - giving up"); @@ -307,7 +307,7 @@ static bool torture_raw_qfileinfo_internals(struct torture_context *torture, printf("STREAM_INFO broken (%d) - skipping streams checks\n", s1 ? s1->stream_info.out.num_streams : -1); } - skip_streams = True; + skip_streams = true; } @@ -401,14 +401,14 @@ static bool torture_raw_qfileinfo_internals(struct torture_context *torture, printf("(%d) handle %s/%s incorrect - %s should be %s\n", __LINE__, #stype, #tfield, \ nt_time_string(mem_ctx, s1->stype.out.tfield), \ nt_time_string(mem_ctx, correct_time)); \ - ret = False; \ + ret = false; \ } \ s1 = fname_find(is_ipc, sname); \ if (s1 && memcmp(&s1->stype.out.tfield, &correct_time, sizeof(correct_time)) != 0) { \ printf("(%d) path %s/%s incorrect - %s should be %s\n", __LINE__, #stype, #tfield, \ nt_time_string(mem_ctx, s1->stype.out.tfield), \ nt_time_string(mem_ctx, correct_time)); \ - ret = False; \ + ret = false; \ }} while (0) #define TIME_CHECK_DOS(sname, stype, tfield) do { \ @@ -417,14 +417,14 @@ static bool torture_raw_qfileinfo_internals(struct torture_context *torture, printf("(%d) handle %s/%s incorrect - %s should be %s\n", __LINE__, #stype, #tfield, \ timestring(mem_ctx, s1->stype.out.tfield), \ nt_time_string(mem_ctx, correct_time)); \ - ret = False; \ + ret = false; \ } \ s1 = fname_find(is_ipc, sname); \ if (s1 && dos_nt_time_cmp(s1->stype.out.tfield, correct_time) != 0) { \ printf("(%d) path %s/%s incorrect - %s should be %s\n", __LINE__, #stype, #tfield, \ timestring(mem_ctx, s1->stype.out.tfield), \ nt_time_string(mem_ctx, correct_time)); \ - ret = False; \ + ret = false; \ }} while (0) #if 0 /* unused */ @@ -434,14 +434,14 @@ static bool torture_raw_qfileinfo_internals(struct torture_context *torture, printf("(%d) handle %s/%s incorrect - %s should be %s\n", __LINE__, #stype, #tfield, \ timestring(mem_ctx, s1->stype.out.tfield), \ nt_time_string(mem_ctx, correct_time)); \ - ret = False; \ + ret = false; \ } \ s1 = fname_find(is_ipc, sname); \ if (s1 && unx_nt_time_cmp(s1->stype.out.tfield, correct_time) != 0) { \ printf("(%d) path %s/%s incorrect - %s should be %s\n", __LINE__, #stype, #tfield, \ timestring(mem_ctx, s1->stype.out.tfield), \ nt_time_string(mem_ctx, correct_time)); \ - ret = False; \ + ret = false; \ }} while (0) #endif @@ -499,14 +499,14 @@ static bool torture_raw_qfileinfo_internals(struct torture_context *torture, printf("(%d) handle %s/%s incorrect - %u should be %u\n", __LINE__, #stype, #tfield, \ (uint_t)s1->stype.out.tfield, \ (uint_t)correct_size); \ - ret = False; \ + ret = false; \ } \ s1 = fname_find(is_ipc, sname); \ if (s1 && s1->stype.out.tfield != correct_size) { \ printf("(%d) path %s/%s incorrect - %u should be %u\n", __LINE__, #stype, #tfield, \ (uint_t)s1->stype.out.tfield, \ (uint_t)correct_size); \ - ret = False; \ + ret = false; \ }} while (0) s1 = fnum_find("STANDARD_INFO"); @@ -553,14 +553,14 @@ static bool torture_raw_qfileinfo_internals(struct torture_context *torture, printf("(%d) handle %s/%s incorrect - 0x%x should be 0x%x\n", __LINE__, #stype, #tfield, \ (uint_t)s1->stype.out.tfield, \ (uint_t)correct_attrib); \ - ret = False; \ + ret = false; \ } \ s1 = fname_find(is_ipc, sname); \ if (s1 && s1->stype.out.tfield != correct_attrib) { \ printf("(%d) path %s/%s incorrect - 0x%x should be 0x%x\n", __LINE__, #stype, #tfield, \ (uint_t)s1->stype.out.tfield, \ (uint_t)correct_attrib); \ - ret = False; \ + ret = false; \ }} while (0) s1 = fnum_find("BASIC_INFO"); @@ -589,14 +589,14 @@ static bool torture_raw_qfileinfo_internals(struct torture_context *torture, wire_bad_flags(&s1->stype.out.tfield, flags, tree->session->transport))) { \ printf("(%d) handle %s/%s incorrect - '%s/%d'\n", __LINE__, #stype, #tfield, \ s1->stype.out.tfield.s, s1->stype.out.tfield.private_length); \ - ret = False; \ + ret = false; \ } \ s1 = fname_find(is_ipc, sname); \ if (s1 && (strcmp_safe(s1->stype.out.tfield.s, correct_name) != 0 || \ wire_bad_flags(&s1->stype.out.tfield, flags, tree->session->transport))) { \ printf("(%d) path %s/%s incorrect - '%s/%d'\n", __LINE__, #stype, #tfield, \ s1->stype.out.tfield.s, s1->stype.out.tfield.private_length); \ - ret = False; \ + ret = false; \ }} while (0) NAME_CHECK("NAME_INFO", name_info, fname, STR_UNICODE); @@ -612,17 +612,17 @@ static bool torture_raw_qfileinfo_internals(struct torture_context *torture, if (!p) { printf("Not a full path in all_info/fname? - '%s'\n", s1->all_info.out.fname.s); - ret = False; + ret = false; } else { if (strcmp_safe(correct_name, p) != 0) { printf("incorrect basename in all_info/fname - '%s'\n", s1->all_info.out.fname.s); - ret = False; + ret = false; } } if (wire_bad_flags(&s1->all_info.out.fname, STR_UNICODE, tree->session->transport)) { printf("Should not null terminate all_info/fname\n"); - ret = False; + ret = false; } } @@ -646,7 +646,7 @@ static bool torture_raw_qfileinfo_internals(struct torture_context *torture, 0, 0); if (fnum == -1) { printf("Unable to open by alt_name - %s\n", smbcli_errstr(tree)); - ret = False; + ret = false; } if (!skip_streams) { @@ -702,28 +702,28 @@ static bool torture_raw_qfileinfo_internals(struct torture_context *torture, printf("(%d) handle %s/%s != %s/%s - 0x%x vs 0x%x\n", __LINE__, \ #stype1, #tfield1, #stype2, #tfield2, \ s1->stype1.out.tfield1, s2->stype2.out.tfield2); \ - ret = False; \ + ret = false; \ } \ s1 = fname_find(is_ipc, sname1); s2 = fname_find(is_ipc, sname2); \ if (s1 && s2 && s1->stype1.out.tfield1 != s2->stype2.out.tfield2) { \ printf("(%d) path %s/%s != %s/%s - 0x%x vs 0x%x\n", __LINE__, \ #stype1, #tfield1, #stype2, #tfield2, \ s1->stype1.out.tfield1, s2->stype2.out.tfield2); \ - ret = False; \ + ret = false; \ } \ s1 = fnum_find(sname1); s2 = fname_find(is_ipc, sname2); \ if (s1 && s2 && s1->stype1.out.tfield1 != s2->stype2.out.tfield2) { \ printf("(%d) handle %s/%s != path %s/%s - 0x%x vs 0x%x\n", __LINE__, \ #stype1, #tfield1, #stype2, #tfield2, \ s1->stype1.out.tfield1, s2->stype2.out.tfield2); \ - ret = False; \ + ret = false; \ } \ s1 = fname_find(is_ipc, sname1); s2 = fnum_find(sname2); \ if (s1 && s2 && s1->stype1.out.tfield1 != s2->stype2.out.tfield2) { \ printf("(%d) path %s/%s != handle %s/%s - 0x%x vs 0x%x\n", __LINE__, \ #stype1, #tfield1, #stype2, #tfield2, \ s1->stype1.out.tfield1, s2->stype2.out.tfield2); \ - ret = False; \ + ret = false; \ }} while (0) VAL_CHECK("STANDARD_INFO", standard_info, delete_pending, @@ -736,18 +736,18 @@ static bool torture_raw_qfileinfo_internals(struct torture_context *torture, if (s1 && is_ipc) { if (s1->basic_info.out.attrib != FILE_ATTRIBUTE_NORMAL) { printf("(%d) attrib basic_info/nlink incorrect - %d should be %d\n", __LINE__, s1->basic_info.out.attrib, FILE_ATTRIBUTE_NORMAL); - ret = False; + ret = false; } } s1 = fnum_find("STANDARD_INFO"); if (s1 && is_ipc) { if (s1->standard_info.out.nlink != 1) { printf("(%d) nlinks standard_info/nlink incorrect - %d should be 1\n", __LINE__, s1->standard_info.out.nlink); - ret = False; + ret = false; } if (s1->standard_info.out.delete_pending != 1) { printf("(%d) nlinks standard_info/delete_pending incorrect - %d should be 1\n", __LINE__, s1->standard_info.out.delete_pending); - ret = False; + ret = false; } } VAL_CHECK("EA_INFO", ea_info, ea_size, @@ -827,7 +827,7 @@ bool torture_raw_qfileinfo(struct torture_context *torture, return false; } - ret = torture_raw_qfileinfo_internals(torture, torture, cli->tree, fnum, fname, False /* is_ipc */); + ret = torture_raw_qfileinfo_internals(torture, torture, cli->tree, fnum, fname, false /* is_ipc */); smbcli_close(cli->tree, fnum); smbcli_unlink(cli->tree, fname); @@ -846,7 +846,7 @@ bool torture_raw_qfileinfo_pipe(struct torture_context *torture, NTSTATUS status; if (!(p = dcerpc_pipe_init(torture, cli->tree->session->transport->socket->event.ctx))) { - return False; + return false; } status = dcerpc_pipe_open_smb(p, cli->tree, fname); diff --git a/source4/torture/raw/qfsinfo.c b/source4/torture/raw/qfsinfo.c index 05e6f783241..32075586249 100644 --- a/source4/torture/raw/qfsinfo.c +++ b/source4/torture/raw/qfsinfo.c @@ -74,7 +74,7 @@ static union smb_fsinfo *find(const char *name) #n1, #v1, (uint_t)s1->n1.out.v1, \ #n2, #v2, (uint_t)s2->n2.out.v2, \ __FILE__, __LINE__); \ - ret = False; \ + ret = false; \ }} while(0) #define VAL_APPROX_EQUAL(n1, v1, n2, v2) do {if (abs((int)(s1->n1.out.v1) - (int)(s2->n2.out.v2)) > 0.1*s1->n1.out.v1) { \ @@ -82,7 +82,7 @@ static union smb_fsinfo *find(const char *name) #n1, #v1, (uint_t)s1->n1.out.v1, \ #n2, #v2, (uint_t)s2->n2.out.v2, \ __FILE__, __LINE__); \ - ret = False; \ + ret = false; \ }} while(0) #define STR_EQUAL(n1, v1, n2, v2) do { \ @@ -91,7 +91,7 @@ static union smb_fsinfo *find(const char *name) #n1, #v1, s1->n1.out.v1, \ #n2, #v2, s2->n2.out.v2, \ __FILE__, __LINE__); \ - ret = False; \ + ret = false; \ }} while(0) #define STRUCT_EQUAL(n1, v1, n2, v2) do {if (memcmp(&s1->n1.out.v1,&s2->n2.out.v2,sizeof(s1->n1.out.v1))) { \ @@ -99,7 +99,7 @@ static union smb_fsinfo *find(const char *name) #n1, #v1, \ #n2, #v2, \ __FILE__, __LINE__); \ - ret = False; \ + ret = false; \ }} while(0) /* used to find hints on unknown values - and to make sure @@ -110,7 +110,7 @@ static union smb_fsinfo *find(const char *name) (uint_t)s1->n1.out.v1, \ (uint_t)s1->n1.out.v1, \ __FILE__, __LINE__); \ - ret = False; \ + ret = false; \ }} while(0) /* basic testing of all RAW_QFS_* calls @@ -124,7 +124,7 @@ bool torture_raw_qfsinfo(struct torture_context *torture, struct smbcli_state *cli) { int i; - BOOL ret = True; + bool ret = true; int count; union smb_fsinfo *s1, *s2; @@ -154,7 +154,7 @@ bool torture_raw_qfsinfo(struct torture_context *torture, printf("%d levels failed\n", count); if (count > 13) { printf("too many level failures - giving up\n"); - return False; + return false; } } @@ -212,7 +212,7 @@ bool torture_raw_qfsinfo(struct torture_context *torture, if (abs(size1 - size2) > 1) { printf("Inconsistent total size in DSKATTR and ALLOCATION - size1=%.0f size2=%.0f\n", size1, size2); - ret = False; + ret = false; } printf("total disk = %.0f MB\n", size1*scale/1.0e6); } @@ -234,7 +234,7 @@ bool torture_raw_qfsinfo(struct torture_context *torture, if (abs(size1 - size2) > 1) { printf("Inconsistent avail size in DSKATTR and ALLOCATION - size1=%.0f size2=%.0f\n", size1, size2); - ret = False; + ret = false; } printf("free disk = %.0f MB\n", size1*scale/1.0e6); } @@ -283,7 +283,7 @@ bool torture_raw_qfsinfo(struct torture_context *torture, if (s1->stype.out.field.s && wire_bad_flags(&s1->stype.out.field, flags, cli->transport)) { \ printf("(%d) incorrect string termination in %s/%s\n", \ __LINE__, #stype, #field); \ - ret = False; \ + ret = false; \ } \ }} while (0) diff --git a/source4/torture/raw/read.c b/source4/torture/raw/read.c index 9a5153b5537..90f6a3d4a8a 100644 --- a/source4/torture/raw/read.c +++ b/source4/torture/raw/read.c @@ -30,7 +30,7 @@ if (!NT_STATUS_EQUAL(status, correct)) { \ printf("(%s) Incorrect status %s - should be %s\n", \ __location__, nt_errstr(status), nt_errstr(correct)); \ - ret = False; \ + ret = false; \ goto done; \ }} while (0) @@ -38,13 +38,13 @@ if ((v) != (correct)) { \ printf("(%s) Incorrect value %s=%ld - should be %ld\n", \ __location__, #v, (long)v, (long)correct); \ - ret = False; \ + ret = false; \ goto done; \ }} while (0) #define CHECK_BUFFER(buf, seed, len) do { \ if (!check_buffer(buf, seed, len, __LINE__)) { \ - ret = False; \ + ret = false; \ goto done; \ }} while (0) @@ -64,7 +64,7 @@ static void setup_buffer(uint8_t *buf, uint_t seed, int len) /* check a random buffer based on a seed */ -static BOOL check_buffer(uint8_t *buf, uint_t seed, int len, int line) +static bool check_buffer(uint8_t *buf, uint_t seed, int len, int line) { int i; srandom(seed); @@ -73,10 +73,10 @@ static BOOL check_buffer(uint8_t *buf, uint_t seed, int len, int line) if (buf[i] != v) { printf("Buffer incorrect at line %d! ofs=%d v1=0x%x v2=0x%x\n", line, i, buf[i], v); - return False; + return false; } } - return True; + return true; } /* @@ -86,7 +86,7 @@ static bool test_read(struct torture_context *tctx, struct smbcli_state *cli) { union smb_read io; NTSTATUS status; - BOOL ret = True; + bool ret = true; int fnum; uint8_t *buf; const int maxsize = 90000; @@ -97,7 +97,7 @@ static bool test_read(struct torture_context *tctx, struct smbcli_state *cli) buf = talloc_zero_array(tctx, uint8_t, maxsize); if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } printf("Testing RAW_READ_READ\n"); @@ -106,7 +106,7 @@ static bool test_read(struct torture_context *tctx, struct smbcli_state *cli) fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE); if (fnum == -1) { printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree)); - ret = False; + ret = false; goto done; } @@ -144,7 +144,7 @@ static bool test_read(struct torture_context *tctx, struct smbcli_state *cli) CHECK_STATUS(status, NT_STATUS_OK); CHECK_VALUE(io.read.out.nread, strlen(test_data)); if (memcmp(buf, test_data, strlen(test_data)) != 0) { - ret = False; + ret = false; printf("incorrect data at %d!? (%s:%s)\n", __LINE__, test_data, buf); goto done; } @@ -156,7 +156,7 @@ static bool test_read(struct torture_context *tctx, struct smbcli_state *cli) CHECK_STATUS(status, NT_STATUS_OK); CHECK_VALUE(io.read.out.nread, strlen(test_data)-1); if (memcmp(buf, test_data+1, strlen(test_data)-1) != 0) { - ret = False; + ret = false; printf("incorrect data at %d!? (%s:%s)\n", __LINE__, test_data+1, buf); goto done; } @@ -186,7 +186,7 @@ static bool test_read(struct torture_context *tctx, struct smbcli_state *cli) cli->session->pid++; if (NT_STATUS_IS_ERR(smbcli_lock(cli->tree, fnum, 103, 1, 0, WRITE_LOCK))) { printf("Failed to lock file at %d\n", __LINE__); - ret = False; + ret = false; goto done; } cli->session->pid--; @@ -213,7 +213,7 @@ static bool test_lockread(struct torture_context *tctx, { union smb_read io; NTSTATUS status; - BOOL ret = True; + bool ret = true; int fnum; uint8_t *buf; const int maxsize = 90000; @@ -224,7 +224,7 @@ static bool test_lockread(struct torture_context *tctx, buf = talloc_zero_array(tctx, uint8_t, maxsize); if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } printf("Testing RAW_READ_LOCKREAD\n"); @@ -233,7 +233,7 @@ static bool test_lockread(struct torture_context *tctx, fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE); if (fnum == -1) { printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree)); - ret = False; + ret = false; goto done; } @@ -283,7 +283,7 @@ static bool test_lockread(struct torture_context *tctx, CHECK_STATUS(status, NT_STATUS_OK); CHECK_VALUE(io.lockread.out.nread, strlen(test_data)); if (memcmp(buf, test_data, strlen(test_data)) != 0) { - ret = False; + ret = false; printf("incorrect data at %d!? (%s:%s)\n", __LINE__, test_data, buf); goto done; } @@ -299,7 +299,7 @@ static bool test_lockread(struct torture_context *tctx, CHECK_VALUE(io.lockread.out.nread, strlen(test_data)-1); if (memcmp(buf, test_data+1, strlen(test_data)-1) != 0) { - ret = False; + ret = false; printf("incorrect data at %d!? (%s:%s)\n", __LINE__, test_data+1, buf); goto done; } @@ -333,7 +333,7 @@ static bool test_lockread(struct torture_context *tctx, cli->session->pid++; if (NT_STATUS_IS_ERR(smbcli_lock(cli->tree, fnum, 103, 1, 0, WRITE_LOCK))) { printf("Failed to lock file at %d\n", __LINE__); - ret = False; + ret = false; goto done; } cli->session->pid--; @@ -358,7 +358,7 @@ static bool test_readx(struct torture_context *tctx, struct smbcli_state *cli) { union smb_read io; NTSTATUS status; - BOOL ret = True; + bool ret = true; int fnum; uint8_t *buf; const int maxsize = 90000; @@ -369,7 +369,7 @@ static bool test_readx(struct torture_context *tctx, struct smbcli_state *cli) buf = talloc_zero_array(tctx, uint8_t, maxsize); if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } printf("Testing RAW_READ_READX\n"); @@ -377,7 +377,7 @@ static bool test_readx(struct torture_context *tctx, struct smbcli_state *cli) fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE); if (fnum == -1) { printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree)); - ret = False; + ret = false; goto done; } @@ -388,7 +388,7 @@ static bool test_readx(struct torture_context *tctx, struct smbcli_state *cli) io.readx.in.maxcnt = 1; io.readx.in.offset = 0; io.readx.in.remaining = 0; - io.readx.in.read_for_execute = False; + io.readx.in.read_for_execute = false; io.readx.out.data = buf; status = smb_raw_read(cli->tree, &io); @@ -418,7 +418,7 @@ static bool test_readx(struct torture_context *tctx, struct smbcli_state *cli) io.readx.in.file.fnum = fnum; io.readx.in.offset = 0; io.readx.in.remaining = 0; - io.readx.in.read_for_execute = False; + io.readx.in.read_for_execute = false; io.readx.in.mincnt = strlen(test_data); io.readx.in.maxcnt = strlen(test_data); status = smb_raw_read(cli->tree, &io); @@ -427,7 +427,7 @@ static bool test_readx(struct torture_context *tctx, struct smbcli_state *cli) CHECK_VALUE(io.readx.out.remaining, 0xFFFF); CHECK_VALUE(io.readx.out.compaction_mode, 0); if (memcmp(buf, test_data, strlen(test_data)) != 0) { - ret = False; + ret = false; printf("incorrect data at %d!? (%s:%s)\n", __LINE__, test_data, buf); goto done; } @@ -442,7 +442,7 @@ static bool test_readx(struct torture_context *tctx, struct smbcli_state *cli) CHECK_VALUE(io.readx.out.remaining, 0xFFFF); CHECK_VALUE(io.readx.out.compaction_mode, 0); if (memcmp(buf, test_data+1, strlen(test_data)-1) != 0) { - ret = False; + ret = false; printf("incorrect data at %d!? (%s:%s)\n", __LINE__, test_data+1, buf); goto done; } @@ -548,7 +548,7 @@ static bool test_readx(struct torture_context *tctx, struct smbcli_state *cli) cli->session->pid++; if (NT_STATUS_IS_ERR(smbcli_lock(cli->tree, fnum, 103, 1, 0, WRITE_LOCK))) { printf("Failed to lock file at %d\n", __LINE__); - ret = False; + ret = false; goto done; } cli->session->pid--; @@ -574,7 +574,7 @@ static bool test_readx(struct torture_context *tctx, struct smbcli_state *cli) if (NT_STATUS_IS_ERR(smbcli_lock64(cli->tree, fnum, io.readx.in.offset, 1, 0, WRITE_LOCK))) { printf("Failed to lock file at %d\n", __LINE__); - ret = False; + ret = false; goto done; } @@ -597,7 +597,7 @@ static bool test_readbraw(struct torture_context *tctx, { union smb_read io; NTSTATUS status; - BOOL ret = True; + bool ret = true; int fnum; uint8_t *buf; const int maxsize = 90000; @@ -608,7 +608,7 @@ static bool test_readbraw(struct torture_context *tctx, buf = talloc_zero_array(tctx, uint8_t, maxsize); if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } printf("Testing RAW_READ_READBRAW\n"); @@ -616,7 +616,7 @@ static bool test_readbraw(struct torture_context *tctx, fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE); if (fnum == -1) { printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree)); - ret = False; + ret = false; goto done; } @@ -658,7 +658,7 @@ static bool test_readbraw(struct torture_context *tctx, CHECK_STATUS(status, NT_STATUS_OK); CHECK_VALUE(io.readbraw.out.nread, strlen(test_data)); if (memcmp(buf, test_data, strlen(test_data)) != 0) { - ret = False; + ret = false; printf("incorrect data at %d!? (%s:%s)\n", __LINE__, test_data, buf); goto done; } @@ -671,7 +671,7 @@ static bool test_readbraw(struct torture_context *tctx, CHECK_STATUS(status, NT_STATUS_OK); CHECK_VALUE(io.readbraw.out.nread, strlen(test_data)-1); if (memcmp(buf, test_data+1, strlen(test_data)-1) != 0) { - ret = False; + ret = false; printf("incorrect data at %d!? (%s:%s)\n", __LINE__, test_data+1, buf); goto done; } @@ -723,7 +723,7 @@ static bool test_readbraw(struct torture_context *tctx, cli->session->pid++; if (NT_STATUS_IS_ERR(smbcli_lock(cli->tree, fnum, 103, 1, 0, WRITE_LOCK))) { printf("Failed to lock file at %d\n", __LINE__); - ret = False; + ret = false; goto done; } cli->session->pid--; @@ -772,7 +772,7 @@ static bool test_read_for_execute(struct torture_context *tctx, union smb_write wr; union smb_read rd; NTSTATUS status; - BOOL ret = True; + bool ret = true; int fnum=0; uint8_t *buf; const int maxsize = 900; @@ -782,7 +782,7 @@ static bool test_read_for_execute(struct torture_context *tctx, buf = talloc_zero_array(tctx, uint8_t, maxsize); if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } printf("Testing RAW_READ_READX with read_for_execute\n"); @@ -841,7 +841,7 @@ static bool test_read_for_execute(struct torture_context *tctx, rd.readx.in.maxcnt = maxsize; rd.readx.in.offset = 0; rd.readx.in.remaining = 0; - rd.readx.in.read_for_execute = True; + rd.readx.in.read_for_execute = true; rd.readx.out.data = buf; status = smb_raw_read(cli->tree, &rd); CHECK_STATUS(status, NT_STATUS_OK); @@ -856,7 +856,7 @@ static bool test_read_for_execute(struct torture_context *tctx, rd.readx.in.maxcnt = maxsize; rd.readx.in.offset = 0; rd.readx.in.remaining = 0; - rd.readx.in.read_for_execute = False; + rd.readx.in.read_for_execute = false; rd.readx.out.data = buf; status = smb_raw_read(cli->tree, &rd); CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED); @@ -888,7 +888,7 @@ static bool test_read_for_execute(struct torture_context *tctx, rd.readx.in.maxcnt = maxsize; rd.readx.in.offset = 0; rd.readx.in.remaining = 0; - rd.readx.in.read_for_execute = True; + rd.readx.in.read_for_execute = true; rd.readx.out.data = buf; status = smb_raw_read(cli->tree, &rd); CHECK_STATUS(status, NT_STATUS_OK); @@ -903,7 +903,7 @@ static bool test_read_for_execute(struct torture_context *tctx, rd.readx.in.maxcnt = maxsize; rd.readx.in.offset = 0; rd.readx.in.remaining = 0; - rd.readx.in.read_for_execute = False; + rd.readx.in.read_for_execute = false; rd.readx.out.data = buf; status = smb_raw_read(cli->tree, &rd); CHECK_STATUS(status, NT_STATUS_OK); diff --git a/source4/torture/raw/rename.c b/source4/torture/raw/rename.c index 05a53208590..4b0d9866595 100644 --- a/source4/torture/raw/rename.c +++ b/source4/torture/raw/rename.c @@ -27,7 +27,7 @@ if (!NT_STATUS_EQUAL(status, correct)) { \ printf("(%s) Incorrect status %s - should be %s\n", \ __location__, nt_errstr(status), nt_errstr(correct)); \ - ret = False; \ + ret = false; \ goto done; \ }} while (0) @@ -35,7 +35,7 @@ if ((v) != (correct)) { \ printf("(%s) Incorrect %s %d - should be %d\n", \ __location__, #v, (int)v, (int)correct); \ - ret = False; \ + ret = false; \ }} while (0) #define BASEDIR "\\testrename" @@ -48,7 +48,7 @@ static bool test_mv(struct torture_context *tctx, { union smb_rename io; NTSTATUS status; - BOOL ret = True; + bool ret = true; int fnum = -1; const char *fname1 = BASEDIR "\\test1.txt"; const char *fname2 = BASEDIR "\\test2.txt"; @@ -59,7 +59,7 @@ static bool test_mv(struct torture_context *tctx, printf("Testing SMBmv\n"); if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } printf("Trying simple rename\n"); @@ -197,7 +197,7 @@ static bool test_ntrename(struct torture_context *tctx, { union smb_rename io; NTSTATUS status; - BOOL ret = True; + bool ret = true; int fnum, i; const char *fname1 = BASEDIR "\\test1.txt"; const char *fname2 = BASEDIR "\\test2.txt"; @@ -206,7 +206,7 @@ static bool test_ntrename(struct torture_context *tctx, printf("Testing SMBntrename\n"); if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } printf("Trying simple rename\n"); diff --git a/source4/torture/raw/samba3hide.c b/source4/torture/raw/samba3hide.c index 309f65487a5..8fe3aa4d2d9 100644 --- a/source4/torture/raw/samba3hide.c +++ b/source4/torture/raw/samba3hide.c @@ -57,7 +57,7 @@ static void init_unixinfo_nochange(union smb_setfileinfo *info) struct list_state { const char *fname; - BOOL visible; + bool visible; }; static void set_visible(struct clilist_file_info *i, const char *mask, @@ -66,43 +66,43 @@ static void set_visible(struct clilist_file_info *i, const char *mask, struct list_state *state = (struct list_state *)priv; if (strcasecmp_m(state->fname, i->name) == 0) - state->visible = True; + state->visible = true; } -static BOOL is_visible(struct smbcli_tree *tree, const char *fname) +static bool is_visible(struct smbcli_tree *tree, const char *fname) { struct list_state state; - state.visible = False; + state.visible = false; state.fname = fname; if (smbcli_list(tree, "*.*", 0, set_visible, &state) < 0) { - return False; + return false; } return state.visible; } -static BOOL is_readable(struct smbcli_tree *tree, const char *fname) +static bool is_readable(struct smbcli_tree *tree, const char *fname) { int fnum; fnum = smbcli_open(tree, fname, O_RDONLY, DENY_NONE); if (fnum < 0) { - return False; + return false; } smbcli_close(tree, fnum); - return True; + return true; } -static BOOL is_writeable(TALLOC_CTX *mem_ctx, struct smbcli_tree *tree, +static bool is_writeable(TALLOC_CTX *mem_ctx, struct smbcli_tree *tree, const char *fname) { int fnum; fnum = smbcli_open(tree, fname, O_WRONLY, DENY_NONE); if (fnum < 0) { - return False; + return false; } smbcli_close(tree, fnum); - return True; + return true; } /* @@ -110,7 +110,7 @@ static BOOL is_writeable(TALLOC_CTX *mem_ctx, struct smbcli_tree *tree, * might fail. But for our purposes it's sufficient. */ -static BOOL smbcli_file_exists(struct smbcli_tree *tree, const char *fname) +static bool smbcli_file_exists(struct smbcli_tree *tree, const char *fname) { return NT_STATUS_IS_OK(smbcli_getatr(tree, fname, NULL, NULL, NULL)); } @@ -138,7 +138,7 @@ bool torture_samba3_hide(struct torture_context *torture) torture, &cli, torture_setting_string(torture, "host", NULL), torture_setting_string(torture, "share", NULL), NULL)) { d_printf("torture_open_connection_share failed\n"); - return False; + return false; } status = torture_second_tcon(torture, cli->session, "hideunread", @@ -146,7 +146,7 @@ bool torture_samba3_hide(struct torture_context *torture) if (!NT_STATUS_IS_OK(status)) { d_printf("second_tcon(hideunread) failed: %s\n", nt_errstr(status)); - return False; + return false; } status = torture_second_tcon(torture, cli->session, "hideunwrite", @@ -154,7 +154,7 @@ bool torture_samba3_hide(struct torture_context *torture) if (!NT_STATUS_IS_OK(status)) { d_printf("second_tcon(hideunwrite) failed: %s\n", nt_errstr(status)); - return False; + return false; } status = smbcli_unlink(cli->tree, fname); @@ -167,14 +167,14 @@ bool torture_samba3_hide(struct torture_context *torture) if (fnum == -1) { d_printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree)); - return False; + return false; } smbcli_close(cli->tree, fnum); if (!smbcli_file_exists(cli->tree, fname)) { d_printf("%s does not exist\n", fname); - return False; + return false; } /* R/W file should be visible everywhere */ @@ -182,27 +182,27 @@ bool torture_samba3_hide(struct torture_context *torture) status = smbcli_chmod(cli->tree, fname, UNIX_R_USR|UNIX_W_USR); if (!NT_STATUS_IS_OK(status)) { d_printf("smbcli_chmod failed: %s\n", nt_errstr(status)); - return False; + return false; } if (!is_writeable(torture, cli->tree, fname)) { d_printf("File not writable\n"); - return False; + return false; } if (!is_readable(cli->tree, fname)) { d_printf("File not readable\n"); - return False; + return false; } if (!is_visible(cli->tree, fname)) { d_printf("r/w file not visible via normal share\n"); - return False; + return false; } if (!is_visible(hideunread, fname)) { d_printf("r/w file not visible via hide unreadable\n"); - return False; + return false; } if (!is_visible(hideunwrite, fname)) { d_printf("r/w file not visible via hide unwriteable\n"); - return False; + return false; } /* R/O file should not be visible via hide unwriteable files */ @@ -211,27 +211,27 @@ bool torture_samba3_hide(struct torture_context *torture) if (!NT_STATUS_IS_OK(status)) { d_printf("smbcli_chmod failed: %s\n", nt_errstr(status)); - return False; + return false; } if (is_writeable(torture, cli->tree, fname)) { d_printf("r/o is writable\n"); - return False; + return false; } if (!is_readable(cli->tree, fname)) { d_printf("r/o not readable\n"); - return False; + return false; } if (!is_visible(cli->tree, fname)) { d_printf("r/o file not visible via normal share\n"); - return False; + return false; } if (!is_visible(hideunread, fname)) { d_printf("r/o file not visible via hide unreadable\n"); - return False; + return false; } if (is_visible(hideunwrite, fname)) { d_printf("r/o file visible via hide unwriteable\n"); - return False; + return false; } /* inaccessible file should be only visible on normal share */ @@ -239,33 +239,33 @@ bool torture_samba3_hide(struct torture_context *torture) status = smbcli_chmod(cli->tree, fname, 0); if (!NT_STATUS_IS_OK(status)) { d_printf("smbcli_chmod failed: %s\n", nt_errstr(status)); - return False; + return false; } if (is_writeable(torture, cli->tree, fname)) { d_printf("inaccessible file is writable\n"); - return False; + return false; } if (is_readable(cli->tree, fname)) { d_printf("inaccessible file is readable\n"); - return False; + return false; } if (!is_visible(cli->tree, fname)) { d_printf("inaccessible file not visible via normal share\n"); - return False; + return false; } if (is_visible(hideunread, fname)) { d_printf("inaccessible file visible via hide unreadable\n"); - return False; + return false; } if (is_visible(hideunwrite, fname)) { d_printf("inaccessible file visible via hide unwriteable\n"); - return False; + return false; } smbcli_chmod(cli->tree, fname, UNIX_R_USR|UNIX_W_USR); smbcli_unlink(cli->tree, fname); - return True; + return true; } /* @@ -277,7 +277,7 @@ bool torture_samba3_hide(struct torture_context *torture) bool torture_samba3_closeerr(struct torture_context *tctx) { struct smbcli_state *cli = NULL; - BOOL result = False; + bool result = false; NTSTATUS status; const char *dname = "closeerr.dir"; const char *fname = "closeerr.dir\\closerr.txt"; @@ -311,7 +311,7 @@ bool torture_samba3_closeerr(struct torture_context *tctx) talloc_asprintf(tctx, "smbcli_open failed: %s\n", smbcli_errstr(cli->tree))); - status = smbcli_nt_delete_on_close(cli->tree, fnum, True); + status = smbcli_nt_delete_on_close(cli->tree, fnum, true); torture_assert_ntstatus_ok(tctx, status, "setting delete_on_close on file failed !"); @@ -329,7 +329,7 @@ bool torture_samba3_closeerr(struct torture_context *tctx) torture_assert_ntstatus_equal(tctx, status, NT_STATUS_ACCESS_DENIED, "smbcli_close"); - result = True; + result = true; fail: if (cli) { diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c index ec53af93e8b..988405e8069 100644 --- a/source4/torture/raw/samba3misc.c +++ b/source4/torture/raw/samba3misc.c @@ -31,7 +31,7 @@ if (!NT_STATUS_EQUAL(status, correct)) { \ printf("(%s) Incorrect status %s - should be %s\n", \ __location__, nt_errstr(status), nt_errstr(correct)); \ - ret = False; \ + ret = false; \ } \ } while (0) @@ -42,7 +42,7 @@ bool torture_samba3_checkfsp(struct torture_context *torture) const char *dirname = "testdir"; int fnum; NTSTATUS status; - BOOL ret = True; + bool ret = true; TALLOC_CTX *mem_ctx; ssize_t nread; char buf[16]; @@ -50,14 +50,14 @@ bool torture_samba3_checkfsp(struct torture_context *torture) if ((mem_ctx = talloc_init("torture_samba3_checkfsp")) == NULL) { d_printf("talloc_init failed\n"); - return False; + return false; } if (!torture_open_connection_share( torture, &cli, torture_setting_string(torture, "host", NULL), torture_setting_string(torture, "share", NULL), NULL)) { d_printf("torture_open_connection_share failed\n"); - ret = False; + ret = false; goto done; } @@ -80,7 +80,7 @@ bool torture_samba3_checkfsp(struct torture_context *torture) status = smbcli_mkdir(cli->tree, dirname); if (!NT_STATUS_IS_OK(status)) { d_printf("smbcli_mkdir failed: %s\n", nt_errstr(status)); - ret = False; + ret = false; goto done; } @@ -103,7 +103,7 @@ bool torture_samba3_checkfsp(struct torture_context *torture) if (!NT_STATUS_IS_OK(status)) { d_printf("smb_open on the directory failed: %s\n", nt_errstr(status)); - ret = False; + ret = false; goto done; } fnum = io.ntcreatex.out.file.fnum; @@ -115,7 +115,7 @@ bool torture_samba3_checkfsp(struct torture_context *torture) if (nread >= 0) { d_printf("smbcli_read on a directory succeeded, expected " "failure\n"); - ret = False; + ret = false; } CHECK_STATUS(smbcli_nt_error(cli->tree), @@ -127,7 +127,7 @@ bool torture_samba3_checkfsp(struct torture_context *torture) if (nread >= 0) { d_printf("smbcli_read on a directory succeeded, expected " "failure\n"); - ret = False; + ret = false; } CHECK_STATUS(smbcli_nt_error(tree2), NT_STATUS_INVALID_HANDLE); @@ -140,7 +140,7 @@ bool torture_samba3_checkfsp(struct torture_context *torture) if (fnum == -1) { d_printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree)); - ret = False; + ret = false; goto done; } @@ -335,13 +335,13 @@ bool torture_samba3_badpath(struct torture_context *torture) char *fpath1; int fnum; NTSTATUS status; - BOOL ret = True; + bool ret = true; TALLOC_CTX *mem_ctx; - BOOL nt_status_support; + bool nt_status_support; if (!(mem_ctx = talloc_init("torture_samba3_badpath"))) { d_printf("talloc_init failed\n"); - return False; + return false; } nt_status_support = lp_nt_status_support(global_loadparm); @@ -375,7 +375,7 @@ bool torture_samba3_badpath(struct torture_context *torture) status = smbcli_mkdir(cli_nt->tree, dirname); if (!NT_STATUS_IS_OK(status)) { d_printf("smbcli_mkdir failed: %s\n", nt_errstr(status)); - ret = False; + ret = false; goto done; } @@ -586,7 +586,7 @@ bool torture_samba3_badpath(struct torture_context *torture) goto done; fail: - ret = False; + ret = false; done: if (cli_nt != NULL) { @@ -619,11 +619,11 @@ bool torture_samba3_caseinsensitive(struct torture_context *torture) char *fpath; int fnum; int counter = 0; - BOOL ret = True; + bool ret = true; if (!(mem_ctx = talloc_init("torture_samba3_caseinsensitive"))) { d_printf("talloc_init failed\n"); - return False; + return false; } if (!torture_open_connection(&cli, 0)) { @@ -656,11 +656,11 @@ bool torture_samba3_caseinsensitive(struct torture_context *torture) count_fn, (void *)&counter); if (counter == 3) { - ret = True; + ret = true; } else { d_fprintf(stderr, "expected 3 entries, got %d\n", counter); - ret = False; + ret = false; } done: @@ -677,7 +677,7 @@ bool torture_samba3_posixtimedlock(struct torture_context *tctx) { struct smbcli_state *cli; NTSTATUS status; - BOOL ret = True; + bool ret = true; const char *dirname = "posixlock"; const char *fname = "locked"; const char *fpath; @@ -693,7 +693,7 @@ bool torture_samba3_posixtimedlock(struct torture_context *tctx) struct smbcli_request *req; if (!torture_open_connection(&cli, 0)) { - ret = False; + ret = false; goto done; } @@ -703,33 +703,33 @@ bool torture_samba3_posixtimedlock(struct torture_context *tctx) if (!NT_STATUS_IS_OK(status)) { torture_warning(tctx, "smbcli_mkdir failed: %s\n", nt_errstr(status)); - ret = False; + ret = false; goto done; } if (!(fpath = talloc_asprintf(tctx, "%s\\%s", dirname, fname))) { torture_warning(tctx, "talloc failed\n"); - ret = False; + ret = false; goto done; } fnum = smbcli_open(cli->tree, fpath, O_RDWR | O_CREAT, DENY_NONE); if (fnum == -1) { torture_warning(tctx, "Could not create file %s: %s\n", fpath, smbcli_errstr(cli->tree)); - ret = False; + ret = false; goto done; } if (!(localdir = torture_setting_string(tctx, "localdir", NULL))) { torture_warning(tctx, "Need 'localdir' setting\n"); - ret = False; + ret = false; goto done; } if (!(localname = talloc_asprintf(tctx, "%s/%s/%s", localdir, dirname, fname))) { torture_warning(tctx, "talloc failed\n"); - ret = False; + ret = false; goto done; } @@ -751,7 +751,7 @@ bool torture_samba3_posixtimedlock(struct torture_context *tctx) if (fcntl(fd, F_SETLK, &posix_lock) == -1) { torture_warning(tctx, "fcntl failed: %s\n", strerror(errno)); - ret = False; + ret = false; goto done; } @@ -774,7 +774,7 @@ bool torture_samba3_posixtimedlock(struct torture_context *tctx) status = smb_raw_lock(cli->tree, &io); - ret = True; + ret = true; CHECK_STATUS(status, NT_STATUS_FILE_LOCK_CONFLICT); if (!ret) { @@ -791,7 +791,7 @@ bool torture_samba3_posixtimedlock(struct torture_context *tctx) req = smb_raw_lock_send(cli->tree, &io); if (req == NULL) { torture_warning(tctx, "smb_raw_lock_send failed\n"); - ret = False; + ret = false; goto done; } diff --git a/source4/torture/raw/search.c b/source4/torture/raw/search.c index 7b6529245b3..0242b9c5450 100644 --- a/source4/torture/raw/search.c +++ b/source4/torture/raw/search.c @@ -30,7 +30,7 @@ /* callback function for single_search */ -static BOOL single_search_callback(void *private, const union smb_search_data *file) +static bool single_search_callback(void *private, const union smb_search_data *file) { union smb_search_data *data = (union smb_search_data *)private; @@ -234,7 +234,7 @@ static union smb_search_data *find(const char *name) static bool test_one_file(struct torture_context *tctx, struct smbcli_state *cli) { - BOOL ret = True; + bool ret = true; int fnum; const char *fname = "\\torture_search.txt"; const char *fname2 = "\\torture_search-NOTEXIST.txt"; @@ -246,7 +246,7 @@ static bool test_one_file(struct torture_context *tctx, fnum = create_complex_file(cli, tctx, fname); if (fnum == -1) { printf("ERROR: open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree)); - ret = False; + ret = false; goto done; } @@ -274,7 +274,7 @@ static bool test_one_file(struct torture_context *tctx, printf("search level %s(%d) failed - %s\n", levels[i].name, (int)levels[i].level, nt_errstr(levels[i].status)); - ret = False; + ret = false; continue; } @@ -295,7 +295,7 @@ static bool test_one_file(struct torture_context *tctx, levels[i].name, (int)levels[i].level, nt_errstr(expected_status), nt_errstr(status)); - ret = False; + ret = false; } } @@ -328,7 +328,7 @@ static bool test_one_file(struct torture_context *tctx, __location__, \ #sname1, #field1, (int)s->sname1.field1, \ #sname2, #field2, (int)v.sname2.out.field2); \ - ret = False; \ + ret = false; \ } \ }} while (0) @@ -340,7 +340,7 @@ static bool test_one_file(struct torture_context *tctx, __location__, \ #sname1, #field1, timestring(tctx, s->sname1.field1), \ #sname2, #field2, nt_time_string(tctx, v.sname2.out.field2)); \ - ret = False; \ + ret = false; \ } \ }} while (0) @@ -352,7 +352,7 @@ static bool test_one_file(struct torture_context *tctx, __location__, \ #sname1, #field1, nt_time_string(tctx, s->sname1.field1), \ #sname2, #field2, nt_time_string(tctx, v.sname2.out.field2)); \ - ret = False; \ + ret = false; \ } \ }} while (0) @@ -364,7 +364,7 @@ static bool test_one_file(struct torture_context *tctx, __location__, \ #sname1, #field1, s->sname1.field1, \ #sname2, #field2, v.sname2.out.field2.s); \ - ret = False; \ + ret = false; \ } \ }} while (0) @@ -378,7 +378,7 @@ static bool test_one_file(struct torture_context *tctx, __location__, \ #sname1, #field1, s->sname1.field1.s, \ #sname2, #field2, v.sname2.out.field2.s); \ - ret = False; \ + ret = false; \ } \ }} while (0) @@ -392,7 +392,7 @@ static bool test_one_file(struct torture_context *tctx, __location__, \ #sname1, #field1, s->sname1.field1.s, \ fname); \ - ret = False; \ + ret = false; \ } \ }} while (0) @@ -405,7 +405,7 @@ static bool test_one_file(struct torture_context *tctx, __location__, \ #sname1, #field1, s->sname1.field1, \ fname); \ - ret = False; \ + ret = false; \ } \ }} while (0) @@ -509,7 +509,7 @@ struct multiple_result { /* callback function for multiple_search */ -static BOOL multiple_search_callback(void *private, const union smb_search_data *file) +static bool multiple_search_callback(void *private, const union smb_search_data *file) { struct multiple_result *data = (struct multiple_result *)private; @@ -658,7 +658,7 @@ static bool test_many_files(struct torture_context *tctx, const int num_files = 700; int i, fnum, t; char *fname; - BOOL ret = True; + bool ret = true; NTSTATUS status; struct multiple_result result; struct { @@ -751,7 +751,7 @@ static bool test_many_files(struct torture_context *tctx, /* check a individual file result */ -static bool check_result(struct multiple_result *result, const char *name, BOOL exist, uint32_t attrib) +static bool check_result(struct multiple_result *result, const char *name, bool exist, uint32_t attrib) { int i; for (i=0;icount;i++) { @@ -761,7 +761,7 @@ static bool check_result(struct multiple_result *result, const char *name, BOOL if (exist) { printf("failed: '%s' should exist with attribute %s\n", name, attrib_string(result->list, attrib)); - return False; + return false; } return true; } @@ -769,14 +769,14 @@ static bool check_result(struct multiple_result *result, const char *name, BOOL if (!exist) { printf("failed: '%s' should NOT exist (has attribute %s)\n", name, attrib_string(result->list, result->list[i].both_directory_info.attrib)); - return False; + return false; } if ((result->list[i].both_directory_info.attrib&0xFFF) != attrib) { printf("failed: '%s' should have attribute 0x%x (has 0x%x)\n", name, attrib, result->list[i].both_directory_info.attrib); - return False; + return false; } return true; } @@ -790,7 +790,7 @@ static bool test_modify_search(struct torture_context *tctx, const int num_files = 20; int i, fnum; char *fname; - BOOL ret = True; + bool ret = true; NTSTATUS status; struct multiple_result result; union smb_search_first io; @@ -798,7 +798,7 @@ static bool test_modify_search(struct torture_context *tctx, union smb_setfileinfo sfinfo; if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } printf("Creating %d files\n", num_files); @@ -808,7 +808,7 @@ static bool test_modify_search(struct torture_context *tctx, fnum = smbcli_open(cli->tree, fname, O_CREAT|O_RDWR, DENY_NONE); if (fnum == -1) { printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree)); - ret = False; + ret = false; goto done; } talloc_free(fname); @@ -876,16 +876,16 @@ static bool test_modify_search(struct torture_context *tctx, CHECK_STATUS(status, NT_STATUS_OK); CHECK_VALUE(result.count, 20); - ret &= check_result(&result, "t009-9.txt", True, FILE_ATTRIBUTE_ARCHIVE); - ret &= check_result(&result, "t014-14.txt", False, 0); - ret &= check_result(&result, "t015-15.txt", False, 0); - ret &= check_result(&result, "t016-16.txt", True, FILE_ATTRIBUTE_NORMAL); - ret &= check_result(&result, "t017-17.txt", False, 0); - ret &= check_result(&result, "t018-18.txt", True, FILE_ATTRIBUTE_ARCHIVE); - ret &= check_result(&result, "t019-19.txt", True, FILE_ATTRIBUTE_ARCHIVE); - ret &= check_result(&result, "T013-13.txt.2", True, FILE_ATTRIBUTE_ARCHIVE); - ret &= check_result(&result, "T003-3.txt.2", False, 0); - ret &= check_result(&result, "T013-13.txt.3", True, FILE_ATTRIBUTE_ARCHIVE); + ret &= check_result(&result, "t009-9.txt", true, FILE_ATTRIBUTE_ARCHIVE); + ret &= check_result(&result, "t014-14.txt", false, 0); + ret &= check_result(&result, "t015-15.txt", false, 0); + ret &= check_result(&result, "t016-16.txt", true, FILE_ATTRIBUTE_NORMAL); + ret &= check_result(&result, "t017-17.txt", false, 0); + ret &= check_result(&result, "t018-18.txt", true, FILE_ATTRIBUTE_ARCHIVE); + ret &= check_result(&result, "t019-19.txt", true, FILE_ATTRIBUTE_ARCHIVE); + ret &= check_result(&result, "T013-13.txt.2", true, FILE_ATTRIBUTE_ARCHIVE); + ret &= check_result(&result, "T003-3.txt.2", false, 0); + ret &= check_result(&result, "T013-13.txt.3", true, FILE_ATTRIBUTE_ARCHIVE); if (!ret) { for (i=0;itree, fname, O_CREAT|O_RDWR, DENY_NONE); if (fnum == -1) { printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree)); - ret = False; + ret = false; goto done; } talloc_free(fname); @@ -976,12 +976,12 @@ static bool test_many_dirs(struct torture_context *tctx, const int num_dirs = 20; int i, fnum, n; char *fname, *dname; - BOOL ret = True; + bool ret = true; NTSTATUS status; union smb_search_data *file, *file2, *file3; if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } printf("Creating %d dirs\n", num_dirs); @@ -992,7 +992,7 @@ static bool test_many_dirs(struct torture_context *tctx, if (!NT_STATUS_IS_OK(status)) { printf("(%s) Failed to create %s - %s\n", __location__, dname, nt_errstr(status)); - ret = False; + ret = false; goto done; } @@ -1002,7 +1002,7 @@ static bool test_many_dirs(struct torture_context *tctx, if (fnum == -1) { printf("(%s) Failed to create %s - %s\n", __location__, fname, smbcli_errstr(cli->tree)); - ret = False; + ret = false; goto done; } talloc_free(fname); @@ -1034,14 +1034,14 @@ static bool test_many_dirs(struct torture_context *tctx, if (io.search_first.out.count != 1) { printf("(%s) search first gave %d entries for dir %d - %s\n", __location__, io.search_first.out.count, i, nt_errstr(status)); - ret = False; + ret = false; goto done; } CHECK_STATUS(status, NT_STATUS_OK); if (strncasecmp(file[i].search.name, fname, strlen(fname)) != 0) { printf("(%s) incorrect name '%s' expected '%s'[12].txt\n", __location__, file[i].search.name, fname); - ret = False; + ret = false; goto done; } @@ -1067,14 +1067,14 @@ static bool test_many_dirs(struct torture_context *tctx, if (io2.search_next.out.count != 1) { printf("(%s) search next gave %d entries for dir %d - %s\n", __location__, io2.search_next.out.count, i, nt_errstr(status)); - ret = False; + ret = false; goto done; } CHECK_STATUS(status, NT_STATUS_OK); if (strncasecmp(file2[i].search.name, fname, strlen(fname)) != 0) { printf("(%s) incorrect name '%s' expected '%s'[12].txt\n", __location__, file2[i].search.name, fname); - ret = False; + ret = false; goto done; } @@ -1100,7 +1100,7 @@ static bool test_many_dirs(struct torture_context *tctx, if (io2.search_next.out.count != 1) { printf("(%s) search next gave %d entries for dir %d - %s\n", __location__, io2.search_next.out.count, i, nt_errstr(status)); - ret = False; + ret = false; goto done; } CHECK_STATUS(status, NT_STATUS_OK); @@ -1108,14 +1108,14 @@ static bool test_many_dirs(struct torture_context *tctx, if (strncasecmp(file3[i].search.name, file2[i].search.name, 3) != 0) { printf("(%s) incorrect name '%s' on rewind at dir %d\n", __location__, file2[i].search.name, i); - ret = False; + ret = false; goto done; } if (strcmp(file3[i].search.name, file2[i].search.name) != 0) { printf("(%s) server did not rewind - got '%s' expected '%s'\n", __location__, file3[i].search.name, file2[i].search.name); - ret = False; + ret = false; goto done; } @@ -1142,14 +1142,14 @@ static bool test_os2_delete(struct torture_context *tctx, int total_deleted = 0; int i, fnum; char *fname; - BOOL ret = True; + bool ret = true; NTSTATUS status; union smb_search_first io; union smb_search_next io2; struct multiple_result result; if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } printf("Testing OS/2 style delete on %d files\n", num_files); @@ -1159,7 +1159,7 @@ static bool test_os2_delete(struct torture_context *tctx, fnum = smbcli_open(cli->tree, fname, O_CREAT|O_RDWR, DENY_NONE); if (fnum == -1) { printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree)); - ret = False; + ret = false; goto done; } talloc_free(fname); @@ -1227,7 +1227,7 @@ static bool test_os2_delete(struct torture_context *tctx, if (total_deleted != num_files) { printf("error: deleted %d - expected to delete %d\n", total_deleted, num_files); - ret = False; + ret = false; } done: @@ -1250,7 +1250,7 @@ static bool test_ea_list(struct torture_context *tctx, struct smbcli_state *cli) { int fnum; - BOOL ret = True; + bool ret = true; NTSTATUS status; union smb_search_first io; union smb_search_next nxt; @@ -1258,7 +1258,7 @@ static bool test_ea_list(struct torture_context *tctx, union smb_setfileinfo setfile; if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } printf("Testing RAW_SEARCH_EA_LIST level\n"); diff --git a/source4/torture/raw/seek.c b/source4/torture/raw/seek.c index f5413d8b1d8..3ba022feef9 100644 --- a/source4/torture/raw/seek.c +++ b/source4/torture/raw/seek.c @@ -28,7 +28,7 @@ if (!NT_STATUS_EQUAL(status, correct)) { \ printf("(%d) Incorrect status %s - should be %s\n", \ __LINE__, nt_errstr(status), nt_errstr(correct)); \ - ret = False; \ + ret = false; \ goto done; \ }} while (0) @@ -36,7 +36,7 @@ if ((v) != (correct)) { \ printf("(%d) Incorrect value %s=%d - should be %d\n", \ __LINE__, #v, (int)v, (int)correct); \ - ret = False; \ + ret = false; \ goto done; \ }} while (0) @@ -45,25 +45,25 @@ /* test seek ops */ -static BOOL test_seek(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_seek(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { union smb_seek io; union smb_fileinfo finfo; union smb_setfileinfo sfinfo; NTSTATUS status; - BOOL ret = True; + bool ret = true; int fnum, fnum2; const char *fname = BASEDIR "\\test.txt"; uint8_t c[2]; if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT|O_TRUNC, DENY_NONE); if (fnum == -1) { printf("Failed to open test.txt - %s\n", smbcli_errstr(cli->tree)); - ret = False; + ret = false; goto done; } @@ -142,7 +142,7 @@ static BOOL test_seek(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) ZERO_STRUCT(c); if (smbcli_write(cli->tree, fnum, 0, c, 0, 2) != 2) { printf("Write failed - %s\n", smbcli_errstr(cli->tree)); - ret = False; + ret = false; goto done; } @@ -162,7 +162,7 @@ static BOOL test_seek(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) if (smbcli_read(cli->tree, fnum, c, 0, 1) != 1) { printf("Read failed - %s\n", smbcli_errstr(cli->tree)); - ret = False; + ret = false; goto done; } @@ -181,7 +181,7 @@ static BOOL test_seek(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) fnum2 = smbcli_open(cli->tree, fname, O_RDWR, DENY_NONE); if (fnum2 == -1) { printf("2nd open failed - %s\n", smbcli_errstr(cli->tree)); - ret = False; + ret = false; goto done; } sfinfo.generic.level = RAW_SFILEINFO_POSITION_INFORMATION; diff --git a/source4/torture/raw/setfileinfo.c b/source4/torture/raw/setfileinfo.c index 1178af4e9fb..e58b3fd7601 100644 --- a/source4/torture/raw/setfileinfo.c +++ b/source4/torture/raw/setfileinfo.c @@ -45,7 +45,7 @@ bool torture_raw_sfileinfo(struct torture_context *torture, NTSTATUS status, status2; const char *call_name; time_t basetime = (time(NULL) - 86400) & ~1; - BOOL check_fnum; + bool check_fnum; int n = time(NULL) % 100; asprintf(&path_fname, BASEDIR "\\fname_test_%d.txt", n); @@ -54,7 +54,7 @@ bool torture_raw_sfileinfo(struct torture_context *torture, asprintf(&fnum_fname_new, BASEDIR "\\fnum_test_new_%d.txt", n); if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } #define RECREATE_FILE(fname) do { \ @@ -63,7 +63,7 @@ bool torture_raw_sfileinfo(struct torture_context *torture, if (fnum == -1) { \ printf("(%s) ERROR: open of %s failed (%s)\n", \ __location__, fname, smbcli_errstr(cli->tree)); \ - ret = False; \ + ret = false; \ goto done; \ }} while (0) @@ -76,7 +76,7 @@ bool torture_raw_sfileinfo(struct torture_context *torture, RECREATE_BOTH; #define CHECK_CALL_FNUM(call, rightstatus) do { \ - check_fnum = True; \ + check_fnum = true; \ call_name = #call; \ sfinfo.generic.level = RAW_SFILEINFO_ ## call; \ sfinfo.generic.in.file.fnum = fnum; \ @@ -84,18 +84,18 @@ bool torture_raw_sfileinfo(struct torture_context *torture, if (!NT_STATUS_EQUAL(status, rightstatus)) { \ printf("(%s) %s - %s (should be %s)\n", __location__, #call, \ nt_errstr(status), nt_errstr(rightstatus)); \ - ret = False; \ + ret = false; \ } \ finfo1.generic.level = RAW_FILEINFO_ALL_INFO; \ finfo1.generic.in.file.fnum = fnum; \ status2 = smb_raw_fileinfo(cli->tree, torture, &finfo1); \ if (!NT_STATUS_IS_OK(status2)) { \ printf("(%s) %s pathinfo - %s\n", __location__, #call, nt_errstr(status)); \ - ret = False; \ + ret = false; \ }} while (0) #define CHECK_CALL_PATH(call, rightstatus) do { \ - check_fnum = False; \ + check_fnum = false; \ call_name = #call; \ sfinfo.generic.level = RAW_SFILEINFO_ ## call; \ sfinfo.generic.in.file.path = path_fname; \ @@ -107,7 +107,7 @@ bool torture_raw_sfileinfo(struct torture_context *torture, if (!NT_STATUS_EQUAL(status, rightstatus)) { \ printf("(%s) %s - %s (should be %s)\n", __location__, #call, \ nt_errstr(status), nt_errstr(rightstatus)); \ - ret = False; \ + ret = false; \ } \ finfo1.generic.level = RAW_FILEINFO_ALL_INFO; \ finfo1.generic.in.file.path = path_fname; \ @@ -118,7 +118,7 @@ bool torture_raw_sfileinfo(struct torture_context *torture, } \ if (!NT_STATUS_IS_OK(status2)) { \ printf("(%s) %s pathinfo - %s\n", __location__, #call, nt_errstr(status2)); \ - ret = False; \ + ret = false; \ }} while (0) #define CHECK1(call) \ @@ -137,7 +137,7 @@ bool torture_raw_sfileinfo(struct torture_context *torture, } \ if (!NT_STATUS_IS_OK(status2)) { \ printf("%s - %s\n", #call, nt_errstr(status2)); \ - ret = False; \ + ret = false; \ } \ }} while (0) @@ -148,7 +148,7 @@ bool torture_raw_sfileinfo(struct torture_context *torture, call_name, #stype, #field, \ (uint_t)value, (uint_t)finfo2.stype.out.field); \ dump_all_info(torture, &finfo1); \ - ret = False; \ + ret = false; \ }} while (0) #define CHECK_TIME(call, stype, field, value) do { \ @@ -161,7 +161,7 @@ bool torture_raw_sfileinfo(struct torture_context *torture, printf("\t%s", timestring(torture, value)); \ printf("\t%s\n", nt_time_string(torture, finfo2.stype.out.field)); \ dump_all_info(torture, &finfo1); \ - ret = False; \ + ret = false; \ }} while (0) #define CHECK_STR(call, stype, field, value) do { \ @@ -172,14 +172,14 @@ bool torture_raw_sfileinfo(struct torture_context *torture, value, \ finfo2.stype.out.field); \ dump_all_info(torture, &finfo1); \ - ret = False; \ + ret = false; \ }} while (0) #define CHECK_STATUS(status, correct) do { \ if (!NT_STATUS_EQUAL(status, correct)) { \ printf("(%s) Incorrect status %s - should be %s\n", \ __location__, nt_errstr(status), nt_errstr(correct)); \ - ret = False; \ + ret = false; \ goto done; \ }} while (0) @@ -447,7 +447,7 @@ done: bool torture_raw_sfileinfo_rename(struct torture_context *torture, struct smbcli_state *cli) { - BOOL ret = True; + bool ret = true; int fnum_saved, d_fnum, fnum2, fnum = -1; char *fnum_fname; char *fnum_fname_new; @@ -457,7 +457,7 @@ bool torture_raw_sfileinfo_rename(struct torture_context *torture, union smb_setfileinfo sfinfo; NTSTATUS status, status2; const char *call_name; - BOOL check_fnum; + bool check_fnum; int n = time(NULL) % 100; asprintf(&path_fname, BASEDIR "\\fname_test_%d.txt", n); @@ -466,7 +466,7 @@ bool torture_raw_sfileinfo_rename(struct torture_context *torture, asprintf(&fnum_fname_new, BASEDIR "\\fnum_test_new_%d.txt", n); if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } RECREATE_BOTH; @@ -597,5 +597,5 @@ bool torture_raw_sfileinfo_bug(struct torture_context *torture, printf("now try and delete %s\n", fname); - return True; + return true; } diff --git a/source4/torture/raw/streams.c b/source4/torture/raw/streams.c index 81181e49ab5..14d674e482f 100644 --- a/source4/torture/raw/streams.c +++ b/source4/torture/raw/streams.c @@ -32,7 +32,7 @@ if (!NT_STATUS_EQUAL(status, correct)) { \ printf("(%s) Incorrect status %s - should be %s\n", \ __location__, nt_errstr(status), nt_errstr(correct)); \ - ret = False; \ + ret = false; \ goto done; \ }} while (0) @@ -40,13 +40,13 @@ if ((v) != (correct)) { \ printf("(%s) Incorrect value %s=%d - should be %d\n", \ __location__, #v, (int)v, (int)correct); \ - ret = False; \ + ret = false; \ }} while (0) /* check that a stream has the right contents */ -static BOOL check_stream(struct smbcli_state *cli, TALLOC_CTX *mem_ctx, +static bool check_stream(struct smbcli_state *cli, TALLOC_CTX *mem_ctx, const char *fname, const char *sname, const char *value) { @@ -62,15 +62,15 @@ static BOOL check_stream(struct smbcli_state *cli, TALLOC_CTX *mem_ctx, if (value == NULL) { if (fnum != -1) { printf("should have failed stream open of %s\n", full_name); - return False; + return false; } - return True; + return true; } if (fnum == -1) { printf("Failed to open stream '%s' - %s\n", full_name, smbcli_errstr(cli->tree)); - return False; + return false; } buf = talloc_array(mem_ctx, uint8_t, strlen(value)+11); @@ -79,28 +79,28 @@ static BOOL check_stream(struct smbcli_state *cli, TALLOC_CTX *mem_ctx, if (ret != strlen(value)) { printf("Failed to read %lu bytes from stream '%s' - got %d\n", (long)strlen(value), full_name, (int)ret); - return False; + return false; } if (memcmp(buf, value, strlen(value)) != 0) { printf("Bad data in stream\n"); - return False; + return false; } smbcli_close(cli->tree, fnum); - return True; + return true; } /* test basic io on streams */ -static BOOL test_stream_io(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_stream_io(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { NTSTATUS status; union smb_open io; const char *fname = BASEDIR "\\stream.txt"; const char *sname1, *sname2; - BOOL ret = True; + bool ret = true; int fnum = -1; ssize_t retsize; @@ -219,7 +219,7 @@ bool torture_raw_streams(struct torture_context *torture, bool ret = true; if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } ret &= test_stream_io(cli, torture); diff --git a/source4/torture/raw/unlink.c b/source4/torture/raw/unlink.c index 287a8b34589..b9043a58995 100644 --- a/source4/torture/raw/unlink.c +++ b/source4/torture/raw/unlink.c @@ -29,7 +29,7 @@ if (!NT_STATUS_EQUAL(status, correct)) { \ printf("(%s) Incorrect status %s - should be %s\n", \ __location__, nt_errstr(status), nt_errstr(correct)); \ - ret = False; \ + ret = false; \ goto done; \ }} while (0) @@ -42,11 +42,11 @@ static bool test_unlink(struct torture_context *tctx, struct smbcli_state *cli) { union smb_unlink io; NTSTATUS status; - BOOL ret = True; + bool ret = true; const char *fname = BASEDIR "\\test.txt"; if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } printf("Trying non-existant file\n"); @@ -207,7 +207,7 @@ static bool test_delete_on_close(struct torture_context *tctx, union smb_unlink io; struct smb_rmdir dio; NTSTATUS status; - BOOL ret = True; + bool ret = true; int fnum, fnum2; const char *fname = BASEDIR "\\test.txt"; const char *dname = BASEDIR "\\test.dir"; @@ -215,7 +215,7 @@ static bool test_delete_on_close(struct torture_context *tctx, union smb_setfileinfo sfinfo; if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } dio.in.path = dname; diff --git a/source4/torture/raw/write.c b/source4/torture/raw/write.c index 6151c60a715..98a0dde8c7f 100644 --- a/source4/torture/raw/write.c +++ b/source4/torture/raw/write.c @@ -30,7 +30,7 @@ if (!NT_STATUS_EQUAL(status, correct)) { \ printf("(%s) Incorrect status %s - should be %s\n", \ __location__, nt_errstr(status), nt_errstr(correct)); \ - ret = False; \ + ret = false; \ goto done; \ }} while (0) @@ -38,13 +38,13 @@ if ((v) != (correct)) { \ printf("(%s) Incorrect value %s=%d - should be %d\n", \ __location__, #v, v, correct); \ - ret = False; \ + ret = false; \ goto done; \ }} while (0) #define CHECK_BUFFER(buf, seed, len) do { \ if (!check_buffer(buf, seed, len, __location__)) { \ - ret = False; \ + ret = false; \ goto done; \ }} while (0) @@ -57,7 +57,7 @@ printf("(%s) wrong value for field %s %.0f - %.0f\n", \ __location__, #field, (double)v, (double)finfo.all_info.out.field); \ dump_all_info(tctx, &finfo); \ - ret = False; \ + ret = false; \ }} while (0) @@ -77,7 +77,7 @@ static void setup_buffer(uint8_t *buf, uint_t seed, int len) /* check a random buffer based on a seed */ -static BOOL check_buffer(uint8_t *buf, uint_t seed, int len, const char *location) +static bool check_buffer(uint8_t *buf, uint_t seed, int len, const char *location) { int i; srandom(seed); @@ -86,10 +86,10 @@ static BOOL check_buffer(uint8_t *buf, uint_t seed, int len, const char *locatio if (buf[i] != v) { printf("Buffer incorrect at %s! ofs=%d buf=0x%x correct=0x%x\n", location, i, buf[i], v); - return False; + return false; } } - return True; + return true; } /* @@ -100,7 +100,7 @@ static bool test_write(struct torture_context *tctx, { union smb_write io; NTSTATUS status; - BOOL ret = True; + bool ret = true; int fnum; uint8_t *buf; const int maxsize = 90000; @@ -111,7 +111,7 @@ static bool test_write(struct torture_context *tctx, buf = talloc_zero_array(tctx, uint8_t, maxsize); if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } printf("Testing RAW_WRITE_WRITE\n"); @@ -120,7 +120,7 @@ static bool test_write(struct torture_context *tctx, fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE); if (fnum == -1) { printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree)); - ret = False; + ret = false; goto done; } @@ -147,7 +147,7 @@ static bool test_write(struct torture_context *tctx, memset(buf, 0, maxsize); if (smbcli_read(cli->tree, fnum, buf, 0, 13) != 13) { printf("read failed at %s\n", __location__); - ret = False; + ret = false; goto done; } CHECK_BUFFER(buf+4, seed, 9); @@ -166,7 +166,7 @@ static bool test_write(struct torture_context *tctx, memset(buf, 0, maxsize); if (smbcli_read(cli->tree, fnum, buf, 0, 4000) != 4000) { printf("read failed at %s\n", __location__); - ret = False; + ret = false; goto done; } CHECK_BUFFER(buf, seed, 4000); @@ -207,7 +207,7 @@ static bool test_write(struct torture_context *tctx, memset(buf, 0, maxsize); if (smbcli_read(cli->tree, fnum, buf, io.write.in.offset, 4000) != 4000) { printf("read failed at %s\n", __location__); - ret = False; + ret = false; goto done; } CHECK_BUFFER(buf, seed, 4000); @@ -228,7 +228,7 @@ static bool test_writex(struct torture_context *tctx, { union smb_write io; NTSTATUS status; - BOOL ret = True; + bool ret = true; int fnum, i; uint8_t *buf; const int maxsize = 90000; @@ -245,7 +245,7 @@ static bool test_writex(struct torture_context *tctx, buf = talloc_zero_array(tctx, uint8_t, maxsize); if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } printf("Testing RAW_WRITE_WRITEX\n"); @@ -254,7 +254,7 @@ static bool test_writex(struct torture_context *tctx, fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE); if (fnum == -1) { printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree)); - ret = False; + ret = false; goto done; } @@ -282,7 +282,7 @@ static bool test_writex(struct torture_context *tctx, memset(buf, 0, maxsize); if (smbcli_read(cli->tree, fnum, buf, 0, 13) != 13) { printf("read failed at %s\n", __location__); - ret = False; + ret = false; goto done; } CHECK_BUFFER(buf+4, seed, 9); @@ -301,7 +301,7 @@ static bool test_writex(struct torture_context *tctx, memset(buf, 0, maxsize); if (smbcli_read(cli->tree, fnum, buf, 0, 4000) != 4000) { printf("read failed at %s\n", __location__); - ret = False; + ret = false; goto done; } CHECK_BUFFER(buf, seed, 4000); @@ -334,7 +334,7 @@ static bool test_writex(struct torture_context *tctx, cli->session->pid++; if (NT_STATUS_IS_ERR(smbcli_lock(cli->tree, fnum, 3, 1, 0, WRITE_LOCK))) { printf("Failed to lock file at %s\n", __location__); - ret = False; + ret = false; goto done; } cli->session->pid--; @@ -367,7 +367,7 @@ static bool test_writex(struct torture_context *tctx, memset(buf, 0, maxsize); if (smbcli_read(cli->tree, fnum, buf, io.writex.in.offset, 4000) != 4000) { printf("read failed at %s\n", __location__); - ret = False; + ret = false; goto done; } CHECK_BUFFER(buf, seed, 4000); @@ -391,7 +391,7 @@ static bool test_writex(struct torture_context *tctx, memset(buf, 0, maxsize); if (smbcli_read(cli->tree, fnum, buf, io.writex.in.offset, 4000) != 4000) { printf("read failed at %s\n", __location__); - ret = False; + ret = false; goto done; } CHECK_BUFFER(buf, seed+1, 4000); @@ -416,7 +416,7 @@ static bool test_writeunlock(struct torture_context *tctx, { union smb_write io; NTSTATUS status; - BOOL ret = True; + bool ret = true; int fnum; uint8_t *buf; const int maxsize = 90000; @@ -427,7 +427,7 @@ static bool test_writeunlock(struct torture_context *tctx, buf = talloc_zero_array(tctx, uint8_t, maxsize); if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } printf("Testing RAW_WRITE_WRITEUNLOCK\n"); @@ -436,7 +436,7 @@ static bool test_writeunlock(struct torture_context *tctx, fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE); if (fnum == -1) { printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree)); - ret = False; + ret = false; goto done; } @@ -460,7 +460,7 @@ static bool test_writeunlock(struct torture_context *tctx, CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED); if (smbcli_read(cli->tree, fnum, buf, 0, 13) != 13) { printf("read failed at %s\n", __location__); - ret = False; + ret = false; goto done; } CHECK_BUFFER(buf+4, seed, 9); @@ -476,7 +476,7 @@ static bool test_writeunlock(struct torture_context *tctx, memset(buf, 0, maxsize); if (smbcli_read(cli->tree, fnum, buf, 0, 13) != 13) { printf("read failed at %s\n", __location__); - ret = False; + ret = false; goto done; } CHECK_BUFFER(buf+4, seed, 9); @@ -500,7 +500,7 @@ static bool test_writeunlock(struct torture_context *tctx, memset(buf, 0, maxsize); if (smbcli_read(cli->tree, fnum, buf, 0, 4000) != 4000) { printf("read failed at %s\n", __location__); - ret = False; + ret = false; goto done; } CHECK_BUFFER(buf, seed, 4000); @@ -538,7 +538,7 @@ static bool test_writeunlock(struct torture_context *tctx, memset(buf, 0, maxsize); if (smbcli_read(cli->tree, fnum, buf, io.writeunlock.in.offset, 4000) != 4000) { printf("read failed at %s\n", __location__); - ret = False; + ret = false; goto done; } CHECK_BUFFER(buf, seed, 4000); @@ -559,7 +559,7 @@ static bool test_writeclose(struct torture_context *tctx, { union smb_write io; NTSTATUS status; - BOOL ret = True; + bool ret = true; int fnum; uint8_t *buf; const int maxsize = 90000; @@ -570,7 +570,7 @@ static bool test_writeclose(struct torture_context *tctx, buf = talloc_zero_array(tctx, uint8_t, maxsize); if (!torture_setup_dir(cli, BASEDIR)) { - return False; + return false; } printf("Testing RAW_WRITE_WRITECLOSE\n"); @@ -579,7 +579,7 @@ static bool test_writeclose(struct torture_context *tctx, fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE); if (fnum == -1) { printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree)); - ret = False; + ret = false; goto done; } @@ -614,7 +614,7 @@ static bool test_writeclose(struct torture_context *tctx, if (smbcli_read(cli->tree, fnum, buf, 0, 13) != 13) { printf("read failed at %s\n", __location__); - ret = False; + ret = false; goto done; } CHECK_BUFFER(buf+4, seed, 9); @@ -631,7 +631,7 @@ static bool test_writeclose(struct torture_context *tctx, memset(buf, 0, maxsize); if (smbcli_read(cli->tree, fnum, buf, 0, 13) != 13) { printf("read failed at %s\n", __location__); - ret = False; + ret = false; goto done; } CHECK_BUFFER(buf+4, seed, 9); @@ -656,7 +656,7 @@ static bool test_writeclose(struct torture_context *tctx, memset(buf, 0, maxsize); if (smbcli_read(cli->tree, fnum, buf, 0, 4000) != 4000) { printf("read failed at %s\n", __location__); - ret = False; + ret = false; goto done; } CHECK_BUFFER(buf, seed, 4000); @@ -695,7 +695,7 @@ static bool test_writeclose(struct torture_context *tctx, memset(buf, 0, maxsize); if (smbcli_read(cli->tree, fnum, buf, io.writeclose.in.offset, 4000) != 4000) { printf("read failed at %s\n", __location__); - ret = False; + ret = false; goto done; } CHECK_BUFFER(buf, seed, 4000); diff --git a/source4/torture/rpc/async_bind.c b/source4/torture/rpc/async_bind.c index 155f3f8244f..70743bd4339 100644 --- a/source4/torture/rpc/async_bind.c +++ b/source4/torture/rpc/async_bind.c @@ -35,7 +35,7 @@ */ -BOOL torture_async_bind(struct torture_context *torture) +bool torture_async_bind(struct torture_context *torture) { NTSTATUS status; TALLOC_CTX *mem_ctx; @@ -49,30 +49,30 @@ BOOL torture_async_bind(struct torture_context *torture) struct dcerpc_pipe **pipe; const struct ndr_interface_table **table; - if (!torture_setting_bool(torture, "async", False)) { + if (!torture_setting_bool(torture, "async", false)) { printf("async bind test disabled - enable async tests to use\n"); - return True; + return true; } binding_string = torture_setting_string(torture, "binding", NULL); /* talloc context */ mem_ctx = talloc_init("torture_async_bind"); - if (mem_ctx == NULL) return False; + if (mem_ctx == NULL) return false; bind_req = talloc_array(torture, struct composite_context*, torture_numasync); - if (bind_req == NULL) return False; + if (bind_req == NULL) return false; pipe = talloc_array(torture, struct dcerpc_pipe*, torture_numasync); - if (pipe == NULL) return False; + if (pipe == NULL) return false; table = talloc_array(torture, const struct ndr_interface_table*, torture_numasync); - if (table == NULL) return False; + if (table == NULL) return false; /* credentials */ creds = cmdline_credentials; /* event context */ evt_ctx = cli_credentials_get_event_context(creds); - if (evt_ctx == NULL) return False; + if (evt_ctx == NULL) return false; /* send bind requests */ for (i = 0; i < torture_numasync; i++) { @@ -86,10 +86,10 @@ BOOL torture_async_bind(struct torture_context *torture) status = dcerpc_pipe_connect_recv(bind_req[i], mem_ctx, &pipe[i]); if (!NT_STATUS_IS_OK(status)) { printf("async rpc connection failed: %s\n", nt_errstr(status)); - return False; + return false; } } talloc_free(mem_ctx); - return True; + return true; } diff --git a/source4/torture/rpc/atsvc.c b/source4/torture/rpc/atsvc.c index da230979246..b0d1d1519d3 100644 --- a/source4/torture/rpc/atsvc.c +++ b/source4/torture/rpc/atsvc.c @@ -76,7 +76,7 @@ static bool test_JobEnum(struct torture_context *tctx, struct dcerpc_pipe *p) for (i = 0; i < r.out.ctr->entries_read; i++) { if (!test_JobGetInfo(p, tctx, r.out.ctr->first_entry[i].job_id)) { - ret = False; + ret = false; } } diff --git a/source4/torture/rpc/autoidl.c b/source4/torture/rpc/autoidl.c index 451b8ab1201..93437344130 100644 --- a/source4/torture/rpc/autoidl.c +++ b/source4/torture/rpc/autoidl.c @@ -31,7 +31,7 @@ /* get a DRSUAPI policy handle */ -static BOOL get_policy_handle(struct dcerpc_pipe *p, +static bool get_policy_handle(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { @@ -44,16 +44,16 @@ static BOOL get_policy_handle(struct dcerpc_pipe *p, status = dcerpc_drsuapi_DsBind(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("drsuapi_DsBind failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } #else /* get a SAMR handle */ -static BOOL get_policy_handle(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool get_policy_handle(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; @@ -66,10 +66,10 @@ static BOOL get_policy_handle(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_Connect(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("samr_Connect failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } #endif @@ -130,7 +130,7 @@ static void try_expand(TALLOC_CTX *mem_ctx, const struct ndr_interface_table *if memcpy(stub_in.data, base_in->data, insert_ofs); memcpy(stub_in.data+insert_ofs+n, base_in->data+insert_ofs, base_in->length-insert_ofs); - status = dcerpc_request(p, NULL, opnum, False, mem_ctx, &stub_in, &stub_out); + status = dcerpc_request(p, NULL, opnum, false, mem_ctx, &stub_in, &stub_out); if (!NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) { print_depth(depth); @@ -171,7 +171,7 @@ static void test_ptr_scan(TALLOC_CTX *mem_ctx, const struct ndr_interface_table /* work out which elements are pointers */ for (ofs=min_ofs;ofs<=max_ofs-4;ofs+=4) { SIVAL(stub_in.data, ofs, 1); - status = dcerpc_request(p, NULL, opnum, False, mem_ctx, &stub_in, &stub_out); + status = dcerpc_request(p, NULL, opnum, false, mem_ctx, &stub_in, &stub_out); if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) { print_depth(depth); @@ -213,7 +213,7 @@ static void test_scan_call(TALLOC_CTX *mem_ctx, const struct ndr_interface_table data_blob_clear(&stub_in); - status = dcerpc_request(p, NULL, opnum, False, mem_ctx, &stub_in, &stub_out); + status = dcerpc_request(p, NULL, opnum, false, mem_ctx, &stub_in, &stub_out); if (NT_STATUS_IS_OK(status)) { printf("opnum %d min_input %d - output %d\n", @@ -226,7 +226,7 @@ static void test_scan_call(TALLOC_CTX *mem_ctx, const struct ndr_interface_table fill_blob_handle(&stub_in, mem_ctx, &handle); - status = dcerpc_request(p, NULL, opnum, False, mem_ctx, &stub_in, &stub_out); + status = dcerpc_request(p, NULL, opnum, false, mem_ctx, &stub_in, &stub_out); if (NT_STATUS_IS_OK(status)) { printf("opnum %d min_input %d - output %d (with handle)\n", @@ -258,7 +258,7 @@ static void test_auto_scan(TALLOC_CTX *mem_ctx, const struct ndr_interface_table test_scan_call(mem_ctx, iface, 2); } -BOOL torture_rpc_autoidl(struct torture_context *torture) +bool torture_rpc_autoidl(struct torture_context *torture) { TALLOC_CTX *mem_ctx; const struct ndr_interface_table *iface; @@ -266,7 +266,7 @@ BOOL torture_rpc_autoidl(struct torture_context *torture) iface = ndr_table_by_name("drsuapi"); if (!iface) { printf("Unknown interface!\n"); - return False; + return false; } mem_ctx = talloc_init("torture_rpc_autoidl"); @@ -276,5 +276,5 @@ BOOL torture_rpc_autoidl(struct torture_context *torture) test_auto_scan(mem_ctx, iface); talloc_free(mem_ctx); - return True; + return true; } diff --git a/source4/torture/rpc/bench.c b/source4/torture/rpc/bench.c index 9880393cdd8..2619ac2d254 100644 --- a/source4/torture/rpc/bench.c +++ b/source4/torture/rpc/bench.c @@ -28,14 +28,14 @@ /**************************/ /* srvsvc_NetShare */ /**************************/ -static BOOL test_NetShareEnumAll(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) +static bool test_NetShareEnumAll(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) { NTSTATUS status; struct srvsvc_NetShareEnumAll r; struct srvsvc_NetShareCtr0 c0; uint32_t levels[] = {0, 1, 2, 501, 502}; int i; - BOOL ret = True; + bool ret = true; uint32_t resume_handle; ZERO_STRUCT(c0); @@ -53,7 +53,7 @@ static BOOL test_NetShareEnumAll(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) status = dcerpc_srvsvc_NetShareEnumAll(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("NetShareEnumAll level %u failed - %s\n", r.in.level, nt_errstr(status)); - ret = False; + ret = false; continue; } if (!W_ERROR_IS_OK(r.out.result)) { @@ -68,10 +68,10 @@ static BOOL test_NetShareEnumAll(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) /* benchmark srvsvc netshareenumall queries */ -static BOOL bench_NetShareEnumAll(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) +static bool bench_NetShareEnumAll(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) { struct timeval tv = timeval_current(); - BOOL ret = True; + bool ret = true; int timelimit = lp_parm_int(global_loadparm, NULL, "torture", "timelimit", 10); int count=0; @@ -95,12 +95,12 @@ static BOOL bench_NetShareEnumAll(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) } -BOOL torture_bench_rpc(struct torture_context *torture) +bool torture_bench_rpc(struct torture_context *torture) { NTSTATUS status; struct dcerpc_pipe *p; TALLOC_CTX *mem_ctx; - BOOL ret = True; + bool ret = true; mem_ctx = talloc_init("torture_rpc_srvsvc"); @@ -109,11 +109,11 @@ BOOL torture_bench_rpc(struct torture_context *torture) &ndr_table_srvsvc); if (!NT_STATUS_IS_OK(status)) { talloc_free(mem_ctx); - return False; + return false; } if (!bench_NetShareEnumAll(p, mem_ctx)) { - ret = False; + ret = false; } talloc_free(mem_ctx); diff --git a/source4/torture/rpc/bind.c b/source4/torture/rpc/bind.c index c7848f4a897..18009018737 100644 --- a/source4/torture/rpc/bind.c +++ b/source4/torture/rpc/bind.c @@ -41,27 +41,27 @@ */ -BOOL torture_multi_bind(struct torture_context *torture) +bool torture_multi_bind(struct torture_context *torture) { struct dcerpc_pipe *p; struct dcerpc_binding *binding; TALLOC_CTX *mem_ctx; NTSTATUS status; - BOOL ret; + bool ret; mem_ctx = talloc_init("torture_multi_bind"); status = torture_rpc_binding(torture, &binding); if (!NT_STATUS_IS_OK(status)) { talloc_free(mem_ctx); - return False; + return false; } status = torture_rpc_connection(torture, &p, &ndr_table_lsarpc); if (!NT_STATUS_IS_OK(status)) { talloc_free(mem_ctx); - return False; + return false; } status = dcerpc_pipe_auth(mem_ctx, &p, binding, &ndr_table_lsarpc, cmdline_credentials); @@ -69,10 +69,10 @@ BOOL torture_multi_bind(struct torture_context *torture) if (NT_STATUS_IS_OK(status)) { printf("(incorrectly) allowed re-bind to uuid %s - %s\n", GUID_string(mem_ctx, &ndr_table_lsarpc.syntax_id.uuid), nt_errstr(status)); - ret = False; + ret = false; } else { printf("\n"); - ret = True; + ret = true; } talloc_free(mem_ctx); diff --git a/source4/torture/rpc/countcalls.c b/source4/torture/rpc/countcalls.c index eba20e6361e..f9a31feaaf9 100644 --- a/source4/torture/rpc/countcalls.c +++ b/source4/torture/rpc/countcalls.c @@ -29,9 +29,9 @@ -BOOL count_calls(TALLOC_CTX *mem_ctx, +bool count_calls(TALLOC_CTX *mem_ctx, const struct ndr_interface_table *iface, - BOOL all) + bool all) { struct dcerpc_pipe *p; DATA_BLOB stub_in, stub_out; @@ -43,14 +43,14 @@ BOOL count_calls(TALLOC_CTX *mem_ctx, || NT_STATUS_EQUAL(NT_STATUS_ACCESS_DENIED, status)) { if (all) { /* Not fatal if looking for all pipes */ - return True; + return true; } else { printf("Failed to open '%s' to count calls - %s\n", iface->name, nt_errstr(status)); - return False; + return false; } } else if (!NT_STATUS_IS_OK(status)) { printf("Failed to open '%s' to count calls - %s\n", iface->name, nt_errstr(status)); - return False; + return false; } stub_in = data_blob_talloc(p, mem_ctx, 0); @@ -58,7 +58,7 @@ BOOL count_calls(TALLOC_CTX *mem_ctx, printf("\nScanning pipe '%s'\n", iface->name); for (i=0;i<500;i++) { - status = dcerpc_request(p, NULL, i, False, p, &stub_in, &stub_out); + status = dcerpc_request(p, NULL, i, false, p, &stub_in, &stub_out); if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT) && p->last_fault_code == DCERPC_FAULT_OP_RNG_ERROR) { i--; @@ -90,41 +90,41 @@ BOOL count_calls(TALLOC_CTX *mem_ctx, if (i==500) { talloc_free(p); printf("no limit on calls: %s!?\n", nt_errstr(status)); - return False; + return false; } printf("Found %d calls\n", i); talloc_free(p); - return True; + return true; } -BOOL torture_rpc_countcalls(struct torture_context *torture) +bool torture_rpc_countcalls(struct torture_context *torture) { const struct ndr_interface_table *iface; const char *iface_name; - BOOL ret = True; + bool ret = true; const struct ndr_interface_list *l; TALLOC_CTX *mem_ctx = talloc_named(torture, 0, "torture_rpc_countcalls context"); if (!mem_ctx) { - return False; + return false; } iface_name = lp_parm_string(global_loadparm, NULL, "countcalls", "interface"); if (iface_name != NULL) { iface = ndr_table_by_name(iface_name); if (!iface) { printf("Unknown interface '%s'\n", iface_name); - return False; + return false; } - return count_calls(mem_ctx, iface, False); + return count_calls(mem_ctx, iface, false); } for (l=ndr_table_list();l;l=l->next) { TALLOC_CTX *loop_ctx; loop_ctx = talloc_named(mem_ctx, 0, "torture_rpc_councalls loop context"); - ret &= count_calls(loop_ctx, l->table, True); + ret &= count_calls(loop_ctx, l->table, true); talloc_free(loop_ctx); } return ret; diff --git a/source4/torture/rpc/dfs.c b/source4/torture/rpc/dfs.c index 19df14c7724..afa647e71c3 100644 --- a/source4/torture/rpc/dfs.c +++ b/source4/torture/rpc/dfs.c @@ -38,12 +38,12 @@ if (x == DFS_MANAGER_VERSION_W2K3) {\ if (!W_ERROR_EQUAL(y,WERR_NOT_SUPPORTED)) {\ printf("expected WERR_NOT_SUPPORTED\n");\ - return False;\ + return false;\ }\ - return True;\ + return true;\ }\ -static BOOL test_NetShareAdd(TALLOC_CTX *mem_ctx, const char *host, const char *sharename, const char *dir) +static bool test_NetShareAdd(TALLOC_CTX *mem_ctx, const char *host, const char *sharename, const char *dir) { NTSTATUS status; struct srvsvc_NetShareInfo2 i; @@ -53,7 +53,7 @@ static BOOL test_NetShareAdd(TALLOC_CTX *mem_ctx, const char *host, const char * printf("Creating share %s\n", sharename); if (!(libnetctx = libnet_context_init(NULL))) { - return False; + return false; } libnetctx->cred = cmdline_credentials; @@ -75,13 +75,13 @@ static BOOL test_NetShareAdd(TALLOC_CTX *mem_ctx, const char *host, const char * if (!NT_STATUS_IS_OK(status)) { d_printf("Failed to add new share: %s (%s)\n", nt_errstr(status), r.out.error_string); - return False; + return false; } - return True; + return true; } -static BOOL test_NetShareDel(TALLOC_CTX *mem_ctx, const char *host, const char *sharename) +static bool test_NetShareDel(TALLOC_CTX *mem_ctx, const char *host, const char *sharename) { NTSTATUS status; struct libnet_context* libnetctx; @@ -90,7 +90,7 @@ static BOOL test_NetShareDel(TALLOC_CTX *mem_ctx, const char *host, const char * printf("Deleting share %s\n", sharename); if (!(libnetctx = libnet_context_init(NULL))) { - return False; + return false; } libnetctx->cred = cmdline_credentials; @@ -102,13 +102,13 @@ static BOOL test_NetShareDel(TALLOC_CTX *mem_ctx, const char *host, const char * if (!NT_STATUS_IS_OK(status)) { d_printf("Failed to delete share: %s (%s)\n", nt_errstr(status), r.out.error_string); - return False; + return false; } - return True; + return true; } -static BOOL test_CreateDir(TALLOC_CTX *mem_ctx, +static bool test_CreateDir(TALLOC_CTX *mem_ctx, struct smbcli_state **cli, const char *host, const char *share, @@ -117,29 +117,29 @@ static BOOL test_CreateDir(TALLOC_CTX *mem_ctx, printf("Creating directory %s\n", dir); if (!torture_open_connection_share(mem_ctx, cli, host, share, NULL)) { - return False; + return false; } if (!torture_setup_dir(*cli, dir)) { - return False; + return false; } - return True; + return true; } -static BOOL test_DeleteDir(struct smbcli_state *cli, const char *dir) +static bool test_DeleteDir(struct smbcli_state *cli, const char *dir) { printf("Deleting directory %s\n", dir); if (smbcli_deltree(cli->tree, dir) == -1) { printf("Unable to delete dir %s - %s\n", dir, smbcli_errstr(cli->tree)); - return False; + return false; } - return True; + return true; } -static BOOL test_GetManagerVersion(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, enum dfs_ManagerVersion *version) +static bool test_GetManagerVersion(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, enum dfs_ManagerVersion *version) { NTSTATUS status; struct dfs_GetManagerVersion r; @@ -149,13 +149,13 @@ static BOOL test_GetManagerVersion(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, e status = dcerpc_dfs_GetManagerVersion(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("GetManagerVersion failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } -static BOOL test_ManagerInitialize(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, const char *host) +static bool test_ManagerInitialize(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, const char *host) { NTSTATUS status; enum dfs_ManagerVersion version; @@ -164,7 +164,7 @@ static BOOL test_ManagerInitialize(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, c printf("Testing ManagerInitialize\n"); if (!test_GetManagerVersion(p, mem_ctx, &version)) { - return False; + return false; } r.in.servername = host; @@ -173,17 +173,17 @@ static BOOL test_ManagerInitialize(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, c status = dcerpc_dfs_ManagerInitialize(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("ManagerInitialize failed - %s\n", nt_errstr(status)); - return False; + return false; } else if (!W_ERROR_IS_OK(r.out.result)) { printf("dfs_ManagerInitialize failed - %s\n", win_errstr(r.out.result)); IS_DFS_VERSION_UNSUPPORTED_CALL_W2K3(version, r.out.result); - return False; + return false; } - return True; + return true; } -static BOOL test_GetInfoLevel(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, uint16_t level, +static bool test_GetInfoLevel(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, uint16_t level, const char *root) { NTSTATUS status; @@ -199,32 +199,32 @@ static BOOL test_GetInfoLevel(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, uint16 status = dcerpc_dfs_GetInfo(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("GetInfo failed - %s\n", nt_errstr(status)); - return False; + return false; } else if (!W_ERROR_IS_OK(r.out.result) && !W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, r.out.result)) { printf("dfs_GetInfo failed - %s\n", win_errstr(r.out.result)); - return False; + return false; } - return True; + return true; } -static BOOL test_GetInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, const char *root) +static bool test_GetInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, const char *root) { - BOOL ret = True; + bool ret = true; /* 103, 104, 105, 106 is only available on Set */ uint16_t levels[] = {1, 2, 3, 4, 5, 6, 7, 100, 101, 102, 103, 104, 105, 106}; int i; for (i=0;ie.info1->s[i].path); if (!test_GetInfo(p, mem_ctx, root)) { - ret = False; + ret = false; } } } @@ -271,11 +271,11 @@ static BOOL test_EnumLevelEx(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, uint16_ const char *root = talloc_strdup(mem_ctx, rex.out.info->e.info300->s[i].dom_root); for (k=0;ke.info1->s[i].path; if (!test_GetInfo(p, mem_ctx, root)) { - ret = False; + ret = false; } } @@ -332,37 +332,37 @@ static BOOL test_EnumLevel(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, uint16_t } -static BOOL test_Enum(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) +static bool test_Enum(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) { - BOOL ret = True; + bool ret = true; uint16_t levels[] = {1, 2, 3, 4, 200, 300}; int i; for (i=0;ijoin)) == 0) { - found = True; + found = true; break; } } @@ -132,7 +132,7 @@ static bool test_DsGetDomainControllerInfo(struct dcerpc_pipe *p, struct torture for (k=0; k < r.out.ctr.ctr2.count; k++) { if (strcasecmp_m(r.out.ctr.ctr2.array[k].netbios_name, torture_join_netbios_name(priv->join)) == 0) { - found = True; + found = true; priv->dcinfo = r.out.ctr.ctr2.array[k]; break; } @@ -167,7 +167,7 @@ static bool test_DsGetDomainControllerInfo(struct dcerpc_pipe *p, struct torture for (k=0; k < r.out.ctr.ctr01.count; k++) { if (strcasecmp_m(r.out.ctr.ctr01.array[k].client_account, dc_account)) { - found = True; + found = true; break; } } @@ -179,13 +179,13 @@ static bool test_DsGetDomainControllerInfo(struct dcerpc_pipe *p, struct torture return true; } -static BOOL test_DsWriteAccountSpn(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_DsWriteAccountSpn(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct DsPrivate *priv) { NTSTATUS status; struct drsuapi_DsWriteAccountSpn r; struct drsuapi_DsNameString names[2]; - BOOL ret = True; + bool ret = true; r.in.bind_handle = &priv->bind_handle; r.in.level = 1; @@ -207,10 +207,10 @@ static BOOL test_DsWriteAccountSpn(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); } printf("dcerpc_drsuapi_DsWriteAccountSpn failed - %s\n", errstr); - ret = False; + ret = false; } else if (!W_ERROR_IS_OK(r.out.result)) { printf("DsWriteAccountSpn failed - %s\n", win_errstr(r.out.result)); - ret = False; + ret = false; } r.in.req.req1.operation = DRSUAPI_DS_SPN_OPERATION_DELETE; @@ -223,21 +223,21 @@ static BOOL test_DsWriteAccountSpn(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); } printf("dcerpc_drsuapi_DsWriteAccountSpn failed - %s\n", errstr); - ret = False; + ret = false; } else if (!W_ERROR_IS_OK(r.out.result)) { printf("DsWriteAccountSpn failed - %s\n", win_errstr(r.out.result)); - ret = False; + ret = false; } return ret; } -static BOOL test_DsReplicaGetInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_DsReplicaGetInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct DsPrivate *priv) { NTSTATUS status; struct drsuapi_DsReplicaGetInfo r; - BOOL ret = True; + bool ret = true; int i; struct { int32_t level; @@ -307,9 +307,9 @@ static BOOL test_DsReplicaGetInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } }; - if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", False)) { + if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) { printf("skipping DsReplicaGetInfo test against Samba4\n"); - return True; + return true; } r.in.bind_handle = &priv->bind_handle; @@ -348,25 +348,25 @@ static BOOL test_DsReplicaGetInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } if (p->last_fault_code != DCERPC_FAULT_INVALID_TAG) { printf("dcerpc_drsuapi_DsReplicaGetInfo failed - %s\n", errstr); - ret = False; + ret = false; } else { printf("DsReplicaGetInfo level %d and/or infotype %d not supported by server\n", array[i].level, array[i].infotype); } } else if (!W_ERROR_IS_OK(r.out.result)) { printf("DsReplicaGetInfo failed - %s\n", win_errstr(r.out.result)); - ret = False; + ret = false; } } return ret; } -static BOOL test_DsReplicaSync(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_DsReplicaSync(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct DsPrivate *priv) { NTSTATUS status; - BOOL ret = True; + bool ret = true; int i; struct drsuapi_DsReplicaSync r; struct drsuapi_DsReplicaObjectIdentifier nc; @@ -380,14 +380,14 @@ static BOOL test_DsReplicaSync(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } }; - if (!lp_parm_bool(global_loadparm, NULL, "torture", "dangerous", False)) { + if (!lp_parm_bool(global_loadparm, NULL, "torture", "dangerous", false)) { printf("DsReplicaSync disabled - enable dangerous tests to use\n"); - return True; + return true; } - if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", False)) { + if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) { printf("skipping DsReplicaSync test against Samba4\n"); - return True; + return true; } ZERO_STRUCT(null_guid); @@ -420,21 +420,21 @@ static BOOL test_DsReplicaSync(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); } printf("dcerpc_drsuapi_DsReplicaSync failed - %s\n", errstr); - ret = False; + ret = false; } else if (!W_ERROR_IS_OK(r.out.result)) { printf("DsReplicaSync failed - %s\n", win_errstr(r.out.result)); - ret = False; + ret = false; } } return ret; } -static BOOL test_DsReplicaUpdateRefs(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_DsReplicaUpdateRefs(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct DsPrivate *priv) { NTSTATUS status; - BOOL ret = True; + bool ret = true; int i; struct drsuapi_DsReplicaUpdateRefs r; struct drsuapi_DsReplicaObjectIdentifier nc; @@ -448,9 +448,9 @@ static BOOL test_DsReplicaUpdateRefs(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } }; - if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", False)) { + if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) { printf("skipping DsReplicaUpdateRefs test against Samba4\n"); - return True; + return true; } ZERO_STRUCT(null_guid); @@ -484,21 +484,21 @@ static BOOL test_DsReplicaUpdateRefs(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); } printf("dcerpc_drsuapi_DsReplicaUpdateRefs failed - %s\n", errstr); - ret = False; + ret = false; } else if (!W_ERROR_IS_OK(r.out.result)) { printf("DsReplicaUpdateRefs failed - %s\n", win_errstr(r.out.result)); - ret = False; + ret = false; } } return ret; } -static BOOL test_DsGetNCChanges(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_DsGetNCChanges(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct DsPrivate *priv) { NTSTATUS status; - BOOL ret = True; + bool ret = true; int i; struct drsuapi_DsGetNCChanges r; struct drsuapi_DsReplicaObjectIdentifier nc; @@ -515,9 +515,9 @@ static BOOL test_DsGetNCChanges(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } }; - if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", False)) { + if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) { printf("skipping DsGetNCChanges test against Samba4\n"); - return True; + return true; } ZERO_STRUCT(null_guid); @@ -544,7 +544,7 @@ static BOOL test_DsGetNCChanges(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, r.in.req.req5.highwatermark.highest_usn = 0; r.in.req.req5.uptodateness_vector = NULL; r.in.req.req5.replica_flags = 0; - if (lp_parm_bool(global_loadparm, NULL, "drsuapi","compression", False)) { + if (lp_parm_bool(global_loadparm, NULL, "drsuapi","compression", false)) { r.in.req.req5.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES; } r.in.req.req5.max_object_count = 0; @@ -566,10 +566,10 @@ static BOOL test_DsGetNCChanges(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, r.in.req.req8.highwatermark.highest_usn = 0; r.in.req.req8.uptodateness_vector = NULL; r.in.req.req8.replica_flags = 0; - if (lp_parm_bool(global_loadparm, NULL,"drsuapi","compression",False)) { + if (lp_parm_bool(global_loadparm, NULL, "drsuapi", "compression", false)) { r.in.req.req8.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES; } - if (lp_parm_bool(global_loadparm, NULL,"drsuapi","neighbour_writeable",True)) { + if (lp_parm_bool(global_loadparm, NULL, "drsuapi", "neighbour_writeable", true)) { r.in.req.req8.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE; } r.in.req.req8.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP @@ -596,22 +596,22 @@ static BOOL test_DsGetNCChanges(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); } printf("dcerpc_drsuapi_DsGetNCChanges failed - %s\n", errstr); - ret = False; + ret = false; } else if (!W_ERROR_IS_OK(r.out.result)) { printf("DsGetNCChanges failed - %s\n", win_errstr(r.out.result)); - ret = False; + ret = false; } } return ret; } -BOOL test_QuerySitesByCost(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +bool test_QuerySitesByCost(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct DsPrivate *priv) { NTSTATUS status; struct drsuapi_QuerySitesByCost r; - BOOL ret = True; + bool ret = true; const char *my_site = "Default-First-Site-Name"; const char *remote_site1 = "smbtorture-nonexisting-site1"; @@ -633,10 +633,10 @@ BOOL test_QuerySitesByCost(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); } printf("drsuapi_QuerySitesByCost - %s\n", errstr); - ret = False; + ret = false; } else if (!W_ERROR_IS_OK(r.out.result)) { printf("QuerySitesByCost failed - %s\n", win_errstr(r.out.result)); - ret = False; + ret = false; } if (W_ERROR_IS_OK(r.out.result)) { @@ -645,14 +645,14 @@ BOOL test_QuerySitesByCost(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, !W_ERROR_EQUAL(r.out.ctr.ctr1.info[1].error_code, WERR_DS_OBJ_NOT_FOUND)) { printf("expected error_code WERR_DS_OBJ_NOT_FOUND, got %s\n", win_errstr(r.out.ctr.ctr1.info[0].error_code)); - ret = False; + ret = false; } if ((r.out.ctr.ctr1.info[0].site_cost != (uint32_t) -1) || (r.out.ctr.ctr1.info[1].site_cost != (uint32_t) -1)) { printf("expected site_cost %d, got %d\n", (uint32_t) -1, r.out.ctr.ctr1.info[0].site_cost); - ret = False; + ret = false; } } @@ -661,12 +661,12 @@ BOOL test_QuerySitesByCost(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } -BOOL test_DsUnbind(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +bool test_DsUnbind(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct DsPrivate *priv) { NTSTATUS status; struct drsuapi_DsUnbind r; - BOOL ret = True; + bool ret = true; r.in.bind_handle = &priv->bind_handle; r.out.bind_handle = &priv->bind_handle; @@ -680,10 +680,10 @@ BOOL test_DsUnbind(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); } printf("dcerpc_drsuapi_DsUnbind failed - %s\n", errstr); - ret = False; + ret = false; } else if (!W_ERROR_IS_OK(r.out.result)) { printf("DsBind failed - %s\n", win_errstr(r.out.result)); - ret = False; + ret = false; } return ret; diff --git a/source4/torture/rpc/drsuapi_cracknames.c b/source4/torture/rpc/drsuapi_cracknames.c index d3530dae196..ac3eebfa68d 100644 --- a/source4/torture/rpc/drsuapi_cracknames.c +++ b/source4/torture/rpc/drsuapi_cracknames.c @@ -29,14 +29,14 @@ #include "libcli/security/security.h" #include "param/param.h" -static BOOL test_DsCrackNamesMatrix(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_DsCrackNamesMatrix(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct DsPrivate *priv, const char *dn, const char *user_principal_name, const char *service_principal_name) { NTSTATUS status; - BOOL ret = True; + bool ret = true; struct drsuapi_DsCrackNames r; enum drsuapi_DsNameFormat formats[] = { DRSUAPI_DS_NAME_FORMAT_FQDN_1779, @@ -81,13 +81,13 @@ static BOOL test_DsCrackNamesMatrix(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, names[0].str, r.in.req.req1.format_offered, r.in.req.req1.format_desired); printf("dcerpc_drsuapi_DsCrackNames failed - %s\n", errstr); - ret = False; + ret = false; } else if (!W_ERROR_IS_OK(r.out.result)) { printf("testing DsCrackNames (matrix prep) with name '%s' from format: %d desired format:%d ", names[0].str, r.in.req.req1.format_offered, r.in.req.req1.format_desired); printf("DsCrackNames failed - %s\n", win_errstr(r.out.result)); - ret = False; + ret = false; } if (!ret) { @@ -98,7 +98,7 @@ static BOOL test_DsCrackNamesMatrix(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (r.out.ctr.ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_NOT_UNIQUE) { printf(__location__ ": Unexpected error (%d): This name lookup should fail\n", r.out.ctr.ctr1->array[0].status); - return False; + return false; } printf ("(expected) error\n"); break; @@ -106,7 +106,7 @@ static BOOL test_DsCrackNamesMatrix(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (r.out.ctr.ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_NO_MAPPING) { printf(__location__ ": Unexpected error (%d): This name lookup should fail\n", r.out.ctr.ctr1->array[0].status); - return False; + return false; } printf ("(expected) error\n"); break; @@ -115,14 +115,14 @@ static BOOL test_DsCrackNamesMatrix(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (r.out.ctr.ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_RESOLVE_ERROR) { printf(__location__ ": Unexpected error (%d): This name lookup should fail\n", r.out.ctr.ctr1->array[0].status); - return False; + return false; } printf ("(expected) error\n"); break; default: if (r.out.ctr.ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) { printf("Error: %d\n", r.out.ctr.ctr1->array[0].status); - return False; + return false; } } @@ -160,12 +160,12 @@ static BOOL test_DsCrackNamesMatrix(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } printf("testing DsCrackNames (matrix) with name '%s' from format: %d desired format:%d failed - %s", names[0].str, r.in.req.req1.format_offered, r.in.req.req1.format_desired, errstr); - ret = False; + ret = false; } else if (!W_ERROR_IS_OK(r.out.result)) { printf("testing DsCrackNames (matrix) with name '%s' from format: %d desired format:%d failed - %s", names[0].str, r.in.req.req1.format_offered, r.in.req.req1.format_desired, win_errstr(r.out.result)); - ret = False; + ret = false; } if (!ret) { @@ -191,26 +191,26 @@ static BOOL test_DsCrackNamesMatrix(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } else if (n_matrix[i][j] == NULL && formats[j] == DRSUAPI_DS_NAME_FORMAT_SERVICE_PRINCIPAL) { } else if (n_matrix[i][j] == NULL && n_from[j] != NULL) { printf("dcerpc_drsuapi_DsCrackNames mismatch - from %d to %d: %s should be %s\n", formats[i], formats[j], n_matrix[i][j], n_from[j]); - ret = False; + ret = false; } else if (n_matrix[i][j] != NULL && n_from[j] == NULL) { printf("dcerpc_drsuapi_DsCrackNames mismatch - from %d to %d: %s should be %s\n", formats[i], formats[j], n_matrix[i][j], n_from[j]); - ret = False; + ret = false; } else if (strcmp(n_matrix[i][j], n_from[j]) != 0) { printf("dcerpc_drsuapi_DsCrackNames mismatch - from %d to %d: %s should be %s\n", formats[i], formats[j], n_matrix[i][j], n_from[j]); - ret = False; + ret = false; } } } return ret; } -BOOL test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +bool test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct DsPrivate *priv) { NTSTATUS status; struct drsuapi_DsCrackNames r; struct drsuapi_DsNameString names[1]; - BOOL ret = True; + bool ret = true; const char *dns_domain; const char *nt4_domain; const char *FQDN_1779_name; @@ -254,13 +254,13 @@ BOOL test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); } printf("dcerpc_drsuapi_DsCrackNames failed - %s\n", errstr); - ret = False; + ret = false; } else if (!W_ERROR_IS_OK(r.out.result)) { printf("DsCrackNames failed - %s\n", win_errstr(r.out.result)); - ret = False; + ret = false; } else if (r.out.ctr.ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) { printf("DsCrackNames failed on name - %d\n", r.out.ctr.ctr1->array[0].status); - ret = False; + ret = false; } if (!ret) { @@ -282,13 +282,13 @@ BOOL test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); } printf("dcerpc_drsuapi_DsCrackNames failed - %s\n", errstr); - ret = False; + ret = false; } else if (!W_ERROR_IS_OK(r.out.result)) { printf("DsCrackNames failed - %s\n", win_errstr(r.out.result)); - ret = False; + ret = false; } else if (r.out.ctr.ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) { printf("DsCrackNames failed on name - %d\n", r.out.ctr.ctr1->array[0].status); - ret = False; + ret = false; } if (!ret) { @@ -311,13 +311,13 @@ BOOL test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); } printf("dcerpc_drsuapi_DsCrackNames failed - %s\n", errstr); - ret = False; + ret = false; } else if (!W_ERROR_IS_OK(r.out.result)) { printf("DsCrackNames failed - %s\n", win_errstr(r.out.result)); - ret = False; + ret = false; } else if (r.out.ctr.ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) { printf("DsCrackNames failed on name - %d\n", r.out.ctr.ctr1->array[0].status); - ret = False; + ret = false; } if (!ret) { @@ -335,7 +335,7 @@ BOOL test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("local Round trip on canonical name failed: %s != %s!\n", realm_canonical, talloc_asprintf(mem_ctx, "%s/", dns_domain)); - return False; + return false; }; realm_canonical_ex = ldb_dn_canonical_ex_string(mem_ctx, realm_dn); @@ -345,7 +345,7 @@ BOOL test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("local Round trip on canonical ex name failed: %s != %s!\n", realm_canonical, talloc_asprintf(mem_ctx, "%s\n", dns_domain)); - return False; + return false; }; r.in.req.req1.format_offered = DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT; @@ -362,13 +362,13 @@ BOOL test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); } printf("dcerpc_drsuapi_DsCrackNames failed - %s\n", errstr); - ret = False; + ret = false; } else if (!W_ERROR_IS_OK(r.out.result)) { printf("DsCrackNames failed - %s\n", win_errstr(r.out.result)); - ret = False; + ret = false; } else if (r.out.ctr.ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) { printf("DsCrackNames failed on name - %d\n", r.out.ctr.ctr1->array[0].status); - ret = False; + ret = false; } if (!ret) { @@ -391,13 +391,13 @@ BOOL test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); } printf("dcerpc_drsuapi_DsCrackNames failed - %s\n", errstr); - ret = False; + ret = false; } else if (!W_ERROR_IS_OK(r.out.result)) { printf("DsCrackNames failed - %s\n", win_errstr(r.out.result)); - ret = False; + ret = false; } else if (r.out.ctr.ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) { printf("DsCrackNames failed on name - %d\n", r.out.ctr.ctr1->array[0].status); - ret = False; + ret = false; } if (!ret) { @@ -420,13 +420,13 @@ BOOL test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); } printf("dcerpc_drsuapi_DsCrackNames failed - %s\n", errstr); - ret = False; + ret = false; } else if (!W_ERROR_IS_OK(r.out.result)) { printf("DsCrackNames failed - %s\n", win_errstr(r.out.result)); - ret = False; + ret = false; } else if (r.out.ctr.ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) { printf("DsCrackNames failed on name - %d\n", r.out.ctr.ctr1->array[0].status); - ret = False; + ret = false; } if (!ret) { @@ -435,7 +435,7 @@ BOOL test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (strcmp(priv->domain_dns_name, r.out.ctr.ctr1->array[0].dns_domain_name) != 0) { printf("DsCrackNames failed to return same DNS name - expected %s got %s\n", priv->domain_dns_name, r.out.ctr.ctr1->array[0].dns_domain_name); - return False; + return false; } FQDN_1779_dn = ldb_dn_new(mem_ctx, ldb, FQDN_1779_name); @@ -463,7 +463,7 @@ BOOL test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, enum drsuapi_DsNameStatus status; enum drsuapi_DsNameStatus alternate_status; enum drsuapi_DsNameFlags flags; - BOOL skip; + bool skip; } crack[] = { { .format_offered = DRSUAPI_DS_NAME_FORMAT_USER_PRINCIPAL, @@ -589,7 +589,7 @@ BOOL test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, .comment = "display name for Microsoft Support Account", .status = DRSUAPI_DS_NAME_STATUS_OK, .alternate_status = DRSUAPI_DS_NAME_STATUS_NOT_UNIQUE, - .skip = lp_parm_bool(global_loadparm, NULL, "torture", "samba4", False) + .skip = lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false) }, { .format_offered = DRSUAPI_DS_NAME_FORMAT_GUID, @@ -941,10 +941,10 @@ BOOL test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); } printf("dcerpc_drsuapi_DsCrackNames failed on %s - %s\n", comment, errstr); - ret = False; + ret = false; } else if (!W_ERROR_IS_OK(r.out.result)) { printf("DsCrackNames failed - %s\n", win_errstr(r.out.result)); - ret = False; + ret = false; } else if (r.out.ctr.ctr1->array[0].status != crack[i].status) { if (crack[i].alternate_status) { if (r.out.ctr.ctr1->array[0].status != crack[i].alternate_status) { @@ -953,14 +953,14 @@ BOOL test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, crack[i].status, crack[i].alternate_status, comment); - ret = False; + ret = false; } } else { printf("DsCrackNames unexpected status %d, wanted %d on: %s\n", r.out.ctr.ctr1->array[0].status, crack[i].status, comment); - ret = False; + ret = false; } } else if (crack[i].expected_str && (strcmp(r.out.ctr.ctr1->array[0].result_name, @@ -970,7 +970,7 @@ BOOL test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("DsCrackNames failed - got %s, expected %s on %s\n", r.out.ctr.ctr1->array[0].result_name, crack[i].expected_str, comment); - ret = False; + ret = false; } else { printf("(warning) DsCrackNames returned different case - got %s, expected %s on %s\n", r.out.ctr.ctr1->array[0].result_name, @@ -982,14 +982,14 @@ BOOL test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("DsCrackNames failed - got DNS name %s, expected %s on %s\n", r.out.ctr.ctr1->array[0].result_name, crack[i].expected_str, comment); - ret = False; + ret = false; } } } if (!test_DsCrackNamesMatrix(p, mem_ctx, priv, FQDN_1779_name, user_principal_name, service_principal_name)) { - ret = False; + ret = false; } return ret; diff --git a/source4/torture/rpc/dssync.c b/source4/torture/rpc/dssync.c index 347b1a5bc74..15125ac3657 100644 --- a/source4/torture/rpc/dssync.c +++ b/source4/torture/rpc/dssync.c @@ -173,10 +173,10 @@ static struct DsSyncTest *test_create_context(TALLOC_CTX *mem_ctx) return ctx; } -static BOOL _test_DsBind(struct DsSyncTest *ctx, struct cli_credentials *credentials, struct DsSyncBindInfo *b) +static bool _test_DsBind(struct DsSyncTest *ctx, struct cli_credentials *credentials, struct DsSyncBindInfo *b) { NTSTATUS status; - BOOL ret = True; + bool ret = true; struct event_context *event = NULL; status = dcerpc_pipe_connect_b(ctx, @@ -186,7 +186,7 @@ static BOOL _test_DsBind(struct DsSyncTest *ctx, struct cli_credentials *credent if (!NT_STATUS_IS_OK(status)) { printf("Failed to connect to server as a BDC: %s\n", nt_errstr(status)); - return False; + return false; } status = dcerpc_drsuapi_DsBind(b->pipe, ctx, &b->req); @@ -196,10 +196,10 @@ static BOOL _test_DsBind(struct DsSyncTest *ctx, struct cli_credentials *credent errstr = dcerpc_errstr(ctx, b->pipe->last_fault_code); } printf("dcerpc_drsuapi_DsBind failed - %s\n", errstr); - ret = False; + ret = false; } else if (!W_ERROR_IS_OK(b->req.out.result)) { printf("DsBind failed - %s\n", win_errstr(b->req.out.result)); - ret = False; + ret = false; } ZERO_STRUCT(b->peer_bind_info28); @@ -223,15 +223,15 @@ static BOOL _test_DsBind(struct DsSyncTest *ctx, struct cli_credentials *credent return ret; } -static BOOL test_LDAPBind(struct DsSyncTest *ctx, struct cli_credentials *credentials, struct DsSyncLDAPInfo *l) +static bool test_LDAPBind(struct DsSyncTest *ctx, struct cli_credentials *credentials, struct DsSyncLDAPInfo *l) { NTSTATUS status; - BOOL ret = True; + bool ret = true; status = torture_ldap_connection(ctx, &l->conn, ctx->ldap_url); if (!NT_STATUS_IS_OK(status)) { printf("failed to connect to LDAP: %s\n", ctx->ldap_url); - return False; + return false; } printf("connected to LDAP: %s\n", ctx->ldap_url); @@ -239,19 +239,19 @@ static BOOL test_LDAPBind(struct DsSyncTest *ctx, struct cli_credentials *creden status = torture_ldap_bind_sasl(l->conn, credentials); if (!NT_STATUS_IS_OK(status)) { printf("failed to bind to LDAP:\n"); - return False; + return false; } printf("bound to LDAP.\n"); return ret; } -static BOOL test_GetInfo(struct DsSyncTest *ctx) +static bool test_GetInfo(struct DsSyncTest *ctx) { NTSTATUS status; struct drsuapi_DsCrackNames r; struct drsuapi_DsNameString names[1]; - BOOL ret = True; + bool ret = true; struct cldap_socket *cldap = cldap_socket_init(ctx, NULL); struct cldap_netlogon search; @@ -274,10 +274,10 @@ static BOOL test_GetInfo(struct DsSyncTest *ctx) errstr = dcerpc_errstr(ctx, ctx->admin.drsuapi.pipe->last_fault_code); } printf("dcerpc_drsuapi_DsCrackNames failed - %s\n", errstr); - return False; + return false; } else if (!W_ERROR_IS_OK(r.out.result)) { printf("DsCrackNames failed - %s\n", win_errstr(r.out.result)); - return False; + return false; } ctx->domain_dn = r.out.ctr.ctr1->array[0].result_name; @@ -430,7 +430,7 @@ static void test_analyse_objects(struct DsSyncTest *ctx, const char *dn; struct dom_sid *sid = NULL; uint32_t rid = 0; - BOOL dn_printed = False; + bool dn_printed = false; uint32_t i; if (!cur->object.identifier) continue; @@ -504,7 +504,7 @@ static void test_analyse_objects(struct DsSyncTest *ctx, if (!dn_printed) { object_id++; DEBUG(0,("DN[%u] %s\n", object_id, dn)); - dn_printed = True; + dn_printed = true; } DEBUGADD(0,("ATTR: %s enc.length=%lu plain.length=%lu\n", name, (long)enc_data->length, (long)plain_data.length)); @@ -531,10 +531,10 @@ static void test_analyse_objects(struct DsSyncTest *ctx, } } -static BOOL test_FetchData(struct DsSyncTest *ctx) +static bool test_FetchData(struct DsSyncTest *ctx) { NTSTATUS status; - BOOL ret = True; + bool ret = true; int i, y = 0; uint64_t highest_usn = 0; const char *partition = NULL; @@ -582,7 +582,7 @@ static BOOL test_FetchData(struct DsSyncTest *ctx) &gensec_skey); if (!NT_STATUS_IS_OK(status)) { printf("failed to get gensec session key: %s\n", nt_errstr(status)); - return False; + return false; } for (i=0; i < ARRAY_SIZE(array); i++) { @@ -686,16 +686,16 @@ static BOOL test_FetchData(struct DsSyncTest *ctx) errstr = dcerpc_errstr(ctx, ctx->new_dc.drsuapi.pipe->last_fault_code); } printf("dcerpc_drsuapi_DsGetNCChanges failed - %s\n", errstr); - ret = False; + ret = false; } else if (!W_ERROR_IS_OK(r.out.result)) { printf("DsGetNCChanges failed - %s\n", win_errstr(r.out.result)); - ret = False; + ret = false; } - if (ret == True && *r.out.level == 1) { + if (ret == true && *r.out.level == 1) { out_level = 1; ctr1 = &r.out.ctr.ctr1; - } else if (ret == True && *r.out.level == 2) { + } else if (ret == true && *r.out.level == 2) { out_level = 1; ctr1 = r.out.ctr.ctr2.ctr.mszip1.ctr1; } @@ -713,10 +713,10 @@ static BOOL test_FetchData(struct DsSyncTest *ctx) } } - if (ret == True && *r.out.level == 6) { + if (ret == true && *r.out.level == 6) { out_level = 6; ctr6 = &r.out.ctr.ctr6; - } else if (ret == True && *r.out.level == 7 + } else if (ret == true && *r.out.level == 7 && r.out.ctr.ctr7.level == 6 && r.out.ctr.ctr7.type == DRSUAPI_COMPRESSION_TYPE_MSZIP) { out_level = 6; @@ -743,10 +743,10 @@ static BOOL test_FetchData(struct DsSyncTest *ctx) return ret; } -static BOOL test_FetchNT4Data(struct DsSyncTest *ctx) +static bool test_FetchNT4Data(struct DsSyncTest *ctx) { NTSTATUS status; - BOOL ret = True; + bool ret = true; struct drsuapi_DsGetNT4ChangeLog r; struct GUID null_guid; struct dom_sid null_sid; @@ -774,16 +774,16 @@ static BOOL test_FetchNT4Data(struct DsSyncTest *ctx) errstr = dcerpc_errstr(ctx, ctx->new_dc.drsuapi.pipe->last_fault_code); } printf("dcerpc_drsuapi_DsGetNT4ChangeLog failed - %s\n", errstr); - ret = False; + ret = false; } else if (W_ERROR_EQUAL(r.out.result, WERR_INVALID_DOMAIN_ROLE)) { printf("DsGetNT4ChangeLog not supported by target server\n"); break; } else if (!W_ERROR_IS_OK(r.out.result)) { printf("DsGetNT4ChangeLog failed - %s\n", win_errstr(r.out.result)); - ret = False; + ret = false; } else if (r.out.level != 1) { printf("DsGetNT4ChangeLog unknown level - %u\n", r.out.level); - ret = False; + ret = false; } else if (NT_STATUS_IS_OK(r.out.info.info1.status)) { } else if (NT_STATUS_EQUAL(r.out.info.info1.status, STATUS_MORE_ENTRIES)) { cookie.length = r.out.info.info1.length1; @@ -791,7 +791,7 @@ static BOOL test_FetchNT4Data(struct DsSyncTest *ctx) continue; } else { printf("DsGetNT4ChangeLog failed - %s\n", nt_errstr(r.out.info.info1.status)); - ret = False; + ret = false; } break; diff --git a/source4/torture/rpc/echo.c b/source4/torture/rpc/echo.c index c873cdf0aee..5c027d32990 100644 --- a/source4/torture/rpc/echo.c +++ b/source4/torture/rpc/echo.c @@ -230,7 +230,7 @@ static bool test_sleep(struct torture_context *tctx, #define ASYNC_COUNT 3 struct rpc_request *req[ASYNC_COUNT]; struct echo_TestSleep r[ASYNC_COUNT]; - BOOL done[ASYNC_COUNT]; + bool done[ASYNC_COUNT]; struct timeval snd[ASYNC_COUNT]; struct timeval rcv[ASYNC_COUNT]; struct timeval diff[ASYNC_COUNT]; @@ -243,7 +243,7 @@ static bool test_sleep(struct torture_context *tctx, torture_comment(tctx, "Testing TestSleep - use \"torture:quick=yes\" to disable\n"); for (i=0;istate == RPC_REQUEST_DONE) { + if (done[i] == false && req[i]->state == RPC_REQUEST_DONE) { int rounded_tdiff; total_done++; - done[i] = True; + done[i] = true; rcv[i] = timeval_current(); diff[i] = timeval_until(&snd[i], &rcv[i]); rounded_tdiff = (int)(0.5 + diff[i].tv_sec + (1.0e-6*diff[i].tv_usec)); @@ -393,7 +393,7 @@ static bool test_timeout(struct torture_context *tctx, torture_comment(tctx, "Failed to send async sleep request\n"); goto failed; } - req->ignore_timeout = True; + req->ignore_timeout = true; status = dcerpc_ndr_request_recv(req); torture_assert_ntstatus_equal(tctx, status, NT_STATUS_IO_TIMEOUT, @@ -412,7 +412,7 @@ static bool test_timeout(struct torture_context *tctx, torture_comment(tctx, "Failed to send async sleep request\n"); goto failed; } - req->ignore_timeout = True; + req->ignore_timeout = true; status = dcerpc_ndr_request_recv(req); torture_assert_ntstatus_equal(tctx, status, NT_STATUS_IO_TIMEOUT, "request should have timed out"); diff --git a/source4/torture/rpc/epmapper.c b/source4/torture/rpc/epmapper.c index f6f8e66369f..830b77aed97 100644 --- a/source4/torture/rpc/epmapper.c +++ b/source4/torture/rpc/epmapper.c @@ -39,7 +39,7 @@ static void display_tower(TALLOC_CTX *mem_ctx, struct epm_tower *twr) } -static BOOL test_Map(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_Map(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct epm_twr_t *twr) { NTSTATUS status; @@ -131,7 +131,7 @@ static BOOL test_Map(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, /* FIXME: Extend to do other protocols as well (ncacn_unix_stream, ncalrpc) */ - return True; + return true; } static bool test_Lookup(struct torture_context *tctx, @@ -186,7 +186,7 @@ static bool test_Lookup(struct torture_context *tctx, return true; } -static BOOL test_Delete(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct epm_entry_t *entries) +static bool test_Delete(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct epm_entry_t *entries) { NTSTATUS status; struct epm_Delete r; @@ -197,15 +197,15 @@ static BOOL test_Delete(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct epm_e status = dcerpc_epm_Delete(p, mem_ctx, &r); if (NT_STATUS_IS_ERR(status)) { printf("Delete failed - %s\n", nt_errstr(status)); - return False; + return false; } if (r.out.result != 0) { printf("Delete failed - %d\n", r.out.result); - return False; + return false; } - return True; + return true; } static bool test_Insert(struct torture_context *tctx, diff --git a/source4/torture/rpc/join.c b/source4/torture/rpc/join.c index 23c43c525ed..d0ad97110a2 100644 --- a/source4/torture/rpc/join.c +++ b/source4/torture/rpc/join.c @@ -8,7 +8,7 @@ #define TORTURE_NETBIOS_NAME "smbtorturejoin" -BOOL torture_rpc_join(struct torture_context *torture) +bool torture_rpc_join(struct torture_context *torture) { NTSTATUS status; struct test_join *tj; @@ -24,7 +24,7 @@ BOOL torture_rpc_join(struct torture_context *torture) if (!tj) { DEBUG(0, ("%s failed to join domain as workstation\n", TORTURE_NETBIOS_NAME)); - return False; + return false; } status = smbcli_full_connection(tj, &cli, host, @@ -34,7 +34,7 @@ BOOL torture_rpc_join(struct torture_context *torture) if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("%s failed to connect to IPC$ with workstation credentials\n", TORTURE_NETBIOS_NAME)); - return False; + return false; } smbcli_tdis(cli); @@ -48,7 +48,7 @@ BOOL torture_rpc_join(struct torture_context *torture) if (!tj) { DEBUG(0, ("%s failed to join domain as domain controller\n", TORTURE_NETBIOS_NAME)); - return False; + return false; } status = smbcli_full_connection(tj, &cli, host, @@ -58,7 +58,7 @@ BOOL torture_rpc_join(struct torture_context *torture) if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("%s failed to connect to IPC$ with workstation credentials\n", TORTURE_NETBIOS_NAME)); - return False; + return false; } smbcli_tdis(cli); @@ -66,6 +66,6 @@ BOOL torture_rpc_join(struct torture_context *torture) /* Leave domain. */ torture_leave_domain(tj); - return True; + return true; } diff --git a/source4/torture/rpc/lsa.c b/source4/torture/rpc/lsa.c index 0a78e9d76d3..1250743955e 100644 --- a/source4/torture/rpc/lsa.c +++ b/source4/torture/rpc/lsa.c @@ -34,7 +34,7 @@ static void init_lsa_String(struct lsa_String *name, const char *s) name->string = s; } -static BOOL test_OpenPolicy(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) +static bool test_OpenPolicy(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) { struct lsa_ObjectAttribute attr; struct policy_handle handle; @@ -67,17 +67,17 @@ static BOOL test_OpenPolicy(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) if (NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED) || NT_STATUS_EQUAL(status, NT_STATUS_RPC_PROTSEQ_NOT_SUPPORTED)) { printf("not considering %s to be an error\n", nt_errstr(status)); - return True; + return true; } printf("OpenPolicy failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } -BOOL test_lsa_OpenPolicy2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +bool test_lsa_OpenPolicy2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle **handle) { struct lsa_ObjectAttribute attr; @@ -89,7 +89,7 @@ BOOL test_lsa_OpenPolicy2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, *handle = talloc(mem_ctx, struct policy_handle); if (!*handle) { - return False; + return false; } qos.len = 0; @@ -116,16 +116,16 @@ BOOL test_lsa_OpenPolicy2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("not considering %s to be an error\n", nt_errstr(status)); talloc_free(*handle); *handle = NULL; - return True; + return true; } printf("OpenPolicy2 failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } -static BOOL test_LookupNames(struct dcerpc_pipe *p, +static bool test_LookupNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_TransNameArray *tnames) @@ -159,15 +159,15 @@ static BOOL test_LookupNames(struct dcerpc_pipe *p, status = dcerpc_lsa_LookupNames(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("LookupNames failed - %s\n", nt_errstr(status)); - return False; + return false; } printf("\n"); - return True; + return true; } -static BOOL test_LookupNames_bogus(struct dcerpc_pipe *p, +static bool test_LookupNames_bogus(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { @@ -207,15 +207,15 @@ static BOOL test_LookupNames_bogus(struct dcerpc_pipe *p, status = dcerpc_lsa_LookupNames(p, mem_ctx, &r); if (!NT_STATUS_EQUAL(status, NT_STATUS_NONE_MAPPED)) { printf("LookupNames failed - %s\n", nt_errstr(status)); - return False; + return false; } printf("\n"); - return True; + return true; } -static BOOL test_LookupNames_wellknown(struct dcerpc_pipe *p, +static bool test_LookupNames_wellknown(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { @@ -256,7 +256,7 @@ static BOOL test_LookupNames_wellknown(struct dcerpc_pipe *p, return ret; } -static BOOL test_LookupNames2(struct dcerpc_pipe *p, +static bool test_LookupNames2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_TransNameArray2 *tnames) @@ -292,16 +292,16 @@ static BOOL test_LookupNames2(struct dcerpc_pipe *p, status = dcerpc_lsa_LookupNames2(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("LookupNames2 failed - %s\n", nt_errstr(status)); - return False; + return false; } printf("\n"); - return True; + return true; } -static BOOL test_LookupNames3(struct dcerpc_pipe *p, +static bool test_LookupNames3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_TransNameArray2 *tnames) @@ -337,15 +337,15 @@ static BOOL test_LookupNames3(struct dcerpc_pipe *p, status = dcerpc_lsa_LookupNames3(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("LookupNames3 failed - %s\n", nt_errstr(status)); - return False; + return false; } printf("\n"); - return True; + return true; } -static BOOL test_LookupNames4(struct dcerpc_pipe *p, +static bool test_LookupNames4(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct lsa_TransNameArray2 *tnames) { @@ -379,16 +379,16 @@ static BOOL test_LookupNames4(struct dcerpc_pipe *p, status = dcerpc_lsa_LookupNames4(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("LookupNames4 failed - %s\n", nt_errstr(status)); - return False; + return false; } printf("\n"); - return True; + return true; } -static BOOL test_LookupSids(struct dcerpc_pipe *p, +static bool test_LookupSids(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_SidArray *sids) @@ -414,20 +414,20 @@ static BOOL test_LookupSids(struct dcerpc_pipe *p, status = dcerpc_lsa_LookupSids(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("LookupSids failed - %s\n", nt_errstr(status)); - return False; + return false; } printf("\n"); if (!test_LookupNames(p, mem_ctx, handle, &names)) { - return False; + return false; } - return True; + return true; } -static BOOL test_LookupSids2(struct dcerpc_pipe *p, +static bool test_LookupSids2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_SidArray *sids) @@ -455,23 +455,23 @@ static BOOL test_LookupSids2(struct dcerpc_pipe *p, status = dcerpc_lsa_LookupSids2(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("LookupSids2 failed - %s\n", nt_errstr(status)); - return False; + return false; } printf("\n"); if (!test_LookupNames2(p, mem_ctx, handle, &names)) { - return False; + return false; } if (!test_LookupNames3(p, mem_ctx, handle, &names)) { - return False; + return false; } - return True; + return true; } -static BOOL test_LookupSids3(struct dcerpc_pipe *p, +static bool test_LookupSids3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct lsa_SidArray *sids) { @@ -499,23 +499,23 @@ static BOOL test_LookupSids3(struct dcerpc_pipe *p, if (NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED) || NT_STATUS_EQUAL(status, NT_STATUS_RPC_PROTSEQ_NOT_SUPPORTED)) { printf("not considering %s to be an error\n", nt_errstr(status)); - return True; + return true; } printf("LookupSids3 failed - %s - not considered an error\n", nt_errstr(status)); - return False; + return false; } printf("\n"); if (!test_LookupNames4(p, mem_ctx, &names)) { - return False; + return false; } - return True; + return true; } -BOOL test_many_LookupSids(struct dcerpc_pipe *p, +bool test_many_LookupSids(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { @@ -554,13 +554,13 @@ BOOL test_many_LookupSids(struct dcerpc_pipe *p, status = dcerpc_lsa_LookupSids(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("LookupSids failed - %s\n", nt_errstr(status)); - return False; + return false; } printf("\n"); if (!test_LookupNames(p, mem_ctx, handle, &names)) { - return False; + return false; } } else { struct lsa_LookupSids3 r; @@ -585,14 +585,14 @@ BOOL test_many_LookupSids(struct dcerpc_pipe *p, if (NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED) || NT_STATUS_EQUAL(status, NT_STATUS_RPC_PROTSEQ_NOT_SUPPORTED)) { printf("not considering %s to be an error\n", nt_errstr(status)); - return True; + return true; } printf("LookupSids3 failed - %s\n", nt_errstr(status)); - return False; + return false; } if (!test_LookupNames4(p, mem_ctx, &names)) { - return False; + return false; } } @@ -600,7 +600,7 @@ BOOL test_many_LookupSids(struct dcerpc_pipe *p, - return True; + return true; } static void lookupsids_cb(struct rpc_request *req) @@ -619,7 +619,7 @@ static void lookupsids_cb(struct rpc_request *req) } } -static BOOL test_LookupSids_async(struct dcerpc_pipe *p, +static bool test_LookupSids_async(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { @@ -630,7 +630,7 @@ static BOOL test_LookupSids_async(struct dcerpc_pipe *p, struct lsa_LookupSids *r; struct rpc_request **req; int i, replies; - BOOL ret = True; + bool ret = true; const int num_async_requests = 50; count = talloc_array(mem_ctx, uint32_t, num_async_requests); @@ -662,7 +662,7 @@ static BOOL test_LookupSids_async(struct dcerpc_pipe *p, req[i] = dcerpc_lsa_LookupSids_send(p, req, &r[i]); if (req[i] == NULL) { - ret = False; + ret = false; break; } @@ -677,13 +677,13 @@ static BOOL test_LookupSids_async(struct dcerpc_pipe *p, talloc_free(req); if (replies < 0) { - ret = False; + ret = false; } return ret; } -static BOOL test_LookupPrivValue(struct dcerpc_pipe *p, +static bool test_LookupPrivValue(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String *name) @@ -699,13 +699,13 @@ static BOOL test_LookupPrivValue(struct dcerpc_pipe *p, status = dcerpc_lsa_LookupPrivValue(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("\nLookupPrivValue failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } -static BOOL test_LookupPrivName(struct dcerpc_pipe *p, +static bool test_LookupPrivName(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_LUID *luid) @@ -719,13 +719,13 @@ static BOOL test_LookupPrivName(struct dcerpc_pipe *p, status = dcerpc_lsa_LookupPrivName(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("\nLookupPrivName failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } -static BOOL test_RemovePrivilegesFromAccount(struct dcerpc_pipe *p, +static bool test_RemovePrivilegesFromAccount(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *acct_handle, struct lsa_LUID *luid) @@ -733,7 +733,7 @@ static BOOL test_RemovePrivilegesFromAccount(struct dcerpc_pipe *p, NTSTATUS status; struct lsa_RemovePrivilegesFromAccount r; struct lsa_PrivilegeSet privs; - BOOL ret = True; + bool ret = true; printf("Testing RemovePrivilegesFromAccount\n"); @@ -750,13 +750,13 @@ static BOOL test_RemovePrivilegesFromAccount(struct dcerpc_pipe *p, status = dcerpc_lsa_RemovePrivilegesFromAccount(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("RemovePrivilegesFromAccount failed - %s\n", nt_errstr(status)); - return False; + return false; } return ret; } -static BOOL test_AddPrivilegesToAccount(struct dcerpc_pipe *p, +static bool test_AddPrivilegesToAccount(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *acct_handle, struct lsa_LUID *luid) @@ -764,7 +764,7 @@ static BOOL test_AddPrivilegesToAccount(struct dcerpc_pipe *p, NTSTATUS status; struct lsa_AddPrivilegesToAccount r; struct lsa_PrivilegeSet privs; - BOOL ret = True; + bool ret = true; printf("Testing AddPrivilegesToAccount\n"); @@ -780,20 +780,20 @@ static BOOL test_AddPrivilegesToAccount(struct dcerpc_pipe *p, status = dcerpc_lsa_AddPrivilegesToAccount(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("AddPrivilegesToAccount failed - %s\n", nt_errstr(status)); - return False; + return false; } return ret; } -static BOOL test_EnumPrivsAccount(struct dcerpc_pipe *p, +static bool test_EnumPrivsAccount(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct policy_handle *acct_handle) { NTSTATUS status; struct lsa_EnumPrivsAccount r; - BOOL ret = True; + bool ret = true; printf("Testing EnumPrivsAccount\n"); @@ -802,7 +802,7 @@ static BOOL test_EnumPrivsAccount(struct dcerpc_pipe *p, status = dcerpc_lsa_EnumPrivsAccount(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("EnumPrivsAccount failed - %s\n", nt_errstr(status)); - return False; + return false; } if (r.out.privs && r.out.privs->count > 0) { @@ -821,7 +821,7 @@ static BOOL test_EnumPrivsAccount(struct dcerpc_pipe *p, return ret; } -static BOOL test_Delete(struct dcerpc_pipe *p, +static bool test_Delete(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { @@ -834,14 +834,14 @@ static BOOL test_Delete(struct dcerpc_pipe *p, status = dcerpc_lsa_Delete(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("Delete failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } -static BOOL test_CreateAccount(struct dcerpc_pipe *p, +static bool test_CreateAccount(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { @@ -862,17 +862,17 @@ static BOOL test_CreateAccount(struct dcerpc_pipe *p, status = dcerpc_lsa_CreateAccount(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("CreateAccount failed - %s\n", nt_errstr(status)); - return False; + return false; } if (!test_Delete(p, mem_ctx, &acct_handle)) { - return False; + return false; } - return True; + return true; } -static BOOL test_DeleteTrustedDomain(struct dcerpc_pipe *p, +static bool test_DeleteTrustedDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_StringLarge name) @@ -889,17 +889,17 @@ static BOOL test_DeleteTrustedDomain(struct dcerpc_pipe *p, status = dcerpc_lsa_OpenTrustedDomainByName(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("lsa_OpenTrustedDomainByName failed - %s\n", nt_errstr(status)); - return False; + return false; } if (!test_Delete(p, mem_ctx, &trustdom_handle)) { - return False; + return false; } - return True; + return true; } -static BOOL test_DeleteTrustedDomainBySid(struct dcerpc_pipe *p, +static bool test_DeleteTrustedDomainBySid(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct dom_sid *sid) @@ -913,14 +913,14 @@ static BOOL test_DeleteTrustedDomainBySid(struct dcerpc_pipe *p, status = dcerpc_lsa_DeleteTrustedDomain(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("lsa_DeleteTrustedDomain failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } -static BOOL test_CreateSecret(struct dcerpc_pipe *p, +static bool test_CreateSecret(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { @@ -939,7 +939,7 @@ static BOOL test_CreateSecret(struct dcerpc_pipe *p, struct lsa_DATA_BUF_PTR bufp1; struct lsa_DATA_BUF_PTR bufp2; DATA_BLOB enc_key; - BOOL ret = True; + bool ret = true; DATA_BLOB session_key; NTTIME old_mtime, new_mtime; DATA_BLOB blob1, blob2; @@ -969,7 +969,7 @@ static BOOL test_CreateSecret(struct dcerpc_pipe *p, status = dcerpc_lsa_CreateSecret(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("CreateSecret failed - %s\n", nt_errstr(status)); - return False; + return false; } r.in.handle = handle; @@ -979,7 +979,7 @@ static BOOL test_CreateSecret(struct dcerpc_pipe *p, status = dcerpc_lsa_CreateSecret(p, mem_ctx, &r); if (!NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_COLLISION)) { printf("CreateSecret should have failed OBJECT_NAME_COLLISION - %s\n", nt_errstr(status)); - return False; + return false; } r2.in.handle = handle; @@ -992,13 +992,13 @@ static BOOL test_CreateSecret(struct dcerpc_pipe *p, status = dcerpc_lsa_OpenSecret(p, mem_ctx, &r2); if (!NT_STATUS_IS_OK(status)) { printf("OpenSecret failed - %s\n", nt_errstr(status)); - return False; + return false; } status = dcerpc_fetch_session_key(p, &session_key); if (!NT_STATUS_IS_OK(status)) { printf("dcerpc_fetch_session_key failed - %s\n", nt_errstr(status)); - return False; + return false; } enc_key = sess_encrypt_string(secret1, &session_key); @@ -1015,7 +1015,7 @@ static BOOL test_CreateSecret(struct dcerpc_pipe *p, status = dcerpc_lsa_SetSecret(p, mem_ctx, &r3); if (!NT_STATUS_IS_OK(status)) { printf("SetSecret failed - %s\n", nt_errstr(status)); - return False; + return false; } r3.in.sec_handle = &sec_handle; @@ -1033,7 +1033,7 @@ static BOOL test_CreateSecret(struct dcerpc_pipe *p, status = dcerpc_lsa_SetSecret(p, mem_ctx, &r3); if (!NT_STATUS_EQUAL(status, NT_STATUS_UNKNOWN_REVISION)) { printf("SetSecret should have failed UNKNOWN_REVISION - %s\n", nt_errstr(status)); - ret = False; + ret = false; } data_blob_free(&enc_key); @@ -1054,11 +1054,11 @@ static BOOL test_CreateSecret(struct dcerpc_pipe *p, status = dcerpc_lsa_QuerySecret(p, mem_ctx, &r4); if (!NT_STATUS_IS_OK(status)) { printf("QuerySecret failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } else { if (r4.out.new_val == NULL || r4.out.new_val->buf == NULL) { printf("No secret buffer returned\n"); - ret = False; + ret = false; } else { blob1.data = r4.out.new_val->buf->data; blob1.length = r4.out.new_val->buf->size; @@ -1071,7 +1071,7 @@ static BOOL test_CreateSecret(struct dcerpc_pipe *p, if (strcmp(secret1, secret2) != 0) { printf("Returned secret '%s' doesn't match '%s'\n", secret2, secret1); - ret = False; + ret = false; } } } @@ -1090,7 +1090,7 @@ static BOOL test_CreateSecret(struct dcerpc_pipe *p, status = dcerpc_lsa_SetSecret(p, mem_ctx, &r5); if (!NT_STATUS_IS_OK(status)) { printf("SetSecret failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } data_blob_free(&enc_key); @@ -1111,14 +1111,14 @@ static BOOL test_CreateSecret(struct dcerpc_pipe *p, status = dcerpc_lsa_QuerySecret(p, mem_ctx, &r6); if (!NT_STATUS_IS_OK(status)) { printf("QuerySecret failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; secret4 = NULL; } else { if (r6.out.new_val->buf == NULL || r6.out.old_val->buf == NULL || r6.out.new_mtime == NULL || r6.out.old_mtime == NULL) { printf("Both secret buffers and both times not returned\n"); - ret = False; + ret = false; secret4 = NULL; } else { blob1.data = r6.out.new_val->buf->data; @@ -1131,7 +1131,7 @@ static BOOL test_CreateSecret(struct dcerpc_pipe *p, if (strcmp(secret3, secret4) != 0) { printf("Returned NEW secret %s doesn't match %s\n", secret4, secret3); - ret = False; + ret = false; } blob1.data = r6.out.old_val->buf->data; @@ -1144,14 +1144,14 @@ static BOOL test_CreateSecret(struct dcerpc_pipe *p, if (strcmp(secret1, secret2) != 0) { printf("Returned OLD secret %s doesn't match %s\n", secret2, secret1); - ret = False; + ret = false; } if (*r6.out.new_mtime == *r6.out.old_mtime) { printf("Returned secret %s had same mtime for both secrets: %s\n", secname[i], nt_time_string(mem_ctx, *r6.out.new_mtime)); - ret = False; + ret = false; } } } @@ -1170,7 +1170,7 @@ static BOOL test_CreateSecret(struct dcerpc_pipe *p, status = dcerpc_lsa_SetSecret(p, mem_ctx, &r7); if (!NT_STATUS_IS_OK(status)) { printf("SetSecret failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } data_blob_free(&enc_key); @@ -1188,26 +1188,26 @@ static BOOL test_CreateSecret(struct dcerpc_pipe *p, status = dcerpc_lsa_QuerySecret(p, mem_ctx, &r8); if (!NT_STATUS_IS_OK(status)) { printf("QuerySecret failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } else { if (!r8.out.new_val || !r8.out.old_val) { printf("in/out pointers not returned, despite being set on in for QuerySecret\n"); - ret = False; + ret = false; } else if (r8.out.new_val->buf == NULL) { if (i != LOCAL) { printf("NEW secret buffer not returned after GLOBAL OLD set\n"); - ret = False; + ret = false; } } else if (r8.out.old_val->buf == NULL) { printf("OLD secret buffer not returned after OLD set\n"); - ret = False; + ret = false; } else if (r8.out.new_mtime == NULL || r8.out.old_mtime == NULL) { printf("Both times not returned after OLD set\n"); - ret = False; + ret = false; } else { if (i == LOCAL) { printf("NEW secret buffer should not be returned after LOCAL OLD set\n"); - ret = False; + ret = false; } blob1.data = r8.out.new_val->buf->data; blob1.length = r8.out.new_val->buf->length; @@ -1219,7 +1219,7 @@ static BOOL test_CreateSecret(struct dcerpc_pipe *p, if (strcmp(secret3, secret4) != 0) { printf("Returned NEW secret '%s' doesn't match '%s'\n", secret4, secret3); - ret = False; + ret = false; } blob1.data = r8.out.old_val->buf->data; @@ -1232,7 +1232,7 @@ static BOOL test_CreateSecret(struct dcerpc_pipe *p, if (strcmp(secret5, secret6) != 0) { printf("Returned OLD secret %s doesn't match %s\n", secret5, secret6); - ret = False; + ret = false; } if (*r8.out.new_mtime == *r8.out.old_mtime) { @@ -1240,27 +1240,27 @@ static BOOL test_CreateSecret(struct dcerpc_pipe *p, printf("Returned secret %s had same mtime for both secrets: %s\n", secname[i], nt_time_string(mem_ctx, *r8.out.new_mtime)); - ret = False; + ret = false; } } else { printf("Returned secret %s should have had same mtime for both secrets: %s != %s\n", secname[i], nt_time_string(mem_ctx, *r8.out.old_mtime), nt_time_string(mem_ctx, *r8.out.new_mtime)); - ret = False; + ret = false; } } } if (!test_Delete(p, mem_ctx, &sec_handle)) { - ret = False; + ret = false; } d.in.handle = &sec_handle2; status = dcerpc_lsa_Delete(p, mem_ctx, &d); if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_HANDLE)) { printf("Second delete expected INVALID_HANDLE - %s\n", nt_errstr(status)); - ret = False; + ret = false; } else { printf("Testing OpenSecret of just-deleted secret\n"); @@ -1268,7 +1268,7 @@ static BOOL test_CreateSecret(struct dcerpc_pipe *p, status = dcerpc_lsa_OpenSecret(p, mem_ctx, &r2); if (!NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) { printf("OpenSecret expected OBJECT_NAME_NOT_FOUND - %s\n", nt_errstr(status)); - ret = False; + ret = false; } } @@ -1278,7 +1278,7 @@ static BOOL test_CreateSecret(struct dcerpc_pipe *p, } -static BOOL test_EnumAccountRights(struct dcerpc_pipe *p, +static bool test_EnumAccountRights(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *acct_handle, struct dom_sid *sid) @@ -1297,14 +1297,14 @@ static BOOL test_EnumAccountRights(struct dcerpc_pipe *p, if (!NT_STATUS_IS_OK(status)) { printf("EnumAccountRights of %s failed - %s\n", dom_sid_string(mem_ctx, sid), nt_errstr(status)); - return False; + return false; } - return True; + return true; } -static BOOL test_QuerySecurity(struct dcerpc_pipe *p, +static bool test_QuerySecurity(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct policy_handle *acct_handle) @@ -1314,7 +1314,7 @@ static BOOL test_QuerySecurity(struct dcerpc_pipe *p, if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) { printf("skipping QuerySecurity test against Samba4\n"); - return True; + return true; } printf("Testing QuerySecurity\n"); @@ -1325,13 +1325,13 @@ static BOOL test_QuerySecurity(struct dcerpc_pipe *p, status = dcerpc_lsa_QuerySecurity(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("QuerySecurity failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } -static BOOL test_OpenAccount(struct dcerpc_pipe *p, +static bool test_OpenAccount(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct dom_sid *sid) @@ -1350,21 +1350,21 @@ static BOOL test_OpenAccount(struct dcerpc_pipe *p, status = dcerpc_lsa_OpenAccount(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("OpenAccount failed - %s\n", nt_errstr(status)); - return False; + return false; } if (!test_EnumPrivsAccount(p, mem_ctx, handle, &acct_handle)) { - return False; + return false; } if (!test_QuerySecurity(p, mem_ctx, handle, &acct_handle)) { - return False; + return false; } - return True; + return true; } -static BOOL test_EnumAccounts(struct dcerpc_pipe *p, +static bool test_EnumAccounts(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { @@ -1373,7 +1373,7 @@ static BOOL test_EnumAccounts(struct dcerpc_pipe *p, struct lsa_SidArray sids1, sids2; uint32_t resume_handle = 0; int i; - BOOL ret = True; + bool ret = true; printf("\ntesting EnumAccounts\n"); @@ -1384,26 +1384,26 @@ static BOOL test_EnumAccounts(struct dcerpc_pipe *p, r.out.sids = &sids1; resume_handle = 0; - while (True) { + while (true) { status = dcerpc_lsa_EnumAccounts(p, mem_ctx, &r); if (NT_STATUS_EQUAL(status, NT_STATUS_NO_MORE_ENTRIES)) { break; } if (!NT_STATUS_IS_OK(status)) { printf("EnumAccounts failed - %s\n", nt_errstr(status)); - return False; + return false; } if (!test_LookupSids(p, mem_ctx, handle, &sids1)) { - return False; + return false; } if (!test_LookupSids2(p, mem_ctx, handle, &sids1)) { - return False; + return false; } if (!test_LookupSids3(p, mem_ctx, &sids1)) { - return False; + return false; } printf("testing all accounts\n"); @@ -1426,18 +1426,18 @@ static BOOL test_EnumAccounts(struct dcerpc_pipe *p, status = dcerpc_lsa_EnumAccounts(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("EnumAccounts failed - %s\n", nt_errstr(status)); - return False; + return false; } if (sids2.num_sids != 1) { printf("Returned wrong number of entries (%d)\n", sids2.num_sids); - return False; + return false; } - return True; + return true; } -static BOOL test_LookupPrivDisplayName(struct dcerpc_pipe *p, +static bool test_LookupPrivDisplayName(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String *priv_name) @@ -1459,16 +1459,16 @@ static BOOL test_LookupPrivDisplayName(struct dcerpc_pipe *p, status = dcerpc_lsa_LookupPrivDisplayName(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("LookupPrivDisplayName failed - %s\n", nt_errstr(status)); - return False; + return false; } printf("%s -> \"%s\" (language 0x%x/0x%x)\n", priv_name->string, r.out.disp_name->string, *r.in.language_id, *r.out.language_id); - return True; + return true; } -static BOOL test_EnumAccountsWithUserRight(struct dcerpc_pipe *p, +static bool test_EnumAccountsWithUserRight(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String *priv_name) @@ -1489,19 +1489,19 @@ static BOOL test_EnumAccountsWithUserRight(struct dcerpc_pipe *p, /* NT_STATUS_NO_MORE_ENTRIES means noone has this privilege */ if (NT_STATUS_EQUAL(status, NT_STATUS_NO_MORE_ENTRIES)) { - return True; + return true; } if (!NT_STATUS_IS_OK(status)) { printf("EnumAccountsWithUserRight failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } -static BOOL test_EnumPrivs(struct dcerpc_pipe *p, +static bool test_EnumPrivs(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { @@ -1510,7 +1510,7 @@ static BOOL test_EnumPrivs(struct dcerpc_pipe *p, struct lsa_PrivArray privs1; uint32_t resume_handle = 0; int i; - BOOL ret = True; + bool ret = true; printf("\ntesting EnumPrivs\n"); @@ -1524,26 +1524,26 @@ static BOOL test_EnumPrivs(struct dcerpc_pipe *p, status = dcerpc_lsa_EnumPrivs(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("EnumPrivs failed - %s\n", nt_errstr(status)); - return False; + return false; } for (i = 0; i< privs1.count; i++) { test_LookupPrivDisplayName(p, mem_ctx, handle, (struct lsa_String *)&privs1.privs[i].name); test_LookupPrivValue(p, mem_ctx, handle, (struct lsa_String *)&privs1.privs[i].name); if (!test_EnumAccountsWithUserRight(p, mem_ctx, handle, (struct lsa_String *)&privs1.privs[i].name)) { - ret = False; + ret = false; } } return ret; } -static BOOL test_QueryForestTrustInformation(struct dcerpc_pipe *p, +static bool test_QueryForestTrustInformation(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, const char *trusted_domain_name) { - BOOL ret = True; + bool ret = true; struct lsa_lsaRQueryForestTrustInformation r; NTSTATUS status; struct lsa_String string; @@ -1553,7 +1553,7 @@ static BOOL test_QueryForestTrustInformation(struct dcerpc_pipe *p, if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) { printf("skipping QueryForestTrustInformation against Samba4\n"); - return True; + return true; } ZERO_STRUCT(string); @@ -1573,19 +1573,19 @@ static BOOL test_QueryForestTrustInformation(struct dcerpc_pipe *p, if (!NT_STATUS_IS_OK(status)) { printf("lsaRQueryForestTrustInformation failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } return ret; } -static BOOL test_query_each_TrustDomEx(struct dcerpc_pipe *p, +static bool test_query_each_TrustDomEx(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_DomainListEx *domains) { int i; - BOOL ret = True; + bool ret = true; for (i=0; i< domains->count; i++) { @@ -1598,14 +1598,14 @@ static BOOL test_query_each_TrustDomEx(struct dcerpc_pipe *p, return ret; } -static BOOL test_query_each_TrustDom(struct dcerpc_pipe *p, +static bool test_query_each_TrustDom(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_DomainList *domains) { NTSTATUS status; int i,j; - BOOL ret = True; + bool ret = true; printf("\nTesting OpenTrustedDomain, OpenTrustedDomainByName and QueryInfoTrustedDomain\n"); for (i=0; i< domains->count; i++) { @@ -1628,7 +1628,7 @@ static BOOL test_query_each_TrustDom(struct dcerpc_pipe *p, if (!NT_STATUS_IS_OK(status)) { printf("OpenTrustedDomain failed - %s\n", nt_errstr(status)); - return False; + return false; } c.in.handle = &trustdom_handle; @@ -1647,18 +1647,18 @@ static BOOL test_query_each_TrustDom(struct dcerpc_pipe *p, if (!NT_STATUS_IS_OK(status) && ok[j]) { printf("QueryTrustedDomainInfo level %d failed - %s\n", levels[j], nt_errstr(status)); - ret = False; + ret = false; } else if (NT_STATUS_IS_OK(status) && !ok[j]) { printf("QueryTrustedDomainInfo level %d unexpectedly succeeded - %s\n", levels[j], nt_errstr(status)); - ret = False; + ret = false; } } status = dcerpc_lsa_CloseTrustedDomainEx(p, mem_ctx, &c_trust); if (!NT_STATUS_EQUAL(status, NT_STATUS_NOT_IMPLEMENTED)) { printf("Expected CloseTrustedDomainEx to return NT_STATUS_NOT_IMPLEMENTED, instead - %s\n", nt_errstr(status)); - return False; + return false; } c.in.handle = &trustdom_handle; @@ -1667,7 +1667,7 @@ static BOOL test_query_each_TrustDom(struct dcerpc_pipe *p, status = dcerpc_lsa_Close(p, mem_ctx, &c); if (!NT_STATUS_IS_OK(status)) { printf("Close of trusted domain failed - %s\n", nt_errstr(status)); - return False; + return false; } for (j=0; j < ARRAY_SIZE(levels); j++) { @@ -1686,11 +1686,11 @@ static BOOL test_query_each_TrustDom(struct dcerpc_pipe *p, if (!NT_STATUS_IS_OK(status) && ok[j]) { printf("QueryTrustedDomainInfoBySid level %d failed - %s\n", levels[j], nt_errstr(status)); - ret = False; + ret = false; } else if (NT_STATUS_IS_OK(status) && !ok[j]) { printf("QueryTrustedDomainInfoBySid level %d unexpectedly succeeded - %s\n", levels[j], nt_errstr(status)); - ret = False; + ret = false; } } } @@ -1704,7 +1704,7 @@ static BOOL test_query_each_TrustDom(struct dcerpc_pipe *p, if (!NT_STATUS_IS_OK(status)) { printf("OpenTrustedDomainByName failed - %s\n", nt_errstr(status)); - return False; + return false; } for (j=0; j < ARRAY_SIZE(levels); j++) { @@ -1717,11 +1717,11 @@ static BOOL test_query_each_TrustDom(struct dcerpc_pipe *p, if (!NT_STATUS_IS_OK(status) && ok[j]) { printf("QueryTrustedDomainInfo level %d failed - %s\n", levels[j], nt_errstr(status)); - ret = False; + ret = false; } else if (NT_STATUS_IS_OK(status) && !ok[j]) { printf("QueryTrustedDomainInfo level %d unexpectedly succeeded - %s\n", levels[j], nt_errstr(status)); - ret = False; + ret = false; } } @@ -1731,7 +1731,7 @@ static BOOL test_query_each_TrustDom(struct dcerpc_pipe *p, status = dcerpc_lsa_Close(p, mem_ctx, &c); if (!NT_STATUS_IS_OK(status)) { printf("Close of trusted domain failed - %s\n", nt_errstr(status)); - return False; + return false; } for (j=0; j < ARRAY_SIZE(levels); j++) { @@ -1745,18 +1745,18 @@ static BOOL test_query_each_TrustDom(struct dcerpc_pipe *p, if (!NT_STATUS_IS_OK(status) && ok[j]) { printf("QueryTrustedDomainInfoByName level %d failed - %s\n", levels[j], nt_errstr(status)); - ret = False; + ret = false; } else if (NT_STATUS_IS_OK(status) && !ok[j]) { printf("QueryTrustedDomainInfoByName level %d unexpectedly succeeded - %s\n", levels[j], nt_errstr(status)); - ret = False; + ret = false; } } } return ret; } -static BOOL test_EnumTrustDom(struct dcerpc_pipe *p, +static bool test_EnumTrustDom(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { @@ -1766,7 +1766,7 @@ static BOOL test_EnumTrustDom(struct dcerpc_pipe *p, uint32_t resume_handle = 0; struct lsa_DomainList domains; struct lsa_DomainListEx domains_ex; - BOOL ret = True; + bool ret = true; printf("\nTesting EnumTrustDom\n"); @@ -1781,7 +1781,7 @@ static BOOL test_EnumTrustDom(struct dcerpc_pipe *p, /* NO_MORE_ENTRIES is allowed */ if (NT_STATUS_EQUAL(enum_status, NT_STATUS_NO_MORE_ENTRIES)) { - return True; + return true; } else if (NT_STATUS_EQUAL(enum_status, STATUS_MORE_ENTRIES)) { /* Windows 2003 gets this off by one on the first run */ if (r.out.domains->count < 3 || r.out.domains->count > 4) { @@ -1789,11 +1789,11 @@ static BOOL test_EnumTrustDom(struct dcerpc_pipe *p, "asked it to (got %d, expected %d / %d == %d entries)\n", r.out.domains->count, LSA_ENUM_TRUST_DOMAIN_MULTIPLIER * 3, LSA_ENUM_TRUST_DOMAIN_MULTIPLIER, r.in.max_size); - ret = False; + ret = false; } } else if (!NT_STATUS_IS_OK(enum_status)) { printf("EnumTrustDom failed - %s\n", nt_errstr(enum_status)); - return False; + return false; } ret &= test_query_each_TrustDom(p, mem_ctx, handle, &domains); @@ -1814,7 +1814,7 @@ static BOOL test_EnumTrustDom(struct dcerpc_pipe *p, /* NO_MORE_ENTRIES is allowed */ if (NT_STATUS_EQUAL(enum_status, NT_STATUS_NO_MORE_ENTRIES)) { - return True; + return true; } else if (NT_STATUS_EQUAL(enum_status, STATUS_MORE_ENTRIES)) { /* Windows 2003 gets this off by one on the first run */ if (r_ex.out.domains->count < 3 || r_ex.out.domains->count > 4) { @@ -1824,12 +1824,12 @@ static BOOL test_EnumTrustDom(struct dcerpc_pipe *p, r_ex.in.max_size, LSA_ENUM_TRUST_DOMAIN_EX_MULTIPLIER, r_ex.in.max_size / LSA_ENUM_TRUST_DOMAIN_EX_MULTIPLIER); - ret = False; + ret = false; exit(1); } } else if (!NT_STATUS_IS_OK(enum_status)) { printf("EnumTrustedDomainEx failed - %s\n", nt_errstr(enum_status)); - return False; + return false; } ret &= test_query_each_TrustDomEx(p, mem_ctx, handle, &domains_ex); @@ -1839,12 +1839,12 @@ static BOOL test_EnumTrustDom(struct dcerpc_pipe *p, return ret; } -static BOOL test_CreateTrustedDomain(struct dcerpc_pipe *p, +static bool test_CreateTrustedDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; - BOOL ret = True; + bool ret = true; struct lsa_CreateTrustedDomain r; struct lsa_DomainInfo trustinfo; struct dom_sid *domsid[12]; @@ -1875,7 +1875,7 @@ static BOOL test_CreateTrustedDomain(struct dcerpc_pipe *p, } if (!NT_STATUS_IS_OK(status)) { printf("CreateTrustedDomain failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } else { q.in.trustdom_handle = &trustdom_handle[i]; @@ -1883,14 +1883,14 @@ static BOOL test_CreateTrustedDomain(struct dcerpc_pipe *p, status = dcerpc_lsa_QueryTrustedDomainInfo(p, mem_ctx, &q); if (!NT_STATUS_IS_OK(status)) { printf("QueryTrustedDomainInfo level 1 failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } else if (!q.out.info) { - ret = False; + ret = false; } else { if (strcmp(q.out.info->name.netbios_name.string, trustinfo.name.string) != 0) { printf("QueryTrustedDomainInfo returned inconsistant short name: %s != %s\n", q.out.info->name.netbios_name.string, trustinfo.name.string); - ret = False; + ret = false; } } } @@ -1898,29 +1898,29 @@ static BOOL test_CreateTrustedDomain(struct dcerpc_pipe *p, /* now that we have some domains to look over, we can test the enum calls */ if (!test_EnumTrustDom(p, mem_ctx, handle)) { - ret = False; + ret = false; } for (i=0; i<12; i++) { if (!test_DeleteTrustedDomainBySid(p, mem_ctx, handle, domsid[i])) { - ret = False; + ret = false; } } return ret; } -static BOOL test_QueryDomainInfoPolicy(struct dcerpc_pipe *p, +static bool test_QueryDomainInfoPolicy(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { struct lsa_QueryDomainInformationPolicy r; NTSTATUS status; int i; - BOOL ret = True; + bool ret = true; if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) { printf("skipping QueryDomainInformationPolicy test against Samba4\n"); - return True; + return true; } printf("\nTesting QueryDomainInformationPolicy\n"); @@ -1935,7 +1935,7 @@ static BOOL test_QueryDomainInfoPolicy(struct dcerpc_pipe *p, if (!NT_STATUS_IS_OK(status)) { printf("QueryDomainInformationPolicy failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; continue; } } @@ -1944,19 +1944,19 @@ static BOOL test_QueryDomainInfoPolicy(struct dcerpc_pipe *p, } -static BOOL test_QueryInfoPolicy(struct dcerpc_pipe *p, +static bool test_QueryInfoPolicy(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { struct lsa_QueryInfoPolicy r; NTSTATUS status; int i; - BOOL ret = True; + bool ret = true; printf("\nTesting QueryInfoPolicy\n"); if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) { printf("skipping QueryInfoPolicy against Samba4\n"); - return True; + return true; } for (i=1;i<13;i++) { @@ -1973,7 +1973,7 @@ static BOOL test_QueryInfoPolicy(struct dcerpc_pipe *p, case LSA_POLICY_INFO_AUDIT_FULL_QUERY: if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_PARAMETER)) { printf("server should have failed level %u: %s\n", i, nt_errstr(status)); - ret = False; + ret = false; } break; case LSA_POLICY_INFO_DOMAIN: @@ -1981,7 +1981,7 @@ static BOOL test_QueryInfoPolicy(struct dcerpc_pipe *p, case LSA_POLICY_INFO_DNS: if (!NT_STATUS_IS_OK(status)) { printf("QueryInfoPolicy failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } break; default: @@ -1989,11 +1989,11 @@ static BOOL test_QueryInfoPolicy(struct dcerpc_pipe *p, /* Other levels not implemented yet */ if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_INFO_CLASS)) { printf("QueryInfoPolicy failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } } else if (!NT_STATUS_IS_OK(status)) { printf("QueryInfoPolicy failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } break; } @@ -2021,14 +2021,14 @@ static BOOL test_QueryInfoPolicy(struct dcerpc_pipe *p, return ret; } -static BOOL test_QueryInfoPolicy2(struct dcerpc_pipe *p, +static bool test_QueryInfoPolicy2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { struct lsa_QueryInfoPolicy2 r; NTSTATUS status; int i; - BOOL ret = True; + bool ret = true; printf("\nTesting QueryInfoPolicy2\n"); for (i=1;i<13;i++) { r.in.handle = handle; @@ -2044,7 +2044,7 @@ static BOOL test_QueryInfoPolicy2(struct dcerpc_pipe *p, case LSA_POLICY_INFO_AUDIT_FULL_QUERY: if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_PARAMETER)) { printf("server should have failed level %u: %s\n", i, nt_errstr(status)); - ret = False; + ret = false; } break; case LSA_POLICY_INFO_DOMAIN: @@ -2052,7 +2052,7 @@ static BOOL test_QueryInfoPolicy2(struct dcerpc_pipe *p, case LSA_POLICY_INFO_DNS: if (!NT_STATUS_IS_OK(status)) { printf("QueryInfoPolicy2 failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } break; default: @@ -2060,11 +2060,11 @@ static BOOL test_QueryInfoPolicy2(struct dcerpc_pipe *p, /* Other levels not implemented yet */ if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_INFO_CLASS)) { printf("QueryInfoPolicy2 failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } } else if (!NT_STATUS_IS_OK(status)) { printf("QueryInfoPolicy2 failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } break; } @@ -2073,11 +2073,11 @@ static BOOL test_QueryInfoPolicy2(struct dcerpc_pipe *p, return ret; } -static BOOL test_GetUserName(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) +static bool test_GetUserName(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) { struct lsa_GetUserName r; NTSTATUS status; - BOOL ret = True; + bool ret = true; struct lsa_StringPointer authority_name_p; printf("\nTesting GetUserName\n"); @@ -2091,13 +2091,13 @@ static BOOL test_GetUserName(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) if (!NT_STATUS_IS_OK(status)) { printf("GetUserName failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } return ret; } -BOOL test_lsa_Close(struct dcerpc_pipe *p, +bool test_lsa_Close(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { @@ -2113,27 +2113,27 @@ BOOL test_lsa_Close(struct dcerpc_pipe *p, status = dcerpc_lsa_Close(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("Close failed - %s\n", nt_errstr(status)); - return False; + return false; } status = dcerpc_lsa_Close(p, mem_ctx, &r); /* its really a fault - we need a status code for rpc fault */ if (!NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) { printf("Close failed - %s\n", nt_errstr(status)); - return False; + return false; } printf("\n"); - return True; + return true; } -BOOL torture_rpc_lsa(struct torture_context *torture) +bool torture_rpc_lsa(struct torture_context *torture) { NTSTATUS status; struct dcerpc_pipe *p; TALLOC_CTX *mem_ctx; - BOOL ret = True; + bool ret = true; struct policy_handle *handle; mem_ctx = talloc_init("torture_rpc_lsa"); @@ -2141,83 +2141,83 @@ BOOL torture_rpc_lsa(struct torture_context *torture) status = torture_rpc_connection(torture, &p, &ndr_table_lsarpc); if (!NT_STATUS_IS_OK(status)) { talloc_free(mem_ctx); - return False; + return false; } if (!test_OpenPolicy(p, mem_ctx)) { - ret = False; + ret = false; } if (!test_lsa_OpenPolicy2(p, mem_ctx, &handle)) { - ret = False; + ret = false; } if (handle) { if (!test_LookupNames_wellknown(p, mem_ctx, handle)) { - ret = False; + ret = false; } if (!test_LookupNames_bogus(p, mem_ctx, handle)) { - ret = False; + ret = false; } if (!test_LookupSids_async(p, mem_ctx, handle)) { - ret = False; + ret = false; } if (!test_QueryDomainInfoPolicy(p, mem_ctx, handle)) { - ret = False; + ret = false; } if (!test_CreateAccount(p, mem_ctx, handle)) { - ret = False; + ret = false; } if (!test_CreateSecret(p, mem_ctx, handle)) { - ret = False; + ret = false; } if (!test_CreateTrustedDomain(p, mem_ctx, handle)) { - ret = False; + ret = false; } if (!test_EnumAccounts(p, mem_ctx, handle)) { - ret = False; + ret = false; } if (!test_EnumPrivs(p, mem_ctx, handle)) { - ret = False; + ret = false; } if (!test_QueryInfoPolicy(p, mem_ctx, handle)) { - ret = False; + ret = false; } if (!test_QueryInfoPolicy2(p, mem_ctx, handle)) { - ret = False; + ret = false; } #if 0 if (!test_Delete(p, mem_ctx, handle)) { - ret = False; + ret = false; } #endif if (!test_many_LookupSids(p, mem_ctx, handle)) { - ret = False; + ret = false; } if (!test_lsa_Close(p, mem_ctx, handle)) { - ret = False; + ret = false; } } else { if (!test_many_LookupSids(p, mem_ctx, handle)) { - ret = False; + ret = false; } } if (!test_GetUserName(p, mem_ctx)) { - ret = False; + ret = false; } talloc_free(mem_ctx); @@ -2225,23 +2225,23 @@ BOOL torture_rpc_lsa(struct torture_context *torture) return ret; } -BOOL torture_rpc_lsa_get_user(struct torture_context *torture) +bool torture_rpc_lsa_get_user(struct torture_context *torture) { NTSTATUS status; struct dcerpc_pipe *p; TALLOC_CTX *mem_ctx; - BOOL ret = True; + bool ret = true; mem_ctx = talloc_init("torture_rpc_lsa_get_user"); status = torture_rpc_connection(torture, &p, &ndr_table_lsarpc); if (!NT_STATUS_IS_OK(status)) { talloc_free(mem_ctx); - return False; + return false; } if (!test_GetUserName(p, mem_ctx)) { - ret = False; + ret = false; } talloc_free(mem_ctx); diff --git a/source4/torture/rpc/lsa_lookup.c b/source4/torture/rpc/lsa_lookup.c index 7cab05257df..9c817a7061c 100644 --- a/source4/torture/rpc/lsa_lookup.c +++ b/source4/torture/rpc/lsa_lookup.c @@ -26,7 +26,7 @@ #include "librpc/gen_ndr/ndr_lsa_c.h" #include "libcli/security/security.h" -static BOOL open_policy(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *p, +static bool open_policy(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *p, struct policy_handle **handle) { struct lsa_ObjectAttribute attr; @@ -36,7 +36,7 @@ static BOOL open_policy(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *p, *handle = talloc(mem_ctx, struct policy_handle); if (!*handle) { - return False; + return false; } qos.len = 0; @@ -61,7 +61,7 @@ static BOOL open_policy(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *p, return NT_STATUS_IS_OK(status); } -static BOOL get_domainsid(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *p, +static bool get_domainsid(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *p, struct policy_handle *handle, struct dom_sid **sid) { @@ -72,10 +72,10 @@ static BOOL get_domainsid(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *p, r.in.handle = handle; status = dcerpc_lsa_QueryInfoPolicy(p, mem_ctx, &r); - if (!NT_STATUS_IS_OK(status)) return False; + if (!NT_STATUS_IS_OK(status)) return false; *sid = r.out.info->domain.sid; - return True; + return true; } static NTSTATUS lookup_sids(TALLOC_CTX *mem_ctx, uint16_t level, @@ -127,7 +127,7 @@ static const char *sid_type_lookup(enum lsa_SidType r) return "Invalid sid type\n"; } -static BOOL test_lookupsids(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *p, +static bool test_lookupsids(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *p, struct policy_handle *handle, struct dom_sid **sids, uint32_t num_sids, int level, NTSTATUS expected_result, @@ -136,7 +136,7 @@ static BOOL test_lookupsids(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *p, struct lsa_TransNameArray names; NTSTATUS status; uint32_t i; - BOOL ret = True; + bool ret = true; status = lookup_sids(mem_ctx, level, p, handle, sids, num_sids, &names); @@ -144,12 +144,12 @@ static BOOL test_lookupsids(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *p, printf("For level %d expected %s, got %s\n", level, nt_errstr(expected_result), nt_errstr(status)); - return False; + return false; } if (!NT_STATUS_EQUAL(status, NT_STATUS_OK) && !NT_STATUS_EQUAL(status, STATUS_SOME_UNMAPPED)) { - return True; + return true; } for (i=0; iinfo_ex.trust_direction & 2) && (q.out.info->info_ex.trust_type == 1)) { *sid = domains.domains[i].sid; - return True; + return true; } } @@ -218,7 +218,7 @@ bool torture_rpc_lsa_lookup(struct torture_context *torture) { NTSTATUS status; struct dcerpc_pipe *p; - BOOL ret = True; + bool ret = true; struct policy_handle *handle; struct dom_sid *dom_sid; struct dom_sid *trusted_sid; diff --git a/source4/torture/rpc/mgmt.c b/source4/torture/rpc/mgmt.c index f27dcd7b058..258450ada1b 100644 --- a/source4/torture/rpc/mgmt.c +++ b/source4/torture/rpc/mgmt.c @@ -30,9 +30,9 @@ /* ask the server what interface IDs are available on this endpoint */ -BOOL test_inq_if_ids(struct torture_context *tctx, +bool test_inq_if_ids(struct torture_context *tctx, struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, - BOOL (*per_id_test)(struct torture_context *, + bool (*per_id_test)(struct torture_context *, const struct ndr_interface_table *iface, TALLOC_CTX *mem_ctx, struct ndr_syntax_id *id), @@ -49,17 +49,17 @@ BOOL test_inq_if_ids(struct torture_context *tctx, status = dcerpc_mgmt_inq_if_ids(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("inq_if_ids failed - %s\n", nt_errstr(status)); - return False; + return false; } if (!W_ERROR_IS_OK(r.out.result)) { printf("inq_if_ids gave error code %s\n", win_errstr(r.out.result)); - return False; + return false; } if (!vector) { printf("inq_if_ids gave NULL if_id_vector\n"); - return False; + return false; } for (i=0;icount;i++) { @@ -76,10 +76,10 @@ BOOL test_inq_if_ids(struct torture_context *tctx, } } - return True; + return true; } -static BOOL test_inq_stats(struct dcerpc_pipe *p, +static bool test_inq_stats(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) { NTSTATUS status; @@ -93,12 +93,12 @@ static BOOL test_inq_stats(struct dcerpc_pipe *p, status = dcerpc_mgmt_inq_stats(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("inq_stats failed - %s\n", nt_errstr(status)); - return False; + return false; } if (statistics.count != MGMT_STATS_ARRAY_MAX_SIZE) { printf("Unexpected array size %d\n", statistics.count); - return False; + return false; } printf("\tcalls_in %6d calls_out %6d\n\tpkts_in %6d pkts_out %6d\n", @@ -107,16 +107,16 @@ static BOOL test_inq_stats(struct dcerpc_pipe *p, statistics.statistics[MGMT_STATS_PKTS_IN], statistics.statistics[MGMT_STATS_PKTS_OUT]); - return True; + return true; } -static BOOL test_inq_princ_name(struct dcerpc_pipe *p, +static bool test_inq_princ_name(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) { NTSTATUS status; struct mgmt_inq_princ_name r; int i; - BOOL ret = False; + bool ret = false; for (i=0;i<100;i++) { r.in.authn_proto = i; /* DCERPC_AUTH_TYPE_* */ @@ -128,7 +128,7 @@ static BOOL test_inq_princ_name(struct dcerpc_pipe *p, } if (W_ERROR_IS_OK(r.out.result)) { const char *name = gensec_get_name_by_authtype(i); - ret = True; + ret = true; if (name) { printf("\tprinciple name for proto %u (%s) is '%s'\n", i, name, r.out.princ_name); @@ -143,10 +143,10 @@ static BOOL test_inq_princ_name(struct dcerpc_pipe *p, printf("\tno principle names?\n"); } - return True; + return true; } -static BOOL test_is_server_listening(struct dcerpc_pipe *p, +static bool test_is_server_listening(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) { NTSTATUS status; @@ -156,7 +156,7 @@ static BOOL test_is_server_listening(struct dcerpc_pipe *p, status = dcerpc_mgmt_is_server_listening(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("is_server_listening failed - %s\n", nt_errstr(status)); - return False; + return false; } if (*r.out.status != 0 || r.out.result == 0) { @@ -165,10 +165,10 @@ static BOOL test_is_server_listening(struct dcerpc_pipe *p, printf("\tserver is listening\n"); } - return True; + return true; } -static BOOL test_stop_server_listening(struct dcerpc_pipe *p, +static bool test_stop_server_listening(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) { NTSTATUS status; @@ -177,26 +177,26 @@ static BOOL test_stop_server_listening(struct dcerpc_pipe *p, status = dcerpc_mgmt_stop_server_listening(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("stop_server_listening failed - %s\n", nt_errstr(status)); - return False; + return false; } if (!W_ERROR_IS_OK(r.out.result)) { printf("\tserver refused to stop listening - %s\n", win_errstr(r.out.result)); } else { printf("\tserver allowed a stop_server_listening request\n"); - return False; + return false; } - return True; + return true; } -BOOL torture_rpc_mgmt(struct torture_context *torture) +bool torture_rpc_mgmt(struct torture_context *torture) { NTSTATUS status; struct dcerpc_pipe *p; TALLOC_CTX *mem_ctx, *loop_ctx; - BOOL ret = True; + bool ret = true; const struct ndr_interface_list *l; struct dcerpc_binding *b; @@ -205,7 +205,7 @@ BOOL torture_rpc_mgmt(struct torture_context *torture) status = torture_rpc_binding(torture, &b); if (!NT_STATUS_IS_OK(status)) { talloc_free(mem_ctx); - return False; + return false; } for (l=ndr_table_list();l;l=l->next) { @@ -239,28 +239,28 @@ BOOL torture_rpc_mgmt(struct torture_context *torture) if (!NT_STATUS_IS_OK(status)) { talloc_free(loop_ctx); - ret = False; + ret = false; continue; } if (!test_is_server_listening(p, loop_ctx)) { - ret = False; + ret = false; } if (!test_stop_server_listening(p, loop_ctx)) { - ret = False; + ret = false; } if (!test_inq_stats(p, loop_ctx)) { - ret = False; + ret = false; } if (!test_inq_princ_name(p, loop_ctx)) { - ret = False; + ret = false; } if (!test_inq_if_ids(torture, p, loop_ctx, NULL, NULL)) { - ret = False; + ret = false; } } diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c index 92f8778df6a..be0a80b8bd1 100644 --- a/source4/torture/rpc/samba3rpc.c +++ b/source4/torture/rpc/samba3rpc.c @@ -68,11 +68,11 @@ static struct cli_credentials *create_anon_creds(TALLOC_CTX *mem_ctx) * This tests a RPC call using an invalid vuid */ -BOOL torture_bind_authcontext(struct torture_context *torture) +bool torture_bind_authcontext(struct torture_context *torture) { TALLOC_CTX *mem_ctx; NTSTATUS status; - BOOL ret = False; + bool ret = false; struct lsa_ObjectAttribute objectattr; struct lsa_OpenPolicy2 openpolicy; struct policy_handle handle; @@ -88,7 +88,7 @@ BOOL torture_bind_authcontext(struct torture_context *torture) if (mem_ctx == NULL) { d_printf("talloc_init failed\n"); - return False; + return false; } status = smbcli_full_connection(mem_ctx, &cli, @@ -146,7 +146,7 @@ BOOL torture_bind_authcontext(struct torture_context *torture) goto done; } - session2 = smbcli_session_init(cli->transport, mem_ctx, False); + session2 = smbcli_session_init(cli->transport, mem_ctx, false); if (session2 == NULL) { d_printf("smbcli_session_init failed\n"); goto done; @@ -186,7 +186,7 @@ BOOL torture_bind_authcontext(struct torture_context *torture) goto done; } - ret = True; + ret = true; done: talloc_free(mem_ctx); return ret; @@ -196,12 +196,12 @@ BOOL torture_bind_authcontext(struct torture_context *torture) * Bind to lsa using a specific auth method */ -static BOOL bindtest(struct smbcli_state *cli, +static bool bindtest(struct smbcli_state *cli, struct cli_credentials *credentials, uint8_t auth_type, uint8_t auth_level) { TALLOC_CTX *mem_ctx; - BOOL ret = False; + bool ret = false; NTSTATUS status; struct dcerpc_pipe *lsa_pipe; @@ -213,7 +213,7 @@ static BOOL bindtest(struct smbcli_state *cli, if ((mem_ctx = talloc_init("bindtest")) == NULL) { d_printf("talloc_init failed\n"); - return False; + return false; } lsa_pipe = dcerpc_pipe_init(mem_ctx, @@ -273,7 +273,7 @@ static BOOL bindtest(struct smbcli_state *cli, goto done; } - ret = True; + ret = true; done: talloc_free(mem_ctx); return ret; @@ -283,18 +283,18 @@ static BOOL bindtest(struct smbcli_state *cli, * test authenticated RPC binds with the variants Samba3 does support */ -BOOL torture_bind_samba3(struct torture_context *torture) +bool torture_bind_samba3(struct torture_context *torture) { TALLOC_CTX *mem_ctx; NTSTATUS status; - BOOL ret = False; + bool ret = false; struct smbcli_state *cli; mem_ctx = talloc_init("torture_bind_authcontext"); if (mem_ctx == NULL) { d_printf("talloc_init failed\n"); - return False; + return false; } status = smbcli_full_connection(mem_ctx, &cli, @@ -307,7 +307,7 @@ BOOL torture_bind_samba3(struct torture_context *torture) goto done; } - ret = True; + ret = true; ret &= bindtest(cli, cmdline_credentials, DCERPC_AUTH_TYPE_NTLMSSP, DCERPC_AUTH_LEVEL_INTEGRITY); @@ -502,7 +502,7 @@ static NTSTATUS get_usr_handle(struct smbcli_state *cli, * Create a test user */ -static BOOL create_user(TALLOC_CTX *mem_ctx, struct smbcli_state *cli, +static bool create_user(TALLOC_CTX *mem_ctx, struct smbcli_state *cli, struct cli_credentials *admin_creds, const char *username, const char *password, char **domain_name, @@ -512,11 +512,11 @@ static BOOL create_user(TALLOC_CTX *mem_ctx, struct smbcli_state *cli, NTSTATUS status; struct dcerpc_pipe *samr_pipe; struct policy_handle *wks_handle; - BOOL ret = False; + bool ret = false; if (!(tmp_ctx = talloc_new(mem_ctx))) { d_printf("talloc_init failed\n"); - return False; + return false; } status = get_usr_handle(cli, tmp_ctx, admin_creds, @@ -604,7 +604,7 @@ static BOOL create_user(TALLOC_CTX *mem_ctx, struct smbcli_state *cli, *domain_name= talloc_steal(mem_ctx, *domain_name); *user_sid = talloc_steal(mem_ctx, *user_sid); - ret = True; + ret = true; done: talloc_free(tmp_ctx); return ret; @@ -614,7 +614,7 @@ static BOOL create_user(TALLOC_CTX *mem_ctx, struct smbcli_state *cli, * Delete a test user */ -static BOOL delete_user(struct smbcli_state *cli, +static bool delete_user(struct smbcli_state *cli, struct cli_credentials *admin_creds, const char *username) { @@ -623,11 +623,11 @@ static BOOL delete_user(struct smbcli_state *cli, char *dom_name; struct dcerpc_pipe *samr_pipe; struct policy_handle *user_handle; - BOOL ret = False; + bool ret = false; if ((mem_ctx = talloc_init("leave")) == NULL) { d_printf("talloc_init failed\n"); - return False; + return false; } status = get_usr_handle(cli, mem_ctx, admin_creds, @@ -654,7 +654,7 @@ static BOOL delete_user(struct smbcli_state *cli, } } - ret = True; + ret = true; done: talloc_free(mem_ctx); @@ -665,8 +665,8 @@ static BOOL delete_user(struct smbcli_state *cli, * Do a Samba3-style join */ -static BOOL join3(struct smbcli_state *cli, - BOOL use_level25, +static bool join3(struct smbcli_state *cli, + bool use_level25, struct cli_credentials *admin_creds, struct cli_credentials *wks_creds) { @@ -675,11 +675,11 @@ static BOOL join3(struct smbcli_state *cli, char *dom_name; struct dcerpc_pipe *samr_pipe; struct policy_handle *wks_handle; - BOOL ret = False; + bool ret = false; if ((mem_ctx = talloc_init("join3")) == NULL) { d_printf("talloc_init failed\n"); - return False; + return false; } status = get_usr_handle( @@ -788,7 +788,7 @@ static BOOL join3(struct smbcli_state *cli, } } - ret = True; + ret = true; done: talloc_free(mem_ctx); @@ -799,12 +799,12 @@ static BOOL join3(struct smbcli_state *cli, * Do a ReqChallenge/Auth2 and get the wks creds */ -static BOOL auth2(struct smbcli_state *cli, +static bool auth2(struct smbcli_state *cli, struct cli_credentials *wks_cred) { TALLOC_CTX *mem_ctx; struct dcerpc_pipe *net_pipe; - BOOL result = False; + bool result = false; NTSTATUS status; struct netr_ServerReqChallenge r; struct netr_Credential netr_cli_creds; @@ -818,7 +818,7 @@ static BOOL auth2(struct smbcli_state *cli, mem_ctx = talloc_new(NULL); if (mem_ctx == NULL) { d_printf("talloc_new failed\n"); - return False; + return false; } net_pipe = dcerpc_pipe_init(mem_ctx, @@ -894,7 +894,7 @@ static BOOL auth2(struct smbcli_state *cli, cli_credentials_set_netlogon_creds(wks_cred, creds_state); - result = True; + result = true; done: talloc_free(mem_ctx); @@ -906,20 +906,20 @@ static BOOL auth2(struct smbcli_state *cli, * login, and change the wks password */ -static BOOL schan(struct smbcli_state *cli, +static bool schan(struct smbcli_state *cli, struct cli_credentials *wks_creds, struct cli_credentials *user_creds) { TALLOC_CTX *mem_ctx; NTSTATUS status; - BOOL ret = False; + bool ret = false; struct dcerpc_pipe *net_pipe; int i; mem_ctx = talloc_new(NULL); if (mem_ctx == NULL) { d_printf("talloc_new failed\n"); - return False; + return false; } net_pipe = dcerpc_pipe_init(mem_ctx, @@ -1093,7 +1093,7 @@ static BOOL schan(struct smbcli_state *cli, CRED_SPECIFIED); } - ret = True; + ret = true; done: talloc_free(mem_ctx); return ret; @@ -1103,13 +1103,13 @@ static BOOL schan(struct smbcli_state *cli, * Delete the wks account again */ -static BOOL leave(struct smbcli_state *cli, +static bool leave(struct smbcli_state *cli, struct cli_credentials *admin_creds, struct cli_credentials *wks_creds) { char *wks_name = talloc_asprintf( NULL, "%s$", cli_credentials_get_workstation(wks_creds)); - BOOL ret; + bool ret; ret = delete_user(cli, admin_creds, wks_name); talloc_free(wks_name); @@ -1120,11 +1120,11 @@ static BOOL leave(struct smbcli_state *cli, * Test the Samba3 DC code a bit. Join, do some schan netlogon ops, leave */ -BOOL torture_netlogon_samba3(struct torture_context *torture) +bool torture_netlogon_samba3(struct torture_context *torture) { TALLOC_CTX *mem_ctx; NTSTATUS status; - BOOL ret = False; + bool ret = false; struct smbcli_state *cli; struct cli_credentials *anon_creds; struct cli_credentials *wks_creds; @@ -1140,7 +1140,7 @@ BOOL torture_netlogon_samba3(struct torture_context *torture) if (mem_ctx == NULL) { d_printf("talloc_init failed\n"); - return False; + return false; } if (!(anon_creds = create_anon_creds(mem_ctx))) { @@ -1171,7 +1171,7 @@ BOOL torture_netlogon_samba3(struct torture_context *torture) generate_random_str(wks_creds, 8), CRED_SPECIFIED); - if (!join3(cli, False, cmdline_credentials, wks_creds)) { + if (!join3(cli, false, cmdline_credentials, wks_creds)) { d_printf("join failed\n"); goto done; } @@ -1206,7 +1206,7 @@ BOOL torture_netlogon_samba3(struct torture_context *torture) goto done; } - ret = True; + ret = true; done: talloc_free(mem_ctx); @@ -1218,14 +1218,14 @@ BOOL torture_netlogon_samba3(struct torture_context *torture) * credentials */ -static BOOL test_join3(TALLOC_CTX *mem_ctx, - BOOL use_level25, +static bool test_join3(TALLOC_CTX *mem_ctx, + bool use_level25, struct cli_credentials *smb_creds, struct cli_credentials *samr_creds, const char *wks_name) { NTSTATUS status; - BOOL ret = False; + bool ret = false; struct smbcli_state *cli; struct cli_credentials *wks_creds; @@ -1273,7 +1273,7 @@ static BOOL test_join3(TALLOC_CTX *mem_ctx, talloc_free(cli); - ret = True; + ret = true; done: return ret; @@ -1284,10 +1284,10 @@ static BOOL test_join3(TALLOC_CTX *mem_ctx, * session key in the setpassword routine. Test the join by doing the auth2. */ -BOOL torture_samba3_sessionkey(struct torture_context *torture) +bool torture_samba3_sessionkey(struct torture_context *torture) { TALLOC_CTX *mem_ctx; - BOOL ret = False; + bool ret = false; struct cli_credentials *anon_creds; const char *wks_name; @@ -1297,7 +1297,7 @@ BOOL torture_samba3_sessionkey(struct torture_context *torture) if (mem_ctx == NULL) { d_printf("talloc_init failed\n"); - return False; + return false; } if (!(anon_creds = create_anon_creds(mem_ctx))) { @@ -1305,56 +1305,56 @@ BOOL torture_samba3_sessionkey(struct torture_context *torture) goto done; } - ret = True; + ret = true; - if (!torture_setting_bool(torture, "samba3", False)) { + if (!torture_setting_bool(torture, "samba3", false)) { /* Samba3 in the build farm right now does this happily. Need * to fix :-) */ - if (test_join3(mem_ctx, False, anon_creds, NULL, wks_name)) { + if (test_join3(mem_ctx, false, anon_creds, NULL, wks_name)) { d_printf("join using anonymous bind on an anonymous smb " "connection succeeded -- HUH??\n"); - ret = False; + ret = false; } } - if (!test_join3(mem_ctx, False, anon_creds, cmdline_credentials, + if (!test_join3(mem_ctx, false, anon_creds, cmdline_credentials, wks_name)) { d_printf("join using ntlmssp bind on an anonymous smb " "connection failed\n"); - ret = False; + ret = false; } - if (!test_join3(mem_ctx, False, cmdline_credentials, NULL, wks_name)) { + if (!test_join3(mem_ctx, false, cmdline_credentials, NULL, wks_name)) { d_printf("join using anonymous bind on an authenticated smb " "connection failed\n"); - ret = False; + ret = false; } - if (!test_join3(mem_ctx, False, cmdline_credentials, + if (!test_join3(mem_ctx, false, cmdline_credentials, cmdline_credentials, wks_name)) { d_printf("join using ntlmssp bind on an authenticated smb " "connection failed\n"); - ret = False; + ret = false; } /* * The following two are tests for setuserinfolevel 25 */ - if (!test_join3(mem_ctx, True, anon_creds, cmdline_credentials, + if (!test_join3(mem_ctx, true, anon_creds, cmdline_credentials, wks_name)) { d_printf("join using ntlmssp bind on an anonymous smb " "connection failed\n"); - ret = False; + ret = false; } - if (!test_join3(mem_ctx, True, cmdline_credentials, NULL, wks_name)) { + if (!test_join3(mem_ctx, true, cmdline_credentials, NULL, wks_name)) { d_printf("join using anonymous bind on an authenticated smb " "connection failed\n"); - ret = False; + ret = false; } done: @@ -1547,7 +1547,7 @@ NTSTATUS secondary_tcon(TALLOC_CTX *mem_ctx, return NT_STATUS_NO_MEMORY; } - if (!(result = smbcli_tree_init(session, mem_ctx, False))) { + if (!(result = smbcli_tree_init(session, mem_ctx, false))) { talloc_free(tmp_ctx); return NT_STATUS_NO_MEMORY; } @@ -1577,12 +1577,12 @@ NTSTATUS secondary_tcon(TALLOC_CTX *mem_ctx, * Test the getusername behaviour */ -BOOL torture_samba3_rpc_getusername(struct torture_context *torture) +bool torture_samba3_rpc_getusername(struct torture_context *torture) { NTSTATUS status; struct smbcli_state *cli; TALLOC_CTX *mem_ctx; - BOOL ret = True; + bool ret = true; struct dom_sid *user_sid; struct dom_sid *created_sid; struct cli_credentials *anon_creds; @@ -1590,7 +1590,7 @@ BOOL torture_samba3_rpc_getusername(struct torture_context *torture) char *domain_name; if (!(mem_ctx = talloc_new(torture))) { - return False; + return false; } status = smbcli_full_connection( @@ -1599,21 +1599,21 @@ BOOL torture_samba3_rpc_getusername(struct torture_context *torture) if (!NT_STATUS_IS_OK(status)) { d_printf("(%s) smbcli_full_connection failed: %s\n", __location__, nt_errstr(status)); - ret = False; + ret = false; goto done; } if (!(user_sid = whoami(mem_ctx, cli->tree))) { d_printf("(%s) whoami on auth'ed connection failed\n", __location__); - ret = False; + ret = false; } talloc_free(cli); if (!(anon_creds = create_anon_creds(mem_ctx))) { d_printf("(%s) create_anon_creds failed\n", __location__); - ret = False; + ret = false; goto done; } @@ -1623,14 +1623,14 @@ BOOL torture_samba3_rpc_getusername(struct torture_context *torture) if (!NT_STATUS_IS_OK(status)) { d_printf("(%s) anon smbcli_full_connection failed: %s\n", __location__, nt_errstr(status)); - ret = False; + ret = false; goto done; } if (!(user_sid = whoami(mem_ctx, cli->tree))) { d_printf("(%s) whoami on anon connection failed\n", __location__); - ret = False; + ret = false; goto done; } @@ -1639,12 +1639,12 @@ BOOL torture_samba3_rpc_getusername(struct torture_context *torture) d_printf("(%s) Anon lsa_GetUserName returned %s, expected " "S-1-5-7", __location__, dom_sid_string(mem_ctx, user_sid)); - ret = False; + ret = false; } if (!(user_creds = cli_credentials_init(mem_ctx))) { d_printf("(%s) cli_credentials_init failed\n", __location__); - ret = False; + ret = false; goto done; } @@ -1660,7 +1660,7 @@ BOOL torture_samba3_rpc_getusername(struct torture_context *torture) cli_credentials_get_password(user_creds), &domain_name, &created_sid)) { d_printf("(%s) create_user failed\n", __location__); - ret = False; + ret = false; goto done; } @@ -1672,7 +1672,7 @@ BOOL torture_samba3_rpc_getusername(struct torture_context *torture) struct smb_composite_sesssetup setup; struct smbcli_tree *tree; - session2 = smbcli_session_init(cli->transport, mem_ctx, False); + session2 = smbcli_session_init(cli->transport, mem_ctx, false); if (session2 == NULL) { d_printf("(%s) smbcli_session_init failed\n", __location__); @@ -1688,7 +1688,7 @@ BOOL torture_samba3_rpc_getusername(struct torture_context *torture) if (!NT_STATUS_IS_OK(status)) { d_printf("(%s) session setup with new user failed: " "%s\n", __location__, nt_errstr(status)); - ret = False; + ret = false; goto done; } session2->vuid = setup.out.vuid; @@ -1697,14 +1697,14 @@ BOOL torture_samba3_rpc_getusername(struct torture_context *torture) "IPC$", &tree))) { d_printf("(%s) secondary_tcon failed\n", __location__); - ret = False; + ret = false; goto done; } if (!(user_sid = whoami(mem_ctx, tree))) { d_printf("(%s) whoami on user connection failed\n", __location__); - ret = False; + ret = false; goto delete; } @@ -1716,14 +1716,14 @@ BOOL torture_samba3_rpc_getusername(struct torture_context *torture) dom_sid_string(mem_ctx, user_sid)); if (!dom_sid_equal(created_sid, user_sid)) { - ret = False; + ret = false; } delete: if (!delete_user(cli, cmdline_credentials, cli_credentials_get_username(user_creds))) { d_printf("(%s) delete_user failed\n", __location__); - ret = False; + ret = false; } done: @@ -1731,14 +1731,14 @@ BOOL torture_samba3_rpc_getusername(struct torture_context *torture) return ret; } -static BOOL test_NetShareGetInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_NetShareGetInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, const char *sharename) { NTSTATUS status; struct srvsvc_NetShareGetInfo r; uint32_t levels[] = { 0, 1, 2, 501, 502, 1004, 1005, 1006, 1007, 1501 }; int i; - BOOL ret = True; + bool ret = true; r.in.server_unc = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(p)); @@ -1757,14 +1757,14 @@ static BOOL test_NetShareGetInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("NetShareGetInfo level %u on share '%s' failed" " - %s\n", r.in.level, r.in.share_name, nt_errstr(status)); - ret = False; + ret = false; continue; } if (!W_ERROR_IS_OK(r.out.result)) { printf("NetShareGetInfo level %u on share '%s' failed " "- %s\n", r.in.level, r.in.share_name, win_errstr(r.out.result)); - ret = False; + ret = false; continue; } } @@ -1772,7 +1772,7 @@ static BOOL test_NetShareGetInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, return ret; } -static BOOL test_NetShareEnum(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_NetShareEnum(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, const char **one_sharename) { NTSTATUS status; @@ -1780,7 +1780,7 @@ static BOOL test_NetShareEnum(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct srvsvc_NetShareCtr0 c0; uint32_t levels[] = { 0, 1, 2, 501, 502, 1004, 1005, 1006, 1007 }; int i; - BOOL ret = True; + bool ret = true; r.in.server_unc = talloc_asprintf(mem_ctx,"\\\\%s",dcerpc_server_name(p)); r.in.ctr.ctr0 = &c0; @@ -1799,7 +1799,7 @@ static BOOL test_NetShareEnum(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("NetShareEnum level %u failed - %s\n", r.in.level, nt_errstr(status)); - ret = False; + ret = false; continue; } if (!W_ERROR_IS_OK(r.out.result)) { @@ -1818,24 +1818,24 @@ static BOOL test_NetShareEnum(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, return ret; } -BOOL torture_samba3_rpc_srvsvc(struct torture_context *torture) +bool torture_samba3_rpc_srvsvc(struct torture_context *torture) { struct dcerpc_pipe *p; TALLOC_CTX *mem_ctx; - BOOL ret = True; + bool ret = true; const char *sharename = NULL; struct smbcli_state *cli; NTSTATUS status; if (!(mem_ctx = talloc_new(torture))) { - return False; + return false; } if (!(torture_open_connection_share( mem_ctx, &cli, torture_setting_string(torture, "host", NULL), "IPC$", NULL))) { talloc_free(mem_ctx); - return False; + return false; } status = pipe_bind_smb(mem_ctx, cli->tree, "\\pipe\\srvsvc", @@ -1843,7 +1843,7 @@ BOOL torture_samba3_rpc_srvsvc(struct torture_context *torture) if (!NT_STATUS_IS_OK(status)) { d_printf("(%s) could not bind to srvsvc pipe: %s\n", __location__, nt_errstr(status)); - ret = False; + ret = false; goto done; } @@ -1967,7 +1967,7 @@ static NTSTATUS set_sharesec(TALLOC_CTX *mem_ctx, return status; } -BOOL try_tcon(TALLOC_CTX *mem_ctx, +bool try_tcon(TALLOC_CTX *mem_ctx, struct security_descriptor *orig_sd, struct smbcli_session *session, const char *sharename, const struct dom_sid *user_sid, @@ -1980,18 +1980,18 @@ BOOL try_tcon(TALLOC_CTX *mem_ctx, uint32_t rid; struct security_descriptor *sd; NTSTATUS status; - BOOL ret = True; + bool ret = true; if (!(tmp_ctx = talloc_new(mem_ctx))) { d_printf("talloc_new failed\n"); - return False; + return false; } status = secondary_tcon(tmp_ctx, session, sharename, &rmdir_tree); if (!NT_STATUS_IS_OK(status)) { d_printf("first tcon to delete dir failed\n"); talloc_free(tmp_ctx); - return False; + return false; } smbcli_rmdir(rmdir_tree, "sharesec_testdir"); @@ -2000,7 +2000,7 @@ BOOL try_tcon(TALLOC_CTX *mem_ctx, &domain_sid, &rid))) { d_printf("dom_sid_split_rid failed\n"); talloc_free(tmp_ctx); - return False; + return false; } sd = security_descriptor_create( @@ -2012,7 +2012,7 @@ BOOL try_tcon(TALLOC_CTX *mem_ctx, if (sd == NULL) { d_printf("security_descriptor_create failed\n"); talloc_free(tmp_ctx); - return False; + return false; } status = set_sharesec(mem_ctx, session, sharename, sd); @@ -2020,14 +2020,14 @@ BOOL try_tcon(TALLOC_CTX *mem_ctx, d_printf("custom set_sharesec failed: %s\n", nt_errstr(status)); talloc_free(tmp_ctx); - return False; + return false; } status = secondary_tcon(tmp_ctx, session, sharename, &tree); if (!NT_STATUS_EQUAL(status, expected_tcon)) { d_printf("Expected %s, got %s\n", nt_errstr(expected_tcon), nt_errstr(status)); - ret = False; + ret = false; goto done; } @@ -2040,7 +2040,7 @@ BOOL try_tcon(TALLOC_CTX *mem_ctx, if (!NT_STATUS_EQUAL(status, expected_mkdir)) { d_printf("(%s) Expected %s, got %s\n", __location__, nt_errstr(expected_mkdir), nt_errstr(status)); - ret = False; + ret = false; } done: @@ -2051,23 +2051,23 @@ BOOL try_tcon(TALLOC_CTX *mem_ctx, d_printf("custom set_sharesec failed: %s\n", nt_errstr(status)); talloc_free(tmp_ctx); - return False; + return false; } talloc_free(tmp_ctx); return ret; } -BOOL torture_samba3_rpc_sharesec(struct torture_context *torture) +bool torture_samba3_rpc_sharesec(struct torture_context *torture) { TALLOC_CTX *mem_ctx; - BOOL ret = True; + bool ret = true; struct smbcli_state *cli; struct security_descriptor *sd; struct dom_sid *user_sid; if (!(mem_ctx = talloc_new(torture))) { - return False; + return false; } if (!(torture_open_connection_share( @@ -2075,13 +2075,13 @@ BOOL torture_samba3_rpc_sharesec(struct torture_context *torture) "IPC$", NULL))) { d_printf("IPC$ connection failed\n"); talloc_free(mem_ctx); - return False; + return false; } if (!(user_sid = whoami(mem_ctx, cli->tree))) { d_printf("whoami failed\n"); talloc_free(mem_ctx); - return False; + return false; } sd = get_sharesec(mem_ctx, cli->session, torture_setting_string(torture, @@ -2104,10 +2104,10 @@ BOOL torture_samba3_rpc_sharesec(struct torture_context *torture) return ret; } -BOOL torture_samba3_rpc_lsa(struct torture_context *torture) +bool torture_samba3_rpc_lsa(struct torture_context *torture) { TALLOC_CTX *mem_ctx; - BOOL ret = True; + bool ret = true; struct smbcli_state *cli; struct dcerpc_pipe *p; struct policy_handle lsa_handle; @@ -2115,7 +2115,7 @@ BOOL torture_samba3_rpc_lsa(struct torture_context *torture) struct dom_sid *domain_sid; if (!(mem_ctx = talloc_new(torture))) { - return False; + return false; } if (!(torture_open_connection_share( @@ -2123,7 +2123,7 @@ BOOL torture_samba3_rpc_lsa(struct torture_context *torture) "IPC$", NULL))) { d_printf("IPC$ connection failed\n"); talloc_free(mem_ctx); - return False; + return false; } status = pipe_bind_smb(mem_ctx, cli->tree, "\\lsarpc", @@ -2132,7 +2132,7 @@ BOOL torture_samba3_rpc_lsa(struct torture_context *torture) d_printf("(%s) pipe_bind_smb failed: %s\n", __location__, nt_errstr(status)); talloc_free(mem_ctx); - return False; + return false; } { @@ -2149,7 +2149,7 @@ BOOL torture_samba3_rpc_lsa(struct torture_context *torture) d_printf("(%s) dcerpc_lsa_OpenPolicy2 failed: %s\n", __location__, nt_errstr(status)); talloc_free(mem_ctx); - return False; + return false; } } @@ -2171,7 +2171,7 @@ BOOL torture_samba3_rpc_lsa(struct torture_context *torture) "failed: %s\n", __location__, levels[i], nt_errstr(status)); talloc_free(mem_ctx); - return False; + return false; } if (levels[i] == 5) { domain_sid = r.out.info->account_domain.sid; @@ -2266,7 +2266,7 @@ static NTSTATUS find_printers(TALLOC_CTX *ctx, struct smbcli_tree *tree, return NT_STATUS_OK; } -static BOOL enumprinters(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *pipe, +static bool enumprinters(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *pipe, const char *servername, int level, int *num_printers) { struct spoolss_EnumPrinters r; @@ -2283,20 +2283,20 @@ static BOOL enumprinters(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *pipe, if (!NT_STATUS_IS_OK(status)) { d_printf("(%s) dcerpc_spoolss_EnumPrinters failed: %s\n", __location__, nt_errstr(status)); - return False; + return false; } if (!W_ERROR_EQUAL(r.out.result, WERR_INSUFFICIENT_BUFFER)) { d_printf("(%s) EnumPrinters unexpected return code %s, should " "be WERR_INSUFFICIENT_BUFFER\n", __location__, win_errstr(r.out.result)); - return False; + return false; } blob = data_blob_talloc_zero(mem_ctx, r.out.needed); if (blob.data == NULL) { d_printf("(%s) data_blob_talloc failed\n", __location__); - return False; + return false; } r.in.buffer = &blob; @@ -2307,12 +2307,12 @@ static BOOL enumprinters(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *pipe, d_printf("(%s) dcerpc_spoolss_EnumPrinters failed: %s, " "%s\n", __location__, nt_errstr(status), win_errstr(r.out.result)); - return False; + return false; } *num_printers = r.out.count; - return True; + return true; } static NTSTATUS getprinterinfo(TALLOC_CTX *ctx, struct dcerpc_pipe *pipe, @@ -2379,10 +2379,10 @@ static NTSTATUS getprinterinfo(TALLOC_CTX *ctx, struct dcerpc_pipe *pipe, return NT_STATUS_OK; } -BOOL torture_samba3_rpc_spoolss(struct torture_context *torture) +bool torture_samba3_rpc_spoolss(struct torture_context *torture) { TALLOC_CTX *mem_ctx; - BOOL ret = True; + bool ret = true; struct smbcli_state *cli; struct dcerpc_pipe *p; NTSTATUS status; @@ -2393,7 +2393,7 @@ BOOL torture_samba3_rpc_spoolss(struct torture_context *torture) char *servername; if (!(mem_ctx = talloc_new(torture))) { - return False; + return false; } if (!(torture_open_connection_share( @@ -2401,7 +2401,7 @@ BOOL torture_samba3_rpc_spoolss(struct torture_context *torture) "IPC$", NULL))) { d_printf("IPC$ connection failed\n"); talloc_free(mem_ctx); - return False; + return false; } status = get_servername(mem_ctx, cli->tree, &servername); @@ -2409,19 +2409,19 @@ BOOL torture_samba3_rpc_spoolss(struct torture_context *torture) d_fprintf(stderr, "(%s) get_servername returned %s\n", __location__, nt_errstr(status)); talloc_free(mem_ctx); - return False; + return false; } if (!NT_STATUS_IS_OK(find_printers(mem_ctx, cli->tree, &printers, &num_printers))) { talloc_free(mem_ctx); - return False; + return false; } if (num_printers == 0) { d_printf("Did not find printers\n"); talloc_free(mem_ctx); - return True; + return true; } status = pipe_bind_smb(mem_ctx, cli->tree, "\\spoolss", @@ -2430,7 +2430,7 @@ BOOL torture_samba3_rpc_spoolss(struct torture_context *torture) d_printf("(%s) pipe_bind_smb failed: %s\n", __location__, nt_errstr(status)); talloc_free(mem_ctx); - return False; + return false; } ZERO_STRUCT(userlevel1); @@ -2460,7 +2460,7 @@ BOOL torture_samba3_rpc_spoolss(struct torture_context *torture) "%s, %s\n", __location__, nt_errstr(status), win_errstr(r.out.result)); talloc_free(mem_ctx); - return False; + return false; } } @@ -2476,7 +2476,7 @@ BOOL torture_samba3_rpc_spoolss(struct torture_context *torture) "%s, %s\n", __location__, nt_errstr(status), win_errstr(r.out.result)); talloc_free(mem_ctx); - return False; + return false; } } @@ -2498,7 +2498,7 @@ BOOL torture_samba3_rpc_spoolss(struct torture_context *torture) "%s, %s\n", __location__, nt_errstr(status), win_errstr(r.out.result)); talloc_free(mem_ctx); - return False; + return false; } } @@ -2511,7 +2511,7 @@ BOOL torture_samba3_rpc_spoolss(struct torture_context *torture) if (!NT_STATUS_IS_OK(status)) { d_printf("(%s) getprinterinfo %d failed: %s\n", __location__, i, nt_errstr(status)); - ret = False; + ret = false; } } } @@ -2527,7 +2527,7 @@ BOOL torture_samba3_rpc_spoolss(struct torture_context *torture) d_printf("(%s) dcerpc_spoolss_ClosePrinter failed: " "%s\n", __location__, nt_errstr(status)); talloc_free(mem_ctx); - return False; + return false; } } @@ -2537,14 +2537,14 @@ BOOL torture_samba3_rpc_spoolss(struct torture_context *torture) &num_enumerated)) { d_printf("(%s) enumprinters failed\n", __location__); talloc_free(mem_ctx); - return False; + return false; } if (num_printers != num_enumerated) { d_printf("(%s) netshareenum gave %d printers, " "enumprinters lvl 1 gave %d\n", __location__, num_printers, num_enumerated); talloc_free(mem_ctx); - return False; + return false; } } @@ -2554,14 +2554,14 @@ BOOL torture_samba3_rpc_spoolss(struct torture_context *torture) &num_enumerated)) { d_printf("(%s) enumprinters failed\n", __location__); talloc_free(mem_ctx); - return False; + return false; } if (num_printers != num_enumerated) { d_printf("(%s) netshareenum gave %d printers, " "enumprinters lvl 2 gave %d\n", __location__, num_printers, num_enumerated); talloc_free(mem_ctx); - return False; + return false; } } @@ -2570,7 +2570,7 @@ BOOL torture_samba3_rpc_spoolss(struct torture_context *torture) return ret; } -BOOL torture_samba3_rpc_wkssvc(struct torture_context *torture) +bool torture_samba3_rpc_wkssvc(struct torture_context *torture) { TALLOC_CTX *mem_ctx; struct smbcli_state *cli; @@ -2579,7 +2579,7 @@ BOOL torture_samba3_rpc_wkssvc(struct torture_context *torture) char *servername; if (!(mem_ctx = talloc_new(torture))) { - return False; + return false; } if (!(torture_open_connection_share( @@ -2587,7 +2587,7 @@ BOOL torture_samba3_rpc_wkssvc(struct torture_context *torture) "IPC$", NULL))) { d_printf("IPC$ connection failed\n"); talloc_free(mem_ctx); - return False; + return false; } status = get_servername(mem_ctx, cli->tree, &servername); @@ -2595,7 +2595,7 @@ BOOL torture_samba3_rpc_wkssvc(struct torture_context *torture) d_fprintf(stderr, "(%s) get_servername returned %s\n", __location__, nt_errstr(status)); talloc_free(mem_ctx); - return False; + return false; } status = pipe_bind_smb(mem_ctx, cli->tree, "\\wkssvc", @@ -2604,7 +2604,7 @@ BOOL torture_samba3_rpc_wkssvc(struct torture_context *torture) d_printf("(%s) pipe_bind_smb failed: %s\n", __location__, nt_errstr(status)); talloc_free(mem_ctx); - return False; + return false; } { @@ -2623,7 +2623,7 @@ BOOL torture_samba3_rpc_wkssvc(struct torture_context *torture) "%s, %s\n", __location__, nt_errstr(status), win_errstr(r.out.result)); talloc_free(mem_ctx); - return False; + return false; } if (strcmp(servername, @@ -2633,12 +2633,12 @@ BOOL torture_samba3_rpc_wkssvc(struct torture_context *torture) __location__, servername, r.out.info->info100->server_name); talloc_free(mem_ctx); - return False; + return false; } } talloc_free(mem_ctx); - return True; + return true; } static NTSTATUS winreg_close(struct dcerpc_pipe *p, @@ -2767,14 +2767,14 @@ static NTSTATUS enumkeys(struct dcerpc_pipe *p, struct policy_handle *handle, talloc_free(tmp_ctx); r.in.enum_index += 1; - } while(True); + } while(true); return NT_STATUS_OK; } typedef NTSTATUS (*winreg_open_fn)(struct dcerpc_pipe *, TALLOC_CTX *, void *); -static BOOL test_Open3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_Open3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, const char *name, winreg_open_fn open_fn) { struct policy_handle handle; @@ -2789,7 +2789,7 @@ static BOOL test_Open3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(r.out.result)) { d_printf("(%s) %s failed: %s, %s\n", __location__, name, nt_errstr(status), win_errstr(r.out.result)); - return False; + return false; } enumkeys(p, &handle, mem_ctx, 4); @@ -2798,18 +2798,18 @@ static BOOL test_Open3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { d_printf("(%s) dcerpc_CloseKey failed: %s\n", __location__, nt_errstr(status)); - return False; + return false; } - return True; + return true; } -BOOL torture_samba3_rpc_winreg(struct torture_context *torture) +bool torture_samba3_rpc_winreg(struct torture_context *torture) { NTSTATUS status; struct dcerpc_pipe *p; TALLOC_CTX *mem_ctx; - BOOL ret = True; + bool ret = true; struct { const char *name; winreg_open_fn fn; @@ -2829,7 +2829,7 @@ BOOL torture_samba3_rpc_winreg(struct torture_context *torture) if (!NT_STATUS_IS_OK(status)) { talloc_free(mem_ctx); - return False; + return false; } #if 1 @@ -2837,7 +2837,7 @@ BOOL torture_samba3_rpc_winreg(struct torture_context *torture) #else for (i = 0; i < ARRAY_SIZE(open_fns); i++) { if (!test_Open3(p, mem_ctx, open_fns[i].name, open_fns[i].fn)) - ret = False; + ret = false; } #endif diff --git a/source4/torture/rpc/samlogon.c b/source4/torture/rpc/samlogon.c index 46ed3634235..aa0f6de7880 100644 --- a/source4/torture/rpc/samlogon.c +++ b/source4/torture/rpc/samlogon.c @@ -62,7 +62,7 @@ struct samlogon_state { struct netr_Authenticator auth, auth2; struct creds_CredentialState *creds; NTSTATUS expected_error; - BOOL old_password; /* Allow an old password to be accepted or rejected without error, as well as session key bugs */ + bool old_password; /* Allow an old password to be accepted or rejected without error, as well as session key bugs */ DATA_BLOB chall; }; @@ -263,10 +263,10 @@ static NTSTATUS check_samlogon(struct samlogon_state *samlogon_state, * Test the normal 'LM and NTLM' combination */ -static BOOL test_lm_ntlm_broken(struct samlogon_state *samlogon_state, enum ntlm_break break_which, char **error_string) +static bool test_lm_ntlm_broken(struct samlogon_state *samlogon_state, enum ntlm_break break_which, char **error_string) { - BOOL pass = True; - BOOL lm_good; + bool pass = true; + bool lm_good; NTSTATUS nt_status; DATA_BLOB lm_response = data_blob_talloc(samlogon_state->mem_ctx, NULL, 24); DATA_BLOB nt_response = data_blob_talloc(samlogon_state->mem_ctx, NULL, 24); @@ -307,11 +307,11 @@ static BOOL test_lm_ntlm_broken(struct samlogon_state *samlogon_state, enum ntlm if (NT_STATUS_EQUAL(NT_STATUS_WRONG_PASSWORD, nt_status)) { /* for 'long' passwords, the LM password is invalid */ if (break_which == NO_NT && !lm_good) { - return True; + return true; } /* for 'old' passwords, we allow the server to be OK or wrong password */ if (samlogon_state->old_password) { - return True; + return true; } return ((break_which == BREAK_NT) || (break_which == BREAK_BOTH)); } else if (NT_STATUS_EQUAL(NT_STATUS_NOT_FOUND, nt_status) && strchr_m(samlogon_state->account_name, '@')) { @@ -319,16 +319,16 @@ static BOOL test_lm_ntlm_broken(struct samlogon_state *samlogon_state, enum ntlm } else if (!NT_STATUS_EQUAL(samlogon_state->expected_error, nt_status)) { SAFE_FREE(*error_string); asprintf(error_string, "Expected error: %s, got %s", nt_errstr(samlogon_state->expected_error), nt_errstr(nt_status)); - return False; + return false; } else if (NT_STATUS_EQUAL(samlogon_state->expected_error, nt_status) && !NT_STATUS_IS_OK(nt_status)) { - return True; + return true; } else if (!NT_STATUS_IS_OK(nt_status)) { - return False; + return false; } if (break_which == NO_NT && !lm_good) { *error_string = strdup("LM password is 'long' (> 14 chars and therefore invalid) but login did not fail!"); - return False; + return false; } if (memcmp(lm_hash, lm_key, @@ -338,7 +338,7 @@ static BOOL test_lm_ntlm_broken(struct samlogon_state *samlogon_state, enum ntlm dump_data(1, lm_key, 8); d_printf("expected:\n"); dump_data(1, lm_hash, 8); - pass = False; + pass = false; } switch (break_which) { @@ -354,7 +354,7 @@ static BOOL test_lm_ntlm_broken(struct samlogon_state *samlogon_state, enum ntlm dump_data(1, user_session_key, sizeof(user_session_key)); d_printf("expected:\n"); dump_data(1, lm_key_expected, sizeof(lm_key_expected)); - pass = False; + pass = false; } break; } @@ -366,7 +366,7 @@ static BOOL test_lm_ntlm_broken(struct samlogon_state *samlogon_state, enum ntlm dump_data(1, user_session_key, 16); d_printf("expected:\n"); dump_data(1, session_key.data, session_key.length); - pass = False; + pass = false; } } return pass; @@ -376,7 +376,7 @@ static BOOL test_lm_ntlm_broken(struct samlogon_state *samlogon_state, enum ntlm * Test LM authentication, no NT response supplied */ -static BOOL test_lm(struct samlogon_state *samlogon_state, char **error_string) +static bool test_lm(struct samlogon_state *samlogon_state, char **error_string) { return test_lm_ntlm_broken(samlogon_state, NO_NT, error_string); @@ -386,7 +386,7 @@ static BOOL test_lm(struct samlogon_state *samlogon_state, char **error_string) * Test the NTLM response only, no LM. */ -static BOOL test_ntlm(struct samlogon_state *samlogon_state, char **error_string) +static bool test_ntlm(struct samlogon_state *samlogon_state, char **error_string) { return test_lm_ntlm_broken(samlogon_state, NO_LM, error_string); } @@ -395,10 +395,10 @@ static BOOL test_ntlm(struct samlogon_state *samlogon_state, char **error_string * Test the NTLM response only, but in the LM field. */ -static BOOL test_ntlm_in_lm(struct samlogon_state *samlogon_state, char **error_string) +static bool test_ntlm_in_lm(struct samlogon_state *samlogon_state, char **error_string) { - BOOL lm_good; - BOOL pass = True; + bool lm_good; + bool pass = true; NTSTATUS nt_status; DATA_BLOB nt_response = data_blob_talloc(samlogon_state->mem_ctx, NULL, 24); DATA_BLOB session_key = data_blob_talloc(samlogon_state->mem_ctx, NULL, 16); @@ -434,17 +434,17 @@ static BOOL test_ntlm_in_lm(struct samlogon_state *samlogon_state, char **error_ if (NT_STATUS_EQUAL(NT_STATUS_WRONG_PASSWORD, nt_status)) { /* for 'old' passwords, we allow the server to be OK or wrong password */ if (samlogon_state->old_password) { - return True; + return true; } - return False; + return false; } else if (!NT_STATUS_EQUAL(samlogon_state->expected_error, nt_status)) { SAFE_FREE(*error_string); asprintf(error_string, "Expected error: %s, got %s", nt_errstr(samlogon_state->expected_error), nt_errstr(nt_status)); - return False; + return false; } else if (NT_STATUS_EQUAL(samlogon_state->expected_error, nt_status) && !NT_STATUS_IS_OK(nt_status)) { - return True; + return true; } else if (!NT_STATUS_IS_OK(nt_status)) { - return False; + return false; } if (lm_good) { @@ -455,7 +455,7 @@ static BOOL test_ntlm_in_lm(struct samlogon_state *samlogon_state, char **error_ dump_data(1, lm_key, 8); d_printf("expected:\n"); dump_data(1, lm_hash, 8); - pass = False; + pass = false; } #if 0 } else { @@ -466,7 +466,7 @@ static BOOL test_ntlm_in_lm(struct samlogon_state *samlogon_state, char **error_ dump_data(1, lm_key, 8); d_printf("expected:\n"); dump_data(1, session_key.data, 8); - pass = False; + pass = false; } #endif } @@ -481,7 +481,7 @@ static BOOL test_ntlm_in_lm(struct samlogon_state *samlogon_state, char **error_ dump_data(1, user_session_key, sizeof(user_session_key)); d_printf("expected:\n"); dump_data(1, lm_key_expected, sizeof(lm_key_expected)); - pass = False; + pass = false; } } return pass; @@ -491,10 +491,10 @@ static BOOL test_ntlm_in_lm(struct samlogon_state *samlogon_state, char **error_ * Test the NTLM response only, but in the both the NT and LM fields. */ -static BOOL test_ntlm_in_both(struct samlogon_state *samlogon_state, char **error_string) +static bool test_ntlm_in_both(struct samlogon_state *samlogon_state, char **error_string) { - BOOL pass = True; - BOOL lm_good; + bool pass = true; + bool lm_good; NTSTATUS nt_status; DATA_BLOB nt_response = data_blob_talloc(samlogon_state->mem_ctx, NULL, 24); DATA_BLOB session_key = data_blob_talloc(samlogon_state->mem_ctx, NULL, 16); @@ -531,21 +531,21 @@ static BOOL test_ntlm_in_both(struct samlogon_state *samlogon_state, char **erro if (NT_STATUS_EQUAL(NT_STATUS_WRONG_PASSWORD, nt_status)) { /* for 'old' passwords, we allow the server to be OK or wrong password */ if (samlogon_state->old_password) { - return True; + return true; } - return False; + return false; } else if (!NT_STATUS_EQUAL(samlogon_state->expected_error, nt_status)) { SAFE_FREE(*error_string); asprintf(error_string, "Expected error: %s, got %s", nt_errstr(samlogon_state->expected_error), nt_errstr(nt_status)); - return False; + return false; } else if (NT_STATUS_EQUAL(samlogon_state->expected_error, nt_status) && !NT_STATUS_IS_OK(nt_status)) { - return True; + return true; } else if (!NT_STATUS_IS_OK(nt_status)) { - return False; + return false; } if (!NT_STATUS_IS_OK(nt_status)) { - return False; + return false; } if (memcmp(lm_hash, lm_key, @@ -555,7 +555,7 @@ static BOOL test_ntlm_in_both(struct samlogon_state *samlogon_state, char **erro dump_data(1, lm_key, 8); d_printf("expected:\n"); dump_data(1, lm_hash, 8); - pass = False; + pass = false; } if (memcmp(session_key.data, user_session_key, sizeof(user_session_key)) != 0) { @@ -564,7 +564,7 @@ static BOOL test_ntlm_in_both(struct samlogon_state *samlogon_state, char **erro dump_data(1, user_session_key, 16); d_printf("expected:\n"); dump_data(1, session_key.data, session_key.length); - pass = False; + pass = false; } @@ -580,12 +580,12 @@ enum ntlmv2_domain { NO_DOMAIN }; -static BOOL test_lmv2_ntlmv2_broken(struct samlogon_state *samlogon_state, +static bool test_lmv2_ntlmv2_broken(struct samlogon_state *samlogon_state, enum ntlm_break break_which, enum ntlmv2_domain ntlmv2_domain, char **error_string) { - BOOL pass = True; + bool pass = true; NTSTATUS nt_status; DATA_BLOB ntlmv2_response = data_blob(NULL, 0); DATA_BLOB lmv2_response = data_blob(NULL, 0); @@ -608,7 +608,7 @@ static BOOL test_lmv2_ntlmv2_broken(struct samlogon_state *samlogon_state, &lmv2_response, &ntlmv2_response, &lmv2_session_key, &ntlmv2_session_key)) { data_blob_free(&names_blob); - return False; + return false; } break; case NO_DOMAIN: @@ -619,7 +619,7 @@ static BOOL test_lmv2_ntlmv2_broken(struct samlogon_state *samlogon_state, &lmv2_response, &ntlmv2_response, &lmv2_session_key, &ntlmv2_session_key)) { data_blob_free(&names_blob); - return False; + return false; } break; } @@ -642,7 +642,7 @@ static BOOL test_lmv2_ntlmv2_broken(struct samlogon_state *samlogon_state, if (NT_STATUS_EQUAL(NT_STATUS_WRONG_PASSWORD, nt_status)) { /* for 'old' passwords, we allow the server to be OK or wrong password */ if (samlogon_state->old_password) { - return True; + return true; } return break_which == BREAK_BOTH; } else if (NT_STATUS_EQUAL(NT_STATUS_NOT_FOUND, nt_status) && strchr_m(samlogon_state->account_name, '@')) { @@ -650,11 +650,11 @@ static BOOL test_lmv2_ntlmv2_broken(struct samlogon_state *samlogon_state, } else if (!NT_STATUS_EQUAL(samlogon_state->expected_error, nt_status)) { SAFE_FREE(*error_string); asprintf(error_string, "Expected error: %s, got %s", nt_errstr(samlogon_state->expected_error), nt_errstr(nt_status)); - return False; + return false; } else if (NT_STATUS_EQUAL(samlogon_state->expected_error, nt_status) && !NT_STATUS_IS_OK(nt_status)) { - return True; + return true; } else if (!NT_STATUS_IS_OK(nt_status)) { - return False; + return false; } @@ -667,7 +667,7 @@ static BOOL test_lmv2_ntlmv2_broken(struct samlogon_state *samlogon_state, dump_data(1, user_session_key, 16); d_printf("expected:\n"); dump_data(1, lmv2_session_key.data, ntlmv2_session_key.length); - pass = False; + pass = false; } if (memcmp(lmv2_session_key.data, lm_session_key, sizeof(lm_session_key)) != 0) { @@ -676,7 +676,7 @@ static BOOL test_lmv2_ntlmv2_broken(struct samlogon_state *samlogon_state, dump_data(1, lm_session_key, 8); d_printf("expected:\n"); dump_data(1, lmv2_session_key.data, 8); - pass = False; + pass = false; } break; default: @@ -689,7 +689,7 @@ static BOOL test_lmv2_ntlmv2_broken(struct samlogon_state *samlogon_state, dump_data(1, user_session_key, 16); d_printf("expected:\n"); dump_data(1, ntlmv2_session_key.data, ntlmv2_session_key.length); - pass = False; + pass = false; } else { d_printf("USER (NTLMv2) Session Key does not match expectations!\n"); @@ -697,7 +697,7 @@ static BOOL test_lmv2_ntlmv2_broken(struct samlogon_state *samlogon_state, dump_data(1, user_session_key, 16); d_printf("expected:\n"); dump_data(1, ntlmv2_session_key.data, ntlmv2_session_key.length); - pass = False; + pass = false; } } if (memcmp(ntlmv2_session_key.data, lm_session_key, @@ -709,14 +709,14 @@ static BOOL test_lmv2_ntlmv2_broken(struct samlogon_state *samlogon_state, dump_data(1, lm_session_key, 8); d_printf("expected:\n"); dump_data(1, ntlmv2_session_key.data, 8); - pass = False; + pass = false; } else { d_printf("LM (NTLMv2) Session Key does not match expectations!\n"); d_printf("lm_session_key:\n"); dump_data(1, lm_session_key, 8); d_printf("expected:\n"); dump_data(1, ntlmv2_session_key.data, 8); - pass = False; + pass = false; } } } @@ -728,12 +728,12 @@ static BOOL test_lmv2_ntlmv2_broken(struct samlogon_state *samlogon_state, * Test the NTLM and LMv2 responses */ -static BOOL test_lmv2_ntlm_broken(struct samlogon_state *samlogon_state, +static bool test_lmv2_ntlm_broken(struct samlogon_state *samlogon_state, enum ntlm_break break_which, enum ntlmv2_domain ntlmv2_domain, char **error_string) { - BOOL pass = True; + bool pass = true; NTSTATUS nt_status; DATA_BLOB ntlmv2_response = data_blob(NULL, 0); DATA_BLOB lmv2_response = data_blob(NULL, 0); @@ -744,7 +744,7 @@ static BOOL test_lmv2_ntlm_broken(struct samlogon_state *samlogon_state, DATA_BLOB ntlm_response = data_blob_talloc(samlogon_state->mem_ctx, NULL, 24); DATA_BLOB ntlm_session_key = data_blob_talloc(samlogon_state->mem_ctx, NULL, 16); - BOOL lm_good; + bool lm_good; uint8_t lm_hash[16]; uint8_t lm_session_key[8]; uint8_t user_session_key[16]; @@ -774,7 +774,7 @@ static BOOL test_lmv2_ntlm_broken(struct samlogon_state *samlogon_state, &lmv2_response, &ntlmv2_response, &lmv2_session_key, &ntlmv2_session_key)) { data_blob_free(&names_blob); - return False; + return false; } break; case NO_DOMAIN: @@ -786,7 +786,7 @@ static BOOL test_lmv2_ntlm_broken(struct samlogon_state *samlogon_state, &lmv2_response, &ntlmv2_response, &lmv2_session_key, &ntlmv2_session_key)) { data_blob_free(&names_blob); - return False; + return false; } break; } @@ -810,7 +810,7 @@ static BOOL test_lmv2_ntlm_broken(struct samlogon_state *samlogon_state, if (NT_STATUS_EQUAL(NT_STATUS_WRONG_PASSWORD, nt_status)) { /* for 'old' passwords, we allow the server to be OK or wrong password */ if (samlogon_state->old_password) { - return True; + return true; } return ((break_which == BREAK_NT) || (break_which == BREAK_BOTH)); } else if (NT_STATUS_EQUAL(NT_STATUS_NOT_FOUND, nt_status) && strchr_m(samlogon_state->account_name, '@')) { @@ -818,11 +818,11 @@ static BOOL test_lmv2_ntlm_broken(struct samlogon_state *samlogon_state, } else if (!NT_STATUS_EQUAL(samlogon_state->expected_error, nt_status)) { SAFE_FREE(*error_string); asprintf(error_string, "Expected error: %s, got %s", nt_errstr(samlogon_state->expected_error), nt_errstr(nt_status)); - return False; + return false; } else if (NT_STATUS_EQUAL(samlogon_state->expected_error, nt_status) && !NT_STATUS_IS_OK(nt_status)) { - return True; + return true; } else if (!NT_STATUS_IS_OK(nt_status)) { - return False; + return false; } switch (break_which) { @@ -834,7 +834,7 @@ static BOOL test_lmv2_ntlm_broken(struct samlogon_state *samlogon_state, dump_data(1, user_session_key, 16); d_printf("expected:\n"); dump_data(1, lmv2_session_key.data, ntlmv2_session_key.length); - pass = False; + pass = false; } if (memcmp(lmv2_session_key.data, lm_session_key, sizeof(lm_session_key)) != 0) { @@ -843,7 +843,7 @@ static BOOL test_lmv2_ntlm_broken(struct samlogon_state *samlogon_state, dump_data(1, lm_session_key, 8); d_printf("expected:\n"); dump_data(1, lmv2_session_key.data, 8); - pass = False; + pass = false; } break; case BREAK_LM: @@ -854,7 +854,7 @@ static BOOL test_lmv2_ntlm_broken(struct samlogon_state *samlogon_state, dump_data(1, user_session_key, 16); d_printf("expected:\n"); dump_data(1, ntlm_session_key.data, ntlm_session_key.length); - pass = False; + pass = false; } if (lm_good) { if (memcmp(lm_hash, lm_session_key, @@ -864,7 +864,7 @@ static BOOL test_lmv2_ntlm_broken(struct samlogon_state *samlogon_state, dump_data(1, lm_session_key, 8); d_printf("expected:\n"); dump_data(1, lm_hash, 8); - pass = False; + pass = false; } } else { static const uint8_t zeros[8]; @@ -875,7 +875,7 @@ static BOOL test_lmv2_ntlm_broken(struct samlogon_state *samlogon_state, dump_data(1, lm_session_key, 8); d_printf("expected:\n"); dump_data(1, zeros, 8); - pass = False; + pass = false; } } break; @@ -887,7 +887,7 @@ static BOOL test_lmv2_ntlm_broken(struct samlogon_state *samlogon_state, dump_data(1, user_session_key, 16); d_printf("expected:\n"); dump_data(1, ntlm_session_key.data, ntlm_session_key.length); - pass = False; + pass = false; } if (memcmp(ntlm_session_key.data, lm_session_key, sizeof(lm_session_key)) != 0) { @@ -896,7 +896,7 @@ static BOOL test_lmv2_ntlm_broken(struct samlogon_state *samlogon_state, dump_data(1, lm_session_key, 8); d_printf("expected:\n"); dump_data(1, ntlm_session_key.data, 8); - pass = False; + pass = false; } } @@ -907,13 +907,13 @@ static BOOL test_lmv2_ntlm_broken(struct samlogon_state *samlogon_state, * Test the NTLMv2 and LMv2 responses */ -static BOOL test_lmv2_ntlmv2(struct samlogon_state *samlogon_state, char **error_string) +static bool test_lmv2_ntlmv2(struct samlogon_state *samlogon_state, char **error_string) { return test_lmv2_ntlmv2_broken(samlogon_state, BREAK_NONE, UPPER_DOMAIN, error_string); } #if 0 -static BOOL test_lmv2_ntlmv2_no_dom(struct samlogon_state *samlogon_state, char **error_string) +static bool test_lmv2_ntlmv2_no_dom(struct samlogon_state *samlogon_state, char **error_string) { return test_lmv2_ntlmv2_broken(samlogon_state, BREAK_NONE, NO_DOMAIN, error_string); } @@ -923,12 +923,12 @@ static BOOL test_lmv2_ntlmv2_no_dom(struct samlogon_state *samlogon_state, char * Test the LMv2 response only */ -static BOOL test_lmv2(struct samlogon_state *samlogon_state, char **error_string) +static bool test_lmv2(struct samlogon_state *samlogon_state, char **error_string) { return test_lmv2_ntlmv2_broken(samlogon_state, NO_NT, UPPER_DOMAIN, error_string); } -static BOOL test_lmv2_no_dom(struct samlogon_state *samlogon_state, char **error_string) +static bool test_lmv2_no_dom(struct samlogon_state *samlogon_state, char **error_string) { return test_lmv2_ntlmv2_broken(samlogon_state, NO_NT, NO_DOMAIN, error_string); } @@ -937,93 +937,93 @@ static BOOL test_lmv2_no_dom(struct samlogon_state *samlogon_state, char **error * Test the NTLMv2 response only */ -static BOOL test_ntlmv2(struct samlogon_state *samlogon_state, char **error_string) +static bool test_ntlmv2(struct samlogon_state *samlogon_state, char **error_string) { return test_lmv2_ntlmv2_broken(samlogon_state, NO_LM, UPPER_DOMAIN, error_string); } -static BOOL test_ntlmv2_no_dom(struct samlogon_state *samlogon_state, char **error_string) +static bool test_ntlmv2_no_dom(struct samlogon_state *samlogon_state, char **error_string) { return test_lmv2_ntlmv2_broken(samlogon_state, NO_LM, NO_DOMAIN, error_string); } -static BOOL test_lm_ntlm(struct samlogon_state *samlogon_state, char **error_string) +static bool test_lm_ntlm(struct samlogon_state *samlogon_state, char **error_string) { return test_lm_ntlm_broken(samlogon_state, BREAK_NONE, error_string); } -static BOOL test_ntlm_lm_broken(struct samlogon_state *samlogon_state, char **error_string) +static bool test_ntlm_lm_broken(struct samlogon_state *samlogon_state, char **error_string) { return test_lm_ntlm_broken(samlogon_state, BREAK_LM, error_string); } -static BOOL test_ntlm_ntlm_broken(struct samlogon_state *samlogon_state, char **error_string) +static bool test_ntlm_ntlm_broken(struct samlogon_state *samlogon_state, char **error_string) { return test_lm_ntlm_broken(samlogon_state, BREAK_NT, error_string); } -static BOOL test_lm_ntlm_both_broken(struct samlogon_state *samlogon_state, char **error_string) +static bool test_lm_ntlm_both_broken(struct samlogon_state *samlogon_state, char **error_string) { return test_lm_ntlm_broken(samlogon_state, BREAK_BOTH, error_string); } -static BOOL test_ntlmv2_lmv2_broken(struct samlogon_state *samlogon_state, char **error_string) +static bool test_ntlmv2_lmv2_broken(struct samlogon_state *samlogon_state, char **error_string) { return test_lmv2_ntlmv2_broken(samlogon_state, BREAK_LM, UPPER_DOMAIN, error_string); } -static BOOL test_ntlmv2_lmv2_broken_no_dom(struct samlogon_state *samlogon_state, char **error_string) +static bool test_ntlmv2_lmv2_broken_no_dom(struct samlogon_state *samlogon_state, char **error_string) { return test_lmv2_ntlmv2_broken(samlogon_state, BREAK_LM, NO_DOMAIN, error_string); } -static BOOL test_ntlmv2_ntlmv2_broken(struct samlogon_state *samlogon_state, char **error_string) +static bool test_ntlmv2_ntlmv2_broken(struct samlogon_state *samlogon_state, char **error_string) { return test_lmv2_ntlmv2_broken(samlogon_state, BREAK_NT, UPPER_DOMAIN, error_string); } #if 0 -static BOOL test_ntlmv2_ntlmv2_broken_no_dom(struct samlogon_state *samlogon_state, char **error_string) +static bool test_ntlmv2_ntlmv2_broken_no_dom(struct samlogon_state *samlogon_state, char **error_string) { return test_lmv2_ntlmv2_broken(samlogon_state, BREAK_NT, NO_DOMAIN, error_string); } #endif -static BOOL test_ntlmv2_both_broken(struct samlogon_state *samlogon_state, char **error_string) +static bool test_ntlmv2_both_broken(struct samlogon_state *samlogon_state, char **error_string) { return test_lmv2_ntlmv2_broken(samlogon_state, BREAK_BOTH, UPPER_DOMAIN, error_string); } -static BOOL test_ntlmv2_both_broken_no_dom(struct samlogon_state *samlogon_state, char **error_string) +static bool test_ntlmv2_both_broken_no_dom(struct samlogon_state *samlogon_state, char **error_string) { return test_lmv2_ntlmv2_broken(samlogon_state, BREAK_BOTH, NO_DOMAIN, error_string); } -static BOOL test_lmv2_ntlm_both_broken(struct samlogon_state *samlogon_state, char **error_string) +static bool test_lmv2_ntlm_both_broken(struct samlogon_state *samlogon_state, char **error_string) { return test_lmv2_ntlm_broken(samlogon_state, BREAK_BOTH, UPPER_DOMAIN, error_string); } -static BOOL test_lmv2_ntlm_both_broken_no_dom(struct samlogon_state *samlogon_state, char **error_string) +static bool test_lmv2_ntlm_both_broken_no_dom(struct samlogon_state *samlogon_state, char **error_string) { return test_lmv2_ntlm_broken(samlogon_state, BREAK_BOTH, NO_DOMAIN, error_string); } -static BOOL test_lmv2_ntlm_break_ntlm(struct samlogon_state *samlogon_state, char **error_string) +static bool test_lmv2_ntlm_break_ntlm(struct samlogon_state *samlogon_state, char **error_string) { return test_lmv2_ntlm_broken(samlogon_state, BREAK_NT, UPPER_DOMAIN, error_string); } -static BOOL test_lmv2_ntlm_break_ntlm_no_dom(struct samlogon_state *samlogon_state, char **error_string) +static bool test_lmv2_ntlm_break_ntlm_no_dom(struct samlogon_state *samlogon_state, char **error_string) { return test_lmv2_ntlm_broken(samlogon_state, BREAK_NT, NO_DOMAIN, error_string); } -static BOOL test_lmv2_ntlm_break_lm(struct samlogon_state *samlogon_state, char **error_string) +static bool test_lmv2_ntlm_break_lm(struct samlogon_state *samlogon_state, char **error_string) { return test_lmv2_ntlm_broken(samlogon_state, BREAK_LM, UPPER_DOMAIN, error_string); } -static BOOL test_lmv2_ntlm_break_lm_no_dom(struct samlogon_state *samlogon_state, char **error_string) +static bool test_lmv2_ntlm_break_lm_no_dom(struct samlogon_state *samlogon_state, char **error_string) { return test_lmv2_ntlm_broken(samlogon_state, BREAK_LM, NO_DOMAIN, error_string); } @@ -1036,14 +1036,14 @@ static BOOL test_lmv2_ntlm_break_lm_no_dom(struct samlogon_state *samlogon_state * (NETLOGON is the wrong place). */ -static BOOL test_ntlm2(struct samlogon_state *samlogon_state, char **error_string) +static bool test_ntlm2(struct samlogon_state *samlogon_state, char **error_string) { - BOOL pass = True; + bool pass = true; NTSTATUS nt_status; DATA_BLOB lm_response = data_blob_talloc(samlogon_state->mem_ctx, NULL, 24); DATA_BLOB nt_response = data_blob_talloc(samlogon_state->mem_ctx, NULL, 24); - BOOL lm_good; + bool lm_good; uint8_t lm_key[8]; uint8_t nt_hash[16]; uint8_t lm_hash[16]; @@ -1093,17 +1093,17 @@ static BOOL test_ntlm2(struct samlogon_state *samlogon_state, char **error_strin if (NT_STATUS_EQUAL(NT_STATUS_WRONG_PASSWORD, nt_status)) { /* for 'old' passwords, we allow the server to be OK or wrong password */ if (samlogon_state->old_password) { - return True; + return true; } - return False; + return false; } else if (!NT_STATUS_EQUAL(samlogon_state->expected_error, nt_status)) { SAFE_FREE(*error_string); asprintf(error_string, "Expected error: %s, got %s", nt_errstr(samlogon_state->expected_error), nt_errstr(nt_status)); - return False; + return false; } else if (NT_STATUS_EQUAL(samlogon_state->expected_error, nt_status) && !NT_STATUS_IS_OK(nt_status)) { - return True; + return true; } else if (!NT_STATUS_IS_OK(nt_status)) { - return False; + return false; } if (lm_good) { @@ -1114,7 +1114,7 @@ static BOOL test_ntlm2(struct samlogon_state *samlogon_state, char **error_strin dump_data(1, lm_key, 8); d_printf("expected:\n"); dump_data(1, lm_hash, 8); - pass = False; + pass = false; } } else { static const uint8_t zeros[8]; @@ -1125,7 +1125,7 @@ static BOOL test_ntlm2(struct samlogon_state *samlogon_state, char **error_strin dump_data(1, lm_key, 8); d_printf("expected:\n"); dump_data(1, zeros, 8); - pass = False; + pass = false; } } if (memcmp(nt_key, user_session_key, 16) != 0) { @@ -1134,12 +1134,12 @@ static BOOL test_ntlm2(struct samlogon_state *samlogon_state, char **error_strin dump_data(1, user_session_key, sizeof(user_session_key)); d_printf("expected:\n"); dump_data(1, nt_key, sizeof(nt_key)); - pass = False; + pass = false; } return pass; } -static BOOL test_plaintext(struct samlogon_state *samlogon_state, enum ntlm_break break_which, char **error_string) +static bool test_plaintext(struct samlogon_state *samlogon_state, enum ntlm_break break_which, char **error_string) { NTSTATUS nt_status; DATA_BLOB nt_response = data_blob(NULL, 0); @@ -1153,7 +1153,7 @@ static BOOL test_plaintext(struct samlogon_state *samlogon_state, enum ntlm_brea uint8_t lm_hash[16]; static const uint8_t zeros[8]; DATA_BLOB chall = data_blob_talloc(samlogon_state->mem_ctx, zeros, sizeof(zeros)); - BOOL lm_good = E_deshash(samlogon_state->password, lm_hash); + bool lm_good = E_deshash(samlogon_state->password, lm_hash); ZERO_STRUCT(user_session_key); @@ -1190,11 +1190,11 @@ static BOOL test_plaintext(struct samlogon_state *samlogon_state, enum ntlm_brea if (NT_STATUS_EQUAL(NT_STATUS_WRONG_PASSWORD, nt_status)) { /* for 'old' passwords, we allow the server to be OK or wrong password */ if (samlogon_state->old_password) { - return True; + return true; } /* for 'long' passwords, the LM password is invalid */ if (break_which == NO_NT && !lm_good) { - return True; + return true; } return ((break_which == BREAK_NT) || (break_which == BREAK_BOTH)); } else if (NT_STATUS_EQUAL(NT_STATUS_NOT_FOUND, nt_status) && strchr_m(samlogon_state->account_name, '@')) { @@ -1202,42 +1202,42 @@ static BOOL test_plaintext(struct samlogon_state *samlogon_state, enum ntlm_brea } else if (!NT_STATUS_EQUAL(samlogon_state->expected_error, nt_status)) { SAFE_FREE(*error_string); asprintf(error_string, "Expected error: %s, got %s", nt_errstr(samlogon_state->expected_error), nt_errstr(nt_status)); - return False; + return false; } else if (NT_STATUS_EQUAL(samlogon_state->expected_error, nt_status) && !NT_STATUS_IS_OK(nt_status)) { - return True; + return true; } else if (!NT_STATUS_IS_OK(nt_status)) { - return False; + return false; } if (break_which == NO_NT && !lm_good) { *error_string = strdup("LM password is 'long' (> 14 chars and therefore invalid) but login did not fail!"); - return False; + return false; } - return True; + return true; } -static BOOL test_plaintext_none_broken(struct samlogon_state *samlogon_state, +static bool test_plaintext_none_broken(struct samlogon_state *samlogon_state, char **error_string) { return test_plaintext(samlogon_state, BREAK_NONE, error_string); } -static BOOL test_plaintext_lm_broken(struct samlogon_state *samlogon_state, +static bool test_plaintext_lm_broken(struct samlogon_state *samlogon_state, char **error_string) { return test_plaintext(samlogon_state, BREAK_LM, error_string); } -static BOOL test_plaintext_nt_broken(struct samlogon_state *samlogon_state, +static bool test_plaintext_nt_broken(struct samlogon_state *samlogon_state, char **error_string) { return test_plaintext(samlogon_state, BREAK_NT, error_string); } -static BOOL test_plaintext_nt_only(struct samlogon_state *samlogon_state, +static bool test_plaintext_nt_only(struct samlogon_state *samlogon_state, char **error_string) { return test_plaintext(samlogon_state, NO_LM, error_string); } -static BOOL test_plaintext_lm_only(struct samlogon_state *samlogon_state, +static bool test_plaintext_lm_only(struct samlogon_state *samlogon_state, char **error_string) { return test_plaintext(samlogon_state, NO_NT, error_string); } @@ -1261,63 +1261,63 @@ static BOOL test_plaintext_lm_only(struct samlogon_state *samlogon_state, */ static const struct ntlm_tests { - BOOL (*fn)(struct samlogon_state *, char **); + bool (*fn)(struct samlogon_state *, char **); const char *name; - BOOL expect_fail; + bool expect_fail; } test_table[] = { - {test_lmv2_ntlmv2, "NTLMv2 and LMv2", False}, + {test_lmv2_ntlmv2, "NTLMv2 and LMv2", false}, #if 0 - {test_lmv2_ntlmv2_no_dom, "NTLMv2 and LMv2 (no domain)", False}, + {test_lmv2_ntlmv2_no_dom, "NTLMv2 and LMv2 (no domain)", false}, #endif - {test_lm, "LM", False}, - {test_lm_ntlm, "LM and NTLM", False}, - {test_lm_ntlm_both_broken, "LM and NTLM, both broken", False}, - {test_ntlm, "NTLM", False}, - {test_ntlm_in_lm, "NTLM in LM", False}, - {test_ntlm_in_both, "NTLM in both", False}, - {test_ntlmv2, "NTLMv2", False}, - {test_ntlmv2_no_dom, "NTLMv2 (no domain)", False}, - {test_lmv2, "LMv2", False}, - {test_lmv2_no_dom, "LMv2 (no domain)", False}, - {test_ntlmv2_lmv2_broken, "NTLMv2 and LMv2, LMv2 broken", False}, - {test_ntlmv2_lmv2_broken_no_dom, "NTLMv2 and LMv2, LMv2 broken (no domain)", False}, - {test_ntlmv2_ntlmv2_broken, "NTLMv2 and LMv2, NTLMv2 broken", False}, + {test_lm, "LM", false}, + {test_lm_ntlm, "LM and NTLM", false}, + {test_lm_ntlm_both_broken, "LM and NTLM, both broken", false}, + {test_ntlm, "NTLM", false}, + {test_ntlm_in_lm, "NTLM in LM", false}, + {test_ntlm_in_both, "NTLM in both", false}, + {test_ntlmv2, "NTLMv2", false}, + {test_ntlmv2_no_dom, "NTLMv2 (no domain)", false}, + {test_lmv2, "LMv2", false}, + {test_lmv2_no_dom, "LMv2 (no domain)", false}, + {test_ntlmv2_lmv2_broken, "NTLMv2 and LMv2, LMv2 broken", false}, + {test_ntlmv2_lmv2_broken_no_dom, "NTLMv2 and LMv2, LMv2 broken (no domain)", false}, + {test_ntlmv2_ntlmv2_broken, "NTLMv2 and LMv2, NTLMv2 broken", false}, #if 0 - {test_ntlmv2_ntlmv2_broken_no_dom, "NTLMv2 and LMv2, NTLMv2 broken (no domain)", False}, + {test_ntlmv2_ntlmv2_broken_no_dom, "NTLMv2 and LMv2, NTLMv2 broken (no domain)", false}, #endif - {test_ntlmv2_both_broken, "NTLMv2 and LMv2, both broken", False}, - {test_ntlmv2_both_broken_no_dom, "NTLMv2 and LMv2, both broken (no domain)", False}, - {test_ntlm_lm_broken, "NTLM and LM, LM broken", False}, - {test_ntlm_ntlm_broken, "NTLM and LM, NTLM broken", False}, - {test_ntlm2, "NTLM2 (NTLMv2 session security)", False}, - {test_lmv2_ntlm_both_broken, "LMv2 and NTLM, both broken", False}, - {test_lmv2_ntlm_both_broken_no_dom, "LMv2 and NTLM, both broken (no domain)", False}, - {test_lmv2_ntlm_break_ntlm, "LMv2 and NTLM, NTLM broken", False}, - {test_lmv2_ntlm_break_ntlm_no_dom, "LMv2 and NTLM, NTLM broken (no domain)", False}, - {test_lmv2_ntlm_break_lm, "LMv2 and NTLM, LMv2 broken", False}, - {test_lmv2_ntlm_break_lm_no_dom, "LMv2 and NTLM, LMv2 broken (no domain)", False}, - {test_plaintext_none_broken, "Plaintext", False}, - {test_plaintext_lm_broken, "Plaintext LM broken", False}, - {test_plaintext_nt_broken, "Plaintext NT broken", False}, - {test_plaintext_nt_only, "Plaintext NT only", False}, - {test_plaintext_lm_only, "Plaintext LM only", False}, + {test_ntlmv2_both_broken, "NTLMv2 and LMv2, both broken", false}, + {test_ntlmv2_both_broken_no_dom, "NTLMv2 and LMv2, both broken (no domain)", false}, + {test_ntlm_lm_broken, "NTLM and LM, LM broken", false}, + {test_ntlm_ntlm_broken, "NTLM and LM, NTLM broken", false}, + {test_ntlm2, "NTLM2 (NTLMv2 session security)", false}, + {test_lmv2_ntlm_both_broken, "LMv2 and NTLM, both broken", false}, + {test_lmv2_ntlm_both_broken_no_dom, "LMv2 and NTLM, both broken (no domain)", false}, + {test_lmv2_ntlm_break_ntlm, "LMv2 and NTLM, NTLM broken", false}, + {test_lmv2_ntlm_break_ntlm_no_dom, "LMv2 and NTLM, NTLM broken (no domain)", false}, + {test_lmv2_ntlm_break_lm, "LMv2 and NTLM, LMv2 broken", false}, + {test_lmv2_ntlm_break_lm_no_dom, "LMv2 and NTLM, LMv2 broken (no domain)", false}, + {test_plaintext_none_broken, "Plaintext", false}, + {test_plaintext_lm_broken, "Plaintext LM broken", false}, + {test_plaintext_nt_broken, "Plaintext NT broken", false}, + {test_plaintext_nt_only, "Plaintext NT only", false}, + {test_plaintext_lm_only, "Plaintext LM only", false}, {NULL, NULL} }; /* try a netlogon SamLogon */ -static BOOL test_SamLogon(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_SamLogon(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct creds_CredentialState *creds, const char *comment, const char *account_domain, const char *account_name, const char *plain_pass, uint32_t parameter_control, - NTSTATUS expected_error, BOOL old_password, + NTSTATUS expected_error, bool old_password, int n_subtests) { TALLOC_CTX *fn_ctx = talloc_named(mem_ctx, 0, "test_SamLogon function-level context"); int i, v, l, f; - BOOL ret = True; + bool ret = true; int validation_levels[] = {2,3,6}; int logon_levels[] = { 2, 6 }; int function_levels[] = { @@ -1384,7 +1384,7 @@ static BOOL test_SamLogon(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, d_printf(" failed (expected, test incomplete): %s\n", error_string); } else { d_printf(" failed: %s\n", error_string); - ret = False; + ret = false; } SAFE_FREE(error_string); } @@ -1400,7 +1400,7 @@ static BOOL test_SamLogon(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, /* test an ADS style interactive domain logon */ -BOOL test_InteractiveLogon(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +bool test_InteractiveLogon(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct creds_CredentialState *creds, const char *comment, const char *workstation_name, @@ -1456,7 +1456,7 @@ BOOL test_InteractiveLogon(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, || !creds_client_check(creds, &r.out.return_authenticator->cred)) { d_printf("Credential chaining failed\n"); talloc_free(fn_ctx); - return False; + return false; } talloc_free(fn_ctx); @@ -1464,22 +1464,22 @@ BOOL test_InteractiveLogon(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_EQUAL(expected_error, status)) { d_printf("[%s]\\[%s] netr_LogonSamLogonWithFlags - expected %s got %s\n", account_domain, account_name, nt_errstr(expected_error), nt_errstr(status)); - return False; + return false; } - return True; + return true; } -BOOL torture_rpc_samlogon(struct torture_context *torture) +bool torture_rpc_samlogon(struct torture_context *torture) { NTSTATUS status; struct dcerpc_pipe *p; struct dcerpc_binding *b; struct cli_credentials *machine_credentials; TALLOC_CTX *mem_ctx = talloc_init("torture_rpc_netlogon"); - BOOL ret = True; + bool ret = true; struct test_join *join_ctx = NULL; struct test_join *user_ctx = NULL, *user_ctx_wrong_wks = NULL, *user_ctx_wrong_time = NULL; char *user_password, *user_password_wrong_wks, *user_password_wrong_time; @@ -1509,7 +1509,7 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) &machine_credentials); if (!join_ctx) { d_printf("Failed to join as Workstation\n"); - return False; + return false; } userdomain = torture_setting_string(torture, "userdomain", lp_workgroup(global_loadparm)); @@ -1521,14 +1521,14 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) (const char **)&user_password); if (!user_ctx) { d_printf("Failed to create a test user\n"); - return False; + return false; } old_user_password = user_password; test_ChangePasswordUser3(torture_join_samr_pipe(user_ctx), mem_ctx, TEST_USER_NAME, 16 /* > 14 */, &user_password, - NULL, 0, False); + NULL, 0, false); user_ctx_wrong_wks = torture_create_testuser(torture, TEST_USER_NAME_WRONG_WKS, @@ -1537,7 +1537,7 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) (const char **)&user_password_wrong_wks); if (!user_ctx_wrong_wks) { d_printf("Failed to create a test user (wrong workstation test)\n"); - return False; + return false; } ZERO_STRUCT(u); @@ -1551,7 +1551,7 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) status = dcerpc_samr_SetUserInfo(torture_join_samr_pipe(user_ctx_wrong_wks), mem_ctx, &s); if (!NT_STATUS_IS_OK(status)) { printf("SetUserInfo (list of workstations) failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; goto failed; } @@ -1562,7 +1562,7 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) (const char **)&user_password_wrong_time); if (!user_ctx_wrong_time) { d_printf("Failed to create a test user (wrong workstation test)\n"); - return False; + return false; } ZERO_STRUCT(u); @@ -1578,13 +1578,13 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) status = dcerpc_samr_SetUserInfo(torture_join_samr_pipe(user_ctx_wrong_time), mem_ctx, &s); if (!NT_STATUS_IS_OK(status)) { printf("SetUserInfo (logon times and list of workstations) failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; goto failed; } status = torture_rpc_binding(torture, &b); if (!NT_STATUS_IS_OK(status)) { - ret = False; + ret = false; goto failed; } @@ -1600,13 +1600,13 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) if (!NT_STATUS_IS_OK(status)) { d_printf("RPC pipe connect as domain member failed: %s\n", nt_errstr(status)); - ret = False; + ret = false; goto failed; } status = dcerpc_schannel_creds(p->conn->security_state.generic_state, mem_ctx, &creds); if (!NT_STATUS_IS_OK(status)) { - ret = False; + ret = false; goto failed; } @@ -1617,18 +1617,18 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) const char *domain; const char *username; const char *password; - BOOL network_login; + bool network_login; NTSTATUS expected_interactive_error; NTSTATUS expected_network_error; uint32_t parameter_control; - BOOL old_password; /* Allow an old password to be accepted or rejected without error, as well as session key bugs */ + bool old_password; /* Allow an old password to be accepted or rejected without error, as well as session key bugs */ } usercreds[] = { { .comment = "domain\\user", .domain = cli_credentials_get_domain(cmdline_credentials), .username = cli_credentials_get_username(cmdline_credentials), .password = cli_credentials_get_password(cmdline_credentials), - .network_login = True, + .network_login = true, .expected_interactive_error = NT_STATUS_OK, .expected_network_error = NT_STATUS_OK }, @@ -1637,7 +1637,7 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) .domain = cli_credentials_get_realm(cmdline_credentials), .username = cli_credentials_get_username(cmdline_credentials), .password = cli_credentials_get_password(cmdline_credentials), - .network_login = True, + .network_login = true, .expected_interactive_error = NT_STATUS_OK, .expected_network_error = NT_STATUS_OK }, @@ -1650,7 +1650,7 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) cli_credentials_get_domain(cmdline_credentials) ), .password = cli_credentials_get_password(cmdline_credentials), - .network_login = False, /* works for some things, but not NTLMv2. Odd */ + .network_login = false, /* works for some things, but not NTLMv2. Odd */ .expected_interactive_error = NT_STATUS_OK, .expected_network_error = NT_STATUS_OK }, @@ -1663,7 +1663,7 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) cli_credentials_get_realm(cmdline_credentials) ), .password = cli_credentials_get_password(cmdline_credentials), - .network_login = True, + .network_login = true, .expected_interactive_error = NT_STATUS_OK, .expected_network_error = NT_STATUS_OK }, @@ -1672,7 +1672,7 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) .domain = cli_credentials_get_domain(machine_credentials), .username = cli_credentials_get_username(machine_credentials), .password = cli_credentials_get_password(machine_credentials), - .network_login = True, + .network_login = true, .expected_interactive_error = NT_STATUS_NO_SUCH_USER, .parameter_control = MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT }, @@ -1681,7 +1681,7 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) .domain = cli_credentials_get_domain(machine_credentials), .username = cli_credentials_get_username(machine_credentials), .password = cli_credentials_get_password(machine_credentials), - .network_login = True, + .network_login = true, .expected_interactive_error = NT_STATUS_NO_SUCH_USER, .expected_network_error = NT_STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT }, @@ -1690,7 +1690,7 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) .domain = cli_credentials_get_realm(machine_credentials), .username = cli_credentials_get_username(machine_credentials), .password = cli_credentials_get_password(machine_credentials), - .network_login = True, + .network_login = true, .expected_interactive_error = NT_STATUS_NO_SUCH_USER, .parameter_control = MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT }, @@ -1703,7 +1703,7 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) cli_credentials_get_domain(machine_credentials) ), .password = cli_credentials_get_password(machine_credentials), - .network_login = False, /* works for some things, but not NTLMv2. Odd */ + .network_login = false, /* works for some things, but not NTLMv2. Odd */ .expected_interactive_error = NT_STATUS_NO_SUCH_USER, .parameter_control = MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT }, @@ -1716,7 +1716,7 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) cli_credentials_get_realm(machine_credentials) ), .password = cli_credentials_get_password(machine_credentials), - .network_login = True, + .network_login = true, .expected_interactive_error = NT_STATUS_NO_SUCH_USER, .parameter_control = MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT }, @@ -1725,7 +1725,7 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) .domain = userdomain, .username = TEST_USER_NAME, .password = user_password, - .network_login = True, + .network_login = true, .expected_interactive_error = NT_STATUS_OK, .expected_network_error = NT_STATUS_OK }, @@ -1737,7 +1737,7 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) TEST_USER_NAME, lp_realm(global_loadparm)), .password = user_password, - .network_login = True, + .network_login = true, .expected_interactive_error = NT_STATUS_OK, .expected_network_error = NT_STATUS_OK }, @@ -1749,7 +1749,7 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) TEST_USER_NAME, userdomain), .password = user_password, - .network_login = False, /* works for some things, but not NTLMv2. Odd */ + .network_login = false, /* works for some things, but not NTLMv2. Odd */ .expected_interactive_error = NT_STATUS_OK, .expected_network_error = NT_STATUS_OK }, @@ -1759,17 +1759,17 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) .domain = userdomain, .username = TEST_USER_NAME, .password = old_user_password, - .network_login = True, + .network_login = true, .expected_interactive_error = NT_STATUS_WRONG_PASSWORD, .expected_network_error = NT_STATUS_OK, - .old_password = True + .old_password = true }, { .comment = "test user (wong workstation): domain\\user", .domain = userdomain, .username = TEST_USER_NAME_WRONG_WKS, .password = user_password_wrong_wks, - .network_login = True, + .network_login = true, .expected_interactive_error = NT_STATUS_INVALID_WORKSTATION, .expected_network_error = NT_STATUS_INVALID_WORKSTATION } @@ -1786,7 +1786,7 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) usercreds[ci].password, usercreds[ci].parameter_control, usercreds[ci].expected_interactive_error)) { - ret = False; + ret = false; } if (usercreds[ci].network_login) { @@ -1799,7 +1799,7 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) usercreds[ci].expected_network_error, usercreds[ci].old_password, 0)) { - ret = False; + ret = false; } } } @@ -1819,7 +1819,7 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) usercreds[0].password, usercreds[0].parameter_control, usercreds[0].expected_interactive_error)) { - ret = False; + ret = false; } if (usercreds[0].network_login) { @@ -1832,7 +1832,7 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) usercreds[0].expected_network_error, usercreds[0].old_password, 1)) { - ret = False; + ret = false; } } } diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c index af1ff44a43c..ec70c91570e 100644 --- a/source4/torture/rpc/samr.c +++ b/source4/torture/rpc/samr.c @@ -42,16 +42,16 @@ enum torture_samr_choice { TORTURE_SAMR_OTHER }; -static BOOL test_QueryUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_QueryUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle); -static BOOL test_QueryUserInfo2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_QueryUserInfo2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle); -static BOOL test_QueryAliasInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_QueryAliasInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle); -static BOOL test_ChangePassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_ChangePassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, const char *acct_name, struct policy_handle *domain_handle, char **password); @@ -60,7 +60,7 @@ static void init_lsa_String(struct lsa_String *string, const char *s) string->string = s; } -BOOL test_samr_handle_Close(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +bool test_samr_handle_Close(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; @@ -72,13 +72,13 @@ BOOL test_samr_handle_Close(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_Close(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("Close handle failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } -static BOOL test_Shutdown(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_Shutdown(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; @@ -86,7 +86,7 @@ static BOOL test_Shutdown(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!lp_parm_bool(global_loadparm, NULL, "torture", "dangerous", false)) { printf("samr_Shutdown disabled - enable dangerous tests to use\n"); - return True; + return true; } r.in.connect_handle = handle; @@ -96,13 +96,13 @@ static BOOL test_Shutdown(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_Shutdown(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("samr_Shutdown failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } -static BOOL test_SetDsrmPassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_SetDsrmPassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; @@ -112,7 +112,7 @@ static BOOL test_SetDsrmPassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!lp_parm_bool(global_loadparm, NULL, "torture", "dangerous", false)) { printf("samr_SetDsrmPassword disabled - enable dangerous tests to use\n"); - return True; + return true; } E_md4hash("TeSTDSRM123", hash.hash); @@ -128,14 +128,14 @@ static BOOL test_SetDsrmPassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_SetDsrmPassword(p, mem_ctx, &r); if (!NT_STATUS_EQUAL(status, NT_STATUS_NOT_SUPPORTED)) { printf("samr_SetDsrmPassword failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } -static BOOL test_QuerySecurity(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_QuerySecurity(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; @@ -148,11 +148,11 @@ static BOOL test_QuerySecurity(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_QuerySecurity(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("QuerySecurity failed - %s\n", nt_errstr(status)); - return False; + return false; } if (r.out.sdbuf == NULL) { - return False; + return false; } s.in.handle = handle; @@ -161,26 +161,26 @@ static BOOL test_QuerySecurity(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) { printf("skipping SetSecurity test against Samba4\n"); - return True; + return true; } status = dcerpc_samr_SetSecurity(p, mem_ctx, &s); if (!NT_STATUS_IS_OK(status)) { printf("SetSecurity failed - %s\n", nt_errstr(status)); - return False; + return false; } status = dcerpc_samr_QuerySecurity(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("QuerySecurity failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } -static BOOL test_SetUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_SetUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t base_acct_flags, const char *base_account_name) { @@ -190,7 +190,7 @@ static BOOL test_SetUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct samr_QueryUserInfo q; struct samr_QueryUserInfo q0; union samr_UserInfo u; - BOOL ret = True; + bool ret = true; const char *test_account_name; uint32_t user_extra_flags = 0; @@ -214,7 +214,7 @@ static BOOL test_SetUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { \ printf(#call " level %u failed - %s (%s)\n", \ r.in.level, nt_errstr(status), __location__); \ - ret = False; \ + ret = false; \ break; \ } @@ -222,7 +222,7 @@ static BOOL test_SetUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if ((s1 && !s2) || (s2 && !s1) || strcmp(s1, s2)) { \ printf("Failed to set %s to '%s' (%s)\n", \ #field, s2, __location__); \ - ret = False; \ + ret = false; \ break; \ } @@ -230,7 +230,7 @@ static BOOL test_SetUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (i1 != i2) { \ printf("Failed to set %s to 0x%llx - got 0x%llx (%s)\n", \ #field, (unsigned long long)i2, (unsigned long long)i1, __location__); \ - ret = False; \ + ret = false; \ break; \ } @@ -511,13 +511,13 @@ static char *samr_rand_pass_fixed_len(TALLOC_CTX *mem_ctx, int len) return s; } -static BOOL test_SetUserPass(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_SetUserPass(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, char **password) { NTSTATUS status; struct samr_SetUserInfo s; union samr_UserInfo u; - BOOL ret = True; + bool ret = true; DATA_BLOB session_key; char *newpass; struct samr_GetUserPwInfo pwp; @@ -542,7 +542,7 @@ static BOOL test_SetUserPass(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("SetUserInfo level %u - no session key - %s\n", s.in.level, nt_errstr(status)); - return False; + return false; } arcfour_crypt_blob(u.info24.password.data, 516, &session_key); @@ -553,7 +553,7 @@ static BOOL test_SetUserPass(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("SetUserInfo level %u failed - %s\n", s.in.level, nt_errstr(status)); - ret = False; + ret = false; } else { *password = newpass; } @@ -562,14 +562,14 @@ static BOOL test_SetUserPass(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } -static BOOL test_SetUserPass_23(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_SetUserPass_23(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t fields_present, char **password) { NTSTATUS status; struct samr_SetUserInfo s; union samr_UserInfo u; - BOOL ret = True; + bool ret = true; DATA_BLOB session_key; char *newpass; struct samr_GetUserPwInfo pwp; @@ -596,7 +596,7 @@ static BOOL test_SetUserPass_23(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("SetUserInfo level %u - no session key - %s\n", s.in.level, nt_errstr(status)); - return False; + return false; } arcfour_crypt_blob(u.info23.password.data, 516, &session_key); @@ -607,7 +607,7 @@ static BOOL test_SetUserPass_23(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("SetUserInfo level %u failed - %s\n", s.in.level, nt_errstr(status)); - ret = False; + ret = false; } else { *password = newpass; } @@ -618,7 +618,7 @@ static BOOL test_SetUserPass_23(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("SetUserInfo level %u - no session key - %s\n", s.in.level, nt_errstr(status)); - return False; + return false; } /* This should break the key nicely */ @@ -631,21 +631,21 @@ static BOOL test_SetUserPass_23(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_EQUAL(status, NT_STATUS_WRONG_PASSWORD)) { printf("SetUserInfo level %u should have failed with WRONG_PASSWORD- %s\n", s.in.level, nt_errstr(status)); - ret = False; + ret = false; } return ret; } -static BOOL test_SetUserPassEx(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_SetUserPassEx(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, bool makeshort, char **password) { NTSTATUS status; struct samr_SetUserInfo s; union samr_UserInfo u; - BOOL ret = True; + bool ret = true; DATA_BLOB session_key; DATA_BLOB confounded_session_key = data_blob_talloc(mem_ctx, NULL, 16); uint8_t confounder[16]; @@ -676,7 +676,7 @@ static BOOL test_SetUserPassEx(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("SetUserInfo level %u - no session key - %s\n", s.in.level, nt_errstr(status)); - return False; + return false; } generate_random_buffer((uint8_t *)confounder, 16); @@ -695,7 +695,7 @@ static BOOL test_SetUserPassEx(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("SetUserInfo level %u failed - %s\n", s.in.level, nt_errstr(status)); - ret = False; + ret = false; } else { *password = newpass; } @@ -712,7 +712,7 @@ static BOOL test_SetUserPassEx(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_EQUAL(status, NT_STATUS_WRONG_PASSWORD)) { printf("SetUserInfo level %u should have failed with WRONG_PASSWORD: %s\n", s.in.level, nt_errstr(status)); - ret = False; + ret = false; } else { *password = newpass; } @@ -720,14 +720,14 @@ static BOOL test_SetUserPassEx(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, return ret; } -static BOOL test_SetUserPass_25(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_SetUserPass_25(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t fields_present, char **password) { NTSTATUS status; struct samr_SetUserInfo s; union samr_UserInfo u; - BOOL ret = True; + bool ret = true; DATA_BLOB session_key; DATA_BLOB confounded_session_key = data_blob_talloc(mem_ctx, NULL, 16); struct MD5Context ctx; @@ -757,7 +757,7 @@ static BOOL test_SetUserPass_25(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("SetUserInfo level %u - no session key - %s\n", s.in.level, nt_errstr(status)); - return False; + return false; } generate_random_buffer((uint8_t *)confounder, 16); @@ -776,7 +776,7 @@ static BOOL test_SetUserPass_25(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("SetUserInfo level %u failed - %s\n", s.in.level, nt_errstr(status)); - ret = False; + ret = false; } else { *password = newpass; } @@ -793,13 +793,13 @@ static BOOL test_SetUserPass_25(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_EQUAL(status, NT_STATUS_WRONG_PASSWORD)) { printf("SetUserInfo level %u should have failed with WRONG_PASSWORD- %s\n", s.in.level, nt_errstr(status)); - ret = False; + ret = false; } return ret; } -static BOOL test_SetAliasInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_SetAliasInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; @@ -807,7 +807,7 @@ static BOOL test_SetAliasInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct samr_QueryAliasInfo q; uint16_t levels[] = {2, 3}; int i; - BOOL ret = True; + bool ret = true; /* Ignoring switch level 1, as that includes the number of members for the alias * and setting this to a wrong value might have negative consequences @@ -829,7 +829,7 @@ static BOOL test_SetAliasInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("SetAliasInfo level %u failed - %s\n", levels[i], nt_errstr(status)); - ret = False; + ret = false; } q.in.alias_handle = handle; @@ -839,19 +839,19 @@ static BOOL test_SetAliasInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("QueryAliasInfo level %u failed - %s\n", levels[i], nt_errstr(status)); - ret = False; + ret = false; } } return ret; } -static BOOL test_GetGroupsForUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_GetGroupsForUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *user_handle) { struct samr_GetGroupsForUser r; NTSTATUS status; - BOOL ret = True; + bool ret = true; printf("testing GetGroupsForUser\n"); @@ -860,19 +860,19 @@ static BOOL test_GetGroupsForUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_GetGroupsForUser(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("GetGroupsForUser failed - %s\n",nt_errstr(status)); - ret = False; + ret = false; } return ret; } -static BOOL test_GetDomPwInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_GetDomPwInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct lsa_String *domain_name) { NTSTATUS status; struct samr_GetDomPwInfo r; - BOOL ret = True; + bool ret = true; r.in.domain_name = domain_name; printf("Testing GetDomPwInfo with name %s\n", r.in.domain_name->string); @@ -880,7 +880,7 @@ static BOOL test_GetDomPwInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_GetDomPwInfo(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("GetDomPwInfo failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } r.in.domain_name->string = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(p)); @@ -889,7 +889,7 @@ static BOOL test_GetDomPwInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_GetDomPwInfo(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("GetDomPwInfo failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } r.in.domain_name->string = "\\\\__NONAME__"; @@ -898,7 +898,7 @@ static BOOL test_GetDomPwInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_GetDomPwInfo(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("GetDomPwInfo failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } r.in.domain_name->string = "\\\\Builtin"; @@ -907,19 +907,19 @@ static BOOL test_GetDomPwInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_GetDomPwInfo(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("GetDomPwInfo failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } return ret; } -static BOOL test_GetUserPwInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_GetUserPwInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; struct samr_GetUserPwInfo r; - BOOL ret = True; + bool ret = true; printf("Testing GetUserPwInfo\n"); @@ -928,7 +928,7 @@ static BOOL test_GetUserPwInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_GetUserPwInfo(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("GetUserPwInfo failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } return ret; @@ -1024,12 +1024,12 @@ static NTSTATUS test_OpenUser_byname(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } #if 0 -static BOOL test_ChangePasswordNT3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_ChangePasswordNT3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; struct samr_ChangePasswordUser r; - BOOL ret = True; + bool ret = true; struct samr_Password hash1, hash2, hash3, hash4, hash5, hash6; struct policy_handle user_handle; char *oldpass = "test"; @@ -1039,7 +1039,7 @@ static BOOL test_ChangePasswordNT3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = test_OpenUser_byname(p, mem_ctx, handle, "testuser", &user_handle); if (!NT_STATUS_IS_OK(status)) { - return False; + return false; } printf("Testing ChangePasswordUser for user 'testuser'\n"); @@ -1074,30 +1074,30 @@ static BOOL test_ChangePasswordNT3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_ChangePasswordUser(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("ChangePasswordUser failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } if (!test_samr_handle_Close(p, mem_ctx, &user_handle)) { - ret = False; + ret = false; } return ret; } #endif -static BOOL test_ChangePasswordUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_ChangePasswordUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, const char *acct_name, struct policy_handle *handle, char **password) { NTSTATUS status; struct samr_ChangePasswordUser r; - BOOL ret = True; + bool ret = true; struct samr_Password hash1, hash2, hash3, hash4, hash5, hash6; struct policy_handle user_handle; char *oldpass; uint8_t old_nt_hash[16], new_nt_hash[16]; uint8_t old_lm_hash[16], new_lm_hash[16]; - BOOL changed = True; + bool changed = true; char *newpass; struct samr_GetUserPwInfo pwp; @@ -1105,7 +1105,7 @@ static BOOL test_ChangePasswordUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = test_OpenUser_byname(p, mem_ctx, handle, acct_name, &user_handle); if (!NT_STATUS_IS_OK(status)) { - return False; + return false; } pwp.in.user_handle = &user_handle; @@ -1119,7 +1119,7 @@ static BOOL test_ChangePasswordUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!*password) { printf("Failing ChangePasswordUser as old password was NULL. Previous test failed?\n"); - return False; + return false; } oldpass = *password; @@ -1153,7 +1153,7 @@ static BOOL test_ChangePasswordUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_ChangePasswordUser(p, mem_ctx, &r); if (!NT_STATUS_EQUAL(status, NT_STATUS_WRONG_PASSWORD)) { printf("ChangePasswordUser failed: expected NT_STATUS_WRONG_PASSWORD because we broke the LM hash, got %s\n", nt_errstr(status)); - ret = False; + ret = false; } /* Unbreak the LM hash */ @@ -1176,7 +1176,7 @@ static BOOL test_ChangePasswordUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_ChangePasswordUser(p, mem_ctx, &r); if (!NT_STATUS_EQUAL(status, NT_STATUS_WRONG_PASSWORD)) { printf("ChangePasswordUser failed: expected NT_STATUS_WRONG_PASSWORD because we broke the NT hash, got %s\n", nt_errstr(status)); - ret = False; + ret = false; } /* Unbreak the NT hash */ @@ -1199,7 +1199,7 @@ static BOOL test_ChangePasswordUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_ChangePasswordUser(p, mem_ctx, &r); if (!NT_STATUS_EQUAL(status, NT_STATUS_WRONG_PASSWORD)) { printf("ChangePasswordUser failed: expected NT_STATUS_WRONG_PASSWORD because we broke the LM cross-hash, got %s\n", nt_errstr(status)); - ret = False; + ret = false; } /* Unbreak the LM cross */ @@ -1222,7 +1222,7 @@ static BOOL test_ChangePasswordUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_ChangePasswordUser(p, mem_ctx, &r); if (!NT_STATUS_EQUAL(status, NT_STATUS_WRONG_PASSWORD)) { printf("ChangePasswordUser failed: expected NT_STATUS_WRONG_PASSWORD because we broke the NT cross-hash, got %s\n", nt_errstr(status)); - ret = False; + ret = false; } /* Unbreak the NT cross */ @@ -1251,11 +1251,11 @@ static BOOL test_ChangePasswordUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_ChangePasswordUser(p, mem_ctx, &r); if (NT_STATUS_IS_OK(status)) { - changed = True; + changed = true; *password = newpass; } else if (!NT_STATUS_EQUAL(NT_STATUS_PASSWORD_RESTRICTION, status)) { printf("ChangePasswordUser failed: expected NT_STATUS_OK, or at least NT_STATUS_PASSWORD_RESTRICTION, got %s\n", nt_errstr(status)); - ret = False; + ret = false; } oldpass = newpass; @@ -1289,11 +1289,11 @@ static BOOL test_ChangePasswordUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_ChangePasswordUser(p, mem_ctx, &r); if (NT_STATUS_IS_OK(status)) { - changed = True; + changed = true; *password = newpass; } else if (!NT_STATUS_EQUAL(NT_STATUS_PASSWORD_RESTRICTION, status)) { printf("ChangePasswordUser failed: expected NT_STATUS_NT_CROSS_ENCRYPTION_REQUIRED, got %s\n", nt_errstr(status)); - ret = False; + ret = false; } oldpass = newpass; @@ -1330,9 +1330,9 @@ static BOOL test_ChangePasswordUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("ChangePasswordUser returned: %s perhaps min password age? (not fatal)\n", nt_errstr(status)); } else if (!NT_STATUS_IS_OK(status)) { printf("ChangePasswordUser failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } else { - changed = True; + changed = true; *password = newpass; } @@ -1354,26 +1354,26 @@ static BOOL test_ChangePasswordUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("ChangePasswordUser returned: %s perhaps min password age? (not fatal)\n", nt_errstr(status)); } else if (!NT_STATUS_EQUAL(status, NT_STATUS_WRONG_PASSWORD)) { printf("ChangePasswordUser failed: expected NT_STATUS_WRONG_PASSWORD because we already changed the password, got %s\n", nt_errstr(status)); - ret = False; + ret = false; } } if (!test_samr_handle_Close(p, mem_ctx, &user_handle)) { - ret = False; + ret = false; } return ret; } -static BOOL test_OemChangePasswordUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_OemChangePasswordUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, const char *acct_name, struct policy_handle *handle, char **password) { NTSTATUS status; struct samr_OemChangePasswordUser2 r; - BOOL ret = True; + bool ret = true; struct samr_Password lm_verifier; struct samr_CryptPassword lm_pass; struct lsa_AsciiString server, account, account_bad; @@ -1393,7 +1393,7 @@ static BOOL test_OemChangePasswordUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_c if (!*password) { printf("Failing OemChangePasswordUser2 as old password was NULL. Previous test failed?\n"); - return False; + return false; } oldpass = *password; @@ -1429,7 +1429,7 @@ static BOOL test_OemChangePasswordUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_c && !NT_STATUS_EQUAL(status, NT_STATUS_WRONG_PASSWORD)) { printf("ChangePasswordUser3 failed, should have returned WRONG_PASSWORD (or at least 'PASSWORD_RESTRICTON') for invalid password verifier - %s\n", nt_errstr(status)); - ret = False; + ret = false; } encode_pw_buffer(lm_pass.data, newpass, STR_ASCII); @@ -1451,7 +1451,7 @@ static BOOL test_OemChangePasswordUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_c && !NT_STATUS_EQUAL(status, NT_STATUS_WRONG_PASSWORD)) { printf("ChangePasswordUser3 failed, should have returned WRONG_PASSWORD (or at least 'PASSWORD_RESTRICTON') for invalidly encrpted password - %s\n", nt_errstr(status)); - ret = False; + ret = false; } encode_pw_buffer(lm_pass.data, newpass, STR_ASCII); @@ -1468,7 +1468,7 @@ static BOOL test_OemChangePasswordUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_c && !NT_STATUS_EQUAL(status, NT_STATUS_INVALID_PARAMETER)) { printf("ChangePasswordUser3 failed, should have returned INVALID_PARAMETER (or at least 'PASSWORD_RESTRICTON') for no supplied validation hash - %s\n", nt_errstr(status)); - ret = False; + ret = false; } /* This shouldn't be a valid name */ @@ -1480,7 +1480,7 @@ static BOOL test_OemChangePasswordUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_c if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_PARAMETER)) { printf("ChangePasswordUser3 failed, should have returned INVALID_PARAMETER for no supplied validation hash and invalid user - %s\n", nt_errstr(status)); - ret = False; + ret = false; } /* This shouldn't be a valid name */ @@ -1494,7 +1494,7 @@ static BOOL test_OemChangePasswordUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_c if (!NT_STATUS_EQUAL(status, NT_STATUS_WRONG_PASSWORD)) { printf("ChangePasswordUser3 failed, should have returned WRONG_PASSWORD for invalid user - %s\n", nt_errstr(status)); - ret = False; + ret = false; } /* This shouldn't be a valid name */ @@ -1508,7 +1508,7 @@ static BOOL test_OemChangePasswordUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_c if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_PARAMETER)) { printf("ChangePasswordUser3 failed, should have returned INVALID_PARAMETER for no supplied password and invalid user - %s\n", nt_errstr(status)); - ret = False; + ret = false; } E_deshash(oldpass, old_lm_hash); @@ -1528,7 +1528,7 @@ static BOOL test_OemChangePasswordUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_c printf("OemChangePasswordUser2 returned: %s perhaps min password age? (not fatal)\n", nt_errstr(status)); } else if (!NT_STATUS_IS_OK(status)) { printf("OemChangePasswordUser2 failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } else { *password = newpass; } @@ -1537,14 +1537,14 @@ static BOOL test_OemChangePasswordUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_c } -static BOOL test_ChangePasswordUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_ChangePasswordUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, const char *acct_name, char **password, char *newpass, bool allow_password_restriction) { NTSTATUS status; struct samr_ChangePasswordUser2 r; - BOOL ret = True; + bool ret = true; struct lsa_String server, account; struct samr_CryptPassword nt_pass, lm_pass; struct samr_Password nt_verifier, lm_verifier; @@ -1563,7 +1563,7 @@ static BOOL test_ChangePasswordUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!*password) { printf("Failing ChangePasswordUser3 as old password was NULL. Previous test failed?\n"); - return False; + return false; } oldpass = *password; @@ -1607,7 +1607,7 @@ static BOOL test_ChangePasswordUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("ChangePasswordUser2 returned: %s perhaps min password age? (not fatal)\n", nt_errstr(status)); } else if (!NT_STATUS_IS_OK(status)) { printf("ChangePasswordUser2 failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } else { *password = newpass; } @@ -1616,17 +1616,17 @@ static BOOL test_ChangePasswordUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } -BOOL test_ChangePasswordUser3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +bool test_ChangePasswordUser3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, const char *account_string, int policy_min_pw_len, char **password, const char *newpass, NTTIME last_password_change, - BOOL handle_reject_reason) + bool handle_reject_reason) { NTSTATUS status; struct samr_ChangePasswordUser3 r; - BOOL ret = True; + bool ret = true; struct lsa_String server, account, account_bad; struct samr_CryptPassword nt_pass, lm_pass; struct samr_Password nt_verifier, lm_verifier; @@ -1644,14 +1644,14 @@ BOOL test_ChangePasswordUser3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } else { newpass = samr_rand_pass_fixed_len(mem_ctx, policy_min_pw_len); } - } while (check_password_quality(newpass) == False); + } while (check_password_quality(newpass) == false); } else { printf("Using password '%s'\n", newpass); } if (!*password) { printf("Failing ChangePasswordUser3 as old password was NULL. Previous test failed?\n"); - return False; + return false; } oldpass = *password; @@ -1689,7 +1689,7 @@ BOOL test_ChangePasswordUser3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, (!NT_STATUS_EQUAL(status, NT_STATUS_WRONG_PASSWORD))) { printf("ChangePasswordUser3 failed, should have returned WRONG_PASSWORD (or at least 'PASSWORD_RESTRICTON') for invalid password verifier - %s\n", nt_errstr(status)); - ret = False; + ret = false; } encode_pw_buffer(lm_pass.data, newpass, STR_UNICODE); @@ -1718,7 +1718,7 @@ BOOL test_ChangePasswordUser3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, (!NT_STATUS_EQUAL(status, NT_STATUS_WRONG_PASSWORD))) { printf("ChangePasswordUser3 failed, should have returned WRONG_PASSWORD (or at least 'PASSWORD_RESTRICTON') for invalidly encrpted password - %s\n", nt_errstr(status)); - ret = False; + ret = false; } /* This shouldn't be a valid name */ @@ -1729,7 +1729,7 @@ BOOL test_ChangePasswordUser3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_EQUAL(status, NT_STATUS_WRONG_PASSWORD)) { printf("ChangePasswordUser3 failed, should have returned WRONG_PASSWORD for invalid username - %s\n", nt_errstr(status)); - ret = False; + ret = false; } E_md4hash(oldpass, old_nt_hash); @@ -1769,7 +1769,7 @@ BOOL test_ChangePasswordUser3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (r.out.reject && (r.out.reject->reason != SAMR_REJECT_OTHER)) { printf("expected SAMR_REJECT_OTHER (%d), got %d\n", SAMR_REJECT_OTHER, r.out.reject->reason); - return False; + return false; } } @@ -1788,7 +1788,7 @@ BOOL test_ChangePasswordUser3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (r.out.reject->reason != SAMR_REJECT_OTHER) { printf("expected SAMR_REJECT_OTHER (%d), got %d\n", SAMR_REJECT_OTHER, r.out.reject->reason); - return False; + return false; } } else if ((r.out.dominfo->min_password_length > 0) && @@ -1797,7 +1797,7 @@ BOOL test_ChangePasswordUser3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (r.out.reject->reason != SAMR_REJECT_TOO_SHORT) { printf("expected SAMR_REJECT_TOO_SHORT (%d), got %d\n", SAMR_REJECT_TOO_SHORT, r.out.reject->reason); - return False; + return false; } } else if ((r.out.dominfo->password_history_length > 0) && @@ -1806,14 +1806,14 @@ BOOL test_ChangePasswordUser3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (r.out.reject->reason != SAMR_REJECT_IN_HISTORY) { printf("expected SAMR_REJECT_IN_HISTORY (%d), got %d\n", SAMR_REJECT_IN_HISTORY, r.out.reject->reason); - return False; + return false; } } else if (r.out.dominfo->password_properties & DOMAIN_PASSWORD_COMPLEX) { if (r.out.reject->reason != SAMR_REJECT_COMPLEXITY) { printf("expected SAMR_REJECT_COMPLEXITY (%d), got %d\n", SAMR_REJECT_COMPLEXITY, r.out.reject->reason); - return False; + return false; } } @@ -1822,7 +1822,7 @@ BOOL test_ChangePasswordUser3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, /* retry with adjusted size */ return test_ChangePasswordUser3(p, mem_ctx, account_string, r.out.dominfo->min_password_length, - password, NULL, 0, False); + password, NULL, 0, false); } @@ -1830,13 +1830,13 @@ BOOL test_ChangePasswordUser3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (r.out.reject && r.out.reject->reason != SAMR_REJECT_OTHER) { printf("expected SAMR_REJECT_OTHER (%d), got %d\n", SAMR_REJECT_OTHER, r.out.reject->reason); - return False; + return false; } /* Perhaps the server has a 'min password age' set? */ } else if (!NT_STATUS_IS_OK(status)) { printf("ChangePasswordUser3 failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } else { *password = talloc_strdup(mem_ctx, newpass); } @@ -1845,13 +1845,13 @@ BOOL test_ChangePasswordUser3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } -static BOOL test_GetMembersInAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_GetMembersInAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *alias_handle) { struct samr_GetMembersInAlias r; struct lsa_SidArray sids; NTSTATUS status; - BOOL ret = True; + bool ret = true; printf("Testing GetMembersInAlias\n"); @@ -1862,20 +1862,20 @@ static BOOL test_GetMembersInAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("GetMembersInAlias failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } return ret; } -static BOOL test_AddMemberToAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_AddMemberToAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *alias_handle, const struct dom_sid *domain_sid) { struct samr_AddAliasMember r; struct samr_DeleteAliasMember d; NTSTATUS status; - BOOL ret = True; + bool ret = true; struct dom_sid *sid; sid = dom_sid_add_rid(mem_ctx, domain_sid, 512); @@ -1887,7 +1887,7 @@ static BOOL test_AddMemberToAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_AddAliasMember(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("AddAliasMember failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } d.in.alias_handle = alias_handle; @@ -1896,19 +1896,19 @@ static BOOL test_AddMemberToAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_DeleteAliasMember(p, mem_ctx, &d); if (!NT_STATUS_IS_OK(status)) { printf("DelAliasMember failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } return ret; } -static BOOL test_AddMultipleMembersToAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_AddMultipleMembersToAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *alias_handle) { struct samr_AddMultipleMembersToAlias a; struct samr_RemoveMultipleMembersFromAlias r; NTSTATUS status; - BOOL ret = True; + bool ret = true; struct lsa_SidArray sids; printf("testing AddMultipleMembersToAlias\n"); @@ -1925,7 +1925,7 @@ static BOOL test_AddMultipleMembersToAlias(struct dcerpc_pipe *p, TALLOC_CTX *me status = dcerpc_samr_AddMultipleMembersToAlias(p, mem_ctx, &a); if (!NT_STATUS_IS_OK(status)) { printf("AddMultipleMembersToAlias failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } @@ -1936,14 +1936,14 @@ static BOOL test_AddMultipleMembersToAlias(struct dcerpc_pipe *p, TALLOC_CTX *me status = dcerpc_samr_RemoveMultipleMembersFromAlias(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("RemoveMultipleMembersFromAlias failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } /* strange! removing twice doesn't give any error */ status = dcerpc_samr_RemoveMultipleMembersFromAlias(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("RemoveMultipleMembersFromAlias failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } /* but removing an alias that isn't there does */ @@ -1952,18 +1952,18 @@ static BOOL test_AddMultipleMembersToAlias(struct dcerpc_pipe *p, TALLOC_CTX *me status = dcerpc_samr_RemoveMultipleMembersFromAlias(p, mem_ctx, &r); if (!NT_STATUS_EQUAL(NT_STATUS_OBJECT_NAME_NOT_FOUND, status)) { printf("RemoveMultipleMembersFromAlias failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } return ret; } -static BOOL test_TestPrivateFunctionsUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_TestPrivateFunctionsUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *user_handle) { struct samr_TestPrivateFunctionsUser r; NTSTATUS status; - BOOL ret = True; + bool ret = true; printf("Testing TestPrivateFunctionsUser\n"); @@ -1972,14 +1972,14 @@ static BOOL test_TestPrivateFunctionsUser(struct dcerpc_pipe *p, TALLOC_CTX *mem status = dcerpc_samr_TestPrivateFunctionsUser(p, mem_ctx, &r); if (!NT_STATUS_EQUAL(NT_STATUS_NOT_IMPLEMENTED, status)) { printf("TestPrivateFunctionsUser failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } return ret; } -static BOOL test_user_ops(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_user_ops(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *user_handle, struct policy_handle *domain_handle, uint32_t base_acct_flags, @@ -1988,7 +1988,7 @@ static BOOL test_user_ops(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, TALLOC_CTX *user_ctx; char *password = NULL; - BOOL ret = True; + bool ret = true; int i; const uint32_t password_fields[] = { SAMR_FIELD_PASSWORD, @@ -2001,32 +2001,32 @@ static BOOL test_user_ops(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, switch (which_ops) { case TORTURE_SAMR_USER_ATTRIBUTES: if (!test_QuerySecurity(p, user_ctx, user_handle)) { - ret = False; + ret = false; } if (!test_QueryUserInfo(p, user_ctx, user_handle)) { - ret = False; + ret = false; } if (!test_QueryUserInfo2(p, user_ctx, user_handle)) { - ret = False; + ret = false; } if (!test_SetUserInfo(p, user_ctx, user_handle, base_acct_flags, base_acct_name)) { - ret = False; + ret = false; } if (!test_GetUserPwInfo(p, user_ctx, user_handle)) { - ret = False; + ret = false; } if (!test_TestPrivateFunctionsUser(p, user_ctx, user_handle)) { - ret = False; + ret = false; } if (!test_SetUserPass(p, user_ctx, user_handle, &password)) { - ret = False; + ret = false; } break; case TORTURE_SAMR_PASSWORDS: @@ -2041,53 +2041,53 @@ static BOOL test_user_ops(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, /* Workstation trust accounts don't seem to need to honour password quality policy */ if (!test_SetUserPassEx(p, user_ctx, user_handle, true, &password)) { - ret = False; + ret = false; } - if (!test_ChangePasswordUser2(p, user_ctx, base_acct_name, &password, simple_pass, False)) { - ret = False; + if (!test_ChangePasswordUser2(p, user_ctx, base_acct_name, &password, simple_pass, false)) { + ret = false; } /* reset again, to allow another 'user' password change */ if (!test_SetUserPassEx(p, user_ctx, user_handle, true, &password)) { - ret = False; + ret = false; } /* Try a 'short' password */ - if (!test_ChangePasswordUser2(p, user_ctx, base_acct_name, &password, samr_rand_pass(mem_ctx, 4), False)) { - ret = False; + if (!test_ChangePasswordUser2(p, user_ctx, base_acct_name, &password, samr_rand_pass(mem_ctx, 4), false)) { + ret = false; } } for (i = 0; password_fields[i]; i++) { if (!test_SetUserPass_23(p, user_ctx, user_handle, password_fields[i], &password)) { - ret = False; + ret = false; } /* check it was set right */ - if (!test_ChangePasswordUser3(p, user_ctx, base_acct_name, 0, &password, NULL, 0, False)) { - ret = False; + if (!test_ChangePasswordUser3(p, user_ctx, base_acct_name, 0, &password, NULL, 0, false)) { + ret = false; } } for (i = 0; password_fields[i]; i++) { if (!test_SetUserPass_25(p, user_ctx, user_handle, password_fields[i], &password)) { - ret = False; + ret = false; } /* check it was set right */ - if (!test_ChangePasswordUser3(p, user_ctx, base_acct_name, 0, &password, NULL, 0, False)) { - ret = False; + if (!test_ChangePasswordUser3(p, user_ctx, base_acct_name, 0, &password, NULL, 0, false)) { + ret = false; } } if (!test_SetUserPassEx(p, user_ctx, user_handle, false, &password)) { - ret = False; + ret = false; } if (!test_ChangePassword(p, user_ctx, base_acct_name, domain_handle, &password)) { - ret = False; + ret = false; } break; @@ -2099,26 +2099,26 @@ static BOOL test_user_ops(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, return ret; } -static BOOL test_alias_ops(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_alias_ops(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *alias_handle, const struct dom_sid *domain_sid) { - BOOL ret = True; + bool ret = true; if (!test_QuerySecurity(p, mem_ctx, alias_handle)) { - ret = False; + ret = false; } if (!test_QueryAliasInfo(p, mem_ctx, alias_handle)) { - ret = False; + ret = false; } if (!test_SetAliasInfo(p, mem_ctx, alias_handle)) { - ret = False; + ret = false; } if (!test_AddMemberToAlias(p, mem_ctx, alias_handle, domain_sid)) { - ret = False; + ret = false; } if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) { @@ -2127,19 +2127,19 @@ static BOOL test_alias_ops(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } if (!test_AddMultipleMembersToAlias(p, mem_ctx, alias_handle)) { - ret = False; + ret = false; } return ret; } -static BOOL test_DeleteUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_DeleteUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *user_handle) { struct samr_DeleteUser d; NTSTATUS status; - BOOL ret = True; + bool ret = true; printf("Testing DeleteUser\n"); d.in.user_handle = user_handle; @@ -2148,13 +2148,13 @@ static BOOL test_DeleteUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_DeleteUser(p, mem_ctx, &d); if (!NT_STATUS_IS_OK(status)) { printf("DeleteUser failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } return ret; } -BOOL test_DeleteUser_byname(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +bool test_DeleteUser_byname(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, const char *name) { NTSTATUS status; @@ -2179,15 +2179,15 @@ BOOL test_DeleteUser_byname(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, goto failed; } - return True; + return true; failed: printf("DeleteUser_byname(%s) failed - %s\n", name, nt_errstr(status)); - return False; + return false; } -static BOOL test_DeleteGroup_byname(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_DeleteGroup_byname(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, const char *name) { NTSTATUS status; @@ -2217,15 +2217,15 @@ static BOOL test_DeleteGroup_byname(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, goto failed; } - return True; + return true; failed: printf("DeleteGroup_byname(%s) failed - %s\n", name, nt_errstr(status)); - return False; + return false; } -static BOOL test_DeleteAlias_byname(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_DeleteAlias_byname(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *domain_handle, const char *name) { NTSTATUS status; @@ -2257,19 +2257,19 @@ static BOOL test_DeleteAlias_byname(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, goto failed; } - return True; + return true; failed: printf("DeleteAlias_byname(%s) failed - %s\n", name, nt_errstr(status)); - return False; + return false; } -static BOOL test_DeleteAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_DeleteAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *alias_handle) { struct samr_DeleteDomAlias d; NTSTATUS status; - BOOL ret = True; + bool ret = true; printf("Testing DeleteAlias\n"); d.in.alias_handle = alias_handle; @@ -2278,13 +2278,13 @@ static BOOL test_DeleteAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_DeleteDomAlias(p, mem_ctx, &d); if (!NT_STATUS_IS_OK(status)) { printf("DeleteAlias failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } return ret; } -static BOOL test_CreateAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_CreateAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *domain_handle, struct policy_handle *alias_handle, const struct dom_sid *domain_sid) @@ -2293,7 +2293,7 @@ static BOOL test_CreateAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct samr_CreateDomAlias r; struct lsa_String name; uint32_t rid; - BOOL ret = True; + bool ret = true; init_lsa_String(&name, TEST_ALIASNAME); r.in.domain_handle = domain_handle; @@ -2308,53 +2308,53 @@ static BOOL test_CreateAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED)) { printf("Server refused create of '%s'\n", r.in.alias_name->string); - return True; + return true; } if (NT_STATUS_EQUAL(status, NT_STATUS_ALIAS_EXISTS)) { if (!test_DeleteAlias_byname(p, mem_ctx, domain_handle, r.in.alias_name->string)) { - return False; + return false; } status = dcerpc_samr_CreateDomAlias(p, mem_ctx, &r); } if (!NT_STATUS_IS_OK(status)) { printf("CreateAlias failed - %s\n", nt_errstr(status)); - return False; + return false; } if (!test_alias_ops(p, mem_ctx, alias_handle, domain_sid)) { - ret = False; + ret = false; } return ret; } -static BOOL test_ChangePassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_ChangePassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, const char *acct_name, struct policy_handle *domain_handle, char **password) { - BOOL ret = True; + bool ret = true; if (!*password) { - return False; + return false; } if (!test_ChangePasswordUser(p, mem_ctx, acct_name, domain_handle, password)) { - ret = False; + ret = false; } - if (!test_ChangePasswordUser2(p, mem_ctx, acct_name, password, 0, True)) { - ret = False; + if (!test_ChangePasswordUser2(p, mem_ctx, acct_name, password, 0, true)) { + ret = false; } if (!test_OemChangePasswordUser2(p, mem_ctx, acct_name, domain_handle, password)) { - ret = False; + ret = false; } /* test what happens when setting the old password again */ - if (!test_ChangePasswordUser3(p, mem_ctx, acct_name, 0, password, *password, 0, True)) { - ret = False; + if (!test_ChangePasswordUser3(p, mem_ctx, acct_name, 0, password, *password, 0, true)) { + ret = false; } { @@ -2365,8 +2365,8 @@ static BOOL test_ChangePassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, memset(simple_pass, *v, sizeof(simple_pass) - 1); /* test what happens when picking a simple password */ - if (!test_ChangePasswordUser3(p, mem_ctx, acct_name, 0, password, simple_pass, 0, True)) { - ret = False; + if (!test_ChangePasswordUser3(p, mem_ctx, acct_name, 0, password, simple_pass, 0, true)) { + ret = false; } } @@ -2387,7 +2387,7 @@ static BOOL test_ChangePassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("testing samr_QueryDomainInfo level 1\n"); status = dcerpc_samr_QueryDomainInfo(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { - return False; + return false; } s.in.domain_handle = domain_handle; @@ -2407,13 +2407,13 @@ static BOOL test_ChangePassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("testing samr_SetDomainInfo level 1\n"); status = dcerpc_samr_SetDomainInfo(p, mem_ctx, &s); if (!NT_STATUS_IS_OK(status)) { - return False; + return false; } printf("calling test_ChangePasswordUser3 with too short password\n"); - if (!test_ChangePasswordUser3(p, mem_ctx, acct_name, len - 1, password, NULL, 0, True)) { - ret = False; + if (!test_ChangePasswordUser3(p, mem_ctx, acct_name, len - 1, password, NULL, 0, true)) { + ret = false; } s.in.info->info1.min_password_length = len_old; @@ -2423,7 +2423,7 @@ static BOOL test_ChangePassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("testing samr_SetDomainInfo level 1\n"); status = dcerpc_samr_SetDomainInfo(p, mem_ctx, &s); if (!NT_STATUS_IS_OK(status)) { - return False; + return false; } } @@ -2443,7 +2443,7 @@ static BOOL test_ChangePassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_LookupNames(p, mem_ctx, &n); if (!NT_STATUS_IS_OK(status)) { printf("LookupNames failed - %s\n", nt_errstr(status)); - return False; + return false; } r.in.domain_handle = domain_handle; @@ -2454,7 +2454,7 @@ static BOOL test_ChangePassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_OpenUser(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("OpenUser(%u) failed - %s\n", n.out.rids.ids[0], nt_errstr(status)); - return False; + return false; } q.in.user_handle = &user_handle; @@ -2463,31 +2463,31 @@ static BOOL test_ChangePassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_QueryUserInfo(p, mem_ctx, &q); if (!NT_STATUS_IS_OK(status)) { printf("QueryUserInfo failed - %s\n", nt_errstr(status)); - return False; + return false; } printf("calling test_ChangePasswordUser3 with too early password change\n"); if (!test_ChangePasswordUser3(p, mem_ctx, acct_name, 0, password, NULL, - q.out.info->info5.last_password_change, True)) { - ret = False; + q.out.info->info5.last_password_change, true)) { + ret = false; } } /* we change passwords twice - this has the effect of verifying they were changed correctly for the final call */ - if (!test_ChangePasswordUser3(p, mem_ctx, acct_name, 0, password, NULL, 0, True)) { - ret = False; + if (!test_ChangePasswordUser3(p, mem_ctx, acct_name, 0, password, NULL, 0, true)) { + ret = false; } - if (!test_ChangePasswordUser3(p, mem_ctx, acct_name, 0, password, NULL, 0, True)) { - ret = False; + if (!test_ChangePasswordUser3(p, mem_ctx, acct_name, 0, password, NULL, 0, true)) { + ret = false; } return ret; } -static BOOL test_CreateUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_CreateUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *domain_handle, struct policy_handle *user_handle_out, enum torture_samr_choice which_ops) @@ -2504,7 +2504,7 @@ static BOOL test_CreateUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, /* This call creates a 'normal' account - check that it really does */ const uint32_t acct_flags = ACB_NORMAL; struct lsa_String name; - BOOL ret = True; + bool ret = true; struct policy_handle user_handle; user_ctx = talloc_named(mem_ctx, 0, "test_CreateUser2 per-user context"); @@ -2523,20 +2523,20 @@ static BOOL test_CreateUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED)) { printf("Server refused create of '%s': %s\n", r.in.account_name->string, nt_errstr(status)); talloc_free(user_ctx); - return True; + return true; } if (NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) { if (!test_DeleteUser_byname(p, user_ctx, domain_handle, r.in.account_name->string)) { talloc_free(user_ctx); - return False; + return false; } status = dcerpc_samr_CreateUser(p, user_ctx, &r); } if (!NT_STATUS_IS_OK(status)) { talloc_free(user_ctx); printf("CreateUser failed - %s\n", nt_errstr(status)); - return False; + return false; } else { q.in.user_handle = &user_handle; q.in.level = 16; @@ -2545,19 +2545,19 @@ static BOOL test_CreateUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("QueryUserInfo level %u failed - %s\n", q.in.level, nt_errstr(status)); - ret = False; + ret = false; } else { if ((q.out.info->info16.acct_flags & acct_flags) != acct_flags) { printf("QuerUserInfo level 16 failed, it returned 0x%08x when we expected flags of 0x%08x\n", q.out.info->info16.acct_flags, acct_flags); - ret = False; + ret = false; } } if (!test_user_ops(p, user_ctx, &user_handle, domain_handle, acct_flags, name.string, which_ops)) { - ret = False; + ret = false; } if (user_handle_out) { @@ -2571,7 +2571,7 @@ static BOOL test_CreateUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_DeleteUser(p, user_ctx, &d); if (!NT_STATUS_IS_OK(status)) { printf("DeleteUser failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } } @@ -2583,7 +2583,7 @@ static BOOL test_CreateUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } -static BOOL test_CreateUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_CreateUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *domain_handle, enum torture_samr_choice which_ops) { NTSTATUS status; @@ -2593,7 +2593,7 @@ static BOOL test_CreateUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle user_handle; uint32_t rid; struct lsa_String name; - BOOL ret = True; + bool ret = true; int i; struct { @@ -2645,7 +2645,7 @@ static BOOL test_CreateUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } else if (NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) { if (!test_DeleteUser_byname(p, user_ctx, domain_handle, r.in.account_name->string)) { talloc_free(user_ctx); - ret = False; + ret = false; continue; } status = dcerpc_samr_CreateUser2(p, user_ctx, &r); @@ -2654,7 +2654,7 @@ static BOOL test_CreateUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_EQUAL(status, account_types[i].nt_status)) { printf("CreateUser2 failed gave incorrect error return - %s (should be %s)\n", nt_errstr(status), nt_errstr(account_types[i].nt_status)); - ret = False; + ret = false; } if (NT_STATUS_IS_OK(status)) { @@ -2665,34 +2665,34 @@ static BOOL test_CreateUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("QueryUserInfo level %u failed - %s\n", q.in.level, nt_errstr(status)); - ret = False; + ret = false; } else { if ((q.out.info->info5.acct_flags & acct_flags) != acct_flags) { printf("QuerUserInfo level 5 failed, it returned 0x%08x when we expected flags of 0x%08x\n", q.out.info->info5.acct_flags, acct_flags); - ret = False; + ret = false; } switch (acct_flags) { case ACB_SVRTRUST: if (q.out.info->info5.primary_gid != DOMAIN_RID_DCS) { printf("QuerUserInfo level 5: DC should have had Primary Group %d, got %d\n", DOMAIN_RID_DCS, q.out.info->info5.primary_gid); - ret = False; + ret = false; } break; case ACB_WSTRUST: if (q.out.info->info5.primary_gid != DOMAIN_RID_DOMAIN_MEMBERS) { printf("QuerUserInfo level 5: Domain Member should have had Primary Group %d, got %d\n", DOMAIN_RID_DOMAIN_MEMBERS, q.out.info->info5.primary_gid); - ret = False; + ret = false; } break; case ACB_NORMAL: if (q.out.info->info5.primary_gid != DOMAIN_RID_USERS) { printf("QuerUserInfo level 5: Users should have had Primary Group %d, got %d\n", DOMAIN_RID_USERS, q.out.info->info5.primary_gid); - ret = False; + ret = false; } break; } @@ -2700,7 +2700,7 @@ static BOOL test_CreateUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!test_user_ops(p, user_ctx, &user_handle, domain_handle, acct_flags, name.string, which_ops)) { - ret = False; + ret = false; } printf("Testing DeleteUser (createuser2 test)\n"); @@ -2711,7 +2711,7 @@ static BOOL test_CreateUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_DeleteUser(p, user_ctx, &d); if (!NT_STATUS_IS_OK(status)) { printf("DeleteUser failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } } talloc_free(user_ctx); @@ -2720,14 +2720,14 @@ static BOOL test_CreateUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, return ret; } -static BOOL test_QueryAliasInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_QueryAliasInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; struct samr_QueryAliasInfo r; uint16_t levels[] = {1, 2, 3}; int i; - BOOL ret = True; + bool ret = true; for (i=0;iinfo16.acct_flags) == 0) { printf("Server failed to filter for 0x%x, allowed 0x%x (%d) on EnumDomainUsers\n", acct_flag_mask, q.out.info->info16.acct_flags, rid); - ret = False; + ret = false; } } if (!test_samr_handle_Close(p, mem_ctx, &user_handle)) { - ret = False; + ret = false; } return ret; } -static BOOL test_EnumDomainUsers(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_EnumDomainUsers(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status = STATUS_MORE_ENTRIES; struct samr_EnumDomainUsers r; uint32_t mask, resume_handle=0; int i, mask_idx; - BOOL ret = True; + bool ret = true; struct samr_LookupNames n; struct samr_LookupRids lr ; uint32_t masks[] = {ACB_NORMAL, ACB_DOMTRUST, ACB_WSTRUST, @@ -3114,12 +3114,12 @@ static BOOL test_EnumDomainUsers(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES) && !NT_STATUS_IS_OK(status)) { printf("EnumDomainUsers failed - %s\n", nt_errstr(status)); - return False; + return false; } if (!r.out.sam) { printf("EnumDomainUsers failed: r.out.sam unexpectedly NULL\n"); - return False; + return false; } if (r.out.sam->count == 0) { @@ -3129,10 +3129,10 @@ static BOOL test_EnumDomainUsers(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, for (i=0;icount;i++) { if (mask) { if (!check_mask(p, mem_ctx, handle, r.out.sam->entries[i].idx, mask)) { - ret = False; + ret = false; } } else if (!test_OpenUser(p, mem_ctx, handle, r.out.sam->entries[i].idx)) { - ret = False; + ret = false; } } } @@ -3147,7 +3147,7 @@ static BOOL test_EnumDomainUsers(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_LookupNames(p, mem_ctx, &n); if (!NT_STATUS_IS_OK(status)) { printf("LookupNames failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } @@ -3161,7 +3161,7 @@ static BOOL test_EnumDomainUsers(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_LookupRids(p, mem_ctx, &lr); if (!NT_STATUS_IS_OK(status)) { printf("LookupRids failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } return ret; @@ -3170,7 +3170,7 @@ static BOOL test_EnumDomainUsers(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, /* try blasting the server with a bunch of sync requests */ -static BOOL test_EnumDomainUsers_async(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_EnumDomainUsers_async(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; @@ -3182,7 +3182,7 @@ static BOOL test_EnumDomainUsers_async(struct dcerpc_pipe *p, TALLOC_CTX *mem_ct if (!lp_parm_bool(global_loadparm, NULL, "torture", "dangerous", false)) { printf("samr async test disabled - enable dangerous tests to use\n"); - return True; + return true; } printf("Testing EnumDomainUsers_async\n"); @@ -3202,23 +3202,23 @@ static BOOL test_EnumDomainUsers_async(struct dcerpc_pipe *p, TALLOC_CTX *mem_ct if (!NT_STATUS_IS_OK(status)) { printf("EnumDomainUsers[%d] failed - %s\n", i, nt_errstr(status)); - return False; + return false; } } printf("%d async requests OK\n", i); - return True; + return true; } -static BOOL test_EnumDomainGroups(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_EnumDomainGroups(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; struct samr_EnumDomainGroups r; uint32_t resume_handle=0; int i; - BOOL ret = True; + bool ret = true; printf("Testing EnumDomainGroups\n"); @@ -3230,30 +3230,30 @@ static BOOL test_EnumDomainGroups(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_EnumDomainGroups(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("EnumDomainGroups failed - %s\n", nt_errstr(status)); - return False; + return false; } if (!r.out.sam) { - return False; + return false; } for (i=0;icount;i++) { if (!test_OpenGroup(p, mem_ctx, handle, r.out.sam->entries[i].idx)) { - ret = False; + ret = false; } } return ret; } -static BOOL test_EnumDomainAliases(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_EnumDomainAliases(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; struct samr_EnumDomainAliases r; uint32_t resume_handle=0; int i; - BOOL ret = True; + bool ret = true; printf("Testing EnumDomainAliases\n"); @@ -3265,28 +3265,28 @@ static BOOL test_EnumDomainAliases(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_EnumDomainAliases(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("EnumDomainAliases failed - %s\n", nt_errstr(status)); - return False; + return false; } if (!r.out.sam) { - return False; + return false; } for (i=0;icount;i++) { if (!test_OpenAlias(p, mem_ctx, handle, r.out.sam->entries[i].idx)) { - ret = False; + ret = false; } } return ret; } -static BOOL test_GetDisplayEnumerationIndex(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_GetDisplayEnumerationIndex(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; struct samr_GetDisplayEnumerationIndex r; - BOOL ret = True; + bool ret = true; uint16_t levels[] = {1, 2, 3, 4, 5}; uint16_t ok_lvl[] = {1, 1, 1, 0, 0}; int i; @@ -3305,7 +3305,7 @@ static BOOL test_GetDisplayEnumerationIndex(struct dcerpc_pipe *p, TALLOC_CTX *m !NT_STATUS_EQUAL(NT_STATUS_NO_MORE_ENTRIES, status)) { printf("GetDisplayEnumerationIndex level %u failed - %s\n", levels[i], nt_errstr(status)); - ret = False; + ret = false; } init_lsa_String(&r.in.name, "zzzzzzzz"); @@ -3315,19 +3315,19 @@ static BOOL test_GetDisplayEnumerationIndex(struct dcerpc_pipe *p, TALLOC_CTX *m if (ok_lvl[i] && !NT_STATUS_EQUAL(NT_STATUS_NO_MORE_ENTRIES, status)) { printf("GetDisplayEnumerationIndex level %u failed - %s\n", levels[i], nt_errstr(status)); - ret = False; + ret = false; } } return ret; } -static BOOL test_GetDisplayEnumerationIndex2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_GetDisplayEnumerationIndex2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; struct samr_GetDisplayEnumerationIndex2 r; - BOOL ret = True; + bool ret = true; uint16_t levels[] = {1, 2, 3, 4, 5}; uint16_t ok_lvl[] = {1, 1, 1, 0, 0}; int i; @@ -3345,7 +3345,7 @@ static BOOL test_GetDisplayEnumerationIndex2(struct dcerpc_pipe *p, TALLOC_CTX * !NT_STATUS_EQUAL(NT_STATUS_NO_MORE_ENTRIES, status)) { printf("GetDisplayEnumerationIndex2 level %u failed - %s\n", levels[i], nt_errstr(status)); - ret = False; + ret = false; } init_lsa_String(&r.in.name, "zzzzzzzz"); @@ -3354,7 +3354,7 @@ static BOOL test_GetDisplayEnumerationIndex2(struct dcerpc_pipe *p, TALLOC_CTX * if (ok_lvl[i] && !NT_STATUS_EQUAL(NT_STATUS_NO_MORE_ENTRIES, status)) { printf("GetDisplayEnumerationIndex2 level %u failed - %s\n", levels[i], nt_errstr(status)); - ret = False; + ret = false; } } @@ -3367,23 +3367,23 @@ static BOOL test_GetDisplayEnumerationIndex2(struct dcerpc_pipe *p, TALLOC_CTX * } else if ((s1.string && !s2.string) || (s2.string && !s1.string) || strcmp(s1.string, s2.string)) { \ printf("%s mismatch for %s: %s != %s (%s)\n", \ #s1, user.string, s1.string, s2.string, __location__); \ - ret = False; \ + ret = false; \ } #define INT_EQUAL_QUERY(s1, s2, user) \ if (s1 != s2) { \ printf("%s mismatch for %s: 0x%llx != 0x%llx (%s)\n", \ #s1, user.string, (unsigned long long)s1, (unsigned long long)s2, __location__); \ - ret = False; \ + ret = false; \ } -static BOOL test_each_DisplayInfo_user(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_each_DisplayInfo_user(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct samr_QueryDisplayInfo *querydisplayinfo, bool *seen_testuser) { struct samr_OpenUser r; struct samr_QueryUserInfo q; struct policy_handle user_handle; - int i, ret = True; + int i, ret = true; NTSTATUS status; r.in.domain_handle = querydisplayinfo->in.domain_handle; r.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED; @@ -3417,7 +3417,7 @@ static BOOL test_each_DisplayInfo_user(struct dcerpc_pipe *p, TALLOC_CTX *mem_ct status = dcerpc_samr_OpenUser(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("OpenUser(%u) failed - %s\n", r.in.rid, nt_errstr(status)); - return False; + return false; } } @@ -3426,7 +3426,7 @@ static BOOL test_each_DisplayInfo_user(struct dcerpc_pipe *p, TALLOC_CTX *mem_ct status = dcerpc_samr_QueryUserInfo(p, mem_ctx, &q); if (!NT_STATUS_IS_OK(status)) { printf("QueryUserInfo(%u) failed - %s\n", r.in.rid, nt_errstr(status)); - return False; + return false; } switch (querydisplayinfo->in.level) { @@ -3466,26 +3466,26 @@ static BOOL test_each_DisplayInfo_user(struct dcerpc_pipe *p, TALLOC_CTX *mem_ct q.out.info->info21.account_name.string, querydisplayinfo->out.info.info2.entries[i].acct_flags, q.out.info->info21.acct_flags); - return False; + return false; } break; } if (!test_samr_handle_Close(p, mem_ctx, &user_handle)) { - return False; + return false; } } return ret; } -static BOOL test_QueryDisplayInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_QueryDisplayInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; struct samr_QueryDisplayInfo r; struct samr_QueryDomainInfo dom_info; - BOOL ret = True; + bool ret = true; uint16_t levels[] = {1, 2, 3, 4, 5}; int i; bool seen_testuser = false; @@ -3505,18 +3505,18 @@ static BOOL test_QueryDisplayInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES) && !NT_STATUS_IS_OK(status)) { printf("QueryDisplayInfo level %u failed - %s\n", levels[i], nt_errstr(status)); - ret = False; + ret = false; } switch (r.in.level) { case 1: if (!test_each_DisplayInfo_user(p, mem_ctx, &r, &seen_testuser)) { - ret = False; + ret = false; } r.in.start_idx += r.out.info.info1.count; break; case 2: if (!test_each_DisplayInfo_user(p, mem_ctx, &r, NULL)) { - ret = False; + ret = false; } r.in.start_idx += r.out.info.info2.count; break; @@ -3538,7 +3538,7 @@ static BOOL test_QueryDisplayInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("QueryDomainInfo level %u failed - %s\n", r.in.level, nt_errstr(status)); - ret = False; + ret = false; break; } switch (r.in.level) { @@ -3548,14 +3548,14 @@ static BOOL test_QueryDisplayInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("QueryDomainInfo indicates that QueryDisplayInfo returned more users (%d/%d) than the domain %s is said to contain!\n", r.in.start_idx, dom_info.out.info->info2.num_groups, dom_info.out.info->info2.domain_name.string); - ret = False; + ret = false; } if (!seen_testuser) { struct policy_handle user_handle; if (NT_STATUS_IS_OK(test_OpenUser_byname(p, mem_ctx, handle, TEST_ACCOUNT_NAME, &user_handle))) { printf("Didn't find test user " TEST_ACCOUNT_NAME " in enumeration of %s\n", dom_info.out.info->info2.domain_name.string); - ret = False; + ret = false; test_samr_handle_Close(p, mem_ctx, &user_handle); } } @@ -3566,7 +3566,7 @@ static BOOL test_QueryDisplayInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("QueryDomainInfo indicates that QueryDisplayInfo didn't return all (%d/%d) the groups in %s\n", r.in.start_idx, dom_info.out.info->info2.num_groups, dom_info.out.info->info2.domain_name.string); - ret = False; + ret = false; } break; @@ -3577,12 +3577,12 @@ static BOOL test_QueryDisplayInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, return ret; } -static BOOL test_QueryDisplayInfo2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_QueryDisplayInfo2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; struct samr_QueryDisplayInfo2 r; - BOOL ret = True; + bool ret = true; uint16_t levels[] = {1, 2, 3, 4, 5}; int i; @@ -3599,19 +3599,19 @@ static BOOL test_QueryDisplayInfo2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("QueryDisplayInfo2 level %u failed - %s\n", levels[i], nt_errstr(status)); - ret = False; + ret = false; } } return ret; } -static BOOL test_QueryDisplayInfo3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_QueryDisplayInfo3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; struct samr_QueryDisplayInfo3 r; - BOOL ret = True; + bool ret = true; uint16_t levels[] = {1, 2, 3, 4, 5}; int i; @@ -3628,7 +3628,7 @@ static BOOL test_QueryDisplayInfo3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("QueryDisplayInfo3 level %u failed - %s\n", levels[i], nt_errstr(status)); - ret = False; + ret = false; } } @@ -3636,12 +3636,12 @@ static BOOL test_QueryDisplayInfo3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } -static BOOL test_QueryDisplayInfo_continue(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_QueryDisplayInfo_continue(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; struct samr_QueryDisplayInfo r; - BOOL ret = True; + bool ret = true; printf("Testing QueryDisplayInfo continuation\n"); @@ -3665,7 +3665,7 @@ static BOOL test_QueryDisplayInfo_continue(struct dcerpc_pipe *p, TALLOC_CTX *me !NT_STATUS_IS_OK(status)) { printf("QueryDisplayInfo level %u failed - %s\n", r.in.level, nt_errstr(status)); - ret = False; + ret = false; break; } r.in.start_idx++; @@ -3676,7 +3676,7 @@ static BOOL test_QueryDisplayInfo_continue(struct dcerpc_pipe *p, TALLOC_CTX *me return ret; } -static BOOL test_QueryDomainInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_QueryDomainInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; @@ -3685,7 +3685,7 @@ static BOOL test_QueryDomainInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, uint16_t levels[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13}; uint16_t set_ok[] = {1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0}; int i; - BOOL ret = True; + bool ret = true; const char *domain_comment = talloc_asprintf(mem_ctx, "Tortured by Samba4 RPC-SAMR: %s", timestring(mem_ctx, time(NULL))); @@ -3699,7 +3699,7 @@ static BOOL test_QueryDomainInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("SetDomainInfo level %u (set comment) failed - %s\n", r.in.level, nt_errstr(status)); - return False; + return false; } for (i=0;iinfo2.comment.string, domain_comment) != 0) { printf("QueryDomainInfo level %u returned different comment (%s, expected %s)\n", levels[i], r.out.info->info2.comment.string, domain_comment); - ret = False; + ret = false; } if (!r.out.info->info2.primary.string) { printf("QueryDomainInfo level %u returned no PDC name\n", levels[i]); - ret = False; + ret = false; } else if (r.out.info->info2.role == SAMR_ROLE_DOMAIN_PDC) { if (dcerpc_server_name(p) && strcasecmp_m(dcerpc_server_name(p), r.out.info->info2.primary.string) != 0) { printf("QueryDomainInfo level %u returned different PDC name (%s) compared to server name (%s), despite claiming to be the PDC\n", @@ -3738,21 +3738,21 @@ static BOOL test_QueryDomainInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (strcmp(r.out.info->info4.comment.string, domain_comment) != 0) { printf("QueryDomainInfo level %u returned different comment (%s, expected %s)\n", levels[i], r.out.info->info4.comment.string, domain_comment); - ret = False; + ret = false; } break; case 6: if (!r.out.info->info6.primary.string) { printf("QueryDomainInfo level %u returned no PDC name\n", levels[i]); - ret = False; + ret = false; } break; case 11: if (strcmp(r.out.info->info11.info2.comment.string, domain_comment) != 0) { printf("QueryDomainInfo level %u returned different comment (%s, expected %s)\n", levels[i], r.out.info->info11.info2.comment.string, domain_comment); - ret = False; + ret = false; } break; } @@ -3768,14 +3768,14 @@ static BOOL test_QueryDomainInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("SetDomainInfo level %u failed - %s\n", r.in.level, nt_errstr(status)); - ret = False; + ret = false; continue; } } else { if (!NT_STATUS_EQUAL(NT_STATUS_INVALID_INFO_CLASS, status)) { printf("SetDomainInfo level %u gave %s - should have been NT_STATUS_INVALID_INFO_CLASS\n", r.in.level, nt_errstr(status)); - ret = False; + ret = false; continue; } } @@ -3784,7 +3784,7 @@ static BOOL test_QueryDomainInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { printf("QueryDomainInfo level %u failed - %s\n", r.in.level, nt_errstr(status)); - ret = False; + ret = false; continue; } } @@ -3793,14 +3793,14 @@ static BOOL test_QueryDomainInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } -static BOOL test_QueryDomainInfo2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_QueryDomainInfo2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; struct samr_QueryDomainInfo2 r; uint16_t levels[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13}; int i; - BOOL ret = True; + bool ret = true; for (i=0;istring); ZERO_STRUCTP(group_handle); - return True; + return true; } if (NT_STATUS_EQUAL(status, NT_STATUS_GROUP_EXISTS)) { @@ -4140,7 +4140,7 @@ static BOOL test_CreateDomainGroup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("CreateDomainGroup failed: Could not delete domain group %s - %s\n", r.in.name->string, nt_errstr(status)); - return False; + return false; } status = dcerpc_samr_CreateDomainGroup(p, mem_ctx, &r); } @@ -4149,22 +4149,22 @@ static BOOL test_CreateDomainGroup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("CreateDomainGroup failed: Could not delete user %s - %s\n", r.in.name->string, nt_errstr(status)); - return False; + return false; } status = dcerpc_samr_CreateDomainGroup(p, mem_ctx, &r); } if (!NT_STATUS_IS_OK(status)) { printf("CreateDomainGroup failed - %s\n", nt_errstr(status)); - return False; + return false; } if (!test_AddGroupMember(p, mem_ctx, domain_handle, group_handle)) { printf("CreateDomainGroup failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } if (!test_SetGroupInfo(p, mem_ctx, group_handle)) { - ret = False; + ret = false; } return ret; @@ -4174,7 +4174,7 @@ static BOOL test_CreateDomainGroup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, /* its not totally clear what this does. It seems to accept any sid you like. */ -static BOOL test_RemoveMemberFromForeignDomain(struct dcerpc_pipe *p, +static bool test_RemoveMemberFromForeignDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *domain_handle) { @@ -4187,18 +4187,18 @@ static BOOL test_RemoveMemberFromForeignDomain(struct dcerpc_pipe *p, status = dcerpc_samr_RemoveMemberFromForeignDomain(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("RemoveMemberFromForeignDomain failed - %s\n", nt_errstr(status)); - return False; + return false; } - return True; + return true; } -static BOOL test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle); -static BOOL test_OpenDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_OpenDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct dom_sid *sid, enum torture_samr_choice which_ops) { @@ -4208,7 +4208,7 @@ static BOOL test_OpenDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle alias_handle; struct policy_handle user_handle; struct policy_handle group_handle; - BOOL ret = True; + bool ret = true; ZERO_STRUCT(alias_handle); ZERO_STRUCT(user_handle); @@ -4225,7 +4225,7 @@ static BOOL test_OpenDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_OpenDomain(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("OpenDomain failed - %s\n", nt_errstr(status)); - return False; + return false; } /* run the domain tests with the main handle closed - this tests @@ -4271,17 +4271,17 @@ static BOOL test_OpenDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!policy_handle_empty(&user_handle) && !test_DeleteUser(p, mem_ctx, &user_handle)) { - ret = False; + ret = false; } if (!policy_handle_empty(&alias_handle) && !test_DeleteAlias(p, mem_ctx, &alias_handle)) { - ret = False; + ret = false; } if (!policy_handle_empty(&group_handle) && !test_DeleteDomainGroup(p, mem_ctx, &group_handle)) { - ret = False; + ret = false; } ret &= test_samr_handle_Close(p, mem_ctx, &domain_handle); @@ -4296,7 +4296,7 @@ static BOOL test_OpenDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, return ret; } -static BOOL test_LookupDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_LookupDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, const char *domain, enum torture_samr_choice which_ops) { @@ -4304,7 +4304,7 @@ static BOOL test_LookupDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct samr_LookupDomain r; struct lsa_String n1; struct lsa_String n2; - BOOL ret = True; + bool ret = true; printf("Testing LookupDomain(%s)\n", domain); @@ -4316,7 +4316,7 @@ static BOOL test_LookupDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_LookupDomain(p, mem_ctx, &r); if (!NT_STATUS_EQUAL(NT_STATUS_INVALID_PARAMETER, status)) { printf("failed: LookupDomain expected NT_STATUS_INVALID_PARAMETER - %s\n", nt_errstr(status)); - ret = False; + ret = false; } init_lsa_String(&n2, "xxNODOMAINxx"); @@ -4324,7 +4324,7 @@ static BOOL test_LookupDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_LookupDomain(p, mem_ctx, &r); if (!NT_STATUS_EQUAL(NT_STATUS_NO_SUCH_DOMAIN, status)) { printf("failed: LookupDomain expected NT_STATUS_NO_SUCH_DOMAIN - %s\n", nt_errstr(status)); - ret = False; + ret = false; } r.in.connect_handle = handle; @@ -4335,29 +4335,29 @@ static BOOL test_LookupDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_LookupDomain(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("LookupDomain failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } if (!test_GetDomPwInfo(p, mem_ctx, &n1)) { - ret = False; + ret = false; } if (!test_OpenDomain(p, mem_ctx, handle, r.out.sid, which_ops)) { - ret = False; + ret = false; } return ret; } -static BOOL test_EnumDomains(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_EnumDomains(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, enum torture_samr_choice which_ops) { NTSTATUS status; struct samr_EnumDomains r; uint32_t resume_handle = 0; int i; - BOOL ret = True; + bool ret = true; r.in.connect_handle = handle; r.in.resume_handle = &resume_handle; @@ -4367,31 +4367,31 @@ static BOOL test_EnumDomains(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_EnumDomains(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("EnumDomains failed - %s\n", nt_errstr(status)); - return False; + return false; } if (!r.out.sam) { - return False; + return false; } for (i=0;icount;i++) { if (!test_LookupDomain(p, mem_ctx, handle, r.out.sam->entries[i].name.string, which_ops)) { - ret = False; + ret = false; } } status = dcerpc_samr_EnumDomains(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("EnumDomains failed - %s\n", nt_errstr(status)); - return False; + return false; } return ret; } -static BOOL test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { NTSTATUS status; @@ -4402,7 +4402,7 @@ static BOOL test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct samr_Connect5 r5; union samr_ConnectInfo info; struct policy_handle h; - BOOL ret = True, got_handle = False; + bool ret = true, got_handle = false; printf("testing samr_Connect\n"); @@ -4413,9 +4413,9 @@ static BOOL test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_Connect(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("Connect failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } else { - got_handle = True; + got_handle = true; *handle = h; } @@ -4428,12 +4428,12 @@ static BOOL test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_Connect2(p, mem_ctx, &r2); if (!NT_STATUS_IS_OK(status)) { printf("Connect2 failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } else { if (got_handle) { test_samr_handle_Close(p, mem_ctx, handle); } - got_handle = True; + got_handle = true; *handle = h; } @@ -4447,12 +4447,12 @@ static BOOL test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_Connect3(p, mem_ctx, &r3); if (!NT_STATUS_IS_OK(status)) { printf("Connect3 failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } else { if (got_handle) { test_samr_handle_Close(p, mem_ctx, handle); } - got_handle = True; + got_handle = true; *handle = h; } @@ -4466,12 +4466,12 @@ static BOOL test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_Connect4(p, mem_ctx, &r4); if (!NT_STATUS_IS_OK(status)) { printf("Connect4 failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } else { if (got_handle) { test_samr_handle_Close(p, mem_ctx, handle); } - got_handle = True; + got_handle = true; *handle = h; } @@ -4490,12 +4490,12 @@ static BOOL test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_Connect5(p, mem_ctx, &r5); if (!NT_STATUS_IS_OK(status)) { printf("Connect5 failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } else { if (got_handle) { test_samr_handle_Close(p, mem_ctx, handle); } - got_handle = True; + got_handle = true; *handle = h; } @@ -4503,16 +4503,16 @@ static BOOL test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } -BOOL torture_rpc_samr(struct torture_context *torture) +bool torture_rpc_samr(struct torture_context *torture) { NTSTATUS status; struct dcerpc_pipe *p; - BOOL ret = True; + bool ret = true; struct policy_handle handle; status = torture_rpc_connection(torture, &p, &ndr_table_samr); if (!NT_STATUS_IS_OK(status)) { - return False; + return false; } ret &= test_Connect(p, torture, &handle); @@ -4531,16 +4531,16 @@ BOOL torture_rpc_samr(struct torture_context *torture) } -BOOL torture_rpc_samr_users(struct torture_context *torture) +bool torture_rpc_samr_users(struct torture_context *torture) { NTSTATUS status; struct dcerpc_pipe *p; - BOOL ret = True; + bool ret = true; struct policy_handle handle; status = torture_rpc_connection(torture, &p, &ndr_table_samr); if (!NT_STATUS_IS_OK(status)) { - return False; + return false; } ret &= test_Connect(p, torture, &handle); @@ -4559,16 +4559,16 @@ BOOL torture_rpc_samr_users(struct torture_context *torture) } -BOOL torture_rpc_samr_passwords(struct torture_context *torture) +bool torture_rpc_samr_passwords(struct torture_context *torture) { NTSTATUS status; struct dcerpc_pipe *p; - BOOL ret = True; + bool ret = true; struct policy_handle handle; status = torture_rpc_connection(torture, &p, &ndr_table_samr); if (!NT_STATUS_IS_OK(status)) { - return False; + return false; } ret &= test_Connect(p, torture, &handle); diff --git a/source4/torture/rpc/samr_accessmask.c b/source4/torture/rpc/samr_accessmask.c index 7d3395c5d06..c444187cfc1 100644 --- a/source4/torture/rpc/samr_accessmask.c +++ b/source4/torture/rpc/samr_accessmask.c @@ -106,27 +106,27 @@ static bool test_samr_accessmask_Connect5(struct torture_context *tctx, */ if(!NT_STATUS_EQUAL(NT_STATUS_ACCESS_DENIED, status)) { printf("Connect5 failed - %s\n", nt_errstr(status)); - return False; + return false; } break; default: /* these bits set are expected to succeed by default */ if (!NT_STATUS_IS_OK(status)) { printf("Connect5 failed - %s\n", nt_errstr(status)); - return False; + return false; } status = torture_samr_Close(tctx, p, &h); if (!NT_STATUS_IS_OK(status)) { printf("Close failed - %s\n", nt_errstr(status)); - return False; + return false; } break; } printf(" OK\n"); } - return True; + return true; } /* check which bits in accessmask allows us to EnumDomains() @@ -163,7 +163,7 @@ static bool test_samr_accessmask_EnumDomains(struct torture_context *tctx, /* these bits set are expected to succeed by default */ if (!NT_STATUS_IS_OK(status)) { printf("Connect5 failed - %s\n", nt_errstr(status)); - return False; + return false; } ed.in.connect_handle = &ch; @@ -174,13 +174,13 @@ static bool test_samr_accessmask_EnumDomains(struct torture_context *tctx, status = dcerpc_samr_EnumDomains(p, tctx, &ed); if (!NT_STATUS_IS_OK(status)) { printf("EnumDomains failed - %s\n", nt_errstr(status)); - return False; + return false; } status = torture_samr_Close(tctx, p, &ch); if (!NT_STATUS_IS_OK(status)) { printf("Close failed - %s\n", nt_errstr(status)); - return False; + return false; } break; default: @@ -199,20 +199,20 @@ static bool test_samr_accessmask_EnumDomains(struct torture_context *tctx, status = dcerpc_samr_EnumDomains(p, tctx, &ed); if(!NT_STATUS_EQUAL(NT_STATUS_ACCESS_DENIED, status)) { printf("EnumDomains failed - %s\n", nt_errstr(status)); - return False; + return false; } status = torture_samr_Close(tctx, p, &ch); if (!NT_STATUS_IS_OK(status)) { printf("Close failed - %s\n", nt_errstr(status)); - return False; + return false; } break; } printf(" OK\n"); } - return True; + return true; } @@ -237,7 +237,7 @@ static bool test_samr_connect_user_acl(struct torture_context *tctx, struct security_ace ace; struct security_descriptor *sd; struct sec_desc_buf sdb; - bool ret = True; + bool ret = true; int sd_size; struct dcerpc_pipe *test_p; const char *binding = torture_setting_string(tctx, "binding", NULL); @@ -248,7 +248,7 @@ static bool test_samr_connect_user_acl(struct torture_context *tctx, status = torture_samr_Connect5(tctx, p, SEC_FLAG_MAXIMUM_ALLOWED, &ch); if (!NT_STATUS_IS_OK(status)) { printf("Connect5 failed - %s\n", nt_errstr(status)); - return False; + return false; } @@ -258,7 +258,7 @@ static bool test_samr_connect_user_acl(struct torture_context *tctx, status = dcerpc_samr_QuerySecurity(p, tctx, &qs); if (!NT_STATUS_IS_OK(status)) { printf("QuerySecurity failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } /* how big is the security descriptor? */ @@ -276,7 +276,7 @@ static bool test_samr_connect_user_acl(struct torture_context *tctx, status = security_descriptor_dacl_add(sd, &ace); if (!NT_STATUS_IS_OK(status)) { printf("Failed to add ACE to security descriptor\n"); - ret = False; + ret = false; } ss.in.handle = &ch; ss.in.sec_info = SECINFO_DACL; @@ -285,7 +285,7 @@ static bool test_samr_connect_user_acl(struct torture_context *tctx, status = dcerpc_samr_SetSecurity(p, tctx, &ss); if (!NT_STATUS_IS_OK(status)) { printf("SetSecurity failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } @@ -297,12 +297,12 @@ static bool test_samr_connect_user_acl(struct torture_context *tctx, status = torture_samr_Connect5(tctx, test_p, SEC_FLAG_MAXIMUM_ALLOWED, &uch); if (!NT_STATUS_IS_OK(status)) { printf("Connect5 failed - %s\n", nt_errstr(status)); - return False; + return false; } /* disconnec the user */ talloc_free(test_p); if (!NT_STATUS_IS_OK(status)) { - return False; + return false; } @@ -312,21 +312,21 @@ static bool test_samr_connect_user_acl(struct torture_context *tctx, status = dcerpc_samr_QuerySecurity(p, tctx, &qs); if (!NT_STATUS_IS_OK(status)) { printf("QuerySecurity failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } if (sd_size != qs.out.sdbuf->sd_size) { printf("security descriptor changed\n"); - ret = False; + ret = false; } status = torture_samr_Close(tctx, p, &ch); if (!NT_STATUS_IS_OK(status)) { printf("Close failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; } - if (ret == True) { + if (ret == true) { printf(" OK\n"); } return ret; @@ -348,7 +348,7 @@ static bool test_samr_connect_user_acl_enforced(struct torture_context *tctx, { NTSTATUS status; struct policy_handle uch; - bool ret = True; + bool ret = true; struct dcerpc_pipe *test_p; const char *binding = torture_setting_string(tctx, "binding", NULL); @@ -363,7 +363,7 @@ static bool test_samr_connect_user_acl_enforced(struct torture_context *tctx, status = torture_samr_Connect5(tctx, test_p, SAMR_ACCESS_SHUTDOWN_SERVER, &uch); if (NT_STATUS_IS_OK(status)) { printf("Connect5 failed - %s\n", nt_errstr(status)); - return False; + return false; } printf(" OK\n"); @@ -407,7 +407,7 @@ static bool test_samr_accessmask_LookupDomain(struct torture_context *tctx, /* these bits set are expected to succeed by default */ if (!NT_STATUS_IS_OK(status)) { printf("Connect5 failed - %s\n", nt_errstr(status)); - return False; + return false; } ld.in.connect_handle = &ch; @@ -417,13 +417,13 @@ static bool test_samr_accessmask_LookupDomain(struct torture_context *tctx, status = dcerpc_samr_LookupDomain(p, tctx, &ld); if (!NT_STATUS_IS_OK(status)) { printf("LookupDomain failed - %s\n", nt_errstr(status)); - return False; + return false; } status = torture_samr_Close(tctx, p, &ch); if (!NT_STATUS_IS_OK(status)) { printf("Close failed - %s\n", nt_errstr(status)); - return False; + return false; } break; default: @@ -441,20 +441,20 @@ static bool test_samr_accessmask_LookupDomain(struct torture_context *tctx, status = dcerpc_samr_LookupDomain(p, tctx, &ld); if(!NT_STATUS_EQUAL(NT_STATUS_ACCESS_DENIED, status)) { printf("LookupDomain failed - %s\n", nt_errstr(status)); - return False; + return false; } status = torture_samr_Close(tctx, p, &ch); if (!NT_STATUS_IS_OK(status)) { printf("Close failed - %s\n", nt_errstr(status)); - return False; + return false; } break; } printf(" OK\n"); } - return True; + return true; } /* check which bits in accessmask allows us to OpenDomain() @@ -483,7 +483,7 @@ static bool test_samr_accessmask_OpenDomain(struct torture_context *tctx, status = torture_samr_Connect5(tctx, p, SEC_FLAG_MAXIMUM_ALLOWED, &ch); if (!NT_STATUS_IS_OK(status)) { printf("Connect5 failed - %s\n", nt_errstr(status)); - return False; + return false; } ld.in.connect_handle = &ch; @@ -492,7 +492,7 @@ static bool test_samr_accessmask_OpenDomain(struct torture_context *tctx, status = dcerpc_samr_LookupDomain(p, tctx, &ld); if (!NT_STATUS_IS_OK(status)) { printf("LookupDomain failed - %s\n", nt_errstr(status)); - return False; + return false; } @@ -512,7 +512,7 @@ static bool test_samr_accessmask_OpenDomain(struct torture_context *tctx, /* these bits set are expected to succeed by default */ if (!NT_STATUS_IS_OK(status)) { printf("Connect5 failed - %s\n", nt_errstr(status)); - return False; + return false; } od.in.connect_handle = &ch; @@ -523,19 +523,19 @@ static bool test_samr_accessmask_OpenDomain(struct torture_context *tctx, status = dcerpc_samr_OpenDomain(p, tctx, &od); if (!NT_STATUS_IS_OK(status)) { printf("OpenDomain failed - %s\n", nt_errstr(status)); - return False; + return false; } status = torture_samr_Close(tctx, p, &dh); if (!NT_STATUS_IS_OK(status)) { printf("Close failed - %s\n", nt_errstr(status)); - return False; + return false; } status = torture_samr_Close(tctx, p, &ch); if (!NT_STATUS_IS_OK(status)) { printf("Close failed - %s\n", nt_errstr(status)); - return False; + return false; } break; default: @@ -549,14 +549,14 @@ static bool test_samr_accessmask_OpenDomain(struct torture_context *tctx, status = torture_samr_Close(tctx, p, &ch); if (!NT_STATUS_IS_OK(status)) { printf("Close failed - %s\n", nt_errstr(status)); - return False; + return false; } break; } printf(" OK\n"); } - return True; + return true; } static bool test_samr_connect(struct torture_context *tctx, @@ -565,7 +565,7 @@ static bool test_samr_connect(struct torture_context *tctx, void *testuser; const char *testuser_passwd; struct cli_credentials *test_credentials; - bool ret = True; + bool ret = true; const struct dom_sid *test_sid; /* create a test user */ @@ -573,7 +573,7 @@ static bool test_samr_connect(struct torture_context *tctx, ACB_NORMAL, &testuser_passwd); if (!testuser) { printf("Failed to create test user\n"); - return False; + return false; } test_credentials = cli_credentials_init(tctx); cli_credentials_set_workstation(test_credentials, "localhost", CRED_SPECIFIED); @@ -588,7 +588,7 @@ static bool test_samr_connect(struct torture_context *tctx, will allow us to connect to the server */ if (!test_samr_accessmask_Connect5(tctx, p)) { - ret = False; + ret = false; } @@ -596,14 +596,14 @@ static bool test_samr_connect(struct torture_context *tctx, * us to call EnumDomains() */ if (!test_samr_accessmask_EnumDomains(tctx, p)) { - ret = False; + ret = false; } /* test which bits in the accessmask to Connect5 will allow * us to call LookupDomain() */ if (!test_samr_accessmask_LookupDomain(tctx, p)) { - ret = False; + ret = false; } @@ -611,7 +611,7 @@ static bool test_samr_connect(struct torture_context *tctx, * us to call OpenDomain() */ if (!test_samr_accessmask_OpenDomain(tctx, p)) { - ret = False; + ret = false; } @@ -619,7 +619,7 @@ static bool test_samr_connect(struct torture_context *tctx, * returned by Connect5 */ if (!test_samr_connect_user_acl(tctx, p, test_credentials, test_sid)) { - ret = False; + ret = false; } /* test if the ACLs that are reported from the Connect5 @@ -633,7 +633,7 @@ static bool test_samr_connect(struct torture_context *tctx, * requesting SAMR_ACCESS_SHUTDOWN_SERVER */ if (!test_samr_connect_user_acl_enforced(tctx, p, test_credentials, test_sid)) { - ret = False; + ret = false; } diff --git a/source4/torture/rpc/samsync.c b/source4/torture/rpc/samsync.c index 8494bdb5433..6f76e3b58b1 100644 --- a/source4/torture/rpc/samsync.c +++ b/source4/torture/rpc/samsync.c @@ -223,21 +223,21 @@ static struct sec_desc_buf *samsync_query_lsa_sec_desc(TALLOC_CTX *mem_ctx, __location__, \ (long long)i1, (long long)i1, \ (long long)i2, (long long)i2);\ - ret = False;\ + ret = false;\ } \ } while (0) #define TEST_INT_EQUAL(i1, i2) do {\ if (i1 != i2) {\ printf("%s: integer mismatch: " #i1 ": 0x%08x (%d) != " #i2 ": 0x%08x (%d)\n", \ __location__, i1, i1, i2, i2); \ - ret = False;\ + ret = false;\ } \ } while (0) #define TEST_TIME_EQUAL(t1, t2) do {\ if (t1 != t2) {\ printf("%s: NTTIME mismatch: " #t1 ":%s != " #t2 ": %s\n", \ __location__, nt_time_string(mem_ctx, t1), nt_time_string(mem_ctx, t2));\ - ret = False;\ + ret = false;\ } \ } while (0) @@ -246,7 +246,7 @@ static struct sec_desc_buf *samsync_query_lsa_sec_desc(TALLOC_CTX *mem_ctx, && strcmp_safe(s1.string, s2.string) != 0) {\ printf("%s: string mismatch: " #s1 ":%s != " #s2 ": %s\n", \ __location__, s1.string, s2.string);\ - ret = False;\ + ret = false;\ } \ } while (0) @@ -254,7 +254,7 @@ static struct sec_desc_buf *samsync_query_lsa_sec_desc(TALLOC_CTX *mem_ctx, if (!dom_sid_equal(s1, s2)) {\ printf("%s: dom_sid mismatch: " #s1 ":%s != " #s2 ": %s\n", \ __location__, dom_sid_string(mem_ctx, s1), dom_sid_string(mem_ctx, s2));\ - ret = False;\ + ret = false;\ } \ } while (0) @@ -266,19 +266,19 @@ static struct sec_desc_buf *samsync_query_lsa_sec_desc(TALLOC_CTX *mem_ctx, handle); \ if (!sdbuf || !sdbuf->sd) { \ printf("Could not obtain security descriptor to match " #sd1 "\n");\ - ret = False; \ + ret = false; \ } else {\ if (!security_descriptor_mask_equal(sd1.sd, sdbuf->sd, \ ~SEC_DESC_SACL_PRESENT)) {\ printf("Security Descriptor Mismatch for %s:\n", #sd1);\ ndr_print_debug((ndr_print_fn_t)ndr_print_security_descriptor, "SamSync", sd1.sd);\ ndr_print_debug((ndr_print_fn_t)ndr_print_security_descriptor, "SamR", sdbuf->sd);\ - ret = False;\ + ret = false;\ }\ }\ } while (0) -static BOOL samsync_handle_domain(TALLOC_CTX *mem_ctx, struct samsync_state *samsync_state, +static bool samsync_handle_domain(TALLOC_CTX *mem_ctx, struct samsync_state *samsync_state, int database_id, struct netr_DELTA_ENUM *delta) { struct netr_DELTA_DOMAIN *domain = delta->delta_union.domain; @@ -287,7 +287,7 @@ static BOOL samsync_handle_domain(TALLOC_CTX *mem_ctx, struct samsync_state *sam uint16_t levels[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13}; NTSTATUS nt_status; int i; - BOOL ret = True; + bool ret = true; samsync_state->seq_num[database_id] = domain->sequence_num; @@ -301,7 +301,7 @@ static BOOL samsync_handle_domain(TALLOC_CTX *mem_ctx, struct samsync_state *sam break; case SAM_DATABASE_PRIVS: printf("DOMAIN entry on privs DB!\n"); - return False; + return false; break; } @@ -312,7 +312,7 @@ static BOOL samsync_handle_domain(TALLOC_CTX *mem_ctx, struct samsync_state *sam if (strcasecmp_m(samsync_state->domain_name[database_id], domain->domain_name.string) != 0) { printf("Domain has name varies!: %s != %s\n", samsync_state->domain_name[database_id], domain->domain_name.string); - return False; + return false; } } @@ -339,7 +339,7 @@ static BOOL samsync_handle_domain(TALLOC_CTX *mem_ctx, struct samsync_state *sam if (!NT_STATUS_IS_OK(nt_status)) { printf("QueryDomainInfo level %u failed - %s\n", q[levels[i]].in.level, nt_errstr(nt_status)); - return False; + return false; } } @@ -367,7 +367,7 @@ static BOOL samsync_handle_domain(TALLOC_CTX *mem_ctx, struct samsync_state *sam return ret; } -static BOOL samsync_handle_policy(TALLOC_CTX *mem_ctx, struct samsync_state *samsync_state, +static bool samsync_handle_policy(TALLOC_CTX *mem_ctx, struct samsync_state *samsync_state, int database_id, struct netr_DELTA_ENUM *delta) { struct netr_DELTA_POLICY *policy = delta->delta_union.policy; @@ -382,23 +382,23 @@ static BOOL samsync_handle_policy(TALLOC_CTX *mem_ctx, struct samsync_state *sam if (strcasecmp_m(samsync_state->domain_name[SAM_DATABASE_DOMAIN], policy->primary_domain_name.string) != 0) { printf("PRIMARY domain has name varies between DOMAIN and POLICY!: %s != %s\n", samsync_state->domain_name[SAM_DATABASE_DOMAIN], policy->primary_domain_name.string); - return False; + return false; } } if (!dom_sid_equal(samsync_state->sid[SAM_DATABASE_DOMAIN], policy->sid)) { printf("Domain SID from POLICY (%s) does not match domain sid from SAMR (%s)\n", dom_sid_string(mem_ctx, policy->sid), dom_sid_string(mem_ctx, samsync_state->sid[SAM_DATABASE_DOMAIN])); - return False; + return false; } printf("\tsequence_nums[%d/PRIVS]=%llu\n", database_id, (long long)samsync_state->seq_num[database_id]); - return True; + return true; } -static BOOL samsync_handle_user(TALLOC_CTX *mem_ctx, struct samsync_state *samsync_state, +static bool samsync_handle_user(TALLOC_CTX *mem_ctx, struct samsync_state *samsync_state, int database_id, struct netr_DELTA_ENUM *delta) { uint32_t rid = delta->delta_id_union.rid; @@ -411,7 +411,7 @@ static BOOL samsync_handle_user(TALLOC_CTX *mem_ctx, struct samsync_state *samsy const char *domain = samsync_state->domain_name[database_id]; const char *username = user->account_name.string; NTSTATUS nt_status; - BOOL ret = True; + bool ret = true; struct samr_OpenUser r; struct samr_QueryUserInfo q; @@ -420,7 +420,7 @@ static BOOL samsync_handle_user(TALLOC_CTX *mem_ctx, struct samsync_state *samsy struct samr_GetGroupsForUser getgroups; if (!samsync_state->domain_name || !samsync_state->domain_handle[database_id]) { printf("SamSync needs domain information before the users\n"); - return False; + return false; } r.in.domain_handle = samsync_state->domain_handle[database_id]; @@ -431,7 +431,7 @@ static BOOL samsync_handle_user(TALLOC_CTX *mem_ctx, struct samsync_state *samsy nt_status = dcerpc_samr_OpenUser(samsync_state->p_samr, mem_ctx, &r); if (!NT_STATUS_IS_OK(nt_status)) { printf("OpenUser(%u) failed - %s\n", rid, nt_errstr(nt_status)); - return False; + return false; } q.in.user_handle = &user_handle; @@ -443,7 +443,7 @@ static BOOL samsync_handle_user(TALLOC_CTX *mem_ctx, struct samsync_state *samsy if (!NT_STATUS_IS_OK(nt_status)) { printf("QueryUserInfo level %u failed - %s\n", q.in.level, nt_errstr(nt_status)); - ret = False; + ret = false; } getgroups.in.user_handle = &user_handle; @@ -452,22 +452,22 @@ static BOOL samsync_handle_user(TALLOC_CTX *mem_ctx, struct samsync_state *samsy if (!NT_STATUS_IS_OK(nt_status)) { printf("GetGroupsForUser failed - %s\n", nt_errstr(nt_status)); - ret = False; + ret = false; } if (!test_samr_handle_Close(samsync_state->p_samr, mem_ctx, &user_handle)) { printf("samr_handle_Close failed - %s\n", nt_errstr(nt_status)); - ret = False; + ret = false; } if (!ret) { - return False; + return false; } if (!NT_STATUS_IS_OK(nt_status)) { printf("QueryUserInfo level %u failed - %s\n", q.in.level, nt_errstr(nt_status)); - return False; + return false; } TEST_STRING_EQUAL(q.out.info->info21.account_name, user->account_name); @@ -490,7 +490,7 @@ static BOOL samsync_handle_user(TALLOC_CTX *mem_ctx, struct samsync_state *samsy if (memcmp(q.out.info->info21.logon_hours.bits, user->logon_hours.bits, q.out.info->info21.logon_hours.units_per_week/8) != 0) { printf("Logon hours mismatch\n"); - ret = False; + ret = false; } } @@ -508,7 +508,7 @@ static BOOL samsync_handle_user(TALLOC_CTX *mem_ctx, struct samsync_state *samsy if (user->acct_flags & ACB_PWNOEXP) { if (q.out.info->info21.acct_flags & ACB_PW_EXPIRED) { printf("ACB flags mismatch: both expired and no expiry!\n"); - ret = False; + ret = false; } if (q.out.info->info21.force_password_change != (NTTIME)0x7FFFFFFFFFFFFFFFULL) { printf("ACB flags mismatch: no password expiry, but force password change 0x%016llx (%lld) != 0x%016llx (%lld)\n", @@ -516,7 +516,7 @@ static BOOL samsync_handle_user(TALLOC_CTX *mem_ctx, struct samsync_state *samsy (unsigned long long)q.out.info->info21.force_password_change, (unsigned long long)0x7FFFFFFFFFFFFFFFULL, (unsigned long long)0x7FFFFFFFFFFFFFFFULL ); - ret = False; + ret = false; } } @@ -562,7 +562,7 @@ static BOOL samsync_handle_user(TALLOC_CTX *mem_ctx, struct samsync_state *samsy #if 0 dump_data(0, data.data, data.length); #endif - return False; + return false; } } @@ -585,39 +585,39 @@ static BOOL samsync_handle_user(TALLOC_CTX *mem_ctx, struct samsync_state *samsy if (NT_STATUS_EQUAL(nt_status, NT_STATUS_ACCOUNT_DISABLED)) { if (user->acct_flags & ACB_DISABLED) { - return True; + return true; } } else if (NT_STATUS_EQUAL(nt_status, NT_STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT)) { if (user->acct_flags & ACB_WSTRUST) { - return True; + return true; } } else if (NT_STATUS_EQUAL(nt_status, NT_STATUS_NOLOGON_SERVER_TRUST_ACCOUNT)) { if (user->acct_flags & ACB_SVRTRUST) { - return True; + return true; } } else if (NT_STATUS_EQUAL(nt_status, NT_STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT)) { if (user->acct_flags & ACB_DOMTRUST) { - return True; + return true; } } else if (NT_STATUS_EQUAL(nt_status, NT_STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT)) { if (user->acct_flags & ACB_DOMTRUST) { - return True; + return true; } } else if (NT_STATUS_EQUAL(nt_status, NT_STATUS_ACCOUNT_LOCKED_OUT)) { if (user->acct_flags & ACB_AUTOLOCK) { - return True; + return true; } } else if (NT_STATUS_EQUAL(nt_status, NT_STATUS_PASSWORD_EXPIRED)) { if (q.out.info->info21.acct_flags & ACB_PW_EXPIRED) { - return True; + return true; } } else if (NT_STATUS_EQUAL(nt_status, NT_STATUS_WRONG_PASSWORD)) { if (!lm_hash_p && !nt_hash_p) { - return True; + return true; } } else if (NT_STATUS_EQUAL(nt_status, NT_STATUS_PASSWORD_MUST_CHANGE)) { /* We would need to know the server's current time to test this properly */ - return True; + return true; } else if (NT_STATUS_IS_OK(nt_status)) { TEST_INT_EQUAL(user->rid, info3->base.rid); TEST_INT_EQUAL(user->primary_gid, info3->base.primary_gid); @@ -660,7 +660,7 @@ static BOOL samsync_handle_user(TALLOC_CTX *mem_ctx, struct samsync_state *samsy if (getgroups.out.rids->count == info3->base.groups.count) { int i, j; int count = getgroups.out.rids->count; - BOOL *matched = talloc_zero_array(mem_ctx, BOOL, getgroups.out.rids->count); + bool *matched = talloc_zero_array(mem_ctx, bool, getgroups.out.rids->count); for (i = 0; i < count; i++) { for (j = 0; j < count; j++) { @@ -668,14 +668,14 @@ static BOOL samsync_handle_user(TALLOC_CTX *mem_ctx, struct samsync_state *samsy info3->base.groups.rids[j].rid) && (getgroups.out.rids->rids[i].attributes == info3->base.groups.rids[j].attributes)) { - matched[i] = True; + matched[i] = true; } } } for (i = 0; i < getgroups.out.rids->count; i++) { - if (matched[i] == False) { - ret = False; + if (matched[i] == false) { + ret = false; printf("Could not find group RID %u found in getgroups in NETLOGON reply\n", getgroups.out.rids->rids[i].rid); } @@ -685,18 +685,18 @@ static BOOL samsync_handle_user(TALLOC_CTX *mem_ctx, struct samsync_state *samsy } else { printf("Could not validate password for user %s\\%s: %s\n", domain, username, nt_errstr(nt_status)); - return False; + return false; } - return False; + return false; } -static BOOL samsync_handle_alias(TALLOC_CTX *mem_ctx, struct samsync_state *samsync_state, +static bool samsync_handle_alias(TALLOC_CTX *mem_ctx, struct samsync_state *samsync_state, int database_id, struct netr_DELTA_ENUM *delta) { uint32_t rid = delta->delta_id_union.rid; struct netr_DELTA_ALIAS *alias = delta->delta_union.alias; NTSTATUS nt_status; - BOOL ret = True; + bool ret = true; struct samr_OpenAlias r; struct samr_QueryAliasInfo q; @@ -704,7 +704,7 @@ static BOOL samsync_handle_alias(TALLOC_CTX *mem_ctx, struct samsync_state *sams if (!samsync_state->domain_name || !samsync_state->domain_handle[database_id]) { printf("SamSync needs domain information before the users\n"); - return False; + return false; } r.in.domain_handle = samsync_state->domain_handle[database_id]; @@ -715,7 +715,7 @@ static BOOL samsync_handle_alias(TALLOC_CTX *mem_ctx, struct samsync_state *sams nt_status = dcerpc_samr_OpenAlias(samsync_state->p_samr, mem_ctx, &r); if (!NT_STATUS_IS_OK(nt_status)) { printf("OpenUser(%u) failed - %s\n", rid, nt_errstr(nt_status)); - return False; + return false; } q.in.alias_handle = &alias_handle; @@ -725,13 +725,13 @@ static BOOL samsync_handle_alias(TALLOC_CTX *mem_ctx, struct samsync_state *sams nt_status = dcerpc_samr_QueryAliasInfo(samsync_state->p_samr, mem_ctx, &q); if (!test_samr_handle_Close(samsync_state->p_samr, mem_ctx, &alias_handle)) { - return False; + return false; } if (!NT_STATUS_IS_OK(nt_status)) { printf("QueryAliasInfo level %u failed - %s\n", q.in.level, nt_errstr(nt_status)); - return False; + return false; } TEST_STRING_EQUAL(q.out.info->all.name, alias->alias_name); @@ -739,13 +739,13 @@ static BOOL samsync_handle_alias(TALLOC_CTX *mem_ctx, struct samsync_state *sams return ret; } -static BOOL samsync_handle_group(TALLOC_CTX *mem_ctx, struct samsync_state *samsync_state, +static bool samsync_handle_group(TALLOC_CTX *mem_ctx, struct samsync_state *samsync_state, int database_id, struct netr_DELTA_ENUM *delta) { uint32_t rid = delta->delta_id_union.rid; struct netr_DELTA_GROUP *group = delta->delta_union.group; NTSTATUS nt_status; - BOOL ret = True; + bool ret = true; struct samr_OpenGroup r; struct samr_QueryGroupInfo q; @@ -753,7 +753,7 @@ static BOOL samsync_handle_group(TALLOC_CTX *mem_ctx, struct samsync_state *sams if (!samsync_state->domain_name || !samsync_state->domain_handle[database_id]) { printf("SamSync needs domain information before the users\n"); - return False; + return false; } r.in.domain_handle = samsync_state->domain_handle[database_id]; @@ -764,7 +764,7 @@ static BOOL samsync_handle_group(TALLOC_CTX *mem_ctx, struct samsync_state *sams nt_status = dcerpc_samr_OpenGroup(samsync_state->p_samr, mem_ctx, &r); if (!NT_STATUS_IS_OK(nt_status)) { printf("OpenUser(%u) failed - %s\n", rid, nt_errstr(nt_status)); - return False; + return false; } q.in.group_handle = &group_handle; @@ -774,13 +774,13 @@ static BOOL samsync_handle_group(TALLOC_CTX *mem_ctx, struct samsync_state *sams nt_status = dcerpc_samr_QueryGroupInfo(samsync_state->p_samr, mem_ctx, &q); if (!test_samr_handle_Close(samsync_state->p_samr, mem_ctx, &group_handle)) { - return False; + return false; } if (!NT_STATUS_IS_OK(nt_status)) { printf("QueryGroupInfo level %u failed - %s\n", q.in.level, nt_errstr(nt_status)); - return False; + return false; } TEST_STRING_EQUAL(q.out.info->all.name, group->group_name); @@ -789,7 +789,7 @@ static BOOL samsync_handle_group(TALLOC_CTX *mem_ctx, struct samsync_state *sams return ret; } -static BOOL samsync_handle_secret(TALLOC_CTX *mem_ctx, struct samsync_state *samsync_state, +static bool samsync_handle_secret(TALLOC_CTX *mem_ctx, struct samsync_state *samsync_state, int database_id, struct netr_DELTA_ENUM *delta) { struct netr_DELTA_SECRET *secret = delta->delta_union.secret; @@ -803,7 +803,7 @@ static BOOL samsync_handle_secret(TALLOC_CTX *mem_ctx, struct samsync_state *sam struct lsa_DATA_BUF_PTR bufp2; NTTIME new_mtime; NTTIME old_mtime; - BOOL ret = True; + bool ret = true; DATA_BLOB lsa_blob1, lsa_blob_out, session_key; NTSTATUS status; @@ -832,7 +832,7 @@ static BOOL samsync_handle_secret(TALLOC_CTX *mem_ctx, struct samsync_state *sam status = dcerpc_lsa_OpenSecret(samsync_state->p_lsa, mem_ctx, &o); if (!NT_STATUS_IS_OK(status)) { printf("OpenSecret failed - %s\n", nt_errstr(status)); - return False; + return false; } /* @@ -842,7 +842,7 @@ static BOOL samsync_handle_secret(TALLOC_CTX *mem_ctx, struct samsync_state *sam status = dcerpc_fetch_session_key(samsync_state->p_lsa, &session_key); if (!NT_STATUS_IS_OK(status)) { printf("dcerpc_fetch_session_key failed - %s\n", nt_errstr(status)); - return False; + return false; } @@ -862,10 +862,10 @@ static BOOL samsync_handle_secret(TALLOC_CTX *mem_ctx, struct samsync_state *sam status = dcerpc_lsa_QuerySecret(samsync_state->p_lsa, mem_ctx, &q); if (NT_STATUS_EQUAL(NT_STATUS_ACCESS_DENIED, status)) { /* some things are just off limits */ - return True; + return true; } else if (!NT_STATUS_IS_OK(status)) { printf("QuerySecret failed - %s\n", nt_errstr(status)); - return False; + return false; } if (q.out.old_val->buf == NULL) { @@ -877,24 +877,24 @@ static BOOL samsync_handle_secret(TALLOC_CTX *mem_ctx, struct samsync_state *sam status = sess_decrypt_blob(mem_ctx, &lsa_blob1, &session_key, &lsa_blob_out); if (!NT_STATUS_IS_OK(status)) { printf("Failed to decrypt secrets OLD blob: %s\n", nt_errstr(status)); - return False; + return false; } if (!q.out.old_mtime) { printf("OLD mtime not available on LSA for secret %s\n", old->name); - ret = False; + ret = false; } if (old->mtime != *q.out.old_mtime) { printf("OLD mtime on secret %s does not match between SAMSYNC (%s) and LSA (%s)\n", old->name, nt_time_string(mem_ctx, old->mtime), nt_time_string(mem_ctx, *q.out.old_mtime)); - ret = False; + ret = false; } if (old->secret.length != lsa_blob_out.length) { printf("Returned secret %s doesn't match: %d != %d\n", old->name, (int)old->secret.length, (int)lsa_blob_out.length); - ret = False; + ret = false; } else if (memcmp(lsa_blob_out.data, old->secret.data, old->secret.length) != 0) { printf("Returned secret %s doesn't match: \n", @@ -903,7 +903,7 @@ static BOOL samsync_handle_secret(TALLOC_CTX *mem_ctx, struct samsync_state *sam dump_data(1, old->secret.data, old->secret.length); DEBUG(1, ("LSA Secret:\n")); dump_data(1, lsa_blob_out.data, lsa_blob_out.length); - ret = False; + ret = false; } } @@ -917,24 +917,24 @@ static BOOL samsync_handle_secret(TALLOC_CTX *mem_ctx, struct samsync_state *sam status = sess_decrypt_blob(mem_ctx, &lsa_blob1, &session_key, &lsa_blob_out); if (!NT_STATUS_IS_OK(status)) { printf("Failed to decrypt secrets OLD blob\n"); - return False; + return false; } if (!q.out.new_mtime) { printf("NEW mtime not available on LSA for secret %s\n", new->name); - ret = False; + ret = false; } if (new->mtime != *q.out.new_mtime) { printf("NEW mtime on secret %s does not match between SAMSYNC (%s) and LSA (%s)\n", new->name, nt_time_string(mem_ctx, new->mtime), nt_time_string(mem_ctx, *q.out.new_mtime)); - ret = False; + ret = false; } if (new->secret.length != lsa_blob_out.length) { printf("Returned secret %s doesn't match: %d != %d\n", new->name, (int)new->secret.length, (int)lsa_blob_out.length); - ret = False; + ret = false; } else if (memcmp(lsa_blob_out.data, new->secret.data, new->secret.length) != 0) { printf("Returned secret %s doesn't match: \n", @@ -943,18 +943,18 @@ static BOOL samsync_handle_secret(TALLOC_CTX *mem_ctx, struct samsync_state *sam dump_data(1, new->secret.data, new->secret.length); DEBUG(1, ("LSA Secret:\n")); dump_data(1, lsa_blob_out.data, lsa_blob_out.length); - ret = False; + ret = false; } } return ret; } -static BOOL samsync_handle_trusted_domain(TALLOC_CTX *mem_ctx, struct samsync_state *samsync_state, +static bool samsync_handle_trusted_domain(TALLOC_CTX *mem_ctx, struct samsync_state *samsync_state, int database_id, struct netr_DELTA_ENUM *delta) { NTSTATUS status; - BOOL ret = True; + bool ret = true; struct netr_DELTA_TRUSTED_DOMAIN *trusted_domain = delta->delta_union.trusted_domain; struct dom_sid *dom_sid = delta->delta_id_union.sid; @@ -977,7 +977,7 @@ static BOOL samsync_handle_trusted_domain(TALLOC_CTX *mem_ctx, struct samsync_st status = dcerpc_lsa_OpenTrustedDomain(samsync_state->p_lsa, mem_ctx, &t); if (!NT_STATUS_IS_OK(status)) { printf("OpenTrustedDomain failed - %s\n", nt_errstr(status)); - return False; + return false; } for (i=0; i< ARRAY_SIZE(levels); i++) { @@ -991,7 +991,7 @@ static BOOL samsync_handle_trusted_domain(TALLOC_CTX *mem_ctx, struct samsync_st } printf("QueryInfoTrustedDomain level %d failed - %s\n", levels[i], nt_errstr(status)); - return False; + return false; } info[levels[i]] = q.out.info; } @@ -1012,11 +1012,11 @@ static BOOL samsync_handle_trusted_domain(TALLOC_CTX *mem_ctx, struct samsync_st return ret; } -static BOOL samsync_handle_account(TALLOC_CTX *mem_ctx, struct samsync_state *samsync_state, +static bool samsync_handle_account(TALLOC_CTX *mem_ctx, struct samsync_state *samsync_state, int database_id, struct netr_DELTA_ENUM *delta) { NTSTATUS status; - BOOL ret = True; + bool ret = true; struct netr_DELTA_ACCOUNT *account = delta->delta_union.account; struct dom_sid *dom_sid = delta->delta_id_union.sid; @@ -1027,7 +1027,7 @@ static BOOL samsync_handle_account(TALLOC_CTX *mem_ctx, struct samsync_state *sa int i, j; - BOOL *found_priv_in_lsa; + bool *found_priv_in_lsa; a.in.handle = samsync_state->lsa_handle; a.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED; @@ -1037,31 +1037,31 @@ static BOOL samsync_handle_account(TALLOC_CTX *mem_ctx, struct samsync_state *sa status = dcerpc_lsa_OpenAccount(samsync_state->p_lsa, mem_ctx, &a); if (!NT_STATUS_IS_OK(status)) { printf("OpenTrustedDomain failed - %s\n", nt_errstr(status)); - return False; + return false; } TEST_SEC_DESC_EQUAL(account->sdbuf, lsa, &acct_handle); - found_priv_in_lsa = talloc_zero_array(mem_ctx, BOOL, account->privilege_entries); + found_priv_in_lsa = talloc_zero_array(mem_ctx, bool, account->privilege_entries); e.in.handle = &acct_handle; status = dcerpc_lsa_EnumPrivsAccount(samsync_state->p_lsa, mem_ctx, &e); if (!NT_STATUS_IS_OK(status)) { printf("EnumPrivsAccount failed - %s\n", nt_errstr(status)); - return False; + return false; } if ((account->privilege_entries && !e.out.privs)) { printf("Account %s has privileges in SamSync, but not LSA\n", dom_sid_string(mem_ctx, dom_sid)); - return False; + return false; } if (!account->privilege_entries && e.out.privs && e.out.privs->count) { printf("Account %s has privileges in LSA, but not SamSync\n", dom_sid_string(mem_ctx, dom_sid)); - return False; + return false; } TEST_INT_EQUAL(account->privilege_entries, e.out.privs->count); @@ -1073,16 +1073,16 @@ static BOOL samsync_handle_account(TALLOC_CTX *mem_ctx, struct samsync_state *sa status = dcerpc_lsa_LookupPrivName(samsync_state->p_lsa, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("\nLookupPrivName failed - %s\n", nt_errstr(status)); - return False; + return false; } if (!r.out.name) { printf("\nLookupPrivName failed to return a name\n"); - return False; + return false; } for (j=0;jprivilege_entries; j++) { if (strcmp(r.out.name->string, account->privilege_name[j].string) == 0) { - found_priv_in_lsa[j] = True; + found_priv_in_lsa[j] = true; break; } } @@ -1091,7 +1091,7 @@ static BOOL samsync_handle_account(TALLOC_CTX *mem_ctx, struct samsync_state *sa if (!found_priv_in_lsa[j]) { printf("Privilage %s on account %s not found in LSA\n", account->privilege_name[j].string, dom_sid_string(mem_ctx, dom_sid)); - ret = False; + ret = false; } } return ret; @@ -1100,7 +1100,7 @@ static BOOL samsync_handle_account(TALLOC_CTX *mem_ctx, struct samsync_state *sa /* try a netlogon DatabaseSync */ -static BOOL test_DatabaseSync(struct samsync_state *samsync_state, +static bool test_DatabaseSync(struct samsync_state *samsync_state, TALLOC_CTX *mem_ctx) { NTSTATUS status; @@ -1108,7 +1108,7 @@ static BOOL test_DatabaseSync(struct samsync_state *samsync_state, struct netr_DatabaseSync r; const enum netr_SamDatabaseID database_ids[] = {SAM_DATABASE_DOMAIN, SAM_DATABASE_BUILTIN, SAM_DATABASE_PRIVS}; int i, d; - BOOL ret = True; + bool ret = true; struct samsync_trusted_domain *t; struct samsync_secret *s; @@ -1133,7 +1133,7 @@ static BOOL test_DatabaseSync(struct samsync_state *samsync_state, if (!NT_STATUS_IS_OK(status) && !NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES)) { printf("DatabaseSync - %s\n", nt_errstr(status)); - ret = False; + ret = false; break; } @@ -1150,56 +1150,56 @@ static BOOL test_DatabaseSync(struct samsync_state *samsync_state, if (!samsync_handle_domain(delta_ctx, samsync_state, r.in.database_id, &r.out.delta_enum_array->delta_enum[d])) { printf("Failed to handle DELTA_DOMAIN\n"); - ret = False; + ret = false; } break; case NETR_DELTA_GROUP: if (!samsync_handle_group(delta_ctx, samsync_state, r.in.database_id, &r.out.delta_enum_array->delta_enum[d])) { printf("Failed to handle DELTA_USER\n"); - ret = False; + ret = false; } break; case NETR_DELTA_USER: if (!samsync_handle_user(delta_ctx, samsync_state, r.in.database_id, &r.out.delta_enum_array->delta_enum[d])) { printf("Failed to handle DELTA_USER\n"); - ret = False; + ret = false; } break; case NETR_DELTA_ALIAS: if (!samsync_handle_alias(delta_ctx, samsync_state, r.in.database_id, &r.out.delta_enum_array->delta_enum[d])) { printf("Failed to handle DELTA_ALIAS\n"); - ret = False; + ret = false; } break; case NETR_DELTA_POLICY: if (!samsync_handle_policy(delta_ctx, samsync_state, r.in.database_id, &r.out.delta_enum_array->delta_enum[d])) { printf("Failed to handle DELTA_POLICY\n"); - ret = False; + ret = false; } break; case NETR_DELTA_TRUSTED_DOMAIN: if (!samsync_handle_trusted_domain(delta_ctx, samsync_state, r.in.database_id, &r.out.delta_enum_array->delta_enum[d])) { printf("Failed to handle DELTA_TRUSTED_DOMAIN\n"); - ret = False; + ret = false; } break; case NETR_DELTA_ACCOUNT: if (!samsync_handle_account(delta_ctx, samsync_state, r.in.database_id, &r.out.delta_enum_array->delta_enum[d])) { printf("Failed to handle DELTA_ACCOUNT\n"); - ret = False; + ret = false; } break; case NETR_DELTA_SECRET: if (!samsync_handle_secret(delta_ctx, samsync_state, r.in.database_id, &r.out.delta_enum_array->delta_enum[d])) { printf("Failed to handle DELTA_SECRET\n"); - ret = False; + ret = false; } break; case NETR_DELTA_GROUP_MEMBER: @@ -1220,7 +1220,7 @@ static BOOL test_DatabaseSync(struct samsync_state *samsync_state, case NETR_DELTA_MODIFY_COUNT: default: printf("Uxpected delta type %d\n", r.out.delta_enum_array->delta_enum[d].delta_type); - ret = False; + ret = false; break; } talloc_free(delta_ctx); @@ -1233,7 +1233,7 @@ static BOOL test_DatabaseSync(struct samsync_state *samsync_state, domain = samsync_state->domain_name[SAM_DATABASE_DOMAIN]; if (!domain) { printf("Never got a DOMAIN object in samsync!\n"); - return False; + return false; } trustdom_ctx = talloc_named(mem_ctx, 0, "test_DatabaseSync Trusted domains context"); @@ -1264,7 +1264,7 @@ static BOOL test_DatabaseSync(struct samsync_state *samsync_state, if (!NT_STATUS_EQUAL(nt_status, NT_STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT)) { printf("Verifiction of trust password to %s: should have failed (nologon interdomain trust account), instead: %s\n", t->name, nt_errstr(nt_status)); - ret = False; + ret = false; } /* break it */ @@ -1280,7 +1280,7 @@ static BOOL test_DatabaseSync(struct samsync_state *samsync_state, if (!NT_STATUS_EQUAL(nt_status, NT_STATUS_WRONG_PASSWORD)) { printf("Verifiction of trust password to %s: should have failed (wrong password), instead: %s\n", t->name, nt_errstr(nt_status)); - ret = False; + ret = false; } break; @@ -1295,14 +1295,14 @@ static BOOL test_DatabaseSync(struct samsync_state *samsync_state, /* try a netlogon DatabaseDeltas */ -static BOOL test_DatabaseDeltas(struct samsync_state *samsync_state, TALLOC_CTX *mem_ctx) +static bool test_DatabaseDeltas(struct samsync_state *samsync_state, TALLOC_CTX *mem_ctx) { NTSTATUS status; TALLOC_CTX *loop_ctx; struct netr_DatabaseDeltas r; const uint32_t database_ids[] = {0, 1, 2}; int i; - BOOL ret = True; + bool ret = true; r.in.logon_server = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(samsync_state->p)); r.in.computername = TEST_MACHINE_NAME; @@ -1334,7 +1334,7 @@ static BOOL test_DatabaseDeltas(struct samsync_state *samsync_state, TALLOC_CTX !NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES) && !NT_STATUS_EQUAL(status, NT_STATUS_SYNCHRONIZATION_REQUIRED)) { printf("DatabaseDeltas - %s\n", nt_errstr(status)); - ret = False; + ret = false; } if (!creds_client_check(samsync_state->creds, &r.out.return_authenticator.cred)) { @@ -1353,7 +1353,7 @@ static BOOL test_DatabaseDeltas(struct samsync_state *samsync_state, TALLOC_CTX /* try a netlogon DatabaseSync2 */ -static BOOL test_DatabaseSync2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_DatabaseSync2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct creds_CredentialState *creds) { NTSTATUS status; @@ -1361,7 +1361,7 @@ static BOOL test_DatabaseSync2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct netr_DatabaseSync2 r; const uint32_t database_ids[] = {0, 1, 2}; int i; - BOOL ret = True; + bool ret = true; r.in.logon_server = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(p)); r.in.computername = TEST_MACHINE_NAME; @@ -1383,7 +1383,7 @@ static BOOL test_DatabaseSync2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status) && !NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES)) { printf("DatabaseSync2 - %s\n", nt_errstr(status)); - ret = False; + ret = false; } if (!creds_client_check(creds, &r.out.return_authenticator.cred)) { @@ -1400,11 +1400,11 @@ static BOOL test_DatabaseSync2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, -BOOL torture_rpc_samsync(struct torture_context *torture) +bool torture_rpc_samsync(struct torture_context *torture) { NTSTATUS status; TALLOC_CTX *mem_ctx; - BOOL ret = True; + bool ret = true; struct test_join *join_ctx; struct test_join *join_ctx2; struct test_join *user_ctx; @@ -1437,7 +1437,7 @@ BOOL torture_rpc_samsync(struct torture_context *torture) if (!join_ctx) { talloc_free(mem_ctx); printf("Failed to join as BDC\n"); - return False; + return false; } test_wksta_machine_account = talloc_asprintf(mem_ctx, "%s$", TEST_WKSTA_MACHINE_NAME); @@ -1445,7 +1445,7 @@ BOOL torture_rpc_samsync(struct torture_context *torture) if (!join_ctx2) { talloc_free(mem_ctx); printf("Failed to join as member\n"); - return False; + return false; } user_ctx = torture_create_testuser(torture, TEST_USER_NAME, @@ -1454,7 +1454,7 @@ BOOL torture_rpc_samsync(struct torture_context *torture) if (!user_ctx) { talloc_free(mem_ctx); printf("Failed to create test account\n"); - return False; + return false; } samsync_state = talloc_zero(mem_ctx, struct samsync_state); @@ -1469,14 +1469,14 @@ BOOL torture_rpc_samsync(struct torture_context *torture) status = dcerpc_samr_Connect(samsync_state->p_samr, mem_ctx, &c); if (!NT_STATUS_IS_OK(status)) { printf("samr_Connect failed\n"); - ret = False; + ret = false; goto failed; } domain_policy = samsync_open_domain(mem_ctx, samsync_state, lp_workgroup(global_loadparm), NULL); if (!domain_policy) { printf("samrsync_open_domain failed\n"); - ret = False; + ret = false; goto failed; } @@ -1491,14 +1491,14 @@ BOOL torture_rpc_samsync(struct torture_context *torture) status = dcerpc_samr_SetDomainInfo(samsync_state->p_samr, mem_ctx, &s); if (!test_samr_handle_Close(samsync_state->p_samr, mem_ctx, domain_policy)) { - ret = False; + ret = false; goto failed; } if (!NT_STATUS_IS_OK(status)) { printf("SetDomainInfo level %u failed - %s\n", s.in.level, nt_errstr(status)); - ret = False; + ret = false; goto failed; } @@ -1508,7 +1508,7 @@ BOOL torture_rpc_samsync(struct torture_context *torture) &ndr_table_lsarpc); if (!NT_STATUS_IS_OK(status)) { - ret = False; + ret = false; goto failed; } @@ -1532,13 +1532,13 @@ BOOL torture_rpc_samsync(struct torture_context *torture) status = dcerpc_lsa_OpenPolicy2(samsync_state->p_lsa, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("OpenPolicy2 failed - %s\n", nt_errstr(status)); - ret = False; + ret = false; goto failed; } status = torture_rpc_binding(torture, &b); if (!NT_STATUS_IS_OK(status)) { - ret = False; + ret = false; goto failed; } @@ -1561,21 +1561,21 @@ BOOL torture_rpc_samsync(struct torture_context *torture) if (!NT_STATUS_IS_OK(status)) { printf("Failed to connect to server as a BDC: %s\n", nt_errstr(status)); - ret = False; + ret = false; goto failed; } status = dcerpc_schannel_creds(samsync_state->p->conn->security_state.generic_state, samsync_state, &samsync_state->creds); if (!NT_STATUS_IS_OK(status)) { - ret = False; + ret = false; } status = torture_rpc_binding(torture, &b_netlogon_wksta); if (!NT_STATUS_IS_OK(status)) { - ret = False; + ret = false; goto failed; } @@ -1599,7 +1599,7 @@ BOOL torture_rpc_samsync(struct torture_context *torture) if (!NT_STATUS_IS_OK(status)) { printf("Failed to connect to server as a Workstation: %s\n", nt_errstr(status)); - ret = False; + ret = false; goto failed; } @@ -1607,22 +1607,22 @@ BOOL torture_rpc_samsync(struct torture_context *torture) samsync_state, &samsync_state->creds_netlogon_wksta); if (!NT_STATUS_IS_OK(status)) { printf("Failed to obtail schanel creds!\n"); - ret = False; + ret = false; } if (!test_DatabaseSync(samsync_state, mem_ctx)) { printf("DatabaseSync failed\n"); - ret = False; + ret = false; } if (!test_DatabaseDeltas(samsync_state, mem_ctx)) { printf("DatabaseDeltas failed\n"); - ret = False; + ret = false; } if (!test_DatabaseSync2(samsync_state->p, mem_ctx, samsync_state->creds)) { printf("DatabaseSync2 failed\n"); - ret = False; + ret = false; } failed: diff --git a/source4/torture/rpc/scanner.c b/source4/torture/rpc/scanner.c index 976279a8178..630e9cf1e43 100644 --- a/source4/torture/rpc/scanner.c +++ b/source4/torture/rpc/scanner.c @@ -52,7 +52,7 @@ static bool test_num_calls(struct torture_context *tctx, printf("Failed to connect to '%s' on '%s' - %s\n", uuid_str, iface->name, nt_errstr(status)); talloc_free(uuid_str); - return True; + return true; } /* make null calls */ @@ -60,7 +60,7 @@ static bool test_num_calls(struct torture_context *tctx, memset(stub_in.data, 0xFF, stub_in.length); for (i=0;i<200;i++) { - status = dcerpc_request(p, NULL, i, False, mem_ctx, &stub_in, &stub_out); + status = dcerpc_request(p, NULL, i, false, mem_ctx, &stub_in, &stub_out); if (!NT_STATUS_IS_OK(status) && p->last_fault_code == DCERPC_FAULT_OP_RNG_ERROR) { break; @@ -99,7 +99,7 @@ bool torture_rpc_scanner(struct torture_context *torture) NTSTATUS status; struct dcerpc_pipe *p; TALLOC_CTX *loop_ctx; - BOOL ret = True; + bool ret = true; const struct ndr_interface_list *l; struct dcerpc_binding *b; @@ -136,12 +136,12 @@ bool torture_rpc_scanner(struct torture_context *torture) status = torture_rpc_connection(torture, &p, &ndr_table_mgmt); if (!NT_STATUS_IS_OK(status)) { talloc_free(loop_ctx); - ret = False; + ret = false; continue; } if (!test_inq_if_ids(torture, p, torture, test_num_calls, l->table)) { - ret = False; + ret = false; } } diff --git a/source4/torture/rpc/schannel.c b/source4/torture/rpc/schannel.c index 69e18a40cd5..a1a83c69d77 100644 --- a/source4/torture/rpc/schannel.c +++ b/source4/torture/rpc/schannel.c @@ -161,12 +161,12 @@ static bool test_samr_ops(struct torture_context *tctx, if (!NT_STATUS_IS_OK(status)) { if (!NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED)) { printf("GetDomPwInfo op %d failed - %s\n", i, nt_errstr(status)); - return False; + return false; } } } - return True; + return true; } @@ -177,7 +177,7 @@ static bool test_lsa_ops(struct torture_context *tctx, struct dcerpc_pipe *p) { struct lsa_GetUserName r; NTSTATUS status; - BOOL ret = True; + bool ret = true; struct lsa_StringPointer authority_name_p; printf("\nTesting GetUserName\n"); @@ -194,30 +194,30 @@ static bool test_lsa_ops(struct torture_context *tctx, struct dcerpc_pipe *p) printf("not considering %s to be an error\n", nt_errstr(status)); } else if (!NT_STATUS_IS_OK(status)) { printf("GetUserName failed - %s\n", nt_errstr(status)); - return False; + return false; } else { if (!r.out.account_name) { - return False; + return false; } if (strcmp(r.out.account_name->string, "ANONYMOUS LOGON") != 0) { printf("GetUserName returned wrong user: %s, expected %s\n", r.out.account_name->string, "ANONYMOUS LOGON"); - return False; + return false; } if (!r.out.authority_name || !r.out.authority_name->string) { - return False; + return false; } if (strcmp(r.out.authority_name->string->string, "NT AUTHORITY") != 0) { printf("GetUserName returned wrong user: %s, expected %s\n", r.out.authority_name->string->string, "NT AUTHORITY"); - return False; + return false; } } if (!test_many_LookupSids(p, tctx, NULL)) { printf("LsaLookupSids3 failed!\n"); - return False; + return false; } return ret; @@ -388,7 +388,7 @@ static bool test_schannel(struct torture_context *tctx, */ bool torture_rpc_schannel(struct torture_context *torture) { - BOOL ret = True; + bool ret = true; struct { uint16_t acct_flags; uint32_t dcerpc_flags; diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c index 278228f7315..9cc42241d20 100644 --- a/source4/torture/rpc/spoolss.c +++ b/source4/torture/rpc/spoolss.c @@ -874,12 +874,12 @@ static bool test_AddPort(struct torture_context *tctx, if (!W_ERROR_IS_OK(r.out.result)) { printf("AddPort failed - %s\n", win_errstr(r.out.result)); - return False; + return false; } #endif - return True; + return true; } static bool test_GetJob(struct torture_context *tctx, @@ -987,7 +987,7 @@ static bool test_DoPrintTest(struct torture_context *tctx, struct dcerpc_pipe *p, struct policy_handle *handle) { - bool ret = True; + bool ret = true; NTSTATUS status; struct spoolss_StartDocPrinter s; struct spoolss_DocumentInfo1 info1; @@ -1211,7 +1211,7 @@ static bool test_EnumPrinterData(struct torture_context *tctx, struct dcerpc_pip } while (W_ERROR_IS_OK(r.out.result)); - return True; + return true; } static bool test_EnumPrinterDataEx(struct torture_context *tctx, @@ -1301,7 +1301,7 @@ static bool test_SecondaryClosePrinter(struct torture_context *tctx, /* only makes sense on SMB */ if (p->conn->transport.transport != NCACN_NP) { - return True; + return true; } torture_comment(tctx, "testing close on secondary pipe\n"); @@ -1387,7 +1387,7 @@ static bool test_OpenPrinter(struct torture_context *tctx, NTSTATUS status; struct spoolss_OpenPrinter r; struct policy_handle handle; - BOOL ret = True; + bool ret = true; r.in.printername = talloc_asprintf(tctx, "\\\\%s\\%s", dcerpc_server_name(p), name); r.in.datatype = NULL; @@ -1580,7 +1580,7 @@ static bool test_EnumPrinters_old(struct torture_context *tctx, struct dcerpc_pi } #if 0 -static BOOL test_GetPrinterDriver2(struct dcerpc_pipe *p, +static bool test_GetPrinterDriver2(struct dcerpc_pipe *p, struct policy_handle *handle, const char *driver_name) { @@ -1600,7 +1600,7 @@ static BOOL test_GetPrinterDriver2(struct dcerpc_pipe *p, status = dcerpc_spoolss_GetPrinterDriver2(p, tctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("GetPrinterDriver2 failed - %s\n", nt_errstr(status)); - return False; + return false; } if (W_ERROR_EQUAL(r.out.result, WERR_INSUFFICIENT_BUFFER)) { @@ -1611,16 +1611,16 @@ static BOOL test_GetPrinterDriver2(struct dcerpc_pipe *p, if (!NT_STATUS_IS_OK(status)) { printf("GetPrinterDriver2 failed - %s\n", nt_errstr(status)); - return False; + return false; } if (!W_ERROR_IS_OK(r.out.result)) { printf("GetPrinterDriver2 failed - %s\n", win_errstr(r.out.result)); - return False; + return false; } - return True; + return true; } #endif @@ -1706,12 +1706,12 @@ bool torture_rpc_spoolss(struct torture_context *torture) { NTSTATUS status; struct dcerpc_pipe *p; - BOOL ret = True; + bool ret = true; struct test_spoolss_context *ctx; status = torture_rpc_connection(torture, &p, &ndr_table_spoolss); if (!NT_STATUS_IS_OK(status)) { - return False; + return false; } ctx = talloc_zero(torture, struct test_spoolss_context); diff --git a/source4/torture/rpc/testjoin.c b/source4/torture/rpc/testjoin.c index b7e3b488c94..725799f2ddf 100644 --- a/source4/torture/rpc/testjoin.c +++ b/source4/torture/rpc/testjoin.c @@ -341,7 +341,7 @@ _PUBLIC_ struct test_join *torture_join_domain(const char *machine_name, } libnet_r->in.acct_type = acct_flags; - libnet_r->in.recreate_account = True; + libnet_r->in.recreate_account = true; status = libnet_JoinDomain(libnet_ctx, libnet_r, libnet_r); if (!NT_STATUS_IS_OK(status)) { diff --git a/source4/torture/rpc/unixinfo.c b/source4/torture/rpc/unixinfo.c index 2904e8b8dfc..cbe8cf0ff1b 100644 --- a/source4/torture/rpc/unixinfo.c +++ b/source4/torture/rpc/unixinfo.c @@ -42,7 +42,7 @@ static bool test_sidtouid(struct torture_context *tctx, struct dcerpc_pipe *p) if (NT_STATUS_EQUAL(NT_STATUS_NONE_MAPPED, status)) { } else torture_assert_ntstatus_ok(tctx, status, "SidToUid failed"); - return True; + return true; } /* diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c index c071327419d..796b180ddf6 100644 --- a/source4/torture/smb2/connect.c +++ b/source4/torture/smb2/connect.c @@ -189,7 +189,7 @@ static struct smb2_handle torture_smb2_create(struct smb2_tree *tree, /* basic testing of SMB2 connection calls */ -BOOL torture_smb2_connect(struct torture_context *torture) +bool torture_smb2_connect(struct torture_context *torture) { TALLOC_CTX *mem_ctx = talloc_new(NULL); struct smb2_tree *tree; @@ -197,7 +197,7 @@ BOOL torture_smb2_connect(struct torture_context *torture) NTSTATUS status; if (!torture_smb2_connection(mem_ctx, &tree)) { - return False; + return false; } h1 = torture_smb2_create(tree, "test9.dat"); @@ -205,56 +205,56 @@ BOOL torture_smb2_connect(struct torture_context *torture) status = torture_smb2_write(tree, h1); if (!NT_STATUS_IS_OK(status)) { printf("Write failed - %s\n", nt_errstr(status)); - return False; + return false; } status = torture_smb2_close(tree, h1); if (!NT_STATUS_IS_OK(status)) { printf("Close failed - %s\n", nt_errstr(status)); - return False; + return false; } status = torture_smb2_close(tree, h2); if (!NT_STATUS_IS_OK(status)) { printf("Close failed - %s\n", nt_errstr(status)); - return False; + return false; } status = smb2_util_close(tree, h1); if (!NT_STATUS_EQUAL(status, NT_STATUS_FILE_CLOSED)) { printf("close should have closed the handle - %s\n", nt_errstr(status)); - return False; + return false; } status = smb2_tdis(tree); if (!NT_STATUS_IS_OK(status)) { printf("tdis failed - %s\n", nt_errstr(status)); - return False; + return false; } status = smb2_tdis(tree); if (!NT_STATUS_EQUAL(status, NT_STATUS_NETWORK_NAME_DELETED)) { printf("tdis should have disabled session - %s\n", nt_errstr(status)); - return False; + return false; } status = smb2_logoff(tree->session); if (!NT_STATUS_IS_OK(status)) { printf("Logoff failed - %s\n", nt_errstr(status)); - return False; + return false; } status = smb2_logoff(tree->session); if (!NT_STATUS_EQUAL(status, NT_STATUS_USER_SESSION_DELETED)) { printf("Logoff should have disabled session - %s\n", nt_errstr(status)); - return False; + return false; } status = smb2_keepalive(tree->session->transport); if (!NT_STATUS_IS_OK(status)) { printf("keepalive failed? - %s\n", nt_errstr(status)); - return False; + return false; } talloc_free(mem_ctx); - return True; + return true; } diff --git a/source4/torture/smb2/find.c b/source4/torture/smb2/find.c index 2b4bde7865f..654866dfb5d 100644 --- a/source4/torture/smb2/find.c +++ b/source4/torture/smb2/find.c @@ -49,7 +49,7 @@ static struct { printf("(%s) %s/%s should be 0x%llx - 0x%llx\n", __location__, \ #call_name, #field, \ (long long)io.all_info2.out.field, (long long)d->stype.field); \ - ret = False; \ + ret = false; \ }} while (0) #define CHECK_CONST_STRING(call_name, stype, field, str) do { \ @@ -58,7 +58,7 @@ static struct { printf("(%s) %s/%s should be '%s' - '%s'\n", __location__, \ #call_name, #field, \ str, d->stype.field.s); \ - ret = False; \ + ret = false; \ }} while (0) static union smb_search_data *find_level(const char *name) @@ -75,26 +75,26 @@ static union smb_search_data *find_level(const char *name) /* test find levels */ -static BOOL torture_smb2_find_levels(struct smb2_tree *tree) +static bool torture_smb2_find_levels(struct smb2_tree *tree) { struct smb2_handle handle; NTSTATUS status; int i; struct smb2_find f; - BOOL ret = True; + bool ret = true; union smb_fileinfo io; const char *alt_name; status = smb2_create_complex_file(tree, FNAME, &handle); if (!NT_STATUS_IS_OK(status)) { - return False; + return false; } io.generic.level = RAW_FILEINFO_ALT_NAME_INFORMATION; io.generic.in.file.handle = handle; status = smb2_getinfo_file(tree, tree, &io); if (!NT_STATUS_IS_OK(status)) { - return False; + return false; } alt_name = talloc_strdup(tree, io.alt_name_info.out.fname.s); @@ -102,12 +102,12 @@ static BOOL torture_smb2_find_levels(struct smb2_tree *tree) io.generic.in.file.handle = handle; status = smb2_getinfo_file(tree, tree, &io); if (!NT_STATUS_IS_OK(status)) { - return False; + return false; } status = smb2_util_roothandle(tree, &handle); if (!NT_STATUS_IS_OK(status)) { - return False; + return false; } ZERO_STRUCT(f); @@ -130,7 +130,7 @@ static BOOL torture_smb2_find_levels(struct smb2_tree *tree) if (count != 1) { printf("Expected count 1 - got %d in %s\n", count, levels[i].name); - ret = False; + ret = false; } levels[i].data = d[0]; @@ -195,20 +195,20 @@ static BOOL torture_smb2_find_levels(struct smb2_tree *tree) /* basic testing of all SMB2 find levels */ -BOOL torture_smb2_find(struct torture_context *torture) +bool torture_smb2_find(struct torture_context *torture) { TALLOC_CTX *mem_ctx = talloc_new(NULL); struct smb2_tree *tree; - BOOL ret = True; + bool ret = true; NTSTATUS status; if (!torture_smb2_connection(mem_ctx, &tree)) { - return False; + return false; } status = torture_setup_complex_file(tree, FNAME); if (!NT_STATUS_IS_OK(status)) { - return False; + return false; } torture_setup_complex_file(tree, FNAME ":streamtwo"); diff --git a/source4/torture/smb2/getinfo.c b/source4/torture/smb2/getinfo.c index ab7d4e3110a..9ed0b9ddb59 100644 --- a/source4/torture/smb2/getinfo.c +++ b/source4/torture/smb2/getinfo.c @@ -77,7 +77,7 @@ static struct { /* test fileinfo levels */ -static BOOL torture_smb2_fileinfo(struct smb2_tree *tree) +static bool torture_smb2_fileinfo(struct smb2_tree *tree) { struct smb2_handle hfile, hdir; NTSTATUS status; @@ -131,17 +131,17 @@ static BOOL torture_smb2_fileinfo(struct smb2_tree *tree) } } - return True; + return true; failed: - return False; + return false; } /* test fsinfo levels */ -static BOOL torture_smb2_fsinfo(struct smb2_tree *tree) +static bool torture_smb2_fsinfo(struct smb2_tree *tree) { int i; NTSTATUS status; @@ -151,7 +151,7 @@ static BOOL torture_smb2_fsinfo(struct smb2_tree *tree) status = smb2_util_roothandle(tree, &handle); if (!NT_STATUS_IS_OK(status)) { printf("Unable to create test directory '%s' - %s\n", DNAME, nt_errstr(status)); - return False; + return false; } for (i=0;isession->transport->options.timeout = 3; for (opcode=0;opcode<1000;opcode++) { - req = smb2_request_init_tree(tree, opcode, 2, False, 0); + req = smb2_request_init_tree(tree, opcode, 2, false, 0); SSVAL(req->out.body, 0, 0); smb2_transport_send(req); if (!smb2_request_receive(req)) { @@ -227,7 +227,7 @@ BOOL torture_smb2_scan(struct torture_context *torture) event_context_find(mem_ctx)); if (!NT_STATUS_IS_OK(status)) { printf("Connection failed - %s\n", nt_errstr(status)); - return False; + return false; } tree->session->transport->options.timeout = 3; } else { @@ -238,5 +238,5 @@ BOOL torture_smb2_scan(struct torture_context *torture) talloc_free(mem_ctx); - return True; + return true; } diff --git a/source4/torture/smb2/setinfo.c b/source4/torture/smb2/setinfo.c index 88e8d07604d..6a81f13f67c 100644 --- a/source4/torture/smb2/setinfo.c +++ b/source4/torture/smb2/setinfo.c @@ -36,10 +36,10 @@ for each call we test that it succeeds, and where possible test for consistency between the calls. */ -BOOL torture_smb2_setinfo(struct torture_context *torture) +bool torture_smb2_setinfo(struct torture_context *torture) { struct smb2_tree *tree; - BOOL ret = True; + bool ret = true; TALLOC_CTX *mem_ctx = talloc_new(NULL); struct smb2_handle handle; char *fname; @@ -60,7 +60,7 @@ BOOL torture_smb2_setinfo(struct torture_context *torture) fname_new = talloc_asprintf(mem_ctx, BASEDIR "fnum_test_new_%d.txt", n); if (!torture_smb2_connection(mem_ctx, &tree)) { - return False; + return false; } #define RECREATE_FILE(fname) do { \ @@ -69,7 +69,7 @@ BOOL torture_smb2_setinfo(struct torture_context *torture) if (!NT_STATUS_IS_OK(status)) { \ printf("(%s) ERROR: open of %s failed (%s)\n", \ __location__, fname, nt_errstr(status)); \ - ret = False; \ + ret = false; \ goto done; \ }} while (0) @@ -87,7 +87,7 @@ BOOL torture_smb2_setinfo(struct torture_context *torture) if (!NT_STATUS_EQUAL(status, rightstatus)) { \ printf("(%s) %s - %s (should be %s)\n", __location__, #call, \ nt_errstr(status), nt_errstr(rightstatus)); \ - ret = False; \ + ret = false; \ goto done; \ } \ } while (0) @@ -99,7 +99,7 @@ BOOL torture_smb2_setinfo(struct torture_context *torture) status2 = smb2_getinfo_file(tree, mem_ctx, &finfo2); \ if (!NT_STATUS_IS_OK(status2)) { \ printf("(%s) %s - %s\n", __location__, #call, nt_errstr(status2)); \ - ret = False; \ + ret = false; \ goto done; \ } \ }} while (0) @@ -111,7 +111,7 @@ BOOL torture_smb2_setinfo(struct torture_context *torture) call_name, #stype, #field, \ (uint_t)value, (uint_t)finfo2.stype.out.field); \ torture_smb2_all_info(tree, handle); \ - ret = False; \ + ret = false; \ goto done; \ }} while (0) @@ -125,7 +125,7 @@ BOOL torture_smb2_setinfo(struct torture_context *torture) printf("\t%s", timestring(mem_ctx, value)); \ printf("\t%s\n", nt_time_string(mem_ctx, finfo2.stype.out.field)); \ torture_smb2_all_info(tree, handle); \ - ret = False; \ + ret = false; \ goto done; \ }} while (0) @@ -133,7 +133,7 @@ BOOL torture_smb2_setinfo(struct torture_context *torture) if (!NT_STATUS_EQUAL(status, correct)) { \ printf("(%s) Incorrect status %s - should be %s\n", \ __location__, nt_errstr(status), nt_errstr(correct)); \ - ret = False; \ + ret = false; \ goto done; \ }} while (0) @@ -262,7 +262,7 @@ BOOL torture_smb2_setinfo(struct torture_context *torture) NDR_PRINT_DEBUG(security_descriptor, finfo2.query_secdesc.out.sd); printf("expected:\n"); NDR_PRINT_DEBUG(security_descriptor, sd); - ret = False; + ret = false; } printf("remove it again\n"); @@ -281,7 +281,7 @@ BOOL torture_smb2_setinfo(struct torture_context *torture) NDR_PRINT_DEBUG(security_descriptor, finfo2.query_secdesc.out.sd); printf("expected:\n"); NDR_PRINT_DEBUG(security_descriptor, sd); - ret = False; + ret = false; } done: diff --git a/source4/torture/smb2/util.c b/source4/torture/smb2/util.c index 1852d9a984c..705f10a8418 100644 --- a/source4/torture/smb2/util.c +++ b/source4/torture/smb2/util.c @@ -94,7 +94,7 @@ NTSTATUS smb2_util_write(struct smb2_tree *tree, create a complex file/dir using the SMB2 protocol */ static NTSTATUS smb2_create_complex(struct smb2_tree *tree, const char *fname, - struct smb2_handle *handle, BOOL dir) + struct smb2_handle *handle, bool dir) { TALLOC_CTX *tmp_ctx = talloc_new(tree); char buf[7] = "abc"; @@ -199,7 +199,7 @@ static NTSTATUS smb2_create_complex(struct smb2_tree *tree, const char *fname, NTSTATUS smb2_create_complex_file(struct smb2_tree *tree, const char *fname, struct smb2_handle *handle) { - return smb2_create_complex(tree, fname, handle, False); + return smb2_create_complex(tree, fname, handle, false); } /* @@ -208,7 +208,7 @@ NTSTATUS smb2_create_complex_file(struct smb2_tree *tree, const char *fname, NTSTATUS smb2_create_complex_dir(struct smb2_tree *tree, const char *fname, struct smb2_handle *handle) { - return smb2_create_complex(tree, fname, handle, True); + return smb2_create_complex(tree, fname, handle, true); } /* @@ -302,7 +302,7 @@ void torture_smb2_all_info(struct smb2_tree *tree, struct smb2_handle handle) /* open a smb2 connection */ -BOOL torture_smb2_connection(TALLOC_CTX *mem_ctx, struct smb2_tree **tree) +bool torture_smb2_connection(TALLOC_CTX *mem_ctx, struct smb2_tree **tree) { NTSTATUS status; const char *host = lp_parm_string(global_loadparm, NULL, "torture", "host"); @@ -314,9 +314,9 @@ BOOL torture_smb2_connection(TALLOC_CTX *mem_ctx, struct smb2_tree **tree) if (!NT_STATUS_IS_OK(status)) { printf("Failed to connect to SMB2 share \\\\%s\\%s - %s\n", host, share, nt_errstr(status)); - return False; + return false; } - return True; + return true; } diff --git a/source4/torture/smbtorture.c b/source4/torture/smbtorture.c index 76ff3d97fad..ea563f7d634 100644 --- a/source4/torture/smbtorture.c +++ b/source4/torture/smbtorture.c @@ -493,7 +493,7 @@ int main(int argc,char *argv[]) static const char *target = "other"; struct dcerpc_binding *binding_struct; NTSTATUS status; - int shell = False; + int shell = false; static const char *ui_ops_name = "simple"; const char *basedir = NULL; const char *extra_module = NULL; @@ -520,7 +520,7 @@ int main(int argc,char *argv[]) {"dangerous", 'X', POPT_ARG_NONE, NULL, OPT_DANGEROUS, "run dangerous tests (eg. wiping out password database)", NULL}, {"load-module", 0, POPT_ARG_STRING, &extra_module, 0, "load tests from DSO file", "SOFILE"}, - {"shell", 0, POPT_ARG_NONE, &shell, True, "Run shell", NULL}, + {"shell", 0, POPT_ARG_NONE, &shell, true, "Run shell", NULL}, {"target", 'T', POPT_ARG_STRING, &target, 0, "samba3|samba4|other", NULL}, {"async", 'a', POPT_ARG_NONE, NULL, OPT_ASYNC, "run async tests", NULL}, diff --git a/source4/torture/ui.c b/source4/torture/ui.c index 5544c6961ea..5d00b664f4e 100644 --- a/source4/torture/ui.c +++ b/source4/torture/ui.c @@ -105,8 +105,8 @@ struct torture_suite *torture_suite_create(TALLOC_CTX *ctx, const char *name) } void torture_tcase_set_fixture(struct torture_tcase *tcase, - BOOL (*setup) (struct torture_context *, void **), - BOOL (*teardown) (struct torture_context *, void *)) + bool (*setup) (struct torture_context *, void **), + bool (*teardown) (struct torture_context *, void *)) { tcase->setup = setup; tcase->teardown = teardown; @@ -155,7 +155,7 @@ bool torture_suite_init_tcase(struct torture_suite *suite, tcase->description = NULL; tcase->setup = NULL; tcase->teardown = NULL; - tcase->fixture_persistent = True; + tcase->fixture_persistent = true; tcase->tests = NULL; DLIST_ADD_END(suite->testcases, tcase, struct torture_tcase *); @@ -175,10 +175,10 @@ struct torture_tcase *torture_suite_add_tcase(struct torture_suite *suite, return tcase; } -BOOL torture_run_suite(struct torture_context *context, +bool torture_run_suite(struct torture_context *context, struct torture_suite *suite) { - BOOL ret = True; + bool ret = true; struct torture_tcase *tcase; struct torture_suite *tsuite; char *old_testname; @@ -310,10 +310,10 @@ static bool internal_torture_run_test(struct torture_context *context, return success; } -BOOL torture_run_tcase(struct torture_context *context, +bool torture_run_tcase(struct torture_context *context, struct torture_tcase *tcase) { - BOOL ret = True; + bool ret = true; char *old_testname; struct torture_test *test; @@ -358,7 +358,7 @@ done: return ret; } -BOOL torture_run_test(struct torture_context *context, +bool torture_run_test(struct torture_context *context, struct torture_tcase *tcase, struct torture_test *test) { diff --git a/source4/torture/unix/unix_info2.c b/source4/torture/unix/unix_info2.c index 1e063fbe8f8..882dc7a0848 100644 --- a/source4/torture/unix/unix_info2.c +++ b/source4/torture/unix/unix_info2.c @@ -67,7 +67,7 @@ static struct smbcli_state *connect_to_server(struct torture_context *tctx) return cli; } -static BOOL check_unix_info2(struct torture_context *torture, +static bool check_unix_info2(struct torture_context *torture, struct unix_info2 *info2) { printf("\tcreate_time=0x%016llu flags=0x%08x mask=0x%08x\n", @@ -75,7 +75,7 @@ static BOOL check_unix_info2(struct torture_context *torture, info2->file_flags, info2->flags_mask); if (info2->file_flags == 0) { - return True; + return true; } /* If we have any file_flags set, they must be within the range @@ -88,7 +88,7 @@ static BOOL check_unix_info2(struct torture_context *torture, info2->file_flags, info2->flags_mask); } - return True; + return true; } static NTSTATUS set_path_info2(void *mem_ctx, @@ -122,7 +122,7 @@ static NTSTATUS set_path_info2(void *mem_ctx, return smb_raw_setpathinfo(cli->tree, &sfinfo); } -static BOOL query_file_path_info2(void *mem_ctx, +static bool query_file_path_info2(void *mem_ctx, struct torture_context *torture, struct smbcli_state *cli, int fnum, @@ -163,13 +163,13 @@ static BOOL query_file_path_info2(void *mem_ctx, info2->flags_mask = finfo.unix_info2.out.flags_mask; if (!check_unix_info2(torture, info2)) { - return False; + return false; } - return True; + return true; } -static BOOL query_file_info2(void *mem_ctx, +static bool query_file_info2(void *mem_ctx, struct torture_context *torture, struct smbcli_state *cli, int fnum, @@ -179,7 +179,7 @@ static BOOL query_file_info2(void *mem_ctx, fnum, NULL, info2); } -static BOOL query_path_info2(void *mem_ctx, +static bool query_path_info2(void *mem_ctx, struct torture_context *torture, struct smbcli_state *cli, const char *fname, @@ -189,7 +189,7 @@ static BOOL query_path_info2(void *mem_ctx, -1, fname, info2); } -static BOOL search_callback(void *private, const union smb_search_data *fdata) +static bool search_callback(void *private, const union smb_search_data *fdata) { struct unix_info2 *info2 = (struct unix_info2 *)private; @@ -210,10 +210,10 @@ static BOOL search_callback(void *private, const union smb_search_data *fdata) info2->file_flags = fdata->unix_info2.file_flags; info2->flags_mask = fdata->unix_info2.flags_mask; - return True; + return true; } -static BOOL find_single_info2(void *mem_ctx, +static bool find_single_info2(void *mem_ctx, struct torture_context *torture, struct smbcli_state *cli, const char *fname, @@ -267,7 +267,7 @@ static void set_no_metadata_change(struct unix_info2 *info2) ((uint64_t)SMB_SIZE_NO_CHANGE_HI << 32) | SMB_SIZE_NO_CHANGE_LO; } -static BOOL verify_setinfo_flags(void *mem_ctx, +static bool verify_setinfo_flags(void *mem_ctx, struct torture_context *torture, struct smbcli_state *cli, const char *fname) @@ -276,11 +276,11 @@ static BOOL verify_setinfo_flags(void *mem_ctx, uint32_t smb_fmask; int i; - BOOL ret = True; + bool ret = true; NTSTATUS status; if (!query_path_info2(mem_ctx, torture, cli, fname, &info2)) { - return False; + return false; } smb_fmask = info2.flags_mask; @@ -302,7 +302,7 @@ static BOOL verify_setinfo_flags(void *mem_ctx, if (!query_path_info2(mem_ctx, torture, cli, fname, &info2)) { - return False; + return false; } ASSERT_FLAGS_MATCH(&info2, 1 << i); @@ -339,7 +339,7 @@ static int create_file(struct smbcli_state *cli, const char * fname) 0, 0); } -static BOOL match_info2(struct torture_context *torture, +static bool match_info2(struct torture_context *torture, const struct unix_info2 *pinfo, const struct unix_info2 *finfo) { @@ -382,13 +382,13 @@ static BOOL match_info2(struct torture_context *torture, torture_assert_u64_equal(torture, finfo->create_time, pinfo->create_time, "create_time mismatch"); - return True; + return true; } #define FILENAME "\\smb_unix_info2.txt" -BOOL unix_torture_unix_info2(struct torture_context *torture) +bool unix_torture_unix_info2(struct torture_context *torture) { void *mem_ctx; struct smbcli_state *cli; @@ -401,7 +401,7 @@ BOOL unix_torture_unix_info2(struct torture_context *torture) if (!(cli = connect_to_server(torture))) { talloc_free(mem_ctx); - return False; + return false; } smbcli_unlink(cli->tree, FILENAME); @@ -442,7 +442,7 @@ BOOL unix_torture_unix_info2(struct torture_context *torture) smbcli_unlink(cli->tree, FILENAME); torture_close_connection(cli); talloc_free(mem_ctx); - return True; + return true; fail: @@ -450,7 +450,7 @@ fail: smbcli_unlink(cli->tree, FILENAME); torture_close_connection(cli); talloc_free(mem_ctx); - return False; + return false; } diff --git a/source4/torture/unix/whoami.c b/source4/torture/unix/whoami.c index bc2f4382bbd..f45d2345db6 100644 --- a/source4/torture/unix/whoami.c +++ b/source4/torture/unix/whoami.c @@ -88,7 +88,7 @@ static struct smbcli_state *connect_to_server(void *mem_ctx, return cli; } -static BOOL sid_parse(void *mem_ctx, +static bool sid_parse(void *mem_ctx, struct torture_context *torture, DATA_BLOB *data, size_t *offset, struct dom_sid **psid) @@ -126,10 +126,10 @@ static BOOL sid_parse(void *mem_ctx, (*offset) += 4; } - return True; + return true; } -static BOOL smb_raw_query_posix_whoami(void *mem_ctx, +static bool smb_raw_query_posix_whoami(void *mem_ctx, struct torture_context *torture, struct smbcli_state *cli, struct smb_whoami *whoami, @@ -205,7 +205,7 @@ static BOOL smb_raw_query_posix_whoami(void *mem_ctx, "invalid SID count"); torture_assert_int_equal(torture, whoami->num_sid_bytes, 0, "invalid SID byte count"); - return True; + return true; } if (whoami->num_gids != 0) { @@ -233,7 +233,7 @@ static BOOL smb_raw_query_posix_whoami(void *mem_ctx, if (tp.out.data.length == offset) { torture_assert_int_equal(torture, whoami->num_sids, 0, "invalid SID count"); - return True; + return true; } /* All the remaining bytes must be the SID list. */ @@ -252,7 +252,7 @@ static BOOL smb_raw_query_posix_whoami(void *mem_ctx, if (!sid_parse(mem_ctx, torture, &tp.out.data, &offset, &whoami->sid_list[i])) { - return False; + return false; } } @@ -262,10 +262,10 @@ static BOOL smb_raw_query_posix_whoami(void *mem_ctx, torture_assert_int_equal(torture, tp.out.data.length, offset, "trailing garbage bytes"); - return True; + return true; } -BOOL torture_unix_whoami(struct torture_context *torture) +bool torture_unix_whoami(struct torture_context *torture) { struct smbcli_state *cli; struct cli_credentials *anon_credentials; @@ -332,11 +332,11 @@ BOOL torture_unix_whoami(struct torture_context *torture) } talloc_free(mem_ctx); - return True; + return true; fail: talloc_free(mem_ctx); - return False; + return false; } diff --git a/source4/torture/util.c b/source4/torture/util.c index 713004d8d2b..0e9dda42fa4 100644 --- a/source4/torture/util.c +++ b/source4/torture/util.c @@ -27,7 +27,7 @@ /** check if 2 NTTIMEs are equal. */ -BOOL nt_time_equal(NTTIME *t1, NTTIME *t2) +bool nt_time_equal(NTTIME *t1, NTTIME *t2) { return *t1 == *t2; } @@ -46,7 +46,7 @@ NTSTATUS torture_second_tcon(TALLOC_CTX *mem_ctx, return NT_STATUS_NO_MEMORY; } - result = smbcli_tree_init(session, tmp_ctx, False); + result = smbcli_tree_init(session, tmp_ctx, false); if (result == NULL) { talloc_free(tmp_ctx); return NT_STATUS_NO_MEMORY; diff --git a/source4/torture/util_smb.c b/source4/torture/util_smb.c index 10d48313263..21cdba89eba 100644 --- a/source4/torture/util_smb.c +++ b/source4/torture/util_smb.c @@ -43,9 +43,9 @@ _PUBLIC_ bool torture_setup_dir(struct smbcli_state *cli, const char *dname) if (smbcli_deltree(cli->tree, dname) == -1 || NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, dname))) { printf("Unable to setup %s - %s\n", dname, smbcli_errstr(cli->tree)); - return False; + return false; } - return True; + return true; } /* @@ -287,13 +287,13 @@ bool wire_bad_flags(struct smb_wire_string *str, int flags, struct smbcli_transp { bool server_unicode; int len; - if (!str || !str->s) return True; + if (!str || !str->s) return true; len = strlen(str->s); if (flags & STR_TERMINATE) len++; - server_unicode = (transport->negotiate.capabilities&CAP_UNICODE)?True:False; + server_unicode = (transport->negotiate.capabilities&CAP_UNICODE)?true:false; if (getenv("CLI_FORCE_ASCII") || !lp_unicode(global_loadparm)) { - server_unicode = False; + server_unicode = false; } if ((flags & STR_UNICODE) || server_unicode) { @@ -304,9 +304,9 @@ bool wire_bad_flags(struct smb_wire_string *str, int flags, struct smbcli_transp if (str->private_length != len) { printf("Expected wire_length %d but got %d for '%s'\n", len, str->private_length, str->s); - return True; + return true; } - return False; + return false; } /* @@ -385,7 +385,7 @@ NTSTATUS torture_set_sparse(struct smbcli_tree *tree, int fnum) nt.ntioctl.level = RAW_IOCTL_NTIOCTL; nt.ntioctl.in.function = FSCTL_SET_SPARSE; nt.ntioctl.in.file.fnum = fnum; - nt.ntioctl.in.fsctl = True; + nt.ntioctl.in.fsctl = true; nt.ntioctl.in.filter = 0; nt.ntioctl.in.max_data = 0; nt.ntioctl.in.blob = data_blob(NULL, 0); @@ -476,7 +476,7 @@ _PUBLIC_ bool torture_open_connection_share(TALLOC_CTX *mem_ctx, cmdline_credentials, ev); if (!NT_STATUS_IS_OK(status)) { printf("Failed to open connection - %s\n", nt_errstr(status)); - return False; + return false; } (*c)->transport->options.use_oplocks = lp_parm_bool(global_loadparm, NULL, "torture", @@ -484,7 +484,7 @@ _PUBLIC_ bool torture_open_connection_share(TALLOC_CTX *mem_ctx, (*c)->transport->options.use_level2_oplocks = lp_parm_bool(global_loadparm, NULL, "torture", "use_level2_oplocks", false); - return True; + return true; } _PUBLIC_ bool torture_get_conn_index(int conn_index, @@ -500,24 +500,24 @@ _PUBLIC_ bool torture_get_conn_index(int conn_index, p = lp_parm_string(global_loadparm, NULL, "torture", "unclist"); if (!p) { - return True; + return true; } unc_list = file_lines_load(p, &num_unc_names, NULL); if (!unc_list || num_unc_names <= 0) { DEBUG(0,("Failed to load unc names list from '%s'\n", p)); - return False; + return false; } if (!smbcli_parse_unc(unc_list[conn_index % num_unc_names], mem_ctx, host, share)) { DEBUG(0, ("Failed to parse UNC name %s\n", unc_list[conn_index % num_unc_names])); - return False; + return false; } talloc_free(unc_list); - return True; + return true; } @@ -530,7 +530,7 @@ _PUBLIC_ bool torture_open_connection_ev(struct smbcli_state **c, bool ret; if (!torture_get_conn_index(conn_index, ev, &host, &share)) { - return False; + return false; } ret = torture_open_connection_share(NULL, c, host, share, ev); @@ -550,11 +550,11 @@ _PUBLIC_ bool torture_open_connection(struct smbcli_state **c, int conn_index) _PUBLIC_ bool torture_close_connection(struct smbcli_state *c) { - bool ret = True; - if (!c) return True; + bool ret = true; + if (!c) return true; if (NT_STATUS_IS_ERR(smbcli_tdis(c))) { printf("tdis failed (%s)\n", smbcli_errstr(c->tree)); - ret = False; + ret = false; } talloc_free(c); return ret; @@ -577,17 +577,17 @@ _PUBLIC_ bool check_error(const char *location, struct smbcli_state *c, printf(" expected %s or %s (at %s)\n", nt_errstr(NT_STATUS_DOS(eclass, ecode)), nt_errstr(nterr), location); - return False; + return false; } } else { if (!NT_STATUS_EQUAL(nterr, status)) { printf("unexpected error code %s\n", nt_errstr(status)); printf(" expected %s (at %s)\n", nt_errstr(nterr), location); - return False; + return false; } } - return True; + return true; } static struct smbcli_state *current_cli; @@ -609,7 +609,7 @@ double torture_create_procs(struct torture_context *tctx, double start_time_limit = 10 + (torture_nprocs * 1.5); struct timeval tv; - *result = True; + *result = true; synccount = 0; @@ -629,7 +629,7 @@ double torture_create_procs(struct torture_context *tctx, for (i = 0; i < torture_nprocs; i++) { child_status[i] = 0; - child_status_out[i] = True; + child_status_out[i] = true; } tv = timeval_current(); @@ -684,7 +684,7 @@ double torture_create_procs(struct torture_context *tctx, if (synccount != torture_nprocs) { printf("FAILED TO START %d CLIENTS (started %d)\n", torture_nprocs, synccount); - *result = False; + *result = false; return timeval_elapsed(&tv); } @@ -704,7 +704,7 @@ double torture_create_procs(struct torture_context *tctx, int ret; while ((ret=waitpid(0, &status, 0)) == -1 && errno == EINTR) /* noop */ ; if (ret == -1 || WEXITSTATUS(status) != 0) { - *result = False; + *result = false; } } @@ -712,7 +712,7 @@ double torture_create_procs(struct torture_context *tctx, for (i=0;i