dovecot-2.0: master: A bit more logging improvements for bad UID...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Jul 9 20:28:34 EEST 2009
details: http://hg.dovecot.org/dovecot-2.0/rev/444ce507a5ea
changeset: 9598:444ce507a5ea
user: Timo Sirainen <tss at iki.fi>
date: Thu Jul 09 13:28:30 2009 -0400
description:
master: A bit more logging improvements for bad UID/GID.
diffstat:
3 files changed, 27 insertions(+), 37 deletions(-)
src/lib-storage/index/maildir/maildir-copy.c | 16 +--------
src/lib-storage/index/maildir/maildir-save.c | 44 +++++++++++++-------------
src/master/service-process.c | 4 +-
diffs (163 lines):
diff -r 771097ddce48 -r 444ce507a5ea src/lib-storage/index/maildir/maildir-copy.c
--- a/src/lib-storage/index/maildir/maildir-copy.c Thu Jul 09 13:26:00 2009 -0400
+++ b/src/lib-storage/index/maildir/maildir-copy.c Thu Jul 09 13:28:30 2009 -0400
@@ -125,9 +125,7 @@ static int do_hardlink(struct maildir_ma
}
static int
-maildir_copy_hardlink(struct maildir_transaction_context *t, struct mail *mail,
- enum mail_flags flags, struct mail_keywords *keywords,
- struct mail *dest_mail)
+maildir_copy_hardlink(struct maildir_transaction_context *t, struct mail *mail)
{
struct maildir_mailbox *dest_mbox =
(struct maildir_mailbox *)t->ictx.ibox;
@@ -149,11 +147,6 @@ maildir_copy_hardlink(struct maildir_tra
if (t->save_ctx == NULL)
t->save_ctx = maildir_save_transaction_init(t);
-
- /* don't allow caller to specify recent flag */
- flags &= ~MAIL_RECENT;
- if (dest_mbox->ibox.keep_recent)
- flags |= MAIL_RECENT;
memset(&do_ctx, 0, sizeof(do_ctx));
do_ctx.dest_path = str_new(default_pool, 512);
@@ -209,8 +202,7 @@ maildir_copy_hardlink(struct maildir_tra
}
/* hardlinked to tmp/, treat as normal copied mail */
- maildir_save_add(t->save_ctx, do_ctx.dest_fname, flags, keywords,
- dest_mail);
+ maildir_save_add(t->save_ctx, do_ctx.dest_fname);
return 1;
}
@@ -231,9 +223,7 @@ int maildir_copy(struct mail_save_contex
if (mbox->storage->set->maildir_copy_with_hardlinks &&
maildir_compatible_file_modes(&mbox->ibox.box, mail->box)) {
T_BEGIN {
- ret = maildir_copy_hardlink(t, mail, ctx->flags,
- ctx->keywords,
- ctx->dest_mail);
+ ret = maildir_copy_hardlink(t, mail);
} T_END;
if (ret != 0) {
diff -r 771097ddce48 -r 444ce507a5ea src/lib-storage/index/maildir/maildir-save.c
--- a/src/lib-storage/index/maildir/maildir-save.c Thu Jul 09 13:26:00 2009 -0400
+++ b/src/lib-storage/index/maildir/maildir-save.c Thu Jul 09 13:28:30 2009 -0400
@@ -135,22 +135,25 @@ maildir_save_transaction_init(struct mai
}
uint32_t maildir_save_add(struct maildir_save_context *ctx,
- const char *base_fname, enum mail_flags flags,
- struct mail_keywords *keywords,
- struct mail *dest_mail)
+ const char *base_fname)
{
struct maildir_filename *mf;
struct istream *input;
+
+ /* don't allow caller to specify recent flag */
+ ctx->ctx.flags &= ~MAIL_RECENT;
+ if (dest_mbox->ibox.keep_recent)
+ ctx->ctx.flags |= MAIL_RECENT;
/* now, we want to be able to rollback the whole append session,
so we'll just store the name of this temp file and move it later
into new/ or cur/. */
/* @UNSAFE */
mf = p_malloc(ctx->pool, sizeof(*mf) +
- sizeof(unsigned int) * (keywords == NULL ? 0 :
- keywords->count));
+ sizeof(unsigned int) * (ctx->ctx.keywords == NULL ? 0 :
+ ctx->ctx.keywords->count));
mf->basename = p_strdup(ctx->pool, base_fname);
- mf->flags = flags;
+ mf->flags = ctx->ctx.flags;
mf->size = (uoff_t)-1;
mf->vsize = (uoff_t)-1;
@@ -160,22 +163,24 @@ uint32_t maildir_save_add(struct maildir
ctx->files_tail = &mf->next;
ctx->files_count++;
- if (keywords != NULL) {
- i_assert(sizeof(keywords->idx[0]) == sizeof(unsigned int));
+ if (ctx->ctx.keywords != NULL) {
+ i_assert(sizeof(ctx->ctx.keywords->idx[0]) ==
+ sizeof(unsigned int));
/* @UNSAFE */
- mf->keywords_count = keywords->count;
- memcpy(mf + 1, keywords->idx,
- sizeof(unsigned int) * keywords->count);
+ mf->keywords_count = ctx->ctx.keywords->count;
+ memcpy(mf + 1, ctx->ctx.keywords->idx,
+ sizeof(unsigned int) * ctx->ctx.keywords->count);
ctx->have_keywords = TRUE;
}
/* insert into index */
mail_index_append(ctx->trans, 0, &ctx->seq);
- mail_index_update_flags(ctx->trans, ctx->seq, MODIFY_REPLACE, flags);
- if (keywords != NULL) {
+ mail_index_update_flags(ctx->trans, ctx->seq,
+ MODIFY_REPLACE, ctx->ctx.flags);
+ if (ctx->ctx.keywords != NULL) {
mail_index_update_keywords(ctx->trans, ctx->seq,
- MODIFY_REPLACE, keywords);
+ MODIFY_REPLACE, ctx->ctx.keywords);
}
if (ctx->first_seq == 0) {
@@ -183,10 +188,10 @@ uint32_t maildir_save_add(struct maildir
i_assert(ctx->files->next == NULL);
}
- if (dest_mail == NULL) {
+ if (ctx->ctx.dest_mail == NULL) {
if (ctx->mail == NULL)
ctx->mail = mail_alloc(ctx->ctx.transaction, 0, NULL);
- dest_mail = ctx->mail;
+ ctx->ctx.dest_mail = ctx->mail;
}
mail_set_seq(dest_mail, ctx->seq);
@@ -371,10 +376,6 @@ int maildir_save_begin(struct mail_save_
(struct maildir_transaction_context *)_ctx->transaction;
struct maildir_save_context *ctx = (struct maildir_save_context *)_ctx;
- _ctx->flags &= ~MAIL_RECENT;
- if (ctx->mbox->ibox.keep_recent)
- _ctx->flags |= MAIL_RECENT;
-
T_BEGIN {
/* create a new file in tmp/ directory */
const char *fname = _ctx->guid;
@@ -387,8 +388,7 @@ int maildir_save_begin(struct mail_save_
ctx->input = i_stream_create_crlf(input);
else
ctx->input = i_stream_create_lf(input);
- maildir_save_add(t->save_ctx, fname, _ctx->flags,
- _ctx->keywords, _ctx->dest_mail);
+ maildir_save_add(ctx, fname);
}
} T_END;
diff -r 771097ddce48 -r 444ce507a5ea src/master/service-process.c
--- a/src/master/service-process.c Thu Jul 09 13:26:00 2009 -0400
+++ b/src/master/service-process.c Thu Jul 09 13:28:30 2009 -0400
@@ -176,8 +176,8 @@ static int validate_uid_gid(struct maste
struct group *gr;
gr = getgrgid(gid);
- i_error("User %s not allowed to log in using too %s "
- "UNIX GID %s%s (see first_valid_gid in config file)",
+ i_error("User %s not allowed to log in using too %s primary "
+ "UNIX group ID %s%s (see first_valid_gid in config file)",
user,
gid < (gid_t)set->first_valid_gid ? "low" : "high",
dec2str(gid), gr == NULL ? "" :
More information about the dovecot-cvs
mailing list