fi,
want_cyrus_sasl2=no)
-AC_ARG_WITH(rawlog,
-[ --with-rawlog Build support for logging user traffic],
- if test x$withval = xyes; then
- AC_DEFINE(BUILD_RAWLOG,, Build with rawlogging feature)
- fi)
-
AC_ARG_WITH(ssl,
[ --with-ssl=[gnutls|openssl] Build with GNUTLS (default) or OpenSSL],
if test x$withval = xno; then
src/master/Makefile
src/pop3/Makefile
src/pop3-login/Makefile
+src/util/Makefile
stamp.h
dovecot.spec)
#include "ostream.h"
#include "str.h"
#include "lib-signals.h"
-#include "rawlog.h"
#include "restrict-access.h"
#include "fd-close-on-exec.h"
#include "process-title.h"
{
struct client *client;
const char *user, *str;
- int hin, hout;
lib_init_signals(sig_quit);
capability_string = str_new(default_pool, sizeof(CAPABILITY_STRING)+32);
str_append(capability_string, CAPABILITY_STRING);
- hin = 0; hout = 1;
- rawlog_open(&hin, &hout);
-
mail_storage_init();
mail_storage_register_all();
clients_init();
MAILBOX_OPEN_MMAP_INVALIDATE : 0;
namespace_pool = pool_alloconly_create("namespaces", 1024);
- client = client_create(hin, hout, namespace_init(namespace_pool, user));
+ client = client_create(0, 1, namespace_init(namespace_pool, user));
o_stream_cork(client->output);
if (IS_STANDALONE()) {
-/* Copyright (C) 2002 Timo Sirainen */
+/* Copyright (C) 2002-2003 Timo Sirainen */
#include "lib.h"
-#include "rawlog.h"
-
-#ifdef BUILD_RAWLOG
#include "ioloop.h"
#include "network.h"
copy(client_in, imap_out, log_in);
}
-void rawlog_open(int *hin, int *hout)
+static void rawlog_open(void)
{
struct io *io_imap, *io_client;
const char *home, *path, *fname;
if (pid > 0) {
/* parent */
close(log_in); close(log_out);
- close(*hin); close(*hout);
close(sfd[0]);
- *hin = *hout = sfd[1];
+ if (dup2(sfd[1], 0) < 0)
+ i_fatal("dup2(sfd, 0)");
+ if (dup2(sfd[1], 1) < 0)
+ i_fatal("dup2(sfd, 1)");
return;
}
close(sfd[1]);
dec2str(parent_pid)));
/* child */
- client_in = *hin;
- client_out = *hout;
+ client_in = 0;
+ client_out = 1;
imap_in = sfd[0];
imap_out = sfd[0];
exit(0);
}
-#else
-void rawlog_open(int *hin __attr_unused__, int *hout __attr_unused__)
+int main(int argc, char *argv[], char *envp[])
{
+ char *executable, *p;
+
+ lib_init();
+ process_title_init(argv, envp);
+
+ if (argc < 2)
+ i_fatal("Usage: rawlog <binary> <arguments>");
+
+ rawlog_open();
+
+ argv++;
+ executable = argv[0];
+
+ /* hide path, it's ugly */
+ p = strrchr(argv[0], '/');
+ if (p != NULL) argv[0] = p+1;
+ execv(executable, argv);
+
+ i_fatal_status(FATAL_EXEC, "execv(%s) failed: %m", executable);
+
+ /* not reached */
+ return FATAL_EXEC;
}
-#endif