]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap-urlauth: Make imap-urlauth-worker-client compile as a separate module.
authorStephan Bosch <stephan.bosch@open-xchange.com>
Fri, 4 Nov 2022 02:01:18 +0000 (03:01 +0100)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Fri, 24 Mar 2023 07:14:54 +0000 (07:14 +0000)
src/imap-urlauth/Makefile.am
src/imap-urlauth/imap-urlauth-client.c
src/imap-urlauth/imap-urlauth-worker-client.c
src/imap-urlauth/imap-urlauth-worker-client.h [new file with mode: 0644]
src/imap-urlauth/imap-urlauth-worker-common.h [new file with mode: 0644]

index 2942c725f8819e871d4fc61e853aecf2be8ed403..4615c6019b9248bb5d5665127ba0465b96689e9e 100644 (file)
@@ -46,6 +46,7 @@ imap_urlauth_LDADD = $(LIBDOVECOT) \
 imap_urlauth_DEPENDENCIES = $(LIBDOVECOT_DEPS)
 
 imap_urlauth_SOURCES = \
+       imap-urlauth-worker-client.c \
        imap-urlauth.c \
        imap-urlauth-client.c \
        imap-urlauth-settings.c
@@ -82,5 +83,7 @@ noinst_HEADERS = \
        imap-urlauth-common.h \
        imap-urlauth-settings.h \
        imap-urlauth-login-settings.h \
+       imap-urlauth-worker-common.h \
+       imap-urlauth-worker-client.h \
        imap-urlauth-worker-settings.h
 
index 5f6b179821ed6533630504e14e509ba8c9aa8d54..ab36a965124fa44799142402e9162911f3b58679 100644 (file)
@@ -4,7 +4,6 @@
 #include "array.h"
 #include "ioloop.h"
 #include "net.h"
-#include "fdpass.h"
 #include "istream.h"
 #include "ostream.h"
 #include "str.h"
 #include "master-service.h"
 #include "master-interface.h"
 
+#include "imap-urlauth-worker-client.h"
+
 #include <unistd.h>
 #include <sys/wait.h>
 
 #define IMAP_URLAUTH_PROTOCOL_MAJOR_VERSION 1
 #define IMAP_URLAUTH_PROTOCOL_MINOR_VERSION 0
 
-#define IMAP_URLAUTH_WORKER_SOCKET "imap-urlauth-worker"
-
-/* max. length of input lines (URLs) */
-#define MAX_INBUF_SIZE 2048
-
 /* Disconnect client after idling this many milliseconds */
 #define CLIENT_IDLE_TIMEOUT_MSECS (10*60*1000)
 
@@ -43,10 +39,6 @@ static struct event_category event_category_urlauth = {
 struct client *imap_urlauth_clients;
 unsigned int imap_urlauth_client_count;
 
-static int client_worker_connect(struct client *client);
-static void client_worker_disconnect(struct client *client);
-static void client_worker_input(struct client *client);
-
 int client_create(const char *service, const char *username,
                  int fd_in, int fd_out,
                  const struct imap_urlauth_settings *set,
@@ -134,8 +126,6 @@ void client_send_line(struct client *client, const char *fmt, ...)
        va_end(va);
 }
 
-#include "imap-urlauth-worker-client.c"
-
 void client_destroy(struct client *client, const char *reason)
 {
        i_assert(reason != NULL || client->disconnected);
index f4d3788ef37382fcebe54ee0ebd429765e626bb5..58b8215eb3c523527a1931fd4e5d6a031aacaca0 100644 (file)
@@ -1,4 +1,24 @@
-static int client_worker_connect(struct client *client)
+/* Copyright (c) 2023 Dovecot authors, see the included COPYING file */
+
+#include "lib.h"
+#include "array.h"
+#include "net.h"
+#include "istream.h"
+#include "ostream.h"
+#include "str.h"
+#include "strescape.h"
+#include "fdpass.h"
+#include "eacces-error.h"
+
+#include "imap-urlauth-common.h"
+#include "imap-urlauth-worker-client.h"
+
+/* max. length of input lines (URLs) */
+#define MAX_INBUF_SIZE 2048
+
+static void client_worker_input(struct client *client);
+
+int client_worker_connect(struct client *client)
 {
        static const char handshake[] = "VERSION\timap-urlauth-worker\t2\t0\n";
        const char *socket_path;
@@ -167,7 +187,7 @@ client_worker_input_line(struct client *client, const char *response)
        return 0;
 }
 
-void client_worker_input(struct client *client)
+static void client_worker_input(struct client *client)
 {
        struct istream *input = client->ctrl_input;
        const char *line;
diff --git a/src/imap-urlauth/imap-urlauth-worker-client.h b/src/imap-urlauth/imap-urlauth-worker-client.h
new file mode 100644 (file)
index 0000000..6f6d6bd
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef IMAP_URLAUTH_WORKER_CLIENT_H
+#define IMAP_URLAUTH_WORKER_CLIENT_H
+
+#include "imap-urlauth-worker-common.h"
+
+int client_worker_connect(struct client *client);
+void client_worker_disconnect(struct client *client);
+
+#endif
diff --git a/src/imap-urlauth/imap-urlauth-worker-common.h b/src/imap-urlauth/imap-urlauth-worker-common.h
new file mode 100644 (file)
index 0000000..82b640b
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef IMAP_URLAUTH_WORKER_COMMON_H
+#define IMAP_URLAUTH_WORKER_COMMON_H
+
+#define IMAP_URLAUTH_WORKER_SOCKET "imap-urlauth-worker"
+
+#endif