diff options
author | Jeremy Allison <jra@samba.org> | 2007-10-18 17:40:25 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2007-10-18 17:40:25 -0700 |
commit | 30191d1a5704ad2b158386b511558972d539ce47 (patch) | |
tree | 4f46e5c4f28f672ab661aa18f45745860970a88c /source3/lib | |
parent | 789856f63ff73fec66298e95c91c60db7bdaf14e (diff) | |
download | samba-30191d1a5704ad2b158386b511558972d539ce47.tar.gz samba-30191d1a5704ad2b158386b511558972d539ce47.tar.bz2 samba-30191d1a5704ad2b158386b511558972d539ce47.zip |
RIP BOOL. Convert BOOL -> bool. I found a few interesting
bugs in various places whilst doing this (places that assumed
BOOL == int). I also need to fix the Samba4 pidl generation
(next checkin).
Jeremy.
(This used to be commit f35a266b3cbb3e5fa6a86be60f34fe340a3ca71f)
Diffstat (limited to 'source3/lib')
50 files changed, 268 insertions, 268 deletions
diff --git a/source3/lib/account_pol.c b/source3/lib/account_pol.c index 516755426a..96a471cf06 100644 --- a/source3/lib/account_pol.c +++ b/source3/lib/account_pol.c @@ -166,7 +166,7 @@ int account_policy_name_to_fieldnum(const char *name) Get default value for account policy *****************************************************************************/ -BOOL account_policy_get_default(int account_policy, uint32 *val) +bool account_policy_get_default(int account_policy, uint32 *val) { int i; for (i=0; account_policy_names[i].field; i++) { @@ -184,7 +184,7 @@ BOOL account_policy_get_default(int account_policy, uint32 *val) Set default for a field if it is empty *****************************************************************************/ -static BOOL account_policy_set_default_on_empty(int account_policy) +static bool account_policy_set_default_on_empty(int account_policy) { uint32 value; @@ -201,7 +201,7 @@ static BOOL account_policy_set_default_on_empty(int account_policy) Open the account policy tdb. ***`*************************************************************************/ -BOOL init_account_policy(void) +bool init_account_policy(void) { const char *vstring = "INFO/version"; @@ -262,7 +262,7 @@ BOOL init_account_policy(void) Get an account policy (from tdb) *****************************************************************************/ -BOOL account_policy_get(int field, uint32 *value) +bool account_policy_get(int field, uint32 *value) { const char *name; uint32 regval; @@ -299,7 +299,7 @@ BOOL account_policy_get(int field, uint32 *value) Set an account policy (in tdb) ****************************************************************************/ -BOOL account_policy_set(int field, uint32 value) +bool account_policy_set(int field, uint32 value) { const char *name; @@ -327,12 +327,12 @@ BOOL account_policy_set(int field, uint32 value) Set an account policy in the cache ****************************************************************************/ -BOOL cache_account_policy_set(int field, uint32 value) +bool cache_account_policy_set(int field, uint32 value) { const char *policy_name = NULL; char *cache_key = NULL; char *cache_value = NULL; - BOOL ret = False; + bool ret = False; policy_name = decode_account_policy_name(field); if (policy_name == NULL) { @@ -364,12 +364,12 @@ BOOL cache_account_policy_set(int field, uint32 value) Get an account policy from the cache *****************************************************************************/ -BOOL cache_account_policy_get(int field, uint32 *value) +bool cache_account_policy_get(int field, uint32 *value) { const char *policy_name = NULL; char *cache_key = NULL; char *cache_value = NULL; - BOOL ret = False; + bool ret = False; policy_name = decode_account_policy_name(field); if (policy_name == NULL) { diff --git a/source3/lib/adt_tree.c b/source3/lib/adt_tree.c index cf305d7307..ef72ba3e70 100644 --- a/source3/lib/adt_tree.c +++ b/source3/lib/adt_tree.c @@ -24,7 +24,7 @@ /************************************************************************** *************************************************************************/ -static BOOL trim_tree_keypath( char *path, char **base, char **new_path ) +static bool trim_tree_keypath( char *path, char **base, char **new_path ) { char *p; @@ -191,11 +191,11 @@ static TREE_NODE* pathtree_find_child( TREE_NODE *node, char* key ) Add a new node into the tree given a key path and a blob of data *************************************************************************/ - BOOL pathtree_add( SORTED_TREE *tree, const char *path, void *data_p ) + bool pathtree_add( SORTED_TREE *tree, const char *path, void *data_p ) { char *str, *base, *path2; TREE_NODE *current, *next; - BOOL ret = True; + bool ret = True; DEBUG(8,("pathtree_add: Enter\n")); diff --git a/source3/lib/afs.c b/source3/lib/afs.c index 3adab490e9..e9a7059028 100644 --- a/source3/lib/afs.c +++ b/source3/lib/afs.c @@ -72,7 +72,7 @@ static char *afs_encode_token(const char *cell, const DATA_BLOB ticket, /* Create a ClearToken and an encrypted ticket. ClearToken has not yet the * ViceId set, this should be set by the caller. */ -static BOOL afs_createtoken(const char *username, const char *cell, +static bool afs_createtoken(const char *username, const char *cell, DATA_BLOB *ticket, struct ClearToken *ct) { fstring clear_ticket; @@ -208,14 +208,14 @@ char *afs_createtoken_str(const char *username, const char *cell) For the comments "Alice" is the User to be auth'ed, and "Bob" is the AFS server. */ -BOOL afs_login(connection_struct *conn) +bool afs_login(connection_struct *conn) { extern userdom_struct current_user_info; extern struct current_user current_user; DATA_BLOB ticket; pstring afs_username; char *cell; - BOOL result; + bool result; char *ticket_str; const DOM_SID *user_sid; @@ -268,7 +268,7 @@ BOOL afs_login(connection_struct *conn) #else -BOOL afs_login(connection_struct *conn) +bool afs_login(connection_struct *conn) { return True; } diff --git a/source3/lib/afs_settoken.c b/source3/lib/afs_settoken.c index 70768a6c9a..aeef1c3520 100644 --- a/source3/lib/afs_settoken.c +++ b/source3/lib/afs_settoken.c @@ -48,7 +48,7 @@ struct ClearToken { uint32 EndTimestamp; }; -static BOOL afs_decode_token(const char *string, char **cell, +static bool afs_decode_token(const char *string, char **cell, DATA_BLOB *ticket, struct ClearToken *ct) { DATA_BLOB blob; @@ -151,7 +151,7 @@ static BOOL afs_decode_token(const char *string, char **cell, to avoid. */ -static BOOL afs_settoken(const char *cell, +static bool afs_settoken(const char *cell, const struct ClearToken *ctok, DATA_BLOB ticket) { @@ -207,11 +207,11 @@ static BOOL afs_settoken(const char *cell, return (ret == 0); } -BOOL afs_settoken_str(const char *token_string) +bool afs_settoken_str(const char *token_string) { DATA_BLOB ticket; struct ClearToken ct; - BOOL result; + bool result; char *cell; if (!afs_decode_token(token_string, &cell, &ticket, &ct)) @@ -230,7 +230,7 @@ BOOL afs_settoken_str(const char *token_string) #else -BOOL afs_settoken_str(const char *token_string) +bool afs_settoken_str(const char *token_string) { return False; } diff --git a/source3/lib/audit.c b/source3/lib/audit.c index b4a2c23c07..0eb12a95e6 100644 --- a/source3/lib/audit.c +++ b/source3/lib/audit.c @@ -88,7 +88,7 @@ const char *audit_description_str(uint32 category) return NULL; } -BOOL get_audit_category_from_param(const char *param, uint32 *audit_category) +bool get_audit_category_from_param(const char *param, uint32 *audit_category) { *audit_category = Undefined; diff --git a/source3/lib/bitmap.c b/source3/lib/bitmap.c index 1f7475bc03..5e623f474a 100644 --- a/source3/lib/bitmap.c +++ b/source3/lib/bitmap.c @@ -99,7 +99,7 @@ int bitmap_copy(struct bitmap * const dst, const struct bitmap * const src) /**************************************************************************** set a bit in a bitmap ****************************************************************************/ -BOOL bitmap_set(struct bitmap *bm, unsigned i) +bool bitmap_set(struct bitmap *bm, unsigned i) { if (i >= bm->n) { DEBUG(0,("Setting invalid bitmap entry %d (of %d)\n", @@ -113,7 +113,7 @@ BOOL bitmap_set(struct bitmap *bm, unsigned i) /**************************************************************************** clear a bit in a bitmap ****************************************************************************/ -BOOL bitmap_clear(struct bitmap *bm, unsigned i) +bool bitmap_clear(struct bitmap *bm, unsigned i) { if (i >= bm->n) { DEBUG(0,("clearing invalid bitmap entry %d (of %d)\n", @@ -127,7 +127,7 @@ BOOL bitmap_clear(struct bitmap *bm, unsigned i) /**************************************************************************** query a bit in a bitmap ****************************************************************************/ -BOOL bitmap_query(struct bitmap *bm, unsigned i) +bool bitmap_query(struct bitmap *bm, unsigned i) { if (i >= bm->n) return False; if (bm->b[i/32] & (1<<(i%32))) { diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c index b1e3d3bdcf..7c3545dab1 100644 --- a/source3/lib/charcnv.c +++ b/source3/lib/charcnv.c @@ -46,7 +46,7 @@ char lp_failed_convert_char(void) static smb_iconv_t conv_handles[NUM_CHARSETS][NUM_CHARSETS]; -static BOOL conv_silent; /* Should we do a debug if the conversion fails ? */ +static bool conv_silent; /* Should we do a debug if the conversion fails ? */ /** * Return the name of a charset to give to iconv(). @@ -128,7 +128,7 @@ void gfree_charcnv(void) void init_iconv(void) { int c1, c2; - BOOL did_reload = False; + bool did_reload = False; /* so that charset_name() works we need to get the UNIX<->UCS2 going first */ @@ -201,7 +201,7 @@ void init_iconv(void) static size_t convert_string_internal(charset_t from, charset_t to, void const *src, size_t srclen, - void *dest, size_t destlen, BOOL allow_bad_conv) + void *dest, size_t destlen, bool allow_bad_conv) { size_t i_len, o_len; size_t retval; @@ -375,7 +375,7 @@ static size_t convert_string_internal(charset_t from, charset_t to, size_t convert_string(charset_t from, charset_t to, void const *src, size_t srclen, - void *dest, size_t destlen, BOOL allow_bad_conv) + void *dest, size_t destlen, bool allow_bad_conv) { /* * NB. We deliberately don't do a strlen here if srclen == -1. @@ -523,7 +523,7 @@ size_t convert_string(charset_t from, charset_t to, **/ size_t convert_string_allocate(TALLOC_CTX *ctx, charset_t from, charset_t to, - void const *src, size_t srclen, void *dst, BOOL allow_bad_conv) + void const *src, size_t srclen, void *dst, bool allow_bad_conv) { size_t i_len, o_len, destlen = MAX(srclen, 512); size_t retval; @@ -724,7 +724,7 @@ size_t convert_string_allocate(TALLOC_CTX *ctx, charset_t from, charset_t to, **/ size_t convert_string_talloc(TALLOC_CTX *ctx, charset_t from, charset_t to, void const *src, size_t srclen, void *dst, - BOOL allow_bad_conv) + bool allow_bad_conv) { void **dest = (void **)dst; size_t dest_len; diff --git a/source3/lib/conn_tdb.c b/source3/lib/conn_tdb.c index d9552c5f07..dd0a354a85 100644 --- a/source3/lib/conn_tdb.c +++ b/source3/lib/conn_tdb.c @@ -19,7 +19,7 @@ #include "includes.h" -static struct db_context *connections_db_ctx(BOOL rw) +static struct db_context *connections_db_ctx(bool rw) { static struct db_context *db_ctx; @@ -120,7 +120,7 @@ int connections_forall(int (*fn)(struct db_record *rec, return connections_traverse(conn_traverse_fn, (void *)&state); } -BOOL connections_init(BOOL rw) +bool connections_init(bool rw) { return (connections_db_ctx(rw) != NULL); } diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c index 08ab256acc..2892b8f6ab 100644 --- a/source3/lib/ctdbd_conn.c +++ b/source3/lib/ctdbd_conn.c @@ -155,7 +155,7 @@ static NTSTATUS ctdbd_connect(TALLOC_CTX *mem_ctx, * Do we have a complete ctdb packet in the queue? */ -static BOOL ctdb_req_complete(const struct data_blob *data, +static bool ctdb_req_complete(const struct data_blob *data, size_t *length, void *private_data) { @@ -765,7 +765,7 @@ static NTSTATUS ctdbd_control(struct ctdbd_connection *conn, /* * see if a remote process exists */ -BOOL ctdbd_process_exists(struct ctdbd_connection *conn, uint32 vnn, pid_t pid) +bool ctdbd_process_exists(struct ctdbd_connection *conn, uint32 vnn, pid_t pid) { NTSTATUS status; TDB_DATA data; diff --git a/source3/lib/debug.c b/source3/lib/debug.c index 69da08be77..72285277ec 100644 --- a/source3/lib/debug.c +++ b/source3/lib/debug.c @@ -79,15 +79,15 @@ XFILE *dbf = NULL; pstring debugf = ""; -BOOL debug_warn_unknown_class = True; -BOOL debug_auto_add_unknown_class = True; -BOOL AllowDebugChange = True; +bool debug_warn_unknown_class = True; +bool debug_auto_add_unknown_class = True; +bool AllowDebugChange = True; /* used to check if the user specified a logfile on the command line */ -BOOL override_logfile; +bool override_logfile; /* @@ -95,11 +95,11 @@ BOOL override_logfile; * system has been initialised. */ static int debug_all_class_hack = 1; -static BOOL debug_all_class_isset_hack = True; +static bool debug_all_class_isset_hack = True; static int debug_num_classes = 0; int *DEBUGLEVEL_CLASS = &debug_all_class_hack; -BOOL *DEBUGLEVEL_CLASS_ISSET = &debug_all_class_isset_hack; +bool *DEBUGLEVEL_CLASS_ISSET = &debug_all_class_isset_hack; /* DEBUGLEVEL is #defined to *debug_level */ int DEBUGLEVEL = &debug_all_class_hack; @@ -132,14 +132,14 @@ int DEBUGLEVEL = &debug_all_class_hack; * are unable to open a new log file for some reason. */ -static BOOL stdout_logging = False; +static bool stdout_logging = False; static int debug_count = 0; #ifdef WITH_SYSLOG static int syslog_level = 0; #endif static pstring format_bufr = { '\0' }; static size_t format_pos = 0; -static BOOL log_overflow = False; +static bool log_overflow = False; /* * Define all the debug class selection names here. Names *MUST NOT* contain @@ -211,7 +211,7 @@ static char *debug_list_class_names_and_levels(void) char **list; char *buf = NULL; char *b; - BOOL err = False; + bool err = False; if (DEBUGLEVEL_CLASS == &debug_all_class_hack) { return NULL; @@ -334,10 +334,10 @@ int debug_add_class(const char *classname) if (new_ptr == &debug_all_class_isset_hack) { new_ptr = NULL; } - new_ptr = SMB_REALLOC_ARRAY(new_ptr, BOOL, debug_num_classes + 1); + new_ptr = SMB_REALLOC_ARRAY(new_ptr, bool, debug_num_classes + 1); if (!new_ptr) return -1; - DEBUGLEVEL_CLASS_ISSET = (int *)new_ptr; + DEBUGLEVEL_CLASS_ISSET = (bool *)new_ptr; DEBUGLEVEL_CLASS_ISSET[ndx] = False; new_ptr = SMB_REALLOC_ARRAY(classname_table, char *, debug_num_classes + 1); @@ -403,7 +403,7 @@ static void debug_dump_status(int level) printdrivers:7 ****************************************************************************/ -static BOOL debug_parse_params(char **params) +static bool debug_parse_params(char **params) { int i, ndx; char *class_name; @@ -445,7 +445,7 @@ static BOOL debug_parse_params(char **params) Note: the 1st param has no "name:" preceeding it. ****************************************************************************/ -BOOL debug_parse_levels(const char *params_str) +bool debug_parse_levels(const char *params_str) { char **params; @@ -525,7 +525,7 @@ Init debugging (one time stuff) void debug_init(void) { - static BOOL initialised = False; + static bool initialised = False; const char **p; if (initialised) @@ -549,7 +549,7 @@ void debug_register_msgs(struct messaging_context *msg_ctx) Get ready for syslog stuff **************************************************************************/ -void setup_logging(const char *pname, BOOL interactive) +void setup_logging(const char *pname, bool interactive) { debug_init(); @@ -591,13 +591,13 @@ void setup_logging(const char *pname, BOOL interactive) Fix from dgibson@linuxcare.com. **************************************************************************/ -BOOL reopen_logs( void ) +bool reopen_logs( void ) { pstring fname; mode_t oldumask; XFILE *new_dbf = NULL; XFILE *old_dbf = NULL; - BOOL ret = True; + bool ret = True; if (stdout_logging) return True; @@ -662,7 +662,7 @@ void force_check_log_size( void ) Check to see if there is any need to check if the logfile has grown too big. **************************************************************************/ -BOOL need_to_check_log_size( void ) +bool need_to_check_log_size( void ) { int maxlog; @@ -864,7 +864,7 @@ static void bufr_print( void ) static void format_debug_text( const char *msg ) { size_t i; - BOOL timestamp = (!stdout_logging && (lp_timestamp_logs() || !(lp_loaded()))); + bool timestamp = (!stdout_logging && (lp_timestamp_logs() || !(lp_loaded()))); for( i = 0; msg[i]; i++ ) { /* Indent two spaces at each new line. */ @@ -931,7 +931,7 @@ void dbgflush( void ) ****************************************************************************/ -BOOL dbghdr(int level, int cls, const char *file, const char *func, int line) +bool dbghdr(int level, int cls, const char *file, const char *func, int line) { /* Ensure we don't lose any real errno value. */ int old_errno = errno; @@ -1015,7 +1015,7 @@ BOOL dbghdr(int level, int cls, const char *file, const char *func, int line) ***************************************************************************/ - BOOL dbgtext( const char *format_str, ... ) + bool dbgtext( const char *format_str, ... ) { va_list ap; pstring msgbuf; diff --git a/source3/lib/dummysmbd.c b/source3/lib/dummysmbd.c index 38bec5270d..038a945c92 100644 --- a/source3/lib/dummysmbd.c +++ b/source3/lib/dummysmbd.c @@ -28,7 +28,7 @@ int find_service(fstring service) return -1; } -BOOL conn_snum_used(int snum) +bool conn_snum_used(int snum) { return False; } diff --git a/source3/lib/events.c b/source3/lib/events.c index befab3f5c0..f7bad9bcad 100644 --- a/source3/lib/events.c +++ b/source3/lib/events.c @@ -188,14 +188,14 @@ void event_fd_set_not_readable(struct fd_event *fde) * Return if there's something in the queue */ -BOOL event_add_to_select_args(struct event_context *event_ctx, +bool event_add_to_select_args(struct event_context *event_ctx, const struct timeval *now, fd_set *read_fds, fd_set *write_fds, struct timeval *timeout, int *maxfd) { struct fd_event *fde; struct timeval diff; - BOOL ret = False; + bool ret = False; for (fde = event_ctx->fd_events; fde; fde = fde->next) { if (fde->flags & EVENT_FD_READ) { @@ -223,7 +223,7 @@ BOOL event_add_to_select_args(struct event_context *event_ctx, return True; } -BOOL events_pending(struct event_context *event_ctx) +bool events_pending(struct event_context *event_ctx) { struct fd_event *fde; @@ -238,10 +238,10 @@ BOOL events_pending(struct event_context *event_ctx) return False; } -BOOL run_events(struct event_context *event_ctx, +bool run_events(struct event_context *event_ctx, int selrtn, fd_set *read_fds, fd_set *write_fds) { - BOOL fired = False; + bool fired = False; struct fd_event *fde, *next; /* Run all events that are pending, not just one (as we diff --git a/source3/lib/file_id.c b/source3/lib/file_id.c index 8e8ddb0ab1..0633d4b88d 100644 --- a/source3/lib/file_id.c +++ b/source3/lib/file_id.c @@ -47,7 +47,7 @@ struct file_id vfs_file_id_from_sbuf(connection_struct *conn, const SMB_STRUCT_S /* return True if two file_id structures are equal */ -BOOL file_id_equal(const struct file_id *id1, const struct file_id *id2) +bool file_id_equal(const struct file_id *id1, const struct file_id *id2) { return id1->inode == id2->inode && id1->devid == id2->devid; } diff --git a/source3/lib/gencache.c b/source3/lib/gencache.c index 1ee720cdfd..a50e5d01fa 100644 --- a/source3/lib/gencache.c +++ b/source3/lib/gencache.c @@ -32,7 +32,7 @@ #define BLOB_TYPE_LEN 9 static TDB_CONTEXT *cache; -static BOOL cache_readonly; +static bool cache_readonly; /** * @file gencache.c @@ -50,7 +50,7 @@ static BOOL cache_readonly; * false on failure **/ -BOOL gencache_init(void) +bool gencache_init(void) { char* cache_fname = NULL; @@ -87,7 +87,7 @@ BOOL gencache_init(void) * false on failure during cache shutdown **/ -BOOL gencache_shutdown(void) +bool gencache_shutdown(void) { int ret; /* tdb_close routine returns -1 on error */ @@ -112,7 +112,7 @@ BOOL gencache_shutdown(void) * @retval false on failure **/ -BOOL gencache_set(const char *keystr, const char *value, time_t timeout) +bool gencache_set(const char *keystr, const char *value, time_t timeout) { int ret; TDB_DATA databuf; @@ -152,7 +152,7 @@ BOOL gencache_set(const char *keystr, const char *value, time_t timeout) * @retval false in case of failure **/ -BOOL gencache_del(const char *keystr) +bool gencache_del(const char *keystr) { int ret; @@ -185,7 +185,7 @@ BOOL gencache_del(const char *keystr) * @retval False for failure **/ -BOOL gencache_get(const char *keystr, char **valstr, time_t *timeout) +bool gencache_get(const char *keystr, char **valstr, time_t *timeout) { TDB_DATA databuf; time_t t; @@ -250,19 +250,19 @@ BOOL gencache_get(const char *keystr, char **valstr, time_t *timeout) * * @param keystr string that represents a key of this entry * @param blob DATA_BLOB that is filled with entry's blob - * @param expired pointer to a BOOL that indicates whether the entry is expired + * @param expired pointer to a bool that indicates whether the entry is expired * * @retval true when entry is successfuly fetched * @retval False for failure **/ -BOOL gencache_get_data_blob(const char *keystr, DATA_BLOB *blob, BOOL *expired) +bool gencache_get_data_blob(const char *keystr, DATA_BLOB *blob, bool *expired) { TDB_DATA databuf; time_t t; char *blob_type; unsigned char *buf = NULL; - BOOL ret = False; + bool ret = False; fstring valstr; int buflen = 0, len = 0, blob_len = 0; unsigned char *blob_buf = NULL; @@ -335,9 +335,9 @@ BOOL gencache_get_data_blob(const char *keystr, DATA_BLOB *blob, BOOL *expired) * @retval false on failure **/ -BOOL gencache_set_data_blob(const char *keystr, DATA_BLOB *blob, time_t timeout) +bool gencache_set_data_blob(const char *keystr, DATA_BLOB *blob, time_t timeout) { - BOOL ret = False; + bool ret = False; int tdb_ret; TDB_DATA databuf; char *valstr = NULL; diff --git a/source3/lib/genrand.c b/source3/lib/genrand.c index a08fe6719f..4590b812c5 100644 --- a/source3/lib/genrand.c +++ b/source3/lib/genrand.c @@ -24,7 +24,7 @@ static unsigned char smb_arc4_state[258]; static uint32 counter; -static BOOL done_reseed = False; +static bool done_reseed = False; static void (*reseed_callback)(int *newseed); /**************************************************************** @@ -86,7 +86,7 @@ static void do_filehash(const char *fname, unsigned char *the_hash) above... **************************************************************/ -static int do_reseed(BOOL use_fd, int fd) +static int do_reseed(bool use_fd, int fd) { unsigned char seed_inbuf[40]; uint32 v1, v2; struct timeval tval; pid_t mypid; diff --git a/source3/lib/iconv.c b/source3/lib/iconv.c index 6b42384ae2..6575dba5a9 100644 --- a/source3/lib/iconv.c +++ b/source3/lib/iconv.c @@ -116,7 +116,7 @@ NTSTATUS smb_register_charset(struct charset_functions *funcs) static void lazy_initialize_iconv(void) { - static BOOL initialized; + static bool initialized; int i; if (!initialized) { @@ -189,7 +189,7 @@ size_t smb_iconv(smb_iconv_t cd, } -static BOOL is_utf16(const char *name) +static bool is_utf16(const char *name) { return strcasecmp(name, "UCS-2LE") == 0 || strcasecmp(name, "UTF-16LE") == 0; diff --git a/source3/lib/messages.c b/source3/lib/messages.c index c153953fb7..5cd575466f 100644 --- a/source3/lib/messages.c +++ b/source3/lib/messages.c @@ -144,7 +144,7 @@ static int traverse_fn(struct db_record *rec, * * @retval True for success. **/ -BOOL message_send_all(struct messaging_context *msg_ctx, +bool message_send_all(struct messaging_context *msg_ctx, int msg_type, const void *buf, size_t len, int *n_sent) diff --git a/source3/lib/module.c b/source3/lib/module.c index 57b4c38edc..fa06d14b49 100644 --- a/source3/lib/module.c +++ b/source3/lib/module.c @@ -26,7 +26,7 @@ /* Load a dynamic module. Only log a level 0 error if we are not checking for the existence of a module (probling). */ -static NTSTATUS do_smb_load_module(const char *module_name, BOOL is_probe) +static NTSTATUS do_smb_load_module(const char *module_name, bool is_probe) { void *handle; init_module_function *init; diff --git a/source3/lib/ms_fnmatch.c b/source3/lib/ms_fnmatch.c index 9dc942c5f2..a839b42588 100644 --- a/source3/lib/ms_fnmatch.c +++ b/source3/lib/ms_fnmatch.c @@ -55,7 +55,7 @@ struct max_n { */ static int ms_fnmatch_core(const smb_ucs2_t *p, const smb_ucs2_t *n, struct max_n *max_n, const smb_ucs2_t *ldot, - BOOL is_case_sensitive) + bool is_case_sensitive) { smb_ucs2_t c; int i; @@ -145,8 +145,8 @@ static int ms_fnmatch_core(const smb_ucs2_t *p, const smb_ucs2_t *n, return -1; } -int ms_fnmatch(const char *pattern, const char *string, BOOL translate_pattern, - BOOL is_case_sensitive) +int ms_fnmatch(const char *pattern, const char *string, bool translate_pattern, + bool is_case_sensitive) { smb_ucs2_t *p = NULL; smb_ucs2_t *s = NULL; diff --git a/source3/lib/packet.c b/source3/lib/packet.c index c5335bcf15..e0486165f3 100644 --- a/source3/lib/packet.c +++ b/source3/lib/packet.c @@ -119,8 +119,8 @@ NTSTATUS packet_fd_read_sync(struct packet_context *ctx) return packet_fd_read(ctx); } -BOOL packet_handler(struct packet_context *ctx, - BOOL (*full_req)(const struct data_blob *data, +bool packet_handler(struct packet_context *ctx, + bool (*full_req)(const struct data_blob *data, size_t *length, void *private_data), NTSTATUS (*callback)(const struct data_blob *data, diff --git a/source3/lib/popt_common.c b/source3/lib/popt_common.c index 3be25b4363..ec05762cdf 100644 --- a/source3/lib/popt_common.c +++ b/source3/lib/popt_common.c @@ -34,8 +34,8 @@ */ extern pstring user_socket_options; -extern BOOL AllowDebugChange; -extern BOOL override_logfile; +extern bool AllowDebugChange; +extern bool override_logfile; struct user_auth_info cmdline_auth_info; @@ -57,7 +57,7 @@ static void set_logfile(poptContext con, const char * arg) lp_set_logfile(logfile); } -static BOOL PrintSambaVersionString; +static bool PrintSambaVersionString; static void popt_common_callback(poptContext con, enum poptCallbackReason reason, @@ -290,7 +290,7 @@ static void get_password_file(struct user_auth_info *a) { int fd = -1; char *p; - BOOL close_it = False; + bool close_it = False; pstring spec; char pass[128]; diff --git a/source3/lib/privileges.c b/source3/lib/privileges.c index b2e145e819..839ce91a57 100644 --- a/source3/lib/privileges.c +++ b/source3/lib/privileges.c @@ -37,7 +37,7 @@ typedef struct { } PRIV_SID_LIST; -static BOOL get_privileges( const DOM_SID *sid, SE_PRIV *mask ) +static bool get_privileges( const DOM_SID *sid, SE_PRIV *mask ) { TDB_CONTEXT *tdb = get_account_pol_tdb(); fstring keystr; @@ -76,7 +76,7 @@ static BOOL get_privileges( const DOM_SID *sid, SE_PRIV *mask ) Store the privilege mask (set) for a given SID ****************************************************************************/ -static BOOL set_privileges( const DOM_SID *sid, SE_PRIV *mask ) +static bool set_privileges( const DOM_SID *sid, SE_PRIV *mask ) { TDB_CONTEXT *tdb = get_account_pol_tdb(); fstring keystr; @@ -109,11 +109,11 @@ static BOOL set_privileges( const DOM_SID *sid, SE_PRIV *mask ) get a list of all privileges for all sids in the list *********************************************************************/ -BOOL get_privileges_for_sids(SE_PRIV *privileges, DOM_SID *slist, int scount) +bool get_privileges_for_sids(SE_PRIV *privileges, DOM_SID *slist, int scount) { SE_PRIV mask; int i; - BOOL found = False; + bool found = False; se_priv_copy( privileges, &se_priv_none ); @@ -252,7 +252,7 @@ NTSTATUS privilege_enum_sids(const SE_PRIV *mask, TALLOC_CTX *mem_ctx, Add privilege to sid ****************************************************************************/ -BOOL grant_privilege(const DOM_SID *sid, const SE_PRIV *priv_mask) +bool grant_privilege(const DOM_SID *sid, const SE_PRIV *priv_mask) { SE_PRIV old_mask, new_mask; @@ -281,7 +281,7 @@ BOOL grant_privilege(const DOM_SID *sid, const SE_PRIV *priv_mask) Add a privilege based on its name *********************************************************************/ -BOOL grant_privilege_by_name(DOM_SID *sid, const char *name) +bool grant_privilege_by_name(DOM_SID *sid, const char *name) { SE_PRIV mask; @@ -298,7 +298,7 @@ BOOL grant_privilege_by_name(DOM_SID *sid, const char *name) Remove privilege from sid ****************************************************************************/ -BOOL revoke_privilege(const DOM_SID *sid, const SE_PRIV *priv_mask) +bool revoke_privilege(const DOM_SID *sid, const SE_PRIV *priv_mask) { SE_PRIV mask; @@ -324,7 +324,7 @@ BOOL revoke_privilege(const DOM_SID *sid, const SE_PRIV *priv_mask) Revoke all privileges *********************************************************************/ -BOOL revoke_all_privileges( DOM_SID *sid ) +bool revoke_all_privileges( DOM_SID *sid ) { return revoke_privilege( sid, &se_priv_all ); } @@ -333,7 +333,7 @@ BOOL revoke_all_privileges( DOM_SID *sid ) Add a privilege based on its name *********************************************************************/ -BOOL revoke_privilege_by_name(DOM_SID *sid, const char *name) +bool revoke_privilege_by_name(DOM_SID *sid, const char *name) { SE_PRIV mask; @@ -439,7 +439,7 @@ NTSTATUS dup_luid_attr(TALLOC_CTX *mem_ctx, LUID_ATTR **new_la, LUID_ATTR *old_l /******************************************************************* *******************************************************************/ -BOOL is_privileged_sid( const DOM_SID *sid ) +bool is_privileged_sid( const DOM_SID *sid ) { SE_PRIV mask; @@ -449,7 +449,7 @@ BOOL is_privileged_sid( const DOM_SID *sid ) /******************************************************************* *******************************************************************/ -BOOL grant_all_privileges( const DOM_SID *sid ) +bool grant_all_privileges( const DOM_SID *sid ) { SE_PRIV mask; diff --git a/source3/lib/privileges_basic.c b/source3/lib/privileges_basic.c index 8e49915a58..ea566c71eb 100644 --- a/source3/lib/privileges_basic.c +++ b/source3/lib/privileges_basic.c @@ -114,7 +114,7 @@ PRIVS privs[] = { copy an SE_PRIV structure ****************************************************************************/ -BOOL se_priv_copy( SE_PRIV *dst, const SE_PRIV *src ) +bool se_priv_copy( SE_PRIV *dst, const SE_PRIV *src ) { if ( !dst || !src ) return False; @@ -128,7 +128,7 @@ BOOL se_priv_copy( SE_PRIV *dst, const SE_PRIV *src ) put all privileges into a mask ****************************************************************************/ -BOOL se_priv_put_all_privileges(SE_PRIV *mask) +bool se_priv_put_all_privileges(SE_PRIV *mask) { int i; uint32 num_privs = count_all_privileges(); @@ -186,7 +186,7 @@ static void se_priv_invert( SE_PRIV *new_mask, const SE_PRIV *mask ) check if 2 SE_PRIV structure are equal ****************************************************************************/ -BOOL se_priv_equal( const SE_PRIV *mask1, const SE_PRIV *mask2 ) +bool se_priv_equal( const SE_PRIV *mask1, const SE_PRIV *mask2 ) { return ( memcmp(mask1, mask2, sizeof(SE_PRIV)) == 0 ); } @@ -195,7 +195,7 @@ BOOL se_priv_equal( const SE_PRIV *mask1, const SE_PRIV *mask2 ) check if a SE_PRIV has any assigned privileges ****************************************************************************/ -static BOOL se_priv_empty( const SE_PRIV *mask ) +static bool se_priv_empty( const SE_PRIV *mask ) { SE_PRIV p1; int i; @@ -213,7 +213,7 @@ static BOOL se_priv_empty( const SE_PRIV *mask ) Lookup the SE_PRIV value for a privilege name *********************************************************************/ -BOOL se_priv_from_name( const char *name, SE_PRIV *mask ) +bool se_priv_from_name( const char *name, SE_PRIV *mask ) { int i; @@ -248,7 +248,7 @@ void dump_se_priv( int dbg_cl, int dbg_lvl, const SE_PRIV *mask ) check if the privilege is in the privilege list ****************************************************************************/ -BOOL is_privilege_assigned(const SE_PRIV *privileges, +bool is_privilege_assigned(const SE_PRIV *privileges, const SE_PRIV *check) { SE_PRIV p1, p2; @@ -280,7 +280,7 @@ BOOL is_privilege_assigned(const SE_PRIV *privileges, check if the privilege is in the privilege list ****************************************************************************/ -static BOOL is_any_privilege_assigned( SE_PRIV *privileges, const SE_PRIV *check ) +static bool is_any_privilege_assigned( SE_PRIV *privileges, const SE_PRIV *check ) { SE_PRIV p1, p2; @@ -336,7 +336,7 @@ const char* get_privilege_dispname( const char *name ) at a time here. *****************************************************************************/ -BOOL user_has_privileges(const NT_USER_TOKEN *token, const SE_PRIV *privilege) +bool user_has_privileges(const NT_USER_TOKEN *token, const SE_PRIV *privilege) { if ( !token ) return False; @@ -349,7 +349,7 @@ BOOL user_has_privileges(const NT_USER_TOKEN *token, const SE_PRIV *privilege) at a time here. *****************************************************************************/ -BOOL user_has_any_privilege(NT_USER_TOKEN *token, const SE_PRIV *privilege) +bool user_has_any_privilege(NT_USER_TOKEN *token, const SE_PRIV *privilege) { if ( !token ) return False; @@ -419,7 +419,7 @@ const char *luid_to_privilege_name(const LUID *set) add a privilege to a privilege array ****************************************************************************/ -static BOOL privilege_set_add(PRIVILEGE_SET *priv_set, LUID_ATTR set) +static bool privilege_set_add(PRIVILEGE_SET *priv_set, LUID_ATTR set) { LUID_ATTR *new_set; @@ -444,7 +444,7 @@ static BOOL privilege_set_add(PRIVILEGE_SET *priv_set, LUID_ATTR set) /******************************************************************* *******************************************************************/ -BOOL se_priv_to_privilege_set( PRIVILEGE_SET *set, SE_PRIV *mask ) +bool se_priv_to_privilege_set( PRIVILEGE_SET *set, SE_PRIV *mask ) { int i; uint32 num_privs = count_all_privileges(); @@ -469,7 +469,7 @@ BOOL se_priv_to_privilege_set( PRIVILEGE_SET *set, SE_PRIV *mask ) /******************************************************************* *******************************************************************/ -static BOOL luid_to_se_priv( LUID *luid, SE_PRIV *mask ) +static bool luid_to_se_priv( LUID *luid, SE_PRIV *mask ) { int i; uint32 num_privs = count_all_privileges(); @@ -487,7 +487,7 @@ static BOOL luid_to_se_priv( LUID *luid, SE_PRIV *mask ) /******************************************************************* *******************************************************************/ -BOOL privilege_set_to_se_priv( SE_PRIV *mask, PRIVILEGE_SET *privset ) +bool privilege_set_to_se_priv( SE_PRIV *mask, PRIVILEGE_SET *privset ) { int i; diff --git a/source3/lib/readline.c b/source3/lib/readline.c index fe1a0362a9..9d1597abb1 100644 --- a/source3/lib/readline.c +++ b/source3/lib/readline.c @@ -88,7 +88,7 @@ char *smb_readline(const char *prompt, void (*callback)(void), char **(completion_fn)(const char *text, int start, int end)) { char *ret; - BOOL interactive; + bool interactive; interactive = isatty(x_fileno(x_stdin)) || getenv("CLI_FORCE_INTERACTIVE"); if (!interactive) { diff --git a/source3/lib/secace.c b/source3/lib/secace.c index ff6a5105a3..9e533a5a28 100644 --- a/source3/lib/secace.c +++ b/source3/lib/secace.c @@ -26,7 +26,7 @@ Check if ACE has OBJECT type. ********************************************************************/ -BOOL sec_ace_object(uint8 type) +bool sec_ace_object(uint8 type) { if (type == SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT || type == SEC_ACE_TYPE_ACCESS_DENIED_OBJECT || @@ -146,7 +146,7 @@ NTSTATUS sec_ace_del_sid(TALLOC_CTX *ctx, SEC_ACE **pp_new, SEC_ACE *old, uint32 Compares two SEC_ACE structures ********************************************************************/ -BOOL sec_ace_equal(SEC_ACE *s1, SEC_ACE *s2) +bool sec_ace_equal(SEC_ACE *s1, SEC_ACE *s2) { /* Trivial case */ @@ -279,7 +279,7 @@ void dacl_sort_into_canonical_order(SEC_ACE *srclist, unsigned int num_aces) Check if this ACE has a SID in common with the token. ********************************************************************/ -BOOL token_sid_in_ace(const NT_USER_TOKEN *token, const SEC_ACE *ace) +bool token_sid_in_ace(const NT_USER_TOKEN *token, const SEC_ACE *ace) { size_t i; diff --git a/source3/lib/secacl.c b/source3/lib/secacl.c index 1e92df627a..328bc1b4b4 100644 --- a/source3/lib/secacl.c +++ b/source3/lib/secacl.c @@ -74,7 +74,7 @@ SEC_ACL *dup_sec_acl(TALLOC_CTX *ctx, SEC_ACL *src) Compares two SEC_ACL structures ********************************************************************/ -BOOL sec_acl_equal(SEC_ACL *s1, SEC_ACL *s2) +bool sec_acl_equal(SEC_ACL *s1, SEC_ACL *s2) { unsigned int i, j; @@ -101,7 +101,7 @@ BOOL sec_acl_equal(SEC_ACL *s1, SEC_ACL *s2) each ACE in s2. */ for (i = 0; i < s1->num_aces; i++) { - BOOL found = False; + bool found = False; for (j = 0; j < s2->num_aces; j++) { if (sec_ace_equal(&s1->aces[i], &s2->aces[j])) { diff --git a/source3/lib/secdesc.c b/source3/lib/secdesc.c index 99f5c0cb12..db299c4fe7 100644 --- a/source3/lib/secdesc.c +++ b/source3/lib/secdesc.c @@ -64,7 +64,7 @@ size_t sec_desc_size(SEC_DESC *psd) Compares two SEC_DESC structures ********************************************************************/ -BOOL sec_desc_equal(SEC_DESC *s1, SEC_DESC *s2) +bool sec_desc_equal(SEC_DESC *s1, SEC_DESC *s2) { /* Trivial case */ @@ -464,7 +464,7 @@ NTSTATUS sec_desc_del_sid(TALLOC_CTX *ctx, SEC_DESC **psd, DOM_SID *sid, size_t non-container object. */ SEC_DESC_BUF *se_create_child_secdesc(TALLOC_CTX *ctx, SEC_DESC *parent_ctr, - BOOL child_container) + bool child_container) { SEC_DESC_BUF *sdb; SEC_DESC *sd; @@ -490,7 +490,7 @@ SEC_DESC_BUF *se_create_child_secdesc(TALLOC_CTX *ctx, SEC_DESC *parent_ctr, SEC_ACE *ace = &the_acl->aces[i]; SEC_ACE *new_ace = &new_ace_list[new_ace_list_ndx]; uint8 new_flags = 0; - BOOL inherit = False; + bool inherit = False; fstring sid_str; /* The OBJECT_INHERIT_ACE flag causes the ACE to be diff --git a/source3/lib/server_mutex.c b/source3/lib/server_mutex.c index ad4a9710bf..2700aa103b 100644 --- a/source3/lib/server_mutex.c +++ b/source3/lib/server_mutex.c @@ -30,7 +30,7 @@ static char *mutex_server_name; -BOOL grab_server_mutex(const char *name) +bool grab_server_mutex(const char *name) { mutex_server_name = SMB_STRDUP(name); if (!mutex_server_name) { diff --git a/source3/lib/sharesec.c b/source3/lib/sharesec.c index 58e28e797d..244a6d7285 100644 --- a/source3/lib/sharesec.c +++ b/source3/lib/sharesec.c @@ -37,7 +37,7 @@ static const struct generic_mapping file_generic_mapping = { }; -BOOL share_info_db_init(void) +bool share_info_db_init(void) { const char *vstring = "INFO/version"; int32 vers_id; @@ -151,11 +151,11 @@ SEC_DESC *get_share_security( TALLOC_CTX *ctx, const char *servicename, Store a security descriptor in the share db. ********************************************************************/ -BOOL set_share_security(const char *share_name, SEC_DESC *psd) +bool set_share_security(const char *share_name, SEC_DESC *psd) { TALLOC_CTX *frame; char *key; - BOOL ret = False; + bool ret = False; TDB_DATA blob; NTSTATUS status; @@ -197,7 +197,7 @@ BOOL set_share_security(const char *share_name, SEC_DESC *psd) Delete a security descriptor. ********************************************************************/ -BOOL delete_share_security(const char *servicename) +bool delete_share_security(const char *servicename) { TDB_DATA kbuf; char *key; @@ -221,7 +221,7 @@ BOOL delete_share_security(const char *servicename) Can this user access with share with the required permissions ? ********************************************************************/ -BOOL share_access_check(const NT_USER_TOKEN *token, const char *sharename, +bool share_access_check(const NT_USER_TOKEN *token, const char *sharename, uint32 desired_access) { uint32 granted; @@ -229,7 +229,7 @@ BOOL share_access_check(const NT_USER_TOKEN *token, const char *sharename, TALLOC_CTX *mem_ctx = NULL; SEC_DESC *psd = NULL; size_t sd_size; - BOOL ret = True; + bool ret = True; if (!(mem_ctx = talloc_init("share_access_check"))) { return False; @@ -252,7 +252,7 @@ BOOL share_access_check(const NT_USER_TOKEN *token, const char *sharename, Parse the contents of an acl string from a usershare file. ***************************************************************************/ -BOOL parse_usershare_acl(TALLOC_CTX *ctx, const char *acl_str, SEC_DESC **ppsd) +bool parse_usershare_acl(TALLOC_CTX *ctx, const char *acl_str, SEC_DESC **ppsd) { size_t s_size = 0; const char *pacl = acl_str; diff --git a/source3/lib/signal.c b/source3/lib/signal.c index 4d4e9555db..4b1c95eb77 100644 --- a/source3/lib/signal.c +++ b/source3/lib/signal.c @@ -63,7 +63,7 @@ static void sig_cld_leave_status(int signum) Block sigs. ********************************************************************/ -void BlockSignals(BOOL block,int signum) +void BlockSignals(bool block,int signum) { #ifdef HAVE_SIGPROCMASK sigset_t set; diff --git a/source3/lib/smbldap.c b/source3/lib/smbldap.c index 2cfbc657a6..6f9ecb1a31 100644 --- a/source3/lib/smbldap.c +++ b/source3/lib/smbldap.c @@ -261,7 +261,7 @@ ATTRIB_MAP_ENTRY sidmap_attr_list[] = { Search an attribute and return the first value found. ******************************************************************/ - BOOL smbldap_get_single_attribute (LDAP * ldap_struct, LDAPMessage * entry, + bool smbldap_get_single_attribute (LDAP * ldap_struct, LDAPMessage * entry, const char *attribute, char *value, int max_len) { @@ -292,7 +292,7 @@ ATTRIB_MAP_ENTRY sidmap_attr_list[] = { return True; } - BOOL smbldap_get_single_pstring (LDAP * ldap_struct, LDAPMessage * entry, + bool smbldap_get_single_pstring (LDAP * ldap_struct, LDAPMessage * entry, const char *attribute, pstring value) { return smbldap_get_single_attribute(ldap_struct, entry, @@ -472,7 +472,7 @@ ATTRIB_MAP_ENTRY sidmap_attr_list[] = { const char *attribute, const char *newval) { char oldval[2048]; /* current largest allowed value is mungeddial */ - BOOL existed; + bool existed; if (attribute == NULL) { /* This can actually happen for ldapsam_compat where we for @@ -1005,7 +1005,7 @@ static void smbldap_idle_fn(struct event_context *event_ctx, static int smbldap_open(struct smbldap_state *ldap_state) { int rc, opt_rc; - BOOL reopen = False; + bool reopen = False; SMB_ASSERT(ldap_state); #ifndef NO_LDAP_SECURITY @@ -1097,7 +1097,7 @@ static NTSTATUS smbldap_close(struct smbldap_state *ldap_state) return NT_STATUS_OK; } -static BOOL got_alarm; +static bool got_alarm; static void (*old_handler)(int); @@ -1294,7 +1294,7 @@ int smbldap_search_paged(struct smbldap_state *ldap_state, BerElement *cookie_be = NULL; struct berval *cookie_bv = NULL; int tmp = 0, i, rc; - BOOL critical = True; + bool critical = True; *res = NULL; @@ -1675,13 +1675,13 @@ char *smbldap_get_dn(LDAP *ld, LDAPMessage *entry) Check if root-dse has a certain Control or Extension ********************************************************************/ -static BOOL smbldap_check_root_dse(LDAP *ld, const char **attrs, const char *value) +static bool smbldap_check_root_dse(LDAP *ld, const char **attrs, const char *value) { LDAPMessage *msg = NULL; LDAPMessage *entry = NULL; char **values = NULL; int rc, num_result, num_values, i; - BOOL result = False; + bool result = False; if (!attrs[0]) { DEBUG(3,("smbldap_check_root_dse: nothing to look for\n")); @@ -1751,7 +1751,7 @@ static BOOL smbldap_check_root_dse(LDAP *ld, const char **attrs, const char *val Check if LDAP-Server supports a certain Control (OID in string format) ********************************************************************/ -BOOL smbldap_has_control(LDAP *ld, const char *control) +bool smbldap_has_control(LDAP *ld, const char *control) { const char *attrs[] = { "supportedControl", NULL }; return smbldap_check_root_dse(ld, attrs, control); @@ -1761,7 +1761,7 @@ BOOL smbldap_has_control(LDAP *ld, const char *control) Check if LDAP-Server supports a certain Extension (OID in string format) ********************************************************************/ -BOOL smbldap_has_extension(LDAP *ld, const char *extension) +bool smbldap_has_extension(LDAP *ld, const char *extension) { const char *attrs[] = { "supportedExtension", NULL }; return smbldap_check_root_dse(ld, attrs, extension); @@ -1771,13 +1771,13 @@ BOOL smbldap_has_extension(LDAP *ld, const char *extension) Check if LDAP-Server holds a given namingContext ********************************************************************/ -BOOL smbldap_has_naming_context(LDAP *ld, const char *naming_context) +bool smbldap_has_naming_context(LDAP *ld, const char *naming_context) { const char *attrs[] = { "namingContexts", NULL }; return smbldap_check_root_dse(ld, attrs, naming_context); } -BOOL smbldap_set_creds(struct smbldap_state *ldap_state, BOOL anon, const char *dn, const char *secret) +bool smbldap_set_creds(struct smbldap_state *ldap_state, bool anon, const char *dn, const char *secret) { ldap_state->anonymous = anon; diff --git a/source3/lib/smbldap_util.c b/source3/lib/smbldap_util.c index b30a6d5916..8ea9d42a29 100644 --- a/source3/lib/smbldap_util.c +++ b/source3/lib/smbldap_util.c @@ -230,7 +230,7 @@ Search for the domain info entry NTSTATUS smbldap_search_domain_info(struct smbldap_state *ldap_state, LDAPMessage ** result, const char *domain_name, - BOOL try_add) + bool try_add) { NTSTATUS status = NT_STATUS_UNSUCCESSFUL; pstring filter; diff --git a/source3/lib/smbrun.c b/source3/lib/smbrun.c index 26330ab992..515fcd75c2 100644 --- a/source3/lib/smbrun.c +++ b/source3/lib/smbrun.c @@ -64,7 +64,7 @@ run a command being careful about uid/gid handling and putting the output in outfd (or discard it if outfd is NULL). ****************************************************************************/ -static int smbrun_internal(const char *cmd, int *outfd, BOOL sanitize) +static int smbrun_internal(const char *cmd, int *outfd, bool sanitize) { pid_t pid; uid_t uid = current_user.ut.uid; diff --git a/source3/lib/substitute.c b/source3/lib/substitute.c index 57df02f721..07cea81bd1 100644 --- a/source3/lib/substitute.c +++ b/source3/lib/substitute.c @@ -37,9 +37,9 @@ static fstring smb_user_name; * @param if this is the 'final' name for us, not be be changed again */ -void set_local_machine_name(const char* local_name, BOOL perm) +void set_local_machine_name(const char* local_name, bool perm) { - static BOOL already_perm = False; + static bool already_perm = False; fstring tmp_local_machine; fstrcpy(tmp_local_machine,local_name); @@ -70,9 +70,9 @@ void set_local_machine_name(const char* local_name, BOOL perm) * @param if this is the 'final' name for them, not be be changed again */ -void set_remote_machine_name(const char* remote_name, BOOL perm) +void set_remote_machine_name(const char* remote_name, bool perm) { - static BOOL already_perm = False; + static bool already_perm = False; fstring tmp_remote_machine; if (already_perm) @@ -108,7 +108,7 @@ void sub_set_smb_name(const char *name) { fstring tmp; int len; - BOOL is_machine_account = False; + bool is_machine_account = False; /* don't let anonymous logins override the name */ if (! *name) diff --git a/source3/lib/sysquotas.c b/source3/lib/sysquotas.c index 67b158f80d..094422ac9b 100644 --- a/source3/lib/sysquotas.c +++ b/source3/lib/sysquotas.c @@ -402,7 +402,7 @@ int sys_get_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DI { int ret = -1; int i; - BOOL ready = False; + bool ready = False; char *mntpath = NULL; char *bdev = NULL; char *fs = NULL; @@ -467,7 +467,7 @@ int sys_set_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DI { int ret = -1; int i; - BOOL ready = False; + bool ready = False; char *mntpath = NULL; char *bdev = NULL; char *fs = NULL; diff --git a/source3/lib/system.c b/source3/lib/system.c index bf35722ea5..604228233c 100644 --- a/source3/lib/system.c +++ b/source3/lib/system.c @@ -711,8 +711,8 @@ int sys_chroot(const char *dname) * from the inheritable set, because there is no circumstance in which our * children should inherit our elevated privileges. */ -static BOOL set_process_capability(enum smbd_capability capability, - BOOL enable) +static bool set_process_capability(enum smbd_capability capability, + bool enable) { cap_value_t cap_vals[2] = {0}; int num_cap_vals = 0; diff --git a/source3/lib/system_smbd.c b/source3/lib/system_smbd.c index c6b006a07e..9d3eb95664 100644 --- a/source3/lib/system_smbd.c +++ b/source3/lib/system_smbd.c @@ -117,7 +117,7 @@ static int getgrouplist_internals(const char *user, gid_t gid, gid_t *groups, static int sys_getgrouplist(const char *user, gid_t gid, gid_t *groups, int *grpcnt) { int retval; - BOOL winbind_env; + bool winbind_env; DEBUG(10,("sys_getgrouplist: user [%s]\n", user)); @@ -143,7 +143,7 @@ static int sys_getgrouplist(const char *user, gid_t gid, gid_t *groups, int *grp return retval; } -BOOL getgroups_unix_user(TALLOC_CTX *mem_ctx, const char *user, +bool getgroups_unix_user(TALLOC_CTX *mem_ctx, const char *user, gid_t primary_gid, gid_t **ret_groups, size_t *p_ngroups) { diff --git a/source3/lib/time.c b/source3/lib/time.c index 35d10186be..e29308fcd0 100644 --- a/source3/lib/time.c +++ b/source3/lib/time.c @@ -117,7 +117,7 @@ void unix_to_nt_time(NTTIME *nt, time_t t) Check if it's a null unix time. ****************************************************************************/ -BOOL null_time(time_t t) +bool null_time(time_t t) { return t == 0 || t == (time_t)0xFFFFFFFF || @@ -128,7 +128,7 @@ BOOL null_time(time_t t) Check if it's a null NTTIME. ****************************************************************************/ -BOOL null_nttime(NTTIME t) +bool null_nttime(NTTIME t) { return t == 0 || t == (NTTIME)-1; } @@ -137,7 +137,7 @@ BOOL null_nttime(NTTIME t) Check if it's a null timespec. ****************************************************************************/ -BOOL null_timespec(struct timespec ts) +bool null_timespec(struct timespec ts) { return ts.tv_sec == 0 || ts.tv_sec == (time_t)0xFFFFFFFF || @@ -401,7 +401,7 @@ struct timeval timeval_zero(void) /** return True if a timeval is zero */ -BOOL timeval_is_zero(const struct timeval *tv) +bool timeval_is_zero(const struct timeval *tv) { return tv->tv_sec == 0 && tv->tv_usec == 0; } @@ -479,7 +479,7 @@ int timeval_compare(const struct timeval *tv1, const struct timeval *tv2) /** return True if a timer is in the past */ -BOOL timeval_expired(const struct timeval *tv) +bool timeval_expired(const struct timeval *tv) { struct timeval tv2 = timeval_current(); if (tv2.tv_sec > tv->tv_sec) return True; @@ -634,7 +634,7 @@ int get_time_zone(time_t t) Check if NTTIME is 0. ****************************************************************************/ -BOOL nt_time_is_zero(const NTTIME *nt) +bool nt_time_is_zero(const NTTIME *nt) { return (*nt == 0); } @@ -687,7 +687,7 @@ int set_server_zone_offset(time_t t) Return the date and time as a string ****************************************************************************/ -char *current_timestring(BOOL hires) +char *current_timestring(bool hires) { fstring TimeBuf; struct timeval tp; @@ -826,7 +826,7 @@ void put_long_date(char *p, time_t t) structure. ****************************************************************************/ -time_t get_create_time(const SMB_STRUCT_STAT *st,BOOL fake_dirs) +time_t get_create_time(const SMB_STRUCT_STAT *st,bool fake_dirs) { time_t ret, ret1; @@ -848,7 +848,7 @@ time_t get_create_time(const SMB_STRUCT_STAT *st,BOOL fake_dirs) return ret; } -struct timespec get_create_timespec(const SMB_STRUCT_STAT *st,BOOL fake_dirs) +struct timespec get_create_timespec(const SMB_STRUCT_STAT *st,bool fake_dirs) { struct timespec ts; ts.tv_sec = get_create_time(st, fake_dirs); @@ -1239,7 +1239,7 @@ struct timespec nt_time_to_unix_timespec(NTTIME *nt) Check if two NTTIMEs are the same. ****************************************************************************/ -BOOL nt_time_equals(const NTTIME *nt1, const NTTIME *nt2) +bool nt_time_equals(const NTTIME *nt1, const NTTIME *nt2) { return (*nt1 == *nt2); } @@ -1393,7 +1393,7 @@ void unix_to_nt_time_abs(NTTIME *nt, time_t t) Check if it's a null mtime. ****************************************************************************/ -BOOL null_mtime(time_t mtime) +bool null_mtime(time_t mtime) { if (mtime == 0 || mtime == (time_t)0xFFFFFFFF || mtime == (time_t)-1) return(True); @@ -1454,7 +1454,7 @@ const char *display_time(NTTIME nttime) "%u seconds", days, hours, mins, secs); } -BOOL nt_time_is_set(const NTTIME *nt) +bool nt_time_is_set(const NTTIME *nt) { if (*nt == 0x7FFFFFFFFFFFFFFFLL) { return False; diff --git a/source3/lib/util.c b/source3/lib/util.c index a6731347a3..53200ad02a 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -84,7 +84,7 @@ static char **smb_my_netbios_names; Allocate and set myname. Ensure upper case. ***********************************************************************/ -BOOL set_global_myname(const char *myname) +bool set_global_myname(const char *myname) { SAFE_FREE(smb_myname); smb_myname = SMB_STRDUP(myname); @@ -103,7 +103,7 @@ const char *global_myname(void) Allocate and set myworkgroup. Ensure upper case. ***********************************************************************/ -BOOL set_global_myworkgroup(const char *myworkgroup) +bool set_global_myworkgroup(const char *myworkgroup) { SAFE_FREE(smb_myworkgroup); smb_myworkgroup = SMB_STRDUP(myworkgroup); @@ -122,7 +122,7 @@ const char *lp_workgroup(void) Allocate and set scope. Ensure upper case. ***********************************************************************/ -BOOL set_global_scope(const char *scope) +bool set_global_scope(const char *scope) { SAFE_FREE(smb_scope); smb_scope = SMB_STRDUP(scope); @@ -154,7 +154,7 @@ static void free_netbios_names_array(void) smb_num_netbios_names = 0; } -static BOOL allocate_my_netbios_names_array(size_t number) +static bool allocate_my_netbios_names_array(size_t number) { free_netbios_names_array(); @@ -168,7 +168,7 @@ static BOOL allocate_my_netbios_names_array(size_t number) return True; } -static BOOL set_my_netbios_names(const char *name, int i) +static bool set_my_netbios_names(const char *name, int i) { SAFE_FREE(smb_my_netbios_names[i]); @@ -209,7 +209,7 @@ const char *my_netbios_names(int i) return smb_my_netbios_names[i]; } -BOOL set_netbios_aliases(const char **str_array) +bool set_netbios_aliases(const char **str_array) { size_t namecount; @@ -235,7 +235,7 @@ BOOL set_netbios_aliases(const char **str_array) size_t i; for ( i = 0; str_array[i] != NULL; i++) { size_t n; - BOOL duplicate = False; + bool duplicate = False; /* Look for duplicates */ for( n=0; n<namecount; n++ ) { @@ -258,7 +258,7 @@ BOOL set_netbios_aliases(const char **str_array) Common name initialization code. ****************************************************************************/ -BOOL init_names(void) +bool init_names(void) { char *p; int n; @@ -306,7 +306,7 @@ const char *tmpdir(void) Add a gid to an array of gids if it's not already there. ****************************************************************************/ -BOOL add_gid_to_array_unique(TALLOC_CTX *mem_ctx, gid_t gid, +bool add_gid_to_array_unique(TALLOC_CTX *mem_ctx, gid_t gid, gid_t **gids, size_t *num_gids) { int i; @@ -390,7 +390,7 @@ const char *get_numlist(const char *p, uint32 **num, int *count) Check if a file exists - call vfs_file_exist for samba files. ********************************************************************/ -BOOL file_exist(const char *fname,SMB_STRUCT_STAT *sbuf) +bool file_exist(const char *fname,SMB_STRUCT_STAT *sbuf) { SMB_STRUCT_STAT st; if (!sbuf) @@ -420,10 +420,10 @@ time_t file_modtime(const char *fname) Check if a directory exists. ********************************************************************/ -BOOL directory_exist(char *dname,SMB_STRUCT_STAT *st) +bool directory_exist(char *dname,SMB_STRUCT_STAT *st) { SMB_STRUCT_STAT st2; - BOOL ret; + bool ret; if (!st) st = &st2; @@ -532,7 +532,7 @@ void smb_setlen(char *buf,int len) Setup the word count and byte count for a smb message. ********************************************************************/ -int set_message(char *buf,int num_words,int num_bytes,BOOL zero) +int set_message(char *buf,int num_words,int num_bytes,bool zero) { if (zero && (num_words || num_bytes)) { memset(buf + smb_size,'\0',num_words*2 + num_bytes); @@ -670,7 +670,7 @@ void clean_name(char *s) Close the low 3 fd's and open dev/null in their place. ********************************************************************/ -void close_low_fds(BOOL stderr_too) +void close_low_fds(bool stderr_too) { #ifndef VALGRIND int fd; @@ -750,7 +750,7 @@ ssize_t write_data_at_offset(int fd, const char *buffer, size_t N, SMB_OFF_T pos if BSD use FNDELAY ****************************************************************************/ -int set_blocking(int fd, BOOL set) +int set_blocking(int fd, bool set) { int val; #ifdef O_NONBLOCK @@ -888,7 +888,7 @@ void smb_msleep(unsigned int t) Become a daemon, discarding the controlling terminal. ****************************************************************************/ -void become_daemon(BOOL Fork, BOOL no_process_group) +void become_daemon(bool Fork, bool no_process_group) { if (Fork) { if (sys_fork()) { @@ -918,7 +918,7 @@ void become_daemon(BOOL Fork, BOOL no_process_group) Put up a yes/no prompt. ****************************************************************************/ -BOOL yesno(char *p) +bool yesno(char *p) { pstring ans; printf("%s",p); @@ -1059,7 +1059,7 @@ void *calloc_array(size_t size, size_t nmemb) Changes were instigated by Coverity error checking. JRA. ****************************************************************************/ -void *Realloc(void *p, size_t size, BOOL free_old_on_error) +void *Realloc(void *p, size_t size, bool free_old_on_error) { void *ret=NULL; @@ -1099,7 +1099,7 @@ void *Realloc(void *p, size_t size, BOOL free_old_on_error) Type-safe realloc. ****************************************************************************/ -void *realloc_array(void *p, size_t el_size, unsigned int count, BOOL free_old_on_error) +void *realloc_array(void *p, size_t el_size, unsigned int count, bool free_old_on_error) { if (count >= MAX_ALLOC_SIZE/el_size) { if (free_old_on_error) { @@ -1180,7 +1180,7 @@ void safe_free(void *p) Get my own name and IP. ****************************************************************************/ -BOOL get_myname(char *my_name) +bool get_myname(char *my_name) { fstring hostname; @@ -1212,7 +1212,7 @@ BOOL get_myname(char *my_name) Get my own domain name. ****************************************************************************/ -BOOL get_mydnsdomname(fstring my_domname) +bool get_mydnsdomname(fstring my_domname) { fstring domname; char *p; @@ -1383,7 +1383,7 @@ char *automount_lookup(const char *user_name) Check if a process exists. Does this work on all unixes? ****************************************************************************/ -BOOL process_exists(const struct server_id pid) +bool process_exists(const struct server_id pid) { if (procid_is_me(&pid)) { return True; @@ -1401,7 +1401,7 @@ BOOL process_exists(const struct server_id pid) #endif } -BOOL process_exists_by_pid(pid_t pid) +bool process_exists_by_pid(pid_t pid) { /* Doing kill with a non-positive pid causes messages to be * sent to places we don't want. */ @@ -1709,7 +1709,7 @@ const char *readdirname(SMB_STRUCT_DIR *p) of a path matches a (possibly wildcarded) entry in a namelist. ********************************************************************/ -BOOL is_in_path(const char *name, name_compare_entry *namelist, BOOL case_sensitive) +bool is_in_path(const char *name, name_compare_entry *namelist, bool case_sensitive) { const char *last_component; @@ -1860,7 +1860,7 @@ void free_namearray(name_compare_entry *name_array) Returns True if the lock was granted, False otherwise. ****************************************************************************/ -BOOL fcntl_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type) +bool fcntl_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type) { SMB_STRUCT_FLOCK lock; int ret; @@ -1897,7 +1897,7 @@ BOOL fcntl_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type) F_UNLCK in *ptype if the region is unlocked). False if the call failed. ****************************************************************************/ -BOOL fcntl_getlock(int fd, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid) +bool fcntl_getlock(int fd, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid) { SMB_STRUCT_FLOCK lock; int ret; @@ -1939,10 +1939,10 @@ BOOL fcntl_getlock(int fd, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pi Returns true if it is equal, false otherwise. ********************************************************************/ -BOOL is_myname(const char *s) +bool is_myname(const char *s) { int n; - BOOL ret = False; + bool ret = False; for (n=0; my_netbios_names(n); n++) { if (strequal(my_netbios_names(n), s)) { @@ -1959,9 +1959,9 @@ BOOL is_myname(const char *s) Returns true if it is equal, false otherwise. ********************************************************************/ -BOOL is_myworkgroup(const char *s) +bool is_myworkgroup(const char *s) { - BOOL ret = False; + bool ret = False; if (strequal(s, lp_workgroup())) { ret=True; @@ -2462,7 +2462,7 @@ char *parent_dirname(const char *path) return parent; } -BOOL parent_dirname_talloc(TALLOC_CTX *mem_ctx, const char *dir, +bool parent_dirname_talloc(TALLOC_CTX *mem_ctx, const char *dir, char **parent, const char **name) { char *p; @@ -2498,7 +2498,7 @@ BOOL parent_dirname_talloc(TALLOC_CTX *mem_ctx, const char *dir, Determine if a pattern contains any Microsoft wildcard characters. *******************************************************************/ -BOOL ms_has_wild(const char *s) +bool ms_has_wild(const char *s) { char c; @@ -2520,7 +2520,7 @@ BOOL ms_has_wild(const char *s) return False; } -BOOL ms_has_wild_w(const smb_ucs2_t *s) +bool ms_has_wild_w(const smb_ucs2_t *s) { smb_ucs2_t c; if (!s) return False; @@ -2542,7 +2542,7 @@ BOOL ms_has_wild_w(const smb_ucs2_t *s) of the ".." name. *******************************************************************/ -BOOL mask_match(const char *string, const char *pattern, BOOL is_case_sensitive) +bool mask_match(const char *string, const char *pattern, bool is_case_sensitive) { if (strcmp(string,"..") == 0) string = "."; @@ -2558,7 +2558,7 @@ BOOL mask_match(const char *string, const char *pattern, BOOL is_case_sensitive) pattern translation. *******************************************************************/ -BOOL mask_match_search(const char *string, const char *pattern, BOOL is_case_sensitive) +bool mask_match_search(const char *string, const char *pattern, bool is_case_sensitive) { if (strcmp(string,"..") == 0) string = "."; @@ -2573,7 +2573,7 @@ BOOL mask_match_search(const char *string, const char *pattern, BOOL is_case_sen on each. Returns True if any of the patterns match. *******************************************************************/ -BOOL mask_match_list(const char *string, char **list, int listLen, BOOL is_case_sensitive) +bool mask_match_list(const char *string, char **list, int listLen, bool is_case_sensitive) { while (listLen-- > 0) { if (mask_match(string, *list++, is_case_sensitive)) @@ -2886,7 +2886,7 @@ struct server_id server_id_self(void) return procid_self(); } -BOOL procid_equal(const struct server_id *p1, const struct server_id *p2) +bool procid_equal(const struct server_id *p1, const struct server_id *p2) { if (p1->pid != p2->pid) return False; @@ -2897,13 +2897,13 @@ BOOL procid_equal(const struct server_id *p1, const struct server_id *p2) return True; } -BOOL cluster_id_equal(const struct server_id *id1, +bool cluster_id_equal(const struct server_id *id1, const struct server_id *id2) { return procid_equal(id1, id2); } -BOOL procid_is_me(const struct server_id *pid) +bool procid_is_me(const struct server_id *pid) { if (pid->pid != sys_getpid()) return False; @@ -2958,12 +2958,12 @@ char *procid_str_static(const struct server_id *pid) return procid_str(talloc_tos(), pid); } -BOOL procid_valid(const struct server_id *pid) +bool procid_valid(const struct server_id *pid) { return (pid->pid != -1); } -BOOL procid_is_local(const struct server_id *pid) +bool procid_is_local(const struct server_id *pid) { #ifdef CLUSTER_SUPPORT return pid->vnn == my_vnn; @@ -2995,7 +2995,7 @@ int this_is_smp(void) pointer ptr+off. ****************************************************************/ -BOOL is_offset_safe(const char *buf_base, size_t buf_len, char *ptr, size_t off) +bool is_offset_safe(const char *buf_base, size_t buf_len, char *ptr, size_t off) { const char *end_base = buf_base + buf_len; char *end_ptr = ptr + off; diff --git a/source3/lib/util_file.c b/source3/lib/util_file.c index 0eb95e8284..673a15df38 100644 --- a/source3/lib/util_file.c +++ b/source3/lib/util_file.c @@ -34,7 +34,7 @@ char *fgets_slash(char *s2,int maxlen,XFILE *f) char *s=s2; int len = 0; int c; - BOOL start_of_line = True; + bool start_of_line = True; if (x_feof(f)) { return(NULL); @@ -208,7 +208,7 @@ char *file_load(const char *fname, size_t *size, size_t maxsize) unmap or free memory *******************************************************************/ -BOOL unmap_file(void* start, size_t size) +bool unmap_file(void* start, size_t size) { #ifdef HAVE_MMAP if ( munmap( start, size ) != 0 ) { @@ -409,7 +409,7 @@ void file_lines_slashcont(char **lines) Save a lump of data into a file. Mostly used for debugging. ****************************************************************************/ -BOOL file_save(const char *fname, void *packet, size_t length) +bool file_save(const char *fname, void *packet, size_t length) { int fd; fd = open(fname, O_WRONLY|O_CREAT|O_TRUNC, 0644); diff --git a/source3/lib/util_reg.c b/source3/lib/util_reg.c index c319d7d31f..956f0475a5 100644 --- a/source3/lib/util_reg.c +++ b/source3/lib/util_reg.c @@ -123,7 +123,7 @@ void normalize_dbkey(char *key) /* * check whether a given value name is forbidden in registry (smbconf) */ -BOOL registry_smbconf_valname_forbidden(const char *valname) +bool registry_smbconf_valname_forbidden(const char *valname) { /* hard code the list of forbidden names here for now */ const char *forbidden_valnames[] = { diff --git a/source3/lib/util_reg_smbconf.c b/source3/lib/util_reg_smbconf.c index 6b5a6af0d4..154c67ab8f 100644 --- a/source3/lib/util_reg_smbconf.c +++ b/source3/lib/util_reg_smbconf.c @@ -55,9 +55,9 @@ done: * for use in places where not the whole registry is needed, * e.g. utils/net_conf.c and loadparm.c */ -BOOL registry_init_regdb(void) +bool registry_init_regdb(void) { - BOOL ret = False; + bool ret = False; int saved_errno = 0; static REGISTRY_HOOK smbconf_reg_hook = {KEY_SMBCONF, &smbconf_reg_ops}; diff --git a/source3/lib/util_seaccess.c b/source3/lib/util_seaccess.c index 8d49ea2c8b..ad05300079 100644 --- a/source3/lib/util_seaccess.c +++ b/source3/lib/util_seaccess.c @@ -87,7 +87,7 @@ static uint32 check_ace(SEC_ACE *ace, const NT_USER_TOKEN *token, uint32 acc_des include other bits requested. **********************************************************************************/ -static BOOL get_max_access( SEC_ACL *the_acl, const NT_USER_TOKEN *token, uint32 *granted, +static bool get_max_access( SEC_ACL *the_acl, const NT_USER_TOKEN *token, uint32 *granted, uint32 desired, NTSTATUS *status) { @@ -209,7 +209,7 @@ void se_map_standard(uint32 *access_mask, struct standard_mapping *mapping) "Access-Checking" document in MSDN. *****************************************************************************/ -BOOL se_access_check(const SEC_DESC *sd, const NT_USER_TOKEN *token, +bool se_access_check(const SEC_DESC *sd, const NT_USER_TOKEN *token, uint32 acc_desired, uint32 *acc_granted, NTSTATUS *status) { diff --git a/source3/lib/util_sec.c b/source3/lib/util_sec.c index 7723d294fa..d7984ac999 100644 --- a/source3/lib/util_sec.c +++ b/source3/lib/util_sec.c @@ -39,7 +39,7 @@ #define DEBUG(x, y) printf y #define smb_panic(x) exit(1) -#define BOOL int +#define bool int #endif /* are we running as non-root? This is used by the regresison test code, @@ -82,7 +82,7 @@ gid_t sec_initial_gid(void) /**************************************************************************** are we running in non-root mode? ****************************************************************************/ -BOOL non_root_mode(void) +bool non_root_mode(void) { return (initial_uid != (uid_t)0); } @@ -476,7 +476,7 @@ main() /**************************************************************************** Check if we are setuid root. Used in libsmb and smbpasswd paranoia checks. ****************************************************************************/ -BOOL is_setuid_root(void) +bool is_setuid_root(void) { return (geteuid() == (uid_t)0) && (getuid() != (uid_t)0); } diff --git a/source3/lib/util_sid.c b/source3/lib/util_sid.c index 498919876c..f46d363895 100644 --- a/source3/lib/util_sid.c +++ b/source3/lib/util_sid.c @@ -224,7 +224,7 @@ char *sid_string_tos(const DOM_SID *sid) Convert a string to a SID. Returns True on success, False on fail. *****************************************************************/ -BOOL string_to_sid(DOM_SID *sidout, const char *sidstr) +bool string_to_sid(DOM_SID *sidout, const char *sidstr) { const char *p; char *q; @@ -295,7 +295,7 @@ DOM_SID *string_sid_talloc(TALLOC_CTX *mem_ctx, const char *sidstr) Add a rid to the end of a sid *****************************************************************/ -BOOL sid_append_rid(DOM_SID *sid, uint32 rid) +bool sid_append_rid(DOM_SID *sid, uint32 rid) { if (sid->num_auths < MAXSUBAUTHS) { sid->sub_auths[sid->num_auths++] = rid; @@ -304,7 +304,7 @@ BOOL sid_append_rid(DOM_SID *sid, uint32 rid) return False; } -BOOL sid_compose(DOM_SID *dst, const DOM_SID *domain_sid, uint32 rid) +bool sid_compose(DOM_SID *dst, const DOM_SID *domain_sid, uint32 rid) { sid_copy(dst, domain_sid); return sid_append_rid(dst, rid); @@ -314,7 +314,7 @@ BOOL sid_compose(DOM_SID *dst, const DOM_SID *domain_sid, uint32 rid) Removes the last rid from the end of a sid *****************************************************************/ -BOOL sid_split_rid(DOM_SID *sid, uint32 *rid) +bool sid_split_rid(DOM_SID *sid, uint32 *rid) { if (sid->num_auths > 0) { sid->num_auths--; @@ -328,7 +328,7 @@ BOOL sid_split_rid(DOM_SID *sid, uint32 *rid) Return the last rid from the end of a sid *****************************************************************/ -BOOL sid_peek_rid(const DOM_SID *sid, uint32 *rid) +bool sid_peek_rid(const DOM_SID *sid, uint32 *rid) { if (!sid || !rid) return False; @@ -345,7 +345,7 @@ BOOL sid_peek_rid(const DOM_SID *sid, uint32 *rid) and check the sid against the exp_dom_sid *****************************************************************/ -BOOL sid_peek_check_rid(const DOM_SID *exp_dom_sid, const DOM_SID *sid, uint32 *rid) +bool sid_peek_check_rid(const DOM_SID *exp_dom_sid, const DOM_SID *sid, uint32 *rid) { if (!exp_dom_sid || !sid || !rid) return False; @@ -385,7 +385,7 @@ void sid_copy(DOM_SID *dst, const DOM_SID *src) Write a sid out into on-the-wire format. *****************************************************************/ -BOOL sid_linearize(char *outbuf, size_t len, const DOM_SID *sid) +bool sid_linearize(char *outbuf, size_t len, const DOM_SID *sid) { size_t i; @@ -405,7 +405,7 @@ BOOL sid_linearize(char *outbuf, size_t len, const DOM_SID *sid) Parse a on-the-wire SID to a DOM_SID. *****************************************************************/ -BOOL sid_parse(const char *inbuf, size_t len, DOM_SID *sid) +bool sid_parse(const char *inbuf, size_t len, DOM_SID *sid) { int i; if (len < 8) @@ -496,7 +496,7 @@ int sid_compare_domain(const DOM_SID *sid1, const DOM_SID *sid2) Compare two sids. *****************************************************************/ -BOOL sid_equal(const DOM_SID *sid1, const DOM_SID *sid2) +bool sid_equal(const DOM_SID *sid1, const DOM_SID *sid2) { return sid_compare(sid1, sid2) == 0; } @@ -517,7 +517,7 @@ size_t sid_size(const DOM_SID *sid) Returns true if SID is internal (and non-mappable). *****************************************************************/ -BOOL non_mappable_sid(DOM_SID *sid) +bool non_mappable_sid(DOM_SID *sid) { DOM_SID dom; uint32 rid; @@ -592,7 +592,7 @@ DOM_SID *sid_dup_talloc(TALLOC_CTX *ctx, const DOM_SID *src) Add SID to an array SIDs ********************************************************************/ -BOOL add_sid_to_array(TALLOC_CTX *mem_ctx, const DOM_SID *sid, +bool add_sid_to_array(TALLOC_CTX *mem_ctx, const DOM_SID *sid, DOM_SID **sids, size_t *num) { *sids = TALLOC_REALLOC_ARRAY(mem_ctx, *sids, DOM_SID, @@ -613,7 +613,7 @@ BOOL add_sid_to_array(TALLOC_CTX *mem_ctx, const DOM_SID *sid, Add SID to an array SIDs ensuring that it is not already there ********************************************************************/ -BOOL add_sid_to_array_unique(TALLOC_CTX *mem_ctx, const DOM_SID *sid, +bool add_sid_to_array_unique(TALLOC_CTX *mem_ctx, const DOM_SID *sid, DOM_SID **sids, size_t *num_sids) { size_t i; @@ -655,7 +655,7 @@ void del_sid_from_array(const DOM_SID *sid, DOM_SID **sids, size_t *num) return; } -BOOL add_rid_to_array_unique(TALLOC_CTX *mem_ctx, +bool add_rid_to_array_unique(TALLOC_CTX *mem_ctx, uint32 rid, uint32 **pp_rids, size_t *p_num) { size_t i; @@ -677,7 +677,7 @@ BOOL add_rid_to_array_unique(TALLOC_CTX *mem_ctx, return True; } -BOOL is_null_sid(const DOM_SID *sid) +bool is_null_sid(const DOM_SID *sid) { static const DOM_SID null_sid = {0}; return sid_equal(sid, &null_sid); @@ -687,7 +687,7 @@ NTSTATUS sid_array_from_info3(TALLOC_CTX *mem_ctx, const NET_USER_INFO_3 *info3, DOM_SID **user_sids, size_t *num_user_sids, - BOOL include_user_group_rid) + bool include_user_group_rid) { DOM_SID sid; DOM_SID *sid_array = NULL; diff --git a/source3/lib/util_tdb.c b/source3/lib/util_tdb.c index c122b1ba45..6aa7a5348f 100644 --- a/source3/lib/util_tdb.c +++ b/source3/lib/util_tdb.c @@ -226,7 +226,7 @@ int tdb_store_int32(TDB_CONTEXT *tdb, const char *keystr, int32 v) Output is uint32 in native byte order. ****************************************************************************/ -BOOL tdb_fetch_uint32_byblob(TDB_CONTEXT *tdb, TDB_DATA key, uint32 *value) +bool tdb_fetch_uint32_byblob(TDB_CONTEXT *tdb, TDB_DATA key, uint32 *value) { TDB_DATA data; @@ -246,7 +246,7 @@ BOOL tdb_fetch_uint32_byblob(TDB_CONTEXT *tdb, TDB_DATA key, uint32 *value) Output is uint32 in native byte order. ****************************************************************************/ -BOOL tdb_fetch_uint32(TDB_CONTEXT *tdb, const char *keystr, uint32 *value) +bool tdb_fetch_uint32(TDB_CONTEXT *tdb, const char *keystr, uint32 *value) { TDB_DATA key = string_term_tdb_data(keystr); @@ -258,11 +258,11 @@ BOOL tdb_fetch_uint32(TDB_CONTEXT *tdb, const char *keystr, uint32 *value) Input is uint32 in native byte order. Output in tdb is in little-endian. ****************************************************************************/ -BOOL tdb_store_uint32_byblob(TDB_CONTEXT *tdb, TDB_DATA key, uint32 value) +bool tdb_store_uint32_byblob(TDB_CONTEXT *tdb, TDB_DATA key, uint32 value) { TDB_DATA data; uint32 v_store; - BOOL ret = True; + bool ret = True; SIVAL(&v_store, 0, value); data.dptr = (uint8 *)&v_store; @@ -279,7 +279,7 @@ BOOL tdb_store_uint32_byblob(TDB_CONTEXT *tdb, TDB_DATA key, uint32 value) Input is uint32 in native byte order. Output in tdb is in little-endian. ****************************************************************************/ -BOOL tdb_store_uint32(TDB_CONTEXT *tdb, const char *keystr, uint32 value) +bool tdb_store_uint32(TDB_CONTEXT *tdb, const char *keystr, uint32 value) { TDB_DATA key = string_term_tdb_data(keystr); @@ -373,10 +373,10 @@ int32 tdb_change_int32_atomic(TDB_CONTEXT *tdb, const char *keystr, int32 *oldva Atomic unsigned integer change. Returns old value. To create, set initial value in *oldval. ****************************************************************************/ -BOOL tdb_change_uint32_atomic(TDB_CONTEXT *tdb, const char *keystr, uint32 *oldval, uint32 change_val) +bool tdb_change_uint32_atomic(TDB_CONTEXT *tdb, const char *keystr, uint32 *oldval, uint32 change_val) { uint32 val; - BOOL ret = False; + bool ret = False; if (tdb_lock_bystring(tdb, keystr) == -1) return False; @@ -511,7 +511,7 @@ size_t tdb_pack(uint8 *buf, int bufsize, const char *fmt, ...) return result; } -BOOL tdb_pack_append(TALLOC_CTX *mem_ctx, uint8 **buf, size_t *len, +bool tdb_pack_append(TALLOC_CTX *mem_ctx, uint8 **buf, size_t *len, const char *fmt, ...) { va_list ap; @@ -1185,7 +1185,7 @@ int tdb_validate_open(const char *tdb_path, tdb_validate_data_func validate_fn) * the traverse-copy */ struct tdb_copy_data { struct tdb_context *dst; - BOOL success; + bool success; }; static int traverse_copy_fn(struct tdb_context *tdb, TDB_DATA key, @@ -1351,8 +1351,8 @@ static int rename_file_with_suffix(TALLOC_CTX *ctx, const char *path, static int tdb_backup_with_rotate(TALLOC_CTX *ctx, const char *src_path, const char *dst_path, int hash_size, const char *rotate_suffix, - BOOL retry_norotate_if_nospc, - BOOL rename_as_last_resort_if_nospc) + bool retry_norotate_if_nospc, + bool rename_as_last_resort_if_nospc) { int ret; diff --git a/source3/lib/util_unistr.c b/source3/lib/util_unistr.c index 64cfd52120..2b91ea9c80 100644 --- a/source3/lib/util_unistr.c +++ b/source3/lib/util_unistr.c @@ -30,9 +30,9 @@ static smb_ucs2_t *upcase_table; static smb_ucs2_t *lowcase_table; static uint8 *valid_table; -static BOOL upcase_table_use_unmap; -static BOOL lowcase_table_use_unmap; -static BOOL valid_table_use_unmap; +static bool upcase_table_use_unmap; +static bool lowcase_table_use_unmap; +static bool valid_table_use_unmap; /** * This table says which Unicode characters are valid dos @@ -271,7 +271,7 @@ void init_valid_table(void) null termination if applied ********************************************************************/ -size_t dos_PutUniCode(char *dst,const char *src, size_t len, BOOL null_terminate) +size_t dos_PutUniCode(char *dst,const char *src, size_t len, bool null_terminate) { int flags = null_terminate ? STR_UNICODE|STR_NOALIGN|STR_TERMINATE : STR_UNICODE|STR_NOALIGN; @@ -435,7 +435,7 @@ smb_ucs2_t tolower_w( smb_ucs2_t val ) Determine if a character is lowercase. ********************************************************************/ -BOOL islower_w(smb_ucs2_t c) +bool islower_w(smb_ucs2_t c) { return upcase_table[SVAL(&c,0)] != c; } @@ -444,7 +444,7 @@ BOOL islower_w(smb_ucs2_t c) Determine if a character is uppercase. ********************************************************************/ -BOOL isupper_w(smb_ucs2_t c) +bool isupper_w(smb_ucs2_t c) { return lowcase_table[SVAL(&c,0)] != c; } @@ -453,7 +453,7 @@ BOOL isupper_w(smb_ucs2_t c) Determine if a character is valid in a 8.3 name. ********************************************************************/ -BOOL isvalid83_w(smb_ucs2_t c) +bool isvalid83_w(smb_ucs2_t c) { return valid_table[SVAL(&c,0)] != 0; } @@ -594,10 +594,10 @@ smb_ucs2_t *strstr_w(const smb_ucs2_t *s, const smb_ucs2_t *ins) return True if any char is converted ********************************************************************/ -BOOL strlower_w(smb_ucs2_t *s) +bool strlower_w(smb_ucs2_t *s) { smb_ucs2_t cp; - BOOL ret = False; + bool ret = False; while (*(COPY_UCS2_CHAR(&cp,s))) { smb_ucs2_t v = tolower_w(cp); @@ -615,10 +615,10 @@ BOOL strlower_w(smb_ucs2_t *s) return True if any char is converted ********************************************************************/ -BOOL strupper_w(smb_ucs2_t *s) +bool strupper_w(smb_ucs2_t *s) { smb_ucs2_t cp; - BOOL ret = False; + bool ret = False; while (*(COPY_UCS2_CHAR(&cp,s))) { smb_ucs2_t v = toupper_w(cp); if (v != cp) { @@ -706,7 +706,7 @@ int strncasecmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b, size_t len) Compare 2 strings. ********************************************************************/ -BOOL strequal_w(const smb_ucs2_t *s1, const smb_ucs2_t *s2) +bool strequal_w(const smb_ucs2_t *s1, const smb_ucs2_t *s2) { if (s1 == s2) { return(True); @@ -722,7 +722,7 @@ BOOL strequal_w(const smb_ucs2_t *s1, const smb_ucs2_t *s2) Compare 2 strings up to and including the nth char. ******************************************************************/ -BOOL strnequal_w(const smb_ucs2_t *s1,const smb_ucs2_t *s2,size_t n) +bool strnequal_w(const smb_ucs2_t *s1,const smb_ucs2_t *s2,size_t n) { if (s1 == s2) { return(True); @@ -849,10 +849,10 @@ void string_replace_w(smb_ucs2_t *s, smb_ucs2_t oldc, smb_ucs2_t newc) Trim unicode string. ********************************************************************/ -BOOL trim_string_w(smb_ucs2_t *s, const smb_ucs2_t *front, +bool trim_string_w(smb_ucs2_t *s, const smb_ucs2_t *front, const smb_ucs2_t *back) { - BOOL ret = False; + bool ret = False; size_t len, front_len, back_len; if (!s) { @@ -951,7 +951,7 @@ smb_ucs2_t *strstr_wa(const smb_ucs2_t *s, const char *ins) return NULL; } -BOOL trim_string_wa(smb_ucs2_t *s, const char *front, +bool trim_string_wa(smb_ucs2_t *s, const char *front, const char *back) { wpstring f, b; diff --git a/source3/lib/util_uuid.c b/source3/lib/util_uuid.c index 4a9c0848d2..606bfd2147 100644 --- a/source3/lib/util_uuid.c +++ b/source3/lib/util_uuid.c @@ -89,9 +89,9 @@ const char *smb_uuid_string_static(const struct GUID uu) return out; } -BOOL smb_string_to_uuid(const char *in, struct GUID* uu) +bool smb_string_to_uuid(const char *in, struct GUID* uu) { - BOOL ret = False; + bool ret = False; const char *ptr = in; char *end = (char *)in; int i; diff --git a/source3/lib/version.c b/source3/lib/version.c index 9835ad4a9c..cee06fc585 100644 --- a/source3/lib/version.c +++ b/source3/lib/version.c @@ -26,7 +26,7 @@ const char *samba_version_string(void) return SAMBA_VERSION_OFFICIAL_STRING; #else static fstring samba_version; - static BOOL init_samba_version; + static bool init_samba_version; #ifdef SAMBA_VENDOR_PATCH fstring tmp_version; size_t remaining; diff --git a/source3/lib/wins_srv.c b/source3/lib/wins_srv.c index 6344568122..0fb0648fec 100644 --- a/source3/lib/wins_srv.c +++ b/source3/lib/wins_srv.c @@ -94,10 +94,10 @@ done: see if an ip is on the dead list */ -BOOL wins_srv_is_dead(struct in_addr wins_ip, struct in_addr src_ip) +bool wins_srv_is_dead(struct in_addr wins_ip, struct in_addr src_ip) { char *keystr = wins_srv_keystr(wins_ip, src_ip); - BOOL result; + bool result; /* If the key exists then the WINS server has been marked as dead */ |