I don't think these fix any actual bugs.
return TRUE;
}
-static int
+static bool
master_input_cache_flush(struct auth_master_connection *conn, const char *args)
{
const char *const *list;
static struct auth_postfix_connection *auth_postfix_connections;
-static int
+static bool
postfix_input_auth_request(struct auth_postfix_connection *conn,
const char *username,
struct auth_request **request_r, const char **error_r)
return FALSE;
}
-static int auth_passdb_list_have_set_credentials(const struct auth *auth)
+static bool auth_passdb_list_have_set_credentials(const struct auth *auth)
{
const struct auth_passdb *passdb;
strcase_hash, strcasecmp);
}
-int otp_try_lock(struct auth_request *auth_request)
+bool otp_try_lock(struct auth_request *auth_request)
{
- if (hash_table_lookup(otp_lock_table, auth_request->user))
+ if (hash_table_lookup(otp_lock_table, auth_request->user) != NULL)
return FALSE;
hash_table_insert(otp_lock_table, auth_request->user, auth_request);
pool_t pool;
- int lock;
+ bool lock;
struct otp_state state;
};
void otp_lock_init(void);
-int otp_try_lock(struct auth_request *auth_request);
+bool otp_try_lock(struct auth_request *auth_request);
void otp_unlock(struct auth_request *auth_request);
void otp_set_credentials_callback(bool success,
dict_connection_destroy(conn);
return;
}
- if (dict_connection_dict_init(conn)) {
+ if (dict_connection_dict_init(conn) < 0) {
dict_connection_destroy(conn);
return;
}
unsigned int len;
if (argc < 2)
- return NULL;
+ return FALSE;
len = strlen(argv[1]);
if (strncmp(cmdname, argv[1], len) != 0)
- return NULL;
+ return FALSE;
argc--; argv++;
if (cmdname[len] == ' ') {
return FALSE;
ret = mail_index_open(index, MAIL_INDEX_OPEN_FLAG_READONLY) > 0;
- if (ret > 0)
+ if (ret)
mail_index_close(index);
mail_index_free(&index);
return ret;
return -1;
input = i_stream_create_limit(input, hdr_size.physical_size);
- if ((ret = doveadm_print_istream(input) < 0))
+ if ((ret = doveadm_print_istream(input)) < 0)
fetch_set_istream_error(ctx, input);
i_stream_unref(&input);
return ret;
imap_msgpart_free(&msgpart);
return -1;
}
- if ((ret = doveadm_print_istream(result.input) < 0))
+ if ((ret = doveadm_print_istream(result.input)) < 0)
fetch_set_istream_error(ctx, result.input);
i_stream_unref(&result.input);
imap_msgpart_free(&msgpart);
return -1;
i_stream_skip(input, hdr_size.physical_size);
- if ((ret = doveadm_print_istream(input) < 0))
+ if ((ret = doveadm_print_istream(input)) < 0)
fetch_set_istream_error(ctx, input);
return ret;
}
if (mail_get_stream(ctx->mail, NULL, NULL, &input) < 0)
return -1;
- if ((ret = doveadm_print_istream(input) < 0))
+ if ((ret = doveadm_print_istream(input)) < 0)
fetch_set_istream_error(ctx, input);
return ret;
}
safe_memset(buffer_get_modifiable_data(tmp, NULL), 0,tmp->used);
buffer_set_used_size(key, 0);
- if (*point_r == FALSE)
+ if (*point_r == NULL)
return dcrypt_openssl_error(error_r);
return TRUE;
return FALSE;
}
-static bool
+static int
fs_randomfail_add_probability(struct randomfail_fs *fs,
const char *key, const char *value,
const char **error_r)
if (debug)
i_debug("server: PID=%s", my_pid);
/* child: server */
- ioloop_nested = FALSE;
+ ioloop_nested = NULL;
ioloop = io_loop_create();
test_server_init(server_set);
io_loop_run(ioloop);
i_debug("client: PID=%s", my_pid);
i_close_fd(&fd_listen);
/* parent: client */
- ioloop_nested = FALSE;
+ ioloop_nested = NULL;
ioloop = io_loop_create();
client_init(client_set);
io_loop_run(ioloop);
payload = NULL;
for (pos = 0; pos < response_text_len && ret == 0; pos++) {
test_istream_set_size(input, pos);
- ret = http_response_parse_next(parser, FALSE, &response, &error);
+ ret = http_response_parse_next(parser, HTTP_RESPONSE_PAYLOAD_TYPE_ALLOWED, &response, &error);
}
test_istream_set_size(input, response_text_len);
i_stream_unref(&input);
} else {
payload = NULL;
}
- ret = http_response_parse_next(parser, FALSE, &response, &error);
+ ret = http_response_parse_next(parser, HTTP_RESPONSE_PAYLOAD_TYPE_ALLOWED, &response, &error);
}
test_out("parse success", ret == 0);
test_begin(t_strdup_printf("http response invalid [%d]", i));
- while ((ret=http_response_parse_next(parser, FALSE, &response, &error)) > 0);
+ while ((ret=http_response_parse_next(parser, HTTP_RESPONSE_PAYLOAD_TYPE_ALLOWED, &response, &error)) > 0);
test_assert(ret < 0);
test_end();
sizeof(bad_response_with_nuls)-1);
parser = http_response_parser_init(input, NULL);
i_stream_unref(&input);
- while ((ret=http_response_parse_next(parser, FALSE, &response, &error)) > 0);
+ while ((ret=http_response_parse_next(parser, HTTP_RESPONSE_PAYLOAD_TYPE_ALLOWED, &response, &error)) > 0);
test_out("parse success", ret == 0);
header = http_response_header_get(&response, "server");
test_out("header present", header != NULL);
imap_urlauth_request_callback_t *callback;
void *context;
- unsigned int binary_has_nuls;
+ bool binary_has_nuls;
};
struct imap_urlauth_target {
struct istream *input;
struct imap_parser *parser;
const struct imap_arg *args;
- int ret;
+ int args_count;
+ bool ret;
i_assert(field < IMAP_ENVELOPE_FIELDS);
parser = imap_parser_create(input, NULL, (size_t)-1);
(void)i_stream_read(input);
- ret = imap_parser_read_args(parser, field+1, 0, &args);
- if (ret > (int)field) {
+ args_count = imap_parser_read_args(parser, field+1, 0, &args);
+ if (args_count > (int)field) {
ret = imap_envelope_parse_arg(&args[field], field,
envelope, result_type, result);
} else {
}
/* skip over everything parsed so far, plus the following whitespace */
-static int imap_parser_skip_to_next(struct imap_parser *parser,
- const unsigned char **data,
- size_t *data_size)
+static bool imap_parser_skip_to_next(struct imap_parser *parser,
+ const unsigned char **data,
+ size_t *data_size)
{
size_t i;
parser->cur_type = ARG_PARSE_NONE;
}
-static int imap_parser_close_list(struct imap_parser *parser)
+static bool imap_parser_close_list(struct imap_parser *parser)
{
struct imap_arg *arg;
parser->cur_type = ARG_PARSE_NONE;
}
-static int is_valid_atom_char(struct imap_parser *parser, char chr)
+static bool is_valid_atom_char(struct imap_parser *parser, char chr)
{
const char *error_msg;
return FALSE;
}
-static int imap_parser_read_atom(struct imap_parser *parser,
- const unsigned char *data, size_t data_size)
+static bool imap_parser_read_atom(struct imap_parser *parser,
+ const unsigned char *data, size_t data_size)
{
size_t i;
return parser->cur_type == ARG_PARSE_NONE;
}
-static int imap_parser_read_string(struct imap_parser *parser,
- const unsigned char *data, size_t data_size)
+static bool imap_parser_read_string(struct imap_parser *parser,
+ const unsigned char *data, size_t data_size)
{
size_t i;
return parser->cur_type == ARG_PARSE_NONE;
}
-static int imap_parser_literal_end(struct imap_parser *parser)
+static bool imap_parser_literal_end(struct imap_parser *parser)
{
if (parser->literal_minus && parser->literal_nonsync &&
parser->literal_size > 4096) {
return TRUE;
}
-static int imap_parser_read_literal(struct imap_parser *parser,
- const unsigned char *data,
- size_t data_size)
+static bool imap_parser_read_literal(struct imap_parser *parser,
+ const unsigned char *data,
+ size_t data_size)
{
size_t i, prev_size;
return FALSE;
}
-static int imap_parser_read_literal_data(struct imap_parser *parser,
- const unsigned char *data,
- size_t data_size)
+static bool imap_parser_read_literal_data(struct imap_parser *parser,
+ const unsigned char *data,
+ size_t data_size)
{
if (parser->literal_skip_crlf) {
/* skip \r\n or \n, anything else gives an error */
/* Returns TRUE if argument was fully processed. Also returns TRUE if
an argument inside a list was processed. */
-static int imap_parser_read_arg(struct imap_parser *parser)
+static bool imap_parser_read_arg(struct imap_parser *parser)
{
const unsigned char *data;
size_t data_size;
{
const unsigned char *msg_start, *sender_end, *msg_end;
struct tm tm;
- int esc, alt_stamp, timezone_secs = 0, seen_timezone = FALSE;
+ bool esc, alt_stamp, seen_timezone = FALSE;
+ int timezone_secs = 0;
time_t t;
*time_r = (time_t)-1;
/* numeric offset */
if (!i_isdigit(str[1]) || !i_isdigit(str[2]) ||
!i_isdigit(str[3]) || !i_isdigit(str[4]))
- return FALSE;
+ return 0;
offset = ((str[1]-'0') * 10 + (str[2]-'0')) * 60 +
(str[3]-'0') * 10 + (str[4]-'0');
for (i = 0; i < N_ELEMENTS(data); i += 2) {
str_truncate(dest, 0);
message_header_decode_utf8((const unsigned char *)data[i],
- strlen(data[i]), dest, FALSE);
+ strlen(data[i]), dest, NULL);
test_assert(strcmp(str_c(dest), data[i+1]) == 0);
}
test_end();
}
static void ntlmssp_append_string(buffer_t *buf, size_t buffer_offset,
- const char *str, int unicode)
+ const char *str, bool unicode)
{
struct ntlmssp_buffer buffer;
unsigned int length;
{
buffer_t *buf;
uint32_t flags = ntlmssp_flags(read_le32(&request->flags));
- int unicode = flags & NTLMSSP_NEGOTIATE_UNICODE;
+ bool unicode = (flags & NTLMSSP_NEGOTIATE_UNICODE) != 0;
struct ntlmssp_challenge c;
buf = buffer_create_dynamic(pool, sizeof(struct ntlmssp_challenge));
dest_prefixlen = str_len(dest_path);
seq_range_array_iter_init(&iter, &_t->changes->saved_uids); n = 0;
- while (seq_range_array_iter_nth(&iter, n++, &uid) > 0) {
+ while (seq_range_array_iter_nth(&iter, n++, &uid)) {
str_truncate(src_path, src_prefixlen);
str_truncate(dest_path, dest_prefixlen);
str_printfa(src_path, "%u", n-1);
return -1;
if (data->stream == NULL) {
- if (imapc_mail_failed(_mail, "BODY[]"))
+ if (imapc_mail_failed(_mail, "BODY[]") < 0)
return -1;
i_assert(data->stream == NULL);
{
const unsigned int field_idx = mail->ibox->cache_fields[field].idx;
buffer_t buf;
- int ret;
+ bool ret;
buffer_create_from_data(&buf, data, data_size);
if (index_mail_cache_lookup_field(mail, &buf, field_idx) <= 0)
/* finish handling expunges, so we don't break when updating
recent flags */
- while (index_mailbox_sync_next_expunge(ctx, &sync_rec) > 0) ;
+ while (index_mailbox_sync_next_expunge(ctx, &sync_rec)) ;
/* convert sequences to uids before syncing view */
index_sync_search_results_uidify(ctx);
struct mbox_sync_mail_context mail_ctx;
const struct stat *st;
unsigned int i;
- int ret, partial;
+ bool partial;
+ int ret;
if (i_stream_stat(sync_ctx->file_input, FALSE, &st) < 0) {
mbox_set_syscall_error(sync_ctx->mbox, "i_stream_stat()");
struct mail_index_transaction *trans;
struct mbox_sync_context sync_ctx;
enum mail_index_sync_flags sync_flags;
- int ret, changed;
- bool delay_writes, readonly;
+ int ret;
+ bool changed, delay_writes, readonly;
readonly = mbox_is_backend_readonly(mbox) ||
(flags & MBOX_SYNC_READONLY) != 0;
(flags & MBOX_SYNC_FORCE_SYNC) != 0) {
if (mbox_sync_header_refresh(mbox) < 0)
return -1;
- changed = 1;
+ changed = TRUE;
} else {
bool leave_dirty = (flags & MBOX_SYNC_UNDIRTY) == 0;
- if ((changed = mbox_sync_has_changed(mbox, leave_dirty)) < 0)
+ if ((ret = mbox_sync_has_changed(mbox, leave_dirty)) < 0)
return -1;
+ changed = ret > 0;
}
if ((flags & MBOX_SYNC_LOCK_READING) != 0) {
/* see if we need to drop recent flags */
sync_ctx.hdr = mail_index_get_header(sync_view);
if (sync_ctx.hdr->first_recent_uid < sync_ctx.hdr->next_uid)
- changed = 1;
+ changed = TRUE;
}
if (!changed && !mail_index_sync_have_more(index_sync_ctx)) {
/* ok, we have something to do but no locks. we'll have to
restart syncing to avoid deadlocking. */
mbox_sync_context_free(&sync_ctx);
- changed = 1;
+ changed = TRUE;
goto again;
}
if (mailbox_list_settings_parse_full(user, p + 1, FALSE,
&set, &error) < 0)
return "";
- if (mailbox_list_set_get_root_path(&set, type, &path) <= 0)
+ if (!mailbox_list_set_get_root_path(&set, type, &path))
return "";
return path;
}
{
unsigned int ns_prefix_len = strlen(ns_prefix);
string_t *escaped_name = t_str_new(64);
- char dirstart = TRUE;
+ bool dirstart = TRUE;
/* no escaping of namespace prefix */
if (strncmp(ns_prefix, vname, ns_prefix_len) == 0) {
int mailbox_list_mkdir_missing_index_root(struct mailbox_list *list)
{
const char *root_dir, *index_dir;
- int ret;
if (list->index_root_dir_created)
return 1;
/* if index root dir hasn't been created yet, do it now */
- ret = mailbox_list_get_root_path(list, MAILBOX_LIST_PATH_TYPE_INDEX,
- &index_dir);
- if (ret <= 0)
- return ret;
- ret = mailbox_list_get_root_path(list, MAILBOX_LIST_PATH_TYPE_MAILBOX,
- &root_dir);
- if (ret <= 0)
- return ret;
+ if (!mailbox_list_get_root_path(list, MAILBOX_LIST_PATH_TYPE_INDEX,
+ &index_dir))
+ return 0;
+ if (!mailbox_list_get_root_path(list, MAILBOX_LIST_PATH_TYPE_MAILBOX,
+ &root_dir))
+ return 0;
if (strcmp(root_dir, index_dir) != 0) {
if (mailbox_list_mkdir_root(list, index_dir,
int fd;
if (!have_proc_locks)
- return FALSE;
+ return NULL;
if (fstat(lock_fd, &st) < 0)
return "";
}
static char **
-split_str(pool_t pool, const char *data, const char *separators, int spaces)
+split_str(pool_t pool, const char *data, const char *separators, bool spaces)
{
char **array;
char *str;
#define NOMATCH 0
#define MATCH (match+sofar)
-static int wildcard_match_int(const char *data, const char *mask, int icase)
+static int wildcard_match_int(const char *data, const char *mask, bool icase)
{
const char *ma = mask, *na = data, *lsm = NULL, *lsn = NULL;
int match = 1;
static bool
master_settings_verify(void *_set, pool_t pool, const char **error_r)
{
- static int warned_auth = FALSE, warned_anvil = FALSE;
+ static bool warned_auth = FALSE, warned_anvil = FALSE;
struct master_settings *set = _set;
struct service_settings *const *services;
const char *const *strings;
return ret;
}
-static int listener_equals(const struct service_listener *l1,
- const struct service_listener *l2)
+static bool listener_equals(const struct service_listener *l1,
+ const struct service_listener *l2)
{
if (l1->type != l2->type)
return FALSE;
username_r);
} T_END;
if (ret > 0)
- return TRUE;
+ return 1;
if (ret < 0 && ectx->delete_nonexistent_users) {
/* user has been deleted */
dict_unset(ectx->trans, key);
return FALSE;
}
-static time_t
+static bool
doveadm_expire_analyze_or_query(struct doveadm_mail_cmd_context *ctx,
const struct mail_search_arg *args)
{
i_unlink_if_exists(trie_path);
i_unlink_if_exists(uidlist_path);
trie = squat_trie_init(trie_path, time(NULL),
- FILE_LOCK_METHOD_FCNTL, FALSE, 0600, (gid_t)-1);
+ FILE_LOCK_METHOD_FCNTL, 0, 0600, (gid_t)-1);
clock_start = clock();
gettimeofday(&tv_start, NULL);
int fd;
parse_content_disposition(content_disposition, &filename);
- if (script_support_content(user, &content_type, filename) <= 0)
+ if (!script_support_content(user, &content_type, filename))
return NULL;
fd = script_connect(user, &path);
p_array_init(&fuser->languages, user->pool, 4);
if (fts_user_init_languages(user, fuser, error_r) < 0 ||
- fts_user_init_data_language(user, fuser, error_r)) {
+ fts_user_init_data_language(user, fuser, error_r) < 0) {
fts_user_free(fuser);
return -1;
}
bool ret = FALSE;
iter = acl_object_list_init(aclobj);
- while ((ret = acl_object_list_next(iter, &rights)) > 0) {
+ while (acl_object_list_next(iter, &rights) > 0) {
if (acl_rights_is_owner(backend, &rights)) {
if (rights.rights != NULL) {
ret = TRUE;