comparison src/lda/main.c @ 10130:d1384c2b08e5 HEAD

Merged single and multi mail_storage_service_*() functions.
author Timo Sirainen <tss@iki.fi>
date Wed, 21 Oct 2009 19:54:00 -0400
parents e248c1e53e00
children 545bdb7670d2
comparison
equal deleted inserted replaced
10129:3c87c0b18090 10130:d1384c2b08e5
243 NULL 243 NULL
244 }; 244 };
245 struct mail_deliver_context ctx; 245 struct mail_deliver_context ctx;
246 enum mail_storage_service_flags service_flags = 0; 246 enum mail_storage_service_flags service_flags = 0;
247 const char *user, *errstr, *path; 247 const char *user, *errstr, *path;
248 struct mail_storage_service_ctx *storage_service;
249 struct mail_storage_service_user *service_user;
248 struct mail_storage_service_input service_input; 250 struct mail_storage_service_input service_input;
249 struct mail_user *raw_mail_user; 251 struct mail_user *raw_mail_user;
250 struct mail_namespace *raw_ns; 252 struct mail_namespace *raw_ns;
251 struct mail_namespace_settings raw_ns_set; 253 struct mail_namespace_settings raw_ns_set;
252 struct mail_storage *storage; 254 struct mail_storage *storage;
378 service_input.module = "lda"; 380 service_input.module = "lda";
379 service_input.service = "lda"; 381 service_input.service = "lda";
380 service_input.username = user; 382 service_input.username = user;
381 383
382 service_flags |= MAIL_STORAGE_SERVICE_FLAG_DISALLOW_ROOT; 384 service_flags |= MAIL_STORAGE_SERVICE_FLAG_DISALLOW_ROOT;
383 ctx.dest_user = mail_storage_service_init_user(master_service, 385 storage_service = mail_storage_service_init(master_service, set_roots,
384 &service_input, 386 service_flags);
385 set_roots, 387 if (mail_storage_service_lookup_next(storage_service, &service_input,
386 service_flags); 388 &service_user, &ctx.dest_user,
389 &errstr) <= 0)
390 i_fatal("%s", errstr);
391
387 #ifdef SIGXFSZ 392 #ifdef SIGXFSZ
388 lib_signals_ignore(SIGXFSZ, TRUE); 393 lib_signals_ignore(SIGXFSZ, TRUE);
389 #endif 394 #endif
390 ctx.set = mail_storage_service_get_settings(master_service); 395 ctx.set = mail_storage_service_user_get_set(service_user)[1];
391 duplicate_init(mail_user_set_get_storage_set(ctx.dest_user->set)); 396 duplicate_init(mail_user_set_get_storage_set(ctx.dest_user->set));
392 397
393 /* create a separate mail user for the internal namespace */ 398 /* create a separate mail user for the internal namespace */
394 if (master_service_set(master_service, 399 if (master_service_set(master_service,
395 "mail_full_filesystem_access=yes") < 0) 400 "mail_full_filesystem_access=yes") < 0)
487 mail_user_unref(&ctx.dest_user); 492 mail_user_unref(&ctx.dest_user);
488 mail_user_unref(&raw_mail_user); 493 mail_user_unref(&raw_mail_user);
489 duplicate_deinit(); 494 duplicate_deinit();
490 pool_unref(&ctx.pool); 495 pool_unref(&ctx.pool);
491 496
492 mail_storage_service_deinit_user(); 497 mail_storage_service_user_free(&service_user);
498 mail_storage_service_deinit(&storage_service);
493 master_service_deinit(&master_service); 499 master_service_deinit(&master_service);
494 return EX_OK; 500 return EX_OK;
495 } 501 }