Mercurial > dovecot > core-2.2
comparison src/lda/main.c @ 12140:942bb9258e49
lda: If mail_debug=yes and no -d parameter is given, log where username is taken from.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 21 Sep 2010 14:04:22 +0100 |
parents | 8bd2bd410c73 |
children | 002a702cf06a |
comparison
equal
deleted
inserted
replaced
12139:af45e2f36059 | 12140:942bb9258e49 |
---|---|
219 struct mailbox *box; | 219 struct mailbox *box; |
220 struct raw_mailbox *raw_box; | 220 struct raw_mailbox *raw_box; |
221 struct istream *input; | 221 struct istream *input; |
222 struct mailbox_transaction_context *t; | 222 struct mailbox_transaction_context *t; |
223 struct mailbox_header_lookup_ctx *headers_ctx; | 223 struct mailbox_header_lookup_ctx *headers_ctx; |
224 const char *user_source = ""; | |
224 void **sets; | 225 void **sets; |
225 uid_t process_euid; | 226 uid_t process_euid; |
226 bool stderr_rejection = FALSE; | 227 bool stderr_rejection = FALSE; |
227 time_t mtime; | 228 time_t mtime; |
228 int ret, c; | 229 int ret, c; |
317 const char *home; | 318 const char *home; |
318 | 319 |
319 home = getenv("HOME"); | 320 home = getenv("HOME"); |
320 if (user != NULL && home != NULL) { | 321 if (user != NULL && home != NULL) { |
321 /* no need for a pw lookup */ | 322 /* no need for a pw lookup */ |
323 user_source = "USER environment"; | |
322 } else if ((pw = getpwuid(process_euid)) != NULL) { | 324 } else if ((pw = getpwuid(process_euid)) != NULL) { |
323 user = t_strdup(pw->pw_name); | 325 user = t_strdup(pw->pw_name); |
324 if (home == NULL) | 326 if (home == NULL) |
325 env_put(t_strconcat("HOME=", pw->pw_dir, NULL)); | 327 env_put(t_strconcat("HOME=", pw->pw_dir, NULL)); |
328 user_source = "passwd lookup for process euid"; | |
326 } else if (user == NULL) { | 329 } else if (user == NULL) { |
327 i_fatal_status(EX_USAGE, | 330 i_fatal_status(EX_USAGE, |
328 "Couldn't lookup our username (uid=%s)", | 331 "Couldn't lookup our username (uid=%s)", |
329 dec2str(process_euid)); | 332 dec2str(process_euid)); |
330 } | 333 } |
353 | 356 |
354 #ifdef SIGXFSZ | 357 #ifdef SIGXFSZ |
355 lib_signals_ignore(SIGXFSZ, TRUE); | 358 lib_signals_ignore(SIGXFSZ, TRUE); |
356 #endif | 359 #endif |
357 ctx.set = mail_storage_service_user_get_set(service_user)[1]; | 360 ctx.set = mail_storage_service_user_get_set(service_user)[1]; |
361 | |
362 if (ctx.dest_user->mail_debug && *user_source != '\0') { | |
363 i_debug("userdb lookup skipped, username taken from %s", | |
364 user_source); | |
365 } | |
358 | 366 |
359 /* create a separate mail user for the internal namespace */ | 367 /* create a separate mail user for the internal namespace */ |
360 sets = master_service_settings_get_others(master_service); | 368 sets = master_service_settings_get_others(master_service); |
361 raw_mail_user = mail_user_alloc(user, ctx.dest_user->set_info, sets[0]); | 369 raw_mail_user = mail_user_alloc(user, ctx.dest_user->set_info, sets[0]); |
362 mail_user_set_home(raw_mail_user, "/"); | 370 mail_user_set_home(raw_mail_user, "/"); |