int imap_urlauth_fetch_url_parsed(struct imap_urlauth_fetch *ufetch, const char *url, struct imap_url *imap_url, enum imap_urlauth_fetch_flags url_flags) { struct imap_urlauth_context *uctx = ufetch->uctx; struct mail_user *mail_user = uctx->user; const char *error, *errormsg; int ret = 0; ufetch->failed = FALSE; ufetch->pending_requests++; imap_urlauth_fetch_ref(ufetch); /* if access user and target user match, handle fetch request locally */ if (imap_url->userid != NULL && strcmp(mail_user->username, imap_url->userid) == 0) { if (ufetch->waiting_local) { struct imap_urlauth_fetch_url *url_local; url_local = i_new(struct imap_urlauth_fetch_url, 1); url_local->url = i_strdup(url); url_local->flags = url_flags; DLLIST2_APPEND(&ufetch->local_urls_head, &ufetch->local_urls_tail, url_local); } else T_BEGIN { imap_urlauth_fetch_local(ufetch, url, url_flags, imap_url); } T_END; imap_url = NULL; /* don't try to fetch remote URLs that are already known to fail access */ } else if (!imap_urlauth_check(uctx, imap_url, TRUE, &error)) {
static void mail_log_add_dummy_msg(struct mail_log_mail_txn_context *ctx, enum mail_log_event event) { struct mail_log_message *msg; msg = p_new(ctx->pool, struct mail_log_message, 1); msg->event = event; msg->ignore = TRUE; DLLIST2_APPEND(&ctx->messages, &ctx->messages_tail, msg); }
void master_login_auth_request(struct master_login_auth *auth, const struct master_auth_request *req, master_login_auth_request_callback_t *callback, void *context) { struct master_login_auth_request *login_req; unsigned int id; if (auth->fd == -1) { if (master_login_auth_connect(auth) < 0) { /* we couldn't connect to auth now, so we probably can't in future either. */ master_service_stop_new_connections(master_service); callback(NULL, MASTER_AUTH_ERRMSG_INTERNAL_FAILURE, context); return; } o_stream_nsend_str(auth->output, t_strdup_printf("VERSION\t%u\t%u\n", AUTH_MASTER_PROTOCOL_MAJOR_VERSION, AUTH_MASTER_PROTOCOL_MINOR_VERSION)); } id = ++auth->id_counter; if (id == 0) id++; login_req = i_new(struct master_login_auth_request, 1); login_req->create_stamp = ioloop_time; login_req->id = id; login_req->auth_pid = req->auth_pid; login_req->client_pid = req->client_pid; login_req->auth_id = req->auth_id; memcpy(login_req->cookie, req->cookie, sizeof(login_req->cookie)); login_req->callback = callback; login_req->context = context; i_assert(hash_table_lookup(auth->requests, POINTER_CAST(id)) == NULL); hash_table_insert(auth->requests, POINTER_CAST(id), login_req); DLLIST2_APPEND(&auth->request_head, &auth->request_tail, login_req); if (auth->to == NULL) master_login_auth_set_timeout(auth); master_login_auth_send_request(auth, login_req); }
struct smtp_server_command * smtp_server_command_alloc(struct smtp_server_connection *conn) { struct smtp_server_command *cmd; pool_t pool; pool = pool_alloconly_create("smtp_server_command", 256); cmd = p_new(pool, struct smtp_server_command, 1); cmd->context.pool = pool; cmd->context.cmd = cmd; cmd->refcount = 1; cmd->context.conn = conn; cmd->context.server = conn->server; cmd->replies_expected = 1; DLLIST2_APPEND(&conn->command_queue_head, &conn->command_queue_tail, cmd); conn->command_queue_count++; return cmd; }
static void mail_log_append_mail_message_real(struct mail_log_mail_txn_context *ctx, struct mail *mail, enum mail_log_event event, const char *desc) { struct mail_log_user *muser = MAIL_LOG_USER_CONTEXT(mail->box->storage->user); struct mail_log_message *msg; string_t *text; uoff_t size; msg = p_new(ctx->pool, struct mail_log_message, 1); text = t_str_new(128); str_append(text, desc); str_append(text, ": "); if ((muser->fields & MAIL_LOG_FIELD_BOX) != 0) { mail_log_append_mailbox_name(text, mail); str_append(text, ", "); } if ((muser->fields & MAIL_LOG_FIELD_UID) != 0) { if (event != MAIL_LOG_EVENT_SAVE && event != MAIL_LOG_EVENT_COPY) mail_log_append_uid(ctx, msg, text, mail->uid); else { /* with mbox mail->uid contains the uid, but handle this consistently with all mailbox formats */ mail_log_append_uid(ctx, msg, text, 0); } str_append(text, ", "); } if ((muser->fields & MAIL_LOG_FIELD_MSGID) != 0) { mail_log_append_mail_header(text, mail, "msgid", "Message-ID"); str_append(text, ", "); } if ((muser->fields & MAIL_LOG_FIELD_PSIZE) != 0) { if (mail_get_physical_size(mail, &size) == 0) str_printfa(text, "size=%"PRIuUOFF_T, size); else str_printfa(text, "size=error"); str_append(text, ", "); } if ((muser->fields & MAIL_LOG_FIELD_VSIZE) != 0) { if (mail_get_virtual_size(mail, &size) == 0) str_printfa(text, "vsize=%"PRIuUOFF_T, size); else str_printfa(text, "vsize=error"); str_append(text, ", "); } if ((muser->fields & MAIL_LOG_FIELD_FROM) != 0) { mail_log_append_mail_header(text, mail, "from", "From"); str_append(text, ", "); } if ((muser->fields & MAIL_LOG_FIELD_SUBJECT) != 0) { mail_log_append_mail_header(text, mail, "subject", "Subject"); str_append(text, ", "); } if ((muser->fields & MAIL_LOG_FIELD_FLAGS) != 0) { str_printfa(text, "flags=("); imap_write_flags(text, mail_get_flags(mail), mail_get_keywords(mail)); str_append(text, "), "); } str_truncate(text, str_len(text)-2); msg->event = event; msg->text = p_strdup(ctx->pool, str_c(text)); DLLIST2_APPEND(&ctx->messages, &ctx->messages_tail, msg); }