summaryrefslogtreecommitdiffstats
path: root/pigeonhole/src/managesieve
diff options
context:
space:
mode:
Diffstat (limited to 'pigeonhole/src/managesieve')
-rw-r--r--pigeonhole/src/managesieve/Makefile.am59
-rw-r--r--pigeonhole/src/managesieve/Makefile.in1134
-rw-r--r--pigeonhole/src/managesieve/cmd-capability.c76
-rw-r--r--pigeonhole/src/managesieve/cmd-deletescript.c43
-rw-r--r--pigeonhole/src/managesieve/cmd-getscript.c157
-rw-r--r--pigeonhole/src/managesieve/cmd-havespace.c60
-rw-r--r--pigeonhole/src/managesieve/cmd-listscripts.c65
-rw-r--r--pigeonhole/src/managesieve/cmd-logout.c21
-rw-r--r--pigeonhole/src/managesieve/cmd-noop.c46
-rw-r--r--pigeonhole/src/managesieve/cmd-putscript.c578
-rw-r--r--pigeonhole/src/managesieve/cmd-renamescript.c54
-rw-r--r--pigeonhole/src/managesieve/cmd-setactive.c165
-rw-r--r--pigeonhole/src/managesieve/main.c401
-rw-r--r--pigeonhole/src/managesieve/managesieve-capabilities.c136
-rw-r--r--pigeonhole/src/managesieve/managesieve-capabilities.h6
-rw-r--r--pigeonhole/src/managesieve/managesieve-client.c792
-rw-r--r--pigeonhole/src/managesieve/managesieve-client.h162
-rw-r--r--pigeonhole/src/managesieve/managesieve-commands.c110
-rw-r--r--pigeonhole/src/managesieve/managesieve-commands.h46
-rw-r--r--pigeonhole/src/managesieve/managesieve-common.h31
-rw-r--r--pigeonhole/src/managesieve/managesieve-quota.c98
-rw-r--r--pigeonhole/src/managesieve/managesieve-quota.h11
-rw-r--r--pigeonhole/src/managesieve/managesieve-settings.c170
-rw-r--r--pigeonhole/src/managesieve/managesieve-settings.h29
24 files changed, 4450 insertions, 0 deletions
diff --git a/pigeonhole/src/managesieve/Makefile.am b/pigeonhole/src/managesieve/Makefile.am
new file mode 100644
index 0000000..17b5790
--- /dev/null
+++ b/pigeonhole/src/managesieve/Makefile.am
@@ -0,0 +1,59 @@
+settingsdir = $(dovecot_moduledir)/settings
+
+dovecot_pkglibexec_PROGRAMS = managesieve
+
+AM_CPPFLAGS = \
+ $(LIBDOVECOT_INCLUDE) \
+ $(LIBDOVECOT_SERVICE_INCLUDE) \
+ -DMODULEDIR=\""$(dovecot_moduledir)"\" \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/src/lib-sieve \
+ -I$(top_srcdir)/src/lib-managesieve
+
+libmanagesieve_settings_la_LDFLAGS = -module -avoid-version
+
+settings_LTLIBRARIES = \
+ libmanagesieve_settings.la
+
+libmanagesieve_settings_la_SOURCES = \
+ managesieve-settings.c
+
+libs = \
+ managesieve-settings.lo \
+ $(top_builddir)/src/lib-managesieve/libmanagesieve.la \
+ $(top_builddir)/src/lib-sieve/libdovecot-sieve.la
+
+managesieve_CPPFLAGS = $(AM_CPPFLAGS) $(BINARY_CFLAGS)
+managesieve_LDFLAGS = -export-dynamic $(BINARY_LDFLAGS)
+
+managesieve_LDADD = $(libs) $(LIBDOVECOT_STORAGE) $(LIBDOVECOT_LDA) $(LIBDOVECOT)
+
+managesieve_DEPENDENCIES = $(libs) $(LIBDOVECOT_STORAGE_DEPS) $(LIBDOVECOT_LDA_DEPS) $(LIBDOVECOT_DEPS)
+
+cmds = \
+ cmd-capability.c \
+ cmd-logout.c \
+ cmd-putscript.c \
+ cmd-getscript.c \
+ cmd-setactive.c \
+ cmd-deletescript.c \
+ cmd-listscripts.c \
+ cmd-havespace.c \
+ cmd-renamescript.c \
+ cmd-noop.c
+
+managesieve_SOURCES = \
+ $(cmds) \
+ managesieve-quota.c \
+ managesieve-client.c \
+ managesieve-commands.c \
+ managesieve-capabilities.c \
+ main.c
+
+noinst_HEADERS = \
+ managesieve-quota.h \
+ managesieve-client.h \
+ managesieve-commands.h \
+ managesieve-capabilities.h \
+ managesieve-settings.h \
+ managesieve-common.h
diff --git a/pigeonhole/src/managesieve/Makefile.in b/pigeonhole/src/managesieve/Makefile.in
new file mode 100644
index 0000000..d8f9faa
--- /dev/null
+++ b/pigeonhole/src/managesieve/Makefile.in
@@ -0,0 +1,1134 @@
+# Makefile.in generated by automake 1.16.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2020 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+
+VPATH = @srcdir@
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+dovecot_pkglibexec_PROGRAMS = managesieve$(EXEEXT)
+subdir = src/managesieve
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/dovecot.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \
+ $(am__DIST_COMMON)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/dummy-config.h \
+ $(top_builddir)/pigeonhole-config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(dovecot_pkglibexecdir)" \
+ "$(DESTDIR)$(settingsdir)"
+PROGRAMS = $(dovecot_pkglibexec_PROGRAMS)
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+LTLIBRARIES = $(settings_LTLIBRARIES)
+libmanagesieve_settings_la_LIBADD =
+am_libmanagesieve_settings_la_OBJECTS = managesieve-settings.lo
+libmanagesieve_settings_la_OBJECTS = \
+ $(am_libmanagesieve_settings_la_OBJECTS)
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 =
+libmanagesieve_settings_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ $(AM_CFLAGS) $(CFLAGS) $(libmanagesieve_settings_la_LDFLAGS) \
+ $(LDFLAGS) -o $@
+am__objects_1 = managesieve-cmd-capability.$(OBJEXT) \
+ managesieve-cmd-logout.$(OBJEXT) \
+ managesieve-cmd-putscript.$(OBJEXT) \
+ managesieve-cmd-getscript.$(OBJEXT) \
+ managesieve-cmd-setactive.$(OBJEXT) \
+ managesieve-cmd-deletescript.$(OBJEXT) \
+ managesieve-cmd-listscripts.$(OBJEXT) \
+ managesieve-cmd-havespace.$(OBJEXT) \
+ managesieve-cmd-renamescript.$(OBJEXT) \
+ managesieve-cmd-noop.$(OBJEXT)
+am_managesieve_OBJECTS = $(am__objects_1) \
+ managesieve-managesieve-quota.$(OBJEXT) \
+ managesieve-managesieve-client.$(OBJEXT) \
+ managesieve-managesieve-commands.$(OBJEXT) \
+ managesieve-managesieve-capabilities.$(OBJEXT) \
+ managesieve-main.$(OBJEXT)
+managesieve_OBJECTS = $(am_managesieve_OBJECTS)
+am__DEPENDENCIES_1 =
+managesieve_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(managesieve_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__maybe_remake_depfiles = depfiles
+am__depfiles_remade = ./$(DEPDIR)/managesieve-cmd-capability.Po \
+ ./$(DEPDIR)/managesieve-cmd-deletescript.Po \
+ ./$(DEPDIR)/managesieve-cmd-getscript.Po \
+ ./$(DEPDIR)/managesieve-cmd-havespace.Po \
+ ./$(DEPDIR)/managesieve-cmd-listscripts.Po \
+ ./$(DEPDIR)/managesieve-cmd-logout.Po \
+ ./$(DEPDIR)/managesieve-cmd-noop.Po \
+ ./$(DEPDIR)/managesieve-cmd-putscript.Po \
+ ./$(DEPDIR)/managesieve-cmd-renamescript.Po \
+ ./$(DEPDIR)/managesieve-cmd-setactive.Po \
+ ./$(DEPDIR)/managesieve-main.Po \
+ ./$(DEPDIR)/managesieve-managesieve-capabilities.Po \
+ ./$(DEPDIR)/managesieve-managesieve-client.Po \
+ ./$(DEPDIR)/managesieve-managesieve-commands.Po \
+ ./$(DEPDIR)/managesieve-managesieve-quota.Po \
+ ./$(DEPDIR)/managesieve-settings.Plo
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
+SOURCES = $(libmanagesieve_settings_la_SOURCES) $(managesieve_SOURCES)
+DIST_SOURCES = $(libmanagesieve_settings_la_SOURCES) \
+ $(managesieve_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+HEADERS = $(noinst_HEADERS)
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BINARY_CFLAGS = @BINARY_CFLAGS@
+BINARY_LDFLAGS = @BINARY_LDFLAGS@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DISTCHECK_CONFIGURE_FLAGS = @DISTCHECK_CONFIGURE_FLAGS@
+DLLTOOL = @DLLTOOL@
+DOVECOT_BINARY_CFLAGS = @DOVECOT_BINARY_CFLAGS@
+DOVECOT_BINARY_LDFLAGS = @DOVECOT_BINARY_LDFLAGS@
+DOVECOT_CFLAGS = @DOVECOT_CFLAGS@
+DOVECOT_COMPRESS_LIBS = @DOVECOT_COMPRESS_LIBS@
+DOVECOT_INSTALLED = @DOVECOT_INSTALLED@
+DOVECOT_LIBS = @DOVECOT_LIBS@
+DOVECOT_LUA_CFLAGS = @DOVECOT_LUA_CFLAGS@
+DOVECOT_LUA_LIBS = @DOVECOT_LUA_LIBS@
+DOVECOT_SQL_LIBS = @DOVECOT_SQL_LIBS@
+DOVECOT_SSL_LIBS = @DOVECOT_SSL_LIBS@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDAP_LIBS = @LDAP_LIBS@
+LDFLAGS = @LDFLAGS@
+LIBDOVECOT = @LIBDOVECOT@
+LIBDOVECOT_ACL_INCLUDE = @LIBDOVECOT_ACL_INCLUDE@
+LIBDOVECOT_AUTH_INCLUDE = @LIBDOVECOT_AUTH_INCLUDE@
+LIBDOVECOT_COMPRESS = @LIBDOVECOT_COMPRESS@
+LIBDOVECOT_COMPRESS_DEPS = @LIBDOVECOT_COMPRESS_DEPS@
+LIBDOVECOT_CONFIG_INCLUDE = @LIBDOVECOT_CONFIG_INCLUDE@
+LIBDOVECOT_DEPS = @LIBDOVECOT_DEPS@
+LIBDOVECOT_DOVEADM_INCLUDE = @LIBDOVECOT_DOVEADM_INCLUDE@
+LIBDOVECOT_DSYNC = @LIBDOVECOT_DSYNC@
+LIBDOVECOT_DSYNC_DEPS = @LIBDOVECOT_DSYNC_DEPS@
+LIBDOVECOT_DSYNC_INCLUDE = @LIBDOVECOT_DSYNC_INCLUDE@
+LIBDOVECOT_FTS_INCLUDE = @LIBDOVECOT_FTS_INCLUDE@
+LIBDOVECOT_IMAPC_INCLUDE = @LIBDOVECOT_IMAPC_INCLUDE@
+LIBDOVECOT_IMAP_INCLUDE = @LIBDOVECOT_IMAP_INCLUDE@
+LIBDOVECOT_IMAP_LOGIN_INCLUDE = @LIBDOVECOT_IMAP_LOGIN_INCLUDE@
+LIBDOVECOT_INCLUDE = @LIBDOVECOT_INCLUDE@
+LIBDOVECOT_LDA = @LIBDOVECOT_LDA@
+LIBDOVECOT_LDA_DEPS = @LIBDOVECOT_LDA_DEPS@
+LIBDOVECOT_LDA_INCLUDE = @LIBDOVECOT_LDA_INCLUDE@
+LIBDOVECOT_LIBFTS = @LIBDOVECOT_LIBFTS@
+LIBDOVECOT_LIBFTS_DEPS = @LIBDOVECOT_LIBFTS_DEPS@
+LIBDOVECOT_LIBFTS_INCLUDE = @LIBDOVECOT_LIBFTS_INCLUDE@
+LIBDOVECOT_LMTP_INCLUDE = @LIBDOVECOT_LMTP_INCLUDE@
+LIBDOVECOT_LOGIN = @LIBDOVECOT_LOGIN@
+LIBDOVECOT_LOGIN_DEPS = @LIBDOVECOT_LOGIN_DEPS@
+LIBDOVECOT_LOGIN_INCLUDE = @LIBDOVECOT_LOGIN_INCLUDE@
+LIBDOVECOT_LUA = @LIBDOVECOT_LUA@
+LIBDOVECOT_LUA_DEPS = @LIBDOVECOT_LUA_DEPS@
+LIBDOVECOT_LUA_INCLUDE = @LIBDOVECOT_LUA_INCLUDE@
+LIBDOVECOT_NOTIFY_INCLUDE = @LIBDOVECOT_NOTIFY_INCLUDE@
+LIBDOVECOT_POP3_INCLUDE = @LIBDOVECOT_POP3_INCLUDE@
+LIBDOVECOT_PUSH_NOTIFICATION_INCLUDE = @LIBDOVECOT_PUSH_NOTIFICATION_INCLUDE@
+LIBDOVECOT_SERVICE_INCLUDE = @LIBDOVECOT_SERVICE_INCLUDE@
+LIBDOVECOT_SQL = @LIBDOVECOT_SQL@
+LIBDOVECOT_SQL_DEPS = @LIBDOVECOT_SQL_DEPS@
+LIBDOVECOT_SQL_INCLUDE = @LIBDOVECOT_SQL_INCLUDE@
+LIBDOVECOT_SSL = @LIBDOVECOT_SSL@
+LIBDOVECOT_SSL_DEPS = @LIBDOVECOT_SSL_DEPS@
+LIBDOVECOT_STORAGE = @LIBDOVECOT_STORAGE@
+LIBDOVECOT_STORAGE_DEPS = @LIBDOVECOT_STORAGE_DEPS@
+LIBDOVECOT_STORAGE_INCLUDE = @LIBDOVECOT_STORAGE_INCLUDE@
+LIBDOVECOT_SUBMISSION_INCLUDE = @LIBDOVECOT_SUBMISSION_INCLUDE@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PIE_CFLAGS = @PIE_CFLAGS@
+PIE_LDFLAGS = @PIE_LDFLAGS@
+RANLIB = @RANLIB@
+RELRO_LDFLAGS = @RELRO_LDFLAGS@
+RUN_TEST = @RUN_TEST@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VALGRIND = @VALGRIND@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dovecot_docdir = @dovecot_docdir@
+dovecot_installed_moduledir = @dovecot_installed_moduledir@
+dovecot_moduledir = @dovecot_moduledir@
+dovecot_pkgincludedir = @dovecot_pkgincludedir@
+dovecot_pkglibdir = @dovecot_pkglibdir@
+dovecot_pkglibexecdir = @dovecot_pkglibexecdir@
+dovecot_statedir = @dovecot_statedir@
+dovecotdir = @dovecotdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+runstatedir = @runstatedir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sieve_docdir = @sieve_docdir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+settingsdir = $(dovecot_moduledir)/settings
+AM_CPPFLAGS = \
+ $(LIBDOVECOT_INCLUDE) \
+ $(LIBDOVECOT_SERVICE_INCLUDE) \
+ -DMODULEDIR=\""$(dovecot_moduledir)"\" \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/src/lib-sieve \
+ -I$(top_srcdir)/src/lib-managesieve
+
+libmanagesieve_settings_la_LDFLAGS = -module -avoid-version
+settings_LTLIBRARIES = \
+ libmanagesieve_settings.la
+
+libmanagesieve_settings_la_SOURCES = \
+ managesieve-settings.c
+
+libs = \
+ managesieve-settings.lo \
+ $(top_builddir)/src/lib-managesieve/libmanagesieve.la \
+ $(top_builddir)/src/lib-sieve/libdovecot-sieve.la
+
+managesieve_CPPFLAGS = $(AM_CPPFLAGS) $(BINARY_CFLAGS)
+managesieve_LDFLAGS = -export-dynamic $(BINARY_LDFLAGS)
+managesieve_LDADD = $(libs) $(LIBDOVECOT_STORAGE) $(LIBDOVECOT_LDA) $(LIBDOVECOT)
+managesieve_DEPENDENCIES = $(libs) $(LIBDOVECOT_STORAGE_DEPS) $(LIBDOVECOT_LDA_DEPS) $(LIBDOVECOT_DEPS)
+cmds = \
+ cmd-capability.c \
+ cmd-logout.c \
+ cmd-putscript.c \
+ cmd-getscript.c \
+ cmd-setactive.c \
+ cmd-deletescript.c \
+ cmd-listscripts.c \
+ cmd-havespace.c \
+ cmd-renamescript.c \
+ cmd-noop.c
+
+managesieve_SOURCES = \
+ $(cmds) \
+ managesieve-quota.c \
+ managesieve-client.c \
+ managesieve-commands.c \
+ managesieve-capabilities.c \
+ main.c
+
+noinst_HEADERS = \
+ managesieve-quota.h \
+ managesieve-client.h \
+ managesieve-commands.h \
+ managesieve-capabilities.h \
+ managesieve-settings.h \
+ managesieve-common.h
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/managesieve/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/managesieve/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-dovecot_pkglibexecPROGRAMS: $(dovecot_pkglibexec_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ @list='$(dovecot_pkglibexec_PROGRAMS)'; test -n "$(dovecot_pkglibexecdir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(dovecot_pkglibexecdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(dovecot_pkglibexecdir)" || exit 1; \
+ fi; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p \
+ || test -f $$p1 \
+ ; then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' \
+ -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(dovecot_pkglibexecdir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(dovecot_pkglibexecdir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-dovecot_pkglibexecPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dovecot_pkglibexec_PROGRAMS)'; test -n "$(dovecot_pkglibexecdir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' \
+ `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(dovecot_pkglibexecdir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(dovecot_pkglibexecdir)" && rm -f $$files
+
+clean-dovecot_pkglibexecPROGRAMS:
+ @list='$(dovecot_pkglibexec_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+
+install-settingsLTLIBRARIES: $(settings_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ @list='$(settings_LTLIBRARIES)'; test -n "$(settingsdir)" || list=; \
+ list2=; for p in $$list; do \
+ if test -f $$p; then \
+ list2="$$list2 $$p"; \
+ else :; fi; \
+ done; \
+ test -z "$$list2" || { \
+ echo " $(MKDIR_P) '$(DESTDIR)$(settingsdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(settingsdir)" || exit 1; \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(settingsdir)'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(settingsdir)"; \
+ }
+
+uninstall-settingsLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(settings_LTLIBRARIES)'; test -n "$(settingsdir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(settingsdir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(settingsdir)/$$f"; \
+ done
+
+clean-settingsLTLIBRARIES:
+ -test -z "$(settings_LTLIBRARIES)" || rm -f $(settings_LTLIBRARIES)
+ @list='$(settings_LTLIBRARIES)'; \
+ locs=`for p in $$list; do echo $$p; done | \
+ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
+ sort -u`; \
+ test -z "$$locs" || { \
+ echo rm -f $${locs}; \
+ rm -f $${locs}; \
+ }
+
+libmanagesieve_settings.la: $(libmanagesieve_settings_la_OBJECTS) $(libmanagesieve_settings_la_DEPENDENCIES) $(EXTRA_libmanagesieve_settings_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(libmanagesieve_settings_la_LINK) -rpath $(settingsdir) $(libmanagesieve_settings_la_OBJECTS) $(libmanagesieve_settings_la_LIBADD) $(LIBS)
+
+managesieve$(EXEEXT): $(managesieve_OBJECTS) $(managesieve_DEPENDENCIES) $(EXTRA_managesieve_DEPENDENCIES)
+ @rm -f managesieve$(EXEEXT)
+ $(AM_V_CCLD)$(managesieve_LINK) $(managesieve_OBJECTS) $(managesieve_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/managesieve-cmd-capability.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/managesieve-cmd-deletescript.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/managesieve-cmd-getscript.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/managesieve-cmd-havespace.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/managesieve-cmd-listscripts.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/managesieve-cmd-logout.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/managesieve-cmd-noop.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/managesieve-cmd-putscript.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/managesieve-cmd-renamescript.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/managesieve-cmd-setactive.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/managesieve-main.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/managesieve-managesieve-capabilities.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/managesieve-managesieve-client.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/managesieve-managesieve-commands.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/managesieve-managesieve-quota.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/managesieve-settings.Plo@am__quote@ # am--include-marker
+
+$(am__depfiles_remade):
+ @$(MKDIR_P) $(@D)
+ @echo '# dummy' >$@-t && $(am__mv) $@-t $@
+
+am--depfiles: $(am__depfiles_remade)
+
+.c.o:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
+
+managesieve-cmd-capability.o: cmd-capability.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT managesieve-cmd-capability.o -MD -MP -MF $(DEPDIR)/managesieve-cmd-capability.Tpo -c -o managesieve-cmd-capability.o `test -f 'cmd-capability.c' || echo '$(srcdir)/'`cmd-capability.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/managesieve-cmd-capability.Tpo $(DEPDIR)/managesieve-cmd-capability.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cmd-capability.c' object='managesieve-cmd-capability.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o managesieve-cmd-capability.o `test -f 'cmd-capability.c' || echo '$(srcdir)/'`cmd-capability.c
+
+managesieve-cmd-capability.obj: cmd-capability.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT managesieve-cmd-capability.obj -MD -MP -MF $(DEPDIR)/managesieve-cmd-capability.Tpo -c -o managesieve-cmd-capability.obj `if test -f 'cmd-capability.c'; then $(CYGPATH_W) 'cmd-capability.c'; else $(CYGPATH_W) '$(srcdir)/cmd-capability.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/managesieve-cmd-capability.Tpo $(DEPDIR)/managesieve-cmd-capability.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cmd-capability.c' object='managesieve-cmd-capability.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o managesieve-cmd-capability.obj `if test -f 'cmd-capability.c'; then $(CYGPATH_W) 'cmd-capability.c'; else $(CYGPATH_W) '$(srcdir)/cmd-capability.c'; fi`
+
+managesieve-cmd-logout.o: cmd-logout.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT managesieve-cmd-logout.o -MD -MP -MF $(DEPDIR)/managesieve-cmd-logout.Tpo -c -o managesieve-cmd-logout.o `test -f 'cmd-logout.c' || echo '$(srcdir)/'`cmd-logout.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/managesieve-cmd-logout.Tpo $(DEPDIR)/managesieve-cmd-logout.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cmd-logout.c' object='managesieve-cmd-logout.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o managesieve-cmd-logout.o `test -f 'cmd-logout.c' || echo '$(srcdir)/'`cmd-logout.c
+
+managesieve-cmd-logout.obj: cmd-logout.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT managesieve-cmd-logout.obj -MD -MP -MF $(DEPDIR)/managesieve-cmd-logout.Tpo -c -o managesieve-cmd-logout.obj `if test -f 'cmd-logout.c'; then $(CYGPATH_W) 'cmd-logout.c'; else $(CYGPATH_W) '$(srcdir)/cmd-logout.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/managesieve-cmd-logout.Tpo $(DEPDIR)/managesieve-cmd-logout.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cmd-logout.c' object='managesieve-cmd-logout.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o managesieve-cmd-logout.obj `if test -f 'cmd-logout.c'; then $(CYGPATH_W) 'cmd-logout.c'; else $(CYGPATH_W) '$(srcdir)/cmd-logout.c'; fi`
+
+managesieve-cmd-putscript.o: cmd-putscript.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT managesieve-cmd-putscript.o -MD -MP -MF $(DEPDIR)/managesieve-cmd-putscript.Tpo -c -o managesieve-cmd-putscript.o `test -f 'cmd-putscript.c' || echo '$(srcdir)/'`cmd-putscript.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/managesieve-cmd-putscript.Tpo $(DEPDIR)/managesieve-cmd-putscript.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cmd-putscript.c' object='managesieve-cmd-putscript.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o managesieve-cmd-putscript.o `test -f 'cmd-putscript.c' || echo '$(srcdir)/'`cmd-putscript.c
+
+managesieve-cmd-putscript.obj: cmd-putscript.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT managesieve-cmd-putscript.obj -MD -MP -MF $(DEPDIR)/managesieve-cmd-putscript.Tpo -c -o managesieve-cmd-putscript.obj `if test -f 'cmd-putscript.c'; then $(CYGPATH_W) 'cmd-putscript.c'; else $(CYGPATH_W) '$(srcdir)/cmd-putscript.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/managesieve-cmd-putscript.Tpo $(DEPDIR)/managesieve-cmd-putscript.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cmd-putscript.c' object='managesieve-cmd-putscript.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o managesieve-cmd-putscript.obj `if test -f 'cmd-putscript.c'; then $(CYGPATH_W) 'cmd-putscript.c'; else $(CYGPATH_W) '$(srcdir)/cmd-putscript.c'; fi`
+
+managesieve-cmd-getscript.o: cmd-getscript.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT managesieve-cmd-getscript.o -MD -MP -MF $(DEPDIR)/managesieve-cmd-getscript.Tpo -c -o managesieve-cmd-getscript.o `test -f 'cmd-getscript.c' || echo '$(srcdir)/'`cmd-getscript.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/managesieve-cmd-getscript.Tpo $(DEPDIR)/managesieve-cmd-getscript.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cmd-getscript.c' object='managesieve-cmd-getscript.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o managesieve-cmd-getscript.o `test -f 'cmd-getscript.c' || echo '$(srcdir)/'`cmd-getscript.c
+
+managesieve-cmd-getscript.obj: cmd-getscript.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT managesieve-cmd-getscript.obj -MD -MP -MF $(DEPDIR)/managesieve-cmd-getscript.Tpo -c -o managesieve-cmd-getscript.obj `if test -f 'cmd-getscript.c'; then $(CYGPATH_W) 'cmd-getscript.c'; else $(CYGPATH_W) '$(srcdir)/cmd-getscript.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/managesieve-cmd-getscript.Tpo $(DEPDIR)/managesieve-cmd-getscript.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cmd-getscript.c' object='managesieve-cmd-getscript.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o managesieve-cmd-getscript.obj `if test -f 'cmd-getscript.c'; then $(CYGPATH_W) 'cmd-getscript.c'; else $(CYGPATH_W) '$(srcdir)/cmd-getscript.c'; fi`
+
+managesieve-cmd-setactive.o: cmd-setactive.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT managesieve-cmd-setactive.o -MD -MP -MF $(DEPDIR)/managesieve-cmd-setactive.Tpo -c -o managesieve-cmd-setactive.o `test -f 'cmd-setactive.c' || echo '$(srcdir)/'`cmd-setactive.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/managesieve-cmd-setactive.Tpo $(DEPDIR)/managesieve-cmd-setactive.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cmd-setactive.c' object='managesieve-cmd-setactive.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o managesieve-cmd-setactive.o `test -f 'cmd-setactive.c' || echo '$(srcdir)/'`cmd-setactive.c
+
+managesieve-cmd-setactive.obj: cmd-setactive.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT managesieve-cmd-setactive.obj -MD -MP -MF $(DEPDIR)/managesieve-cmd-setactive.Tpo -c -o managesieve-cmd-setactive.obj `if test -f 'cmd-setactive.c'; then $(CYGPATH_W) 'cmd-setactive.c'; else $(CYGPATH_W) '$(srcdir)/cmd-setactive.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/managesieve-cmd-setactive.Tpo $(DEPDIR)/managesieve-cmd-setactive.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cmd-setactive.c' object='managesieve-cmd-setactive.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o managesieve-cmd-setactive.obj `if test -f 'cmd-setactive.c'; then $(CYGPATH_W) 'cmd-setactive.c'; else $(CYGPATH_W) '$(srcdir)/cmd-setactive.c'; fi`
+
+managesieve-cmd-deletescript.o: cmd-deletescript.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT managesieve-cmd-deletescript.o -MD -MP -MF $(DEPDIR)/managesieve-cmd-deletescript.Tpo -c -o managesieve-cmd-deletescript.o `test -f 'cmd-deletescript.c' || echo '$(srcdir)/'`cmd-deletescript.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/managesieve-cmd-deletescript.Tpo $(DEPDIR)/managesieve-cmd-deletescript.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cmd-deletescript.c' object='managesieve-cmd-deletescript.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o managesieve-cmd-deletescript.o `test -f 'cmd-deletescript.c' || echo '$(srcdir)/'`cmd-deletescript.c
+
+managesieve-cmd-deletescript.obj: cmd-deletescript.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT managesieve-cmd-deletescript.obj -MD -MP -MF $(DEPDIR)/managesieve-cmd-deletescript.Tpo -c -o managesieve-cmd-deletescript.obj `if test -f 'cmd-deletescript.c'; then $(CYGPATH_W) 'cmd-deletescript.c'; else $(CYGPATH_W) '$(srcdir)/cmd-deletescript.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/managesieve-cmd-deletescript.Tpo $(DEPDIR)/managesieve-cmd-deletescript.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cmd-deletescript.c' object='managesieve-cmd-deletescript.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o managesieve-cmd-deletescript.obj `if test -f 'cmd-deletescript.c'; then $(CYGPATH_W) 'cmd-deletescript.c'; else $(CYGPATH_W) '$(srcdir)/cmd-deletescript.c'; fi`
+
+managesieve-cmd-listscripts.o: cmd-listscripts.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT managesieve-cmd-listscripts.o -MD -MP -MF $(DEPDIR)/managesieve-cmd-listscripts.Tpo -c -o managesieve-cmd-listscripts.o `test -f 'cmd-listscripts.c' || echo '$(srcdir)/'`cmd-listscripts.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/managesieve-cmd-listscripts.Tpo $(DEPDIR)/managesieve-cmd-listscripts.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cmd-listscripts.c' object='managesieve-cmd-listscripts.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o managesieve-cmd-listscripts.o `test -f 'cmd-listscripts.c' || echo '$(srcdir)/'`cmd-listscripts.c
+
+managesieve-cmd-listscripts.obj: cmd-listscripts.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT managesieve-cmd-listscripts.obj -MD -MP -MF $(DEPDIR)/managesieve-cmd-listscripts.Tpo -c -o managesieve-cmd-listscripts.obj `if test -f 'cmd-listscripts.c'; then $(CYGPATH_W) 'cmd-listscripts.c'; else $(CYGPATH_W) '$(srcdir)/cmd-listscripts.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/managesieve-cmd-listscripts.Tpo $(DEPDIR)/managesieve-cmd-listscripts.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cmd-listscripts.c' object='managesieve-cmd-listscripts.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o managesieve-cmd-listscripts.obj `if test -f 'cmd-listscripts.c'; then $(CYGPATH_W) 'cmd-listscripts.c'; else $(CYGPATH_W) '$(srcdir)/cmd-listscripts.c'; fi`
+
+managesieve-cmd-havespace.o: cmd-havespace.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT managesieve-cmd-havespace.o -MD -MP -MF $(DEPDIR)/managesieve-cmd-havespace.Tpo -c -o managesieve-cmd-havespace.o `test -f 'cmd-havespace.c' || echo '$(srcdir)/'`cmd-havespace.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/managesieve-cmd-havespace.Tpo $(DEPDIR)/managesieve-cmd-havespace.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cmd-havespace.c' object='managesieve-cmd-havespace.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o managesieve-cmd-havespace.o `test -f 'cmd-havespace.c' || echo '$(srcdir)/'`cmd-havespace.c
+
+managesieve-cmd-havespace.obj: cmd-havespace.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT managesieve-cmd-havespace.obj -MD -MP -MF $(DEPDIR)/managesieve-cmd-havespace.Tpo -c -o managesieve-cmd-havespace.obj `if test -f 'cmd-havespace.c'; then $(CYGPATH_W) 'cmd-havespace.c'; else $(CYGPATH_W) '$(srcdir)/cmd-havespace.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/managesieve-cmd-havespace.Tpo $(DEPDIR)/managesieve-cmd-havespace.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cmd-havespace.c' object='managesieve-cmd-havespace.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o managesieve-cmd-havespace.obj `if test -f 'cmd-havespace.c'; then $(CYGPATH_W) 'cmd-havespace.c'; else $(CYGPATH_W) '$(srcdir)/cmd-havespace.c'; fi`
+
+managesieve-cmd-renamescript.o: cmd-renamescript.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT managesieve-cmd-renamescript.o -MD -MP -MF $(DEPDIR)/managesieve-cmd-renamescript.Tpo -c -o managesieve-cmd-renamescript.o `test -f 'cmd-renamescript.c' || echo '$(srcdir)/'`cmd-renamescript.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/managesieve-cmd-renamescript.Tpo $(DEPDIR)/managesieve-cmd-renamescript.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cmd-renamescript.c' object='managesieve-cmd-renamescript.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o managesieve-cmd-renamescript.o `test -f 'cmd-renamescript.c' || echo '$(srcdir)/'`cmd-renamescript.c
+
+managesieve-cmd-renamescript.obj: cmd-renamescript.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT managesieve-cmd-renamescript.obj -MD -MP -MF $(DEPDIR)/managesieve-cmd-renamescript.Tpo -c -o managesieve-cmd-renamescript.obj `if test -f 'cmd-renamescript.c'; then $(CYGPATH_W) 'cmd-renamescript.c'; else $(CYGPATH_W) '$(srcdir)/cmd-renamescript.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/managesieve-cmd-renamescript.Tpo $(DEPDIR)/managesieve-cmd-renamescript.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cmd-renamescript.c' object='managesieve-cmd-renamescript.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o managesieve-cmd-renamescript.obj `if test -f 'cmd-renamescript.c'; then $(CYGPATH_W) 'cmd-renamescript.c'; else $(CYGPATH_W) '$(srcdir)/cmd-renamescript.c'; fi`
+
+managesieve-cmd-noop.o: cmd-noop.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT managesieve-cmd-noop.o -MD -MP -MF $(DEPDIR)/managesieve-cmd-noop.Tpo -c -o managesieve-cmd-noop.o `test -f 'cmd-noop.c' || echo '$(srcdir)/'`cmd-noop.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/managesieve-cmd-noop.Tpo $(DEPDIR)/managesieve-cmd-noop.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cmd-noop.c' object='managesieve-cmd-noop.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o managesieve-cmd-noop.o `test -f 'cmd-noop.c' || echo '$(srcdir)/'`cmd-noop.c
+
+managesieve-cmd-noop.obj: cmd-noop.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT managesieve-cmd-noop.obj -MD -MP -MF $(DEPDIR)/managesieve-cmd-noop.Tpo -c -o managesieve-cmd-noop.obj `if test -f 'cmd-noop.c'; then $(CYGPATH_W) 'cmd-noop.c'; else $(CYGPATH_W) '$(srcdir)/cmd-noop.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/managesieve-cmd-noop.Tpo $(DEPDIR)/managesieve-cmd-noop.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cmd-noop.c' object='managesieve-cmd-noop.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o managesieve-cmd-noop.obj `if test -f 'cmd-noop.c'; then $(CYGPATH_W) 'cmd-noop.c'; else $(CYGPATH_W) '$(srcdir)/cmd-noop.c'; fi`
+
+managesieve-managesieve-quota.o: managesieve-quota.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT managesieve-managesieve-quota.o -MD -MP -MF $(DEPDIR)/managesieve-managesieve-quota.Tpo -c -o managesieve-managesieve-quota.o `test -f 'managesieve-quota.c' || echo '$(srcdir)/'`managesieve-quota.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/managesieve-managesieve-quota.Tpo $(DEPDIR)/managesieve-managesieve-quota.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='managesieve-quota.c' object='managesieve-managesieve-quota.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o managesieve-managesieve-quota.o `test -f 'managesieve-quota.c' || echo '$(srcdir)/'`managesieve-quota.c
+
+managesieve-managesieve-quota.obj: managesieve-quota.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT managesieve-managesieve-quota.obj -MD -MP -MF $(DEPDIR)/managesieve-managesieve-quota.Tpo -c -o managesieve-managesieve-quota.obj `if test -f 'managesieve-quota.c'; then $(CYGPATH_W) 'managesieve-quota.c'; else $(CYGPATH_W) '$(srcdir)/managesieve-quota.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/managesieve-managesieve-quota.Tpo $(DEPDIR)/managesieve-managesieve-quota.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='managesieve-quota.c' object='managesieve-managesieve-quota.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o managesieve-managesieve-quota.obj `if test -f 'managesieve-quota.c'; then $(CYGPATH_W) 'managesieve-quota.c'; else $(CYGPATH_W) '$(srcdir)/managesieve-quota.c'; fi`
+
+managesieve-managesieve-client.o: managesieve-client.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT managesieve-managesieve-client.o -MD -MP -MF $(DEPDIR)/managesieve-managesieve-client.Tpo -c -o managesieve-managesieve-client.o `test -f 'managesieve-client.c' || echo '$(srcdir)/'`managesieve-client.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/managesieve-managesieve-client.Tpo $(DEPDIR)/managesieve-managesieve-client.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='managesieve-client.c' object='managesieve-managesieve-client.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o managesieve-managesieve-client.o `test -f 'managesieve-client.c' || echo '$(srcdir)/'`managesieve-client.c
+
+managesieve-managesieve-client.obj: managesieve-client.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT managesieve-managesieve-client.obj -MD -MP -MF $(DEPDIR)/managesieve-managesieve-client.Tpo -c -o managesieve-managesieve-client.obj `if test -f 'managesieve-client.c'; then $(CYGPATH_W) 'managesieve-client.c'; else $(CYGPATH_W) '$(srcdir)/managesieve-client.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/managesieve-managesieve-client.Tpo $(DEPDIR)/managesieve-managesieve-client.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='managesieve-client.c' object='managesieve-managesieve-client.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o managesieve-managesieve-client.obj `if test -f 'managesieve-client.c'; then $(CYGPATH_W) 'managesieve-client.c'; else $(CYGPATH_W) '$(srcdir)/managesieve-client.c'; fi`
+
+managesieve-managesieve-commands.o: managesieve-commands.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT managesieve-managesieve-commands.o -MD -MP -MF $(DEPDIR)/managesieve-managesieve-commands.Tpo -c -o managesieve-managesieve-commands.o `test -f 'managesieve-commands.c' || echo '$(srcdir)/'`managesieve-commands.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/managesieve-managesieve-commands.Tpo $(DEPDIR)/managesieve-managesieve-commands.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='managesieve-commands.c' object='managesieve-managesieve-commands.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o managesieve-managesieve-commands.o `test -f 'managesieve-commands.c' || echo '$(srcdir)/'`managesieve-commands.c
+
+managesieve-managesieve-commands.obj: managesieve-commands.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT managesieve-managesieve-commands.obj -MD -MP -MF $(DEPDIR)/managesieve-managesieve-commands.Tpo -c -o managesieve-managesieve-commands.obj `if test -f 'managesieve-commands.c'; then $(CYGPATH_W) 'managesieve-commands.c'; else $(CYGPATH_W) '$(srcdir)/managesieve-commands.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/managesieve-managesieve-commands.Tpo $(DEPDIR)/managesieve-managesieve-commands.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='managesieve-commands.c' object='managesieve-managesieve-commands.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o managesieve-managesieve-commands.obj `if test -f 'managesieve-commands.c'; then $(CYGPATH_W) 'managesieve-commands.c'; else $(CYGPATH_W) '$(srcdir)/managesieve-commands.c'; fi`
+
+managesieve-managesieve-capabilities.o: managesieve-capabilities.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT managesieve-managesieve-capabilities.o -MD -MP -MF $(DEPDIR)/managesieve-managesieve-capabilities.Tpo -c -o managesieve-managesieve-capabilities.o `test -f 'managesieve-capabilities.c' || echo '$(srcdir)/'`managesieve-capabilities.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/managesieve-managesieve-capabilities.Tpo $(DEPDIR)/managesieve-managesieve-capabilities.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='managesieve-capabilities.c' object='managesieve-managesieve-capabilities.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o managesieve-managesieve-capabilities.o `test -f 'managesieve-capabilities.c' || echo '$(srcdir)/'`managesieve-capabilities.c
+
+managesieve-managesieve-capabilities.obj: managesieve-capabilities.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT managesieve-managesieve-capabilities.obj -MD -MP -MF $(DEPDIR)/managesieve-managesieve-capabilities.Tpo -c -o managesieve-managesieve-capabilities.obj `if test -f 'managesieve-capabilities.c'; then $(CYGPATH_W) 'managesieve-capabilities.c'; else $(CYGPATH_W) '$(srcdir)/managesieve-capabilities.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/managesieve-managesieve-capabilities.Tpo $(DEPDIR)/managesieve-managesieve-capabilities.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='managesieve-capabilities.c' object='managesieve-managesieve-capabilities.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o managesieve-managesieve-capabilities.obj `if test -f 'managesieve-capabilities.c'; then $(CYGPATH_W) 'managesieve-capabilities.c'; else $(CYGPATH_W) '$(srcdir)/managesieve-capabilities.c'; fi`
+
+managesieve-main.o: main.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT managesieve-main.o -MD -MP -MF $(DEPDIR)/managesieve-main.Tpo -c -o managesieve-main.o `test -f 'main.c' || echo '$(srcdir)/'`main.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/managesieve-main.Tpo $(DEPDIR)/managesieve-main.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='main.c' object='managesieve-main.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o managesieve-main.o `test -f 'main.c' || echo '$(srcdir)/'`main.c
+
+managesieve-main.obj: main.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT managesieve-main.obj -MD -MP -MF $(DEPDIR)/managesieve-main.Tpo -c -o managesieve-main.obj `if test -f 'main.c'; then $(CYGPATH_W) 'main.c'; else $(CYGPATH_W) '$(srcdir)/main.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/managesieve-main.Tpo $(DEPDIR)/managesieve-main.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='main.c' object='managesieve-main.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(managesieve_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o managesieve-main.obj `if test -f 'main.c'; then $(CYGPATH_W) 'main.c'; else $(CYGPATH_W) '$(srcdir)/main.c'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ $(am__define_uniq_tagged_files); \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS) $(LTLIBRARIES) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(dovecot_pkglibexecdir)" "$(DESTDIR)$(settingsdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-dovecot_pkglibexecPROGRAMS clean-generic clean-libtool \
+ clean-settingsLTLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+ -rm -f ./$(DEPDIR)/managesieve-cmd-capability.Po
+ -rm -f ./$(DEPDIR)/managesieve-cmd-deletescript.Po
+ -rm -f ./$(DEPDIR)/managesieve-cmd-getscript.Po
+ -rm -f ./$(DEPDIR)/managesieve-cmd-havespace.Po
+ -rm -f ./$(DEPDIR)/managesieve-cmd-listscripts.Po
+ -rm -f ./$(DEPDIR)/managesieve-cmd-logout.Po
+ -rm -f ./$(DEPDIR)/managesieve-cmd-noop.Po
+ -rm -f ./$(DEPDIR)/managesieve-cmd-putscript.Po
+ -rm -f ./$(DEPDIR)/managesieve-cmd-renamescript.Po
+ -rm -f ./$(DEPDIR)/managesieve-cmd-setactive.Po
+ -rm -f ./$(DEPDIR)/managesieve-main.Po
+ -rm -f ./$(DEPDIR)/managesieve-managesieve-capabilities.Po
+ -rm -f ./$(DEPDIR)/managesieve-managesieve-client.Po
+ -rm -f ./$(DEPDIR)/managesieve-managesieve-commands.Po
+ -rm -f ./$(DEPDIR)/managesieve-managesieve-quota.Po
+ -rm -f ./$(DEPDIR)/managesieve-settings.Plo
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-settingsLTLIBRARIES
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-dovecot_pkglibexecPROGRAMS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f ./$(DEPDIR)/managesieve-cmd-capability.Po
+ -rm -f ./$(DEPDIR)/managesieve-cmd-deletescript.Po
+ -rm -f ./$(DEPDIR)/managesieve-cmd-getscript.Po
+ -rm -f ./$(DEPDIR)/managesieve-cmd-havespace.Po
+ -rm -f ./$(DEPDIR)/managesieve-cmd-listscripts.Po
+ -rm -f ./$(DEPDIR)/managesieve-cmd-logout.Po
+ -rm -f ./$(DEPDIR)/managesieve-cmd-noop.Po
+ -rm -f ./$(DEPDIR)/managesieve-cmd-putscript.Po
+ -rm -f ./$(DEPDIR)/managesieve-cmd-renamescript.Po
+ -rm -f ./$(DEPDIR)/managesieve-cmd-setactive.Po
+ -rm -f ./$(DEPDIR)/managesieve-main.Po
+ -rm -f ./$(DEPDIR)/managesieve-managesieve-capabilities.Po
+ -rm -f ./$(DEPDIR)/managesieve-managesieve-client.Po
+ -rm -f ./$(DEPDIR)/managesieve-managesieve-commands.Po
+ -rm -f ./$(DEPDIR)/managesieve-managesieve-quota.Po
+ -rm -f ./$(DEPDIR)/managesieve-settings.Plo
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-dovecot_pkglibexecPROGRAMS \
+ uninstall-settingsLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
+ clean-dovecot_pkglibexecPROGRAMS clean-generic clean-libtool \
+ clean-settingsLTLIBRARIES cscopelist-am ctags ctags-am \
+ distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dovecot_pkglibexecPROGRAMS install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-settingsLTLIBRARIES install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags tags-am uninstall uninstall-am \
+ uninstall-dovecot_pkglibexecPROGRAMS \
+ uninstall-settingsLTLIBRARIES
+
+.PRECIOUS: Makefile
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/pigeonhole/src/managesieve/cmd-capability.c b/pigeonhole/src/managesieve/cmd-capability.c
new file mode 100644
index 0000000..1d26eb5
--- /dev/null
+++ b/pigeonhole/src/managesieve/cmd-capability.c
@@ -0,0 +1,76 @@
+/* Copyright (c) 2002-2018 Pigeonhole authors, see the included COPYING file
+ */
+
+#include "lib.h"
+#include "str.h"
+#include "strfuncs.h"
+#include "ostream.h"
+
+#include "sieve.h"
+
+#include "managesieve-common.h"
+#include "managesieve-commands.h"
+
+static void send_capability(struct client_command_context *cmd)
+{
+ struct client *client = cmd->client;
+ const char *sievecap, *notifycap;
+ unsigned int max_redirects;
+
+ /* Get capabilities */
+ sievecap = sieve_get_capabilities(client->svinst, NULL);
+ notifycap = sieve_get_capabilities(client->svinst, "notify");
+ max_redirects = sieve_max_redirects(client->svinst);
+
+ /* Default capabilities */
+ client_send_line(client,
+ t_strconcat(
+ "\"IMPLEMENTATION\" \"",
+ client->set->managesieve_implementation_string,
+ "\"", NULL));
+ client_send_line(client,
+ t_strconcat(
+ "\"SIEVE\" \"",
+ (sievecap == NULL ? "" : sievecap),
+ "\"", NULL));
+
+ /* Maximum number of redirects (if limited) */
+ if (max_redirects > 0) {
+ client_send_line(client,
+ t_strdup_printf("\"MAXREDIRECTS\" \"%u\"",
+ max_redirects));
+ }
+
+ /* Notify methods */
+ if (notifycap != NULL) {
+ client_send_line(client,
+ t_strconcat("\"NOTIFY\" \"", notifycap, "\"",
+ NULL));
+ }
+
+ /* Protocol version */
+ client_send_line(client, "\"VERSION\" \"1.0\"");
+}
+
+bool cmd_capability(struct client_command_context *cmd)
+{
+ struct client *client = cmd->client;
+
+ /* no arguments */
+ if (!client_read_no_args(cmd))
+ return FALSE;
+
+ o_stream_cork(client->output);
+
+ T_BEGIN {
+ send_capability(cmd);
+ } T_END;
+
+ client_send_line(client, "OK \"Capability completed.\"");
+
+ o_stream_uncork(client->output);
+
+ return TRUE;
+
+}
+
diff --git a/pigeonhole/src/managesieve/cmd-deletescript.c b/pigeonhole/src/managesieve/cmd-deletescript.c
new file mode 100644
index 0000000..a8be5c9
--- /dev/null
+++ b/pigeonhole/src/managesieve/cmd-deletescript.c
@@ -0,0 +1,43 @@
+/* Copyright (c) 2002-2018 Pigeonhole authors, see the included COPYING file
+ */
+
+#include "lib.h"
+
+#include "sieve.h"
+#include "sieve-script.h"
+#include "sieve-storage.h"
+
+#include "managesieve-common.h"
+#include "managesieve-commands.h"
+
+bool cmd_deletescript(struct client_command_context *cmd)
+{
+ struct client *client = cmd->client;
+ struct sieve_storage *storage = client->storage;
+ const char *scriptname;
+ struct sieve_script *script;
+
+ /* <script name>*/
+ if (!client_read_string_args(cmd, TRUE, 1, &scriptname))
+ return FALSE;
+
+ event_add_str(cmd->event, "script_name", scriptname);
+
+ script = sieve_storage_open_script(storage, scriptname, NULL);
+ if (script == NULL || sieve_script_delete(script, FALSE) < 0) {
+ client_command_storage_error(
+ cmd, "Failed to delete script `%s'", scriptname);
+ sieve_script_unref(&script);
+ return TRUE;
+ }
+
+ struct event_passthrough *e =
+ client_command_create_finish_event(cmd);
+ e_debug(e->event(), "Deleted script `%s'", scriptname);
+
+ client->deleted_count++;
+ client_send_ok(client, "Deletescript completed.");
+
+ sieve_script_unref(&script);
+ return TRUE;
+}
diff --git a/pigeonhole/src/managesieve/cmd-getscript.c b/pigeonhole/src/managesieve/cmd-getscript.c
new file mode 100644
index 0000000..2f0a5f9
--- /dev/null
+++ b/pigeonhole/src/managesieve/cmd-getscript.c
@@ -0,0 +1,157 @@
+/* Copyright (c) 2002-2018 Pigeonhole authors, see the included COPYING file
+ */
+
+#include "lib.h"
+#include "ostream.h"
+#include "istream.h"
+#include "iostream.h"
+
+#include "sieve-script.h"
+#include "sieve-storage.h"
+
+#include "managesieve-common.h"
+#include "managesieve-commands.h"
+
+struct cmd_getscript_context {
+ struct client *client;
+ struct client_command_context *cmd;
+ struct sieve_storage *storage;
+ uoff_t script_size;
+
+ const char *scriptname;
+ struct sieve_script *script;
+ struct istream *script_stream;
+
+ bool failed:1;
+};
+
+static bool cmd_getscript_finish(struct cmd_getscript_context *ctx)
+{
+ struct client_command_context *cmd = ctx->cmd;
+ struct client *client = ctx->client;
+
+ if (ctx->script != NULL)
+ sieve_script_unref(&ctx->script);
+
+ if (ctx->failed) {
+ if (client->output->closed) {
+ client_disconnect(client, NULL);
+ return TRUE;
+ }
+
+ client_command_storage_error(
+ cmd, "Failed to retrieve script `%s'", ctx->scriptname);
+ return TRUE;
+ }
+
+ client->get_count++;
+ client->get_bytes += ctx->script_size;
+
+ struct event_passthrough *e =
+ client_command_create_finish_event(cmd);
+ e_debug(e->event(), "Retrieved script `%s'", ctx->scriptname);
+
+ client_send_line(client, "");
+ client_send_ok(client, "Getscript completed.");
+ return TRUE;
+}
+
+static bool cmd_getscript_continue(struct client_command_context *cmd)
+{
+ struct client *client = cmd->client;
+ struct cmd_getscript_context *ctx = cmd->context;
+
+ switch (o_stream_send_istream(client->output, ctx->script_stream)) {
+ case OSTREAM_SEND_ISTREAM_RESULT_FINISHED:
+ if (ctx->script_stream->v_offset != ctx->script_size &&
+ !ctx->failed) {
+ /* Input stream gave less data than expected */
+ sieve_storage_set_critical(
+ ctx->storage, "GETSCRIPT for script `%s' "
+ "from %s got too little data: "
+ "%"PRIuUOFF_T" vs %"PRIuUOFF_T,
+ sieve_script_name(ctx->script),
+ sieve_script_location(ctx->script),
+ ctx->script_stream->v_offset, ctx->script_size);
+ client_disconnect(ctx->client, "GETSCRIPT failed");
+ ctx->failed = TRUE;
+ }
+ break;
+ case OSTREAM_SEND_ISTREAM_RESULT_WAIT_INPUT:
+ i_unreached();
+ case OSTREAM_SEND_ISTREAM_RESULT_WAIT_OUTPUT:
+ return FALSE;
+ case OSTREAM_SEND_ISTREAM_RESULT_ERROR_INPUT:
+ sieve_storage_set_critical(ctx->storage,
+ "o_stream_send_istream() failed for script `%s' "
+ "from %s: %s",
+ sieve_script_name(ctx->script),
+ sieve_script_location(ctx->script),
+ i_stream_get_error(ctx->script_stream));
+ ctx->failed = TRUE;
+ break;
+ case OSTREAM_SEND_ISTREAM_RESULT_ERROR_OUTPUT:
+ client_disconnect(ctx->client, NULL);
+ ctx->failed = TRUE;
+ break;
+ }
+ return cmd_getscript_finish(ctx);
+}
+
+bool cmd_getscript(struct client_command_context *cmd)
+{
+ struct client *client = cmd->client;
+ struct cmd_getscript_context *ctx;
+ const char *scriptname;
+ enum sieve_error error;
+
+ /* <scriptname> */
+ if (!client_read_string_args(cmd, TRUE, 1, &scriptname))
+ return FALSE;
+
+ event_add_str(cmd->event, "script_name", scriptname);
+
+ ctx = p_new(cmd->pool, struct cmd_getscript_context, 1);
+ ctx->cmd = cmd;
+ ctx->client = client;
+ ctx->scriptname = p_strdup(cmd->pool, scriptname);
+ ctx->storage = client->storage;
+ ctx->failed = FALSE;
+
+ ctx->script = sieve_storage_open_script(client->storage, scriptname,
+ NULL);
+ if (ctx->script == NULL) {
+ ctx->failed = TRUE;
+ return cmd_getscript_finish(ctx);
+ }
+
+ if (sieve_script_get_stream(ctx->script, &ctx->script_stream,
+ &error) < 0 ) {
+ if (error == SIEVE_ERROR_NOT_FOUND) {
+ sieve_storage_set_error(client->storage, error,
+ "Script does not exist.");
+ }
+ ctx->failed = TRUE;
+ return cmd_getscript_finish(ctx);
+ }
+
+ if (sieve_script_get_size(ctx->script, &ctx->script_size) <= 0) {
+ sieve_storage_set_critical(ctx->storage,
+ "failed to obtain script size for script `%s' from %s",
+ sieve_script_name(ctx->script),
+ sieve_script_location(ctx->script));
+ ctx->failed = TRUE;
+ return cmd_getscript_finish(ctx);
+ }
+
+ i_assert(ctx->script_stream->v_offset == 0);
+
+ client_send_line(client, t_strdup_printf("{%"PRIuUOFF_T"}",
+ ctx->script_size));
+
+ client->command_pending = TRUE;
+ cmd->func = cmd_getscript_continue;
+ cmd->context = ctx;
+
+ return cmd_getscript_continue(cmd);
+}
diff --git a/pigeonhole/src/managesieve/cmd-havespace.c b/pigeonhole/src/managesieve/cmd-havespace.c
new file mode 100644
index 0000000..5af2bb1
--- /dev/null
+++ b/pigeonhole/src/managesieve/cmd-havespace.c
@@ -0,0 +1,60 @@
+/* Copyright (c) 2002-2018 Pigeonhole authors, see the included COPYING file
+ */
+
+#include "lib.h"
+
+#include "managesieve-common.h"
+#include "managesieve-commands.h"
+
+#include "sieve.h"
+#include "sieve-script.h"
+#include "sieve-storage.h"
+
+#include "managesieve-client.h"
+#include "managesieve-quota.h"
+
+bool cmd_havespace(struct client_command_context *cmd)
+{
+ struct client *client = cmd->client;
+ const struct managesieve_arg *args;
+ const char *scriptname;
+ uoff_t size;
+
+ /* <scriptname> <size> */
+ if (!client_read_args(cmd, 2, 0, TRUE, &args))
+ return FALSE;
+
+ if (!managesieve_arg_get_string(&args[0], &scriptname)) {
+ client_send_no(client, "Invalid string for scriptname.");
+ return TRUE;
+ }
+
+ if (!managesieve_arg_get_number(&args[1], &size)) {
+ client_send_no(client, "Invalid scriptsize argument.");
+ return TRUE;
+ }
+
+ if (!sieve_script_name_is_valid(scriptname)) {
+ client_send_no(client, "Invalid script name.");
+ return TRUE;
+ }
+
+ if (size == 0) {
+ client_send_no(client, "Cannot upload empty script.");
+ return TRUE;
+ }
+
+ event_add_str(cmd->event, "script_name", scriptname);
+ event_add_int(cmd->event, "script_size", size);
+
+ if (!managesieve_quota_check_all(cmd, scriptname, size))
+ return TRUE;
+
+ struct event_passthrough *e =
+ client_command_create_finish_event(cmd);
+ e_debug(e->event(), "Quota is within limits for script `%s' "
+ "with size %"PRIuUOFF_T, scriptname, size);
+
+ client_send_ok(client, "Putscript would succeed.");
+ return TRUE;
+}
diff --git a/pigeonhole/src/managesieve/cmd-listscripts.c b/pigeonhole/src/managesieve/cmd-listscripts.c
new file mode 100644
index 0000000..9e6abd2
--- /dev/null
+++ b/pigeonhole/src/managesieve/cmd-listscripts.c
@@ -0,0 +1,65 @@
+/* Copyright (c) 2002-2018 Pigeonhole authors, see the included COPYING file
+ */
+
+#include "lib.h"
+#include "str.h"
+
+#include "sieve.h"
+#include "sieve-storage.h"
+
+#include "managesieve-quote.h"
+
+#include "managesieve-common.h"
+#include "managesieve-commands.h"
+
+bool cmd_listscripts(struct client_command_context *cmd)
+{
+ struct client *client = cmd->client;
+ struct sieve_storage_list_context *ctx;
+ const char *scriptname;
+ unsigned int script_count = 0;
+ bool active;
+ string_t *str;
+
+ /* no arguments */
+ if (!client_read_no_args(cmd))
+ return FALSE;
+
+ if ((ctx = sieve_storage_list_init(client->storage)) == NULL) {
+ client_command_storage_error(
+ cmd, "Failed to list scripts");
+ return TRUE;
+ }
+
+ /* FIXME: This will be quite slow for large script lists. Implement
+ * some buffering to fix this. Wont truely be an issue with managesieve
+ * though.
+ */
+ while ((scriptname = sieve_storage_list_next(ctx, &active)) != NULL) {
+ T_BEGIN {
+ str = t_str_new(128);
+
+ managesieve_quote_append_string(str, scriptname, FALSE);
+
+ if (active)
+ str_append(str, " ACTIVE");
+
+ client_send_line(client, str_c(str));
+ } T_END;
+
+ script_count++;
+ }
+
+ if (sieve_storage_list_deinit(&ctx) < 0) {
+ client_command_storage_error(
+ cmd, "Failed to list scripts");
+ return TRUE;
+ }
+
+ struct event_passthrough *e =
+ client_command_create_finish_event(cmd);
+ e_debug(e->event(), "Listed %u scripts", script_count);
+
+ client_send_ok(client, "Listscripts completed.");
+ return TRUE;
+}
diff --git a/pigeonhole/src/managesieve/cmd-logout.c b/pigeonhole/src/managesieve/cmd-logout.c
new file mode 100644
index 0000000..9e0847d
--- /dev/null
+++ b/pigeonhole/src/managesieve/cmd-logout.c
@@ -0,0 +1,21 @@
+/* Copyright (c) 2002-2018 Pigeonhole authors, see the included COPYING file
+ */
+
+#include "lib.h"
+#include "ostream.h"
+
+#include "managesieve-common.h"
+#include "managesieve-commands.h"
+
+bool cmd_logout(struct client_command_context *cmd)
+{
+ struct client *client = cmd->client;
+
+ /* no arguments */
+ if (!client_read_no_args(cmd))
+ return FALSE;
+
+ client_send_line(client, "OK \"Logout completed.\"");
+ client_disconnect(client, "Logged out");
+ return TRUE;
+}
diff --git a/pigeonhole/src/managesieve/cmd-noop.c b/pigeonhole/src/managesieve/cmd-noop.c
new file mode 100644
index 0000000..76d96c3
--- /dev/null
+++ b/pigeonhole/src/managesieve/cmd-noop.c
@@ -0,0 +1,46 @@
+/* Copyright (c) 2002-2018 Pigeonhole authors, see the included COPYING file
+ */
+
+#include "lib.h"
+#include "str.h"
+
+#include "managesieve-quote.h"
+
+#include "managesieve-common.h"
+#include "managesieve-commands.h"
+
+
+bool cmd_noop(struct client_command_context *cmd)
+{
+ struct client *client = cmd->client;
+ const struct managesieve_arg *args;
+ const char *text;
+ string_t *resp_code;
+
+ /* [<echo string>] */
+ if (!client_read_args(cmd, 0, 0, FALSE, &args))
+ return FALSE;
+
+ if (MANAGESIEVE_ARG_IS_EOL(&args[0])) {
+ client_send_ok(client, "NOOP Completed");
+ return TRUE;
+ }
+
+ if (!managesieve_arg_get_string(&args[0], &text)) {
+ client_send_no(client, "Invalid echo tag.");
+ return TRUE;
+ }
+
+ if (!MANAGESIEVE_ARG_IS_EOL(&args[1])) {
+ client_send_command_error(cmd, "Too many arguments.");
+ return TRUE;
+ }
+
+ resp_code = t_str_new(256);
+ str_append(resp_code, "TAG ");
+ managesieve_quote_append_string(resp_code, text, FALSE);
+
+ client_send_okresp(client, str_c(resp_code), "Done");
+ return TRUE;
+}
+
diff --git a/pigeonhole/src/managesieve/cmd-putscript.c b/pigeonhole/src/managesieve/cmd-putscript.c
new file mode 100644
index 0000000..1998cd9
--- /dev/null
+++ b/pigeonhole/src/managesieve/cmd-putscript.c
@@ -0,0 +1,578 @@
+/* Copyright (c) 2002-2018 Pigeonhole authors, see the included COPYING file
+ */
+
+/* NOTE: this file also contains the checkscript command due to its obvious
+ * similarities.
+ */
+
+#include "lib.h"
+#include "ioloop.h"
+#include "istream.h"
+#include "ostream.h"
+#include "iostream.h"
+#include "str.h"
+
+#include "sieve.h"
+#include "sieve-script.h"
+#include "sieve-storage.h"
+
+#include "managesieve-parser.h"
+
+#include "managesieve-common.h"
+#include "managesieve-client.h"
+#include "managesieve-commands.h"
+#include "managesieve-quota.h"
+
+#include <sys/time.h>
+
+struct cmd_putscript_context {
+ struct client *client;
+ struct client_command_context *cmd;
+ struct sieve_storage *storage;
+
+ struct istream *input;
+
+ const char *scriptname;
+ uoff_t script_size, max_script_size;
+
+ struct managesieve_parser *save_parser;
+ struct sieve_storage_save_context *save_ctx;
+
+ bool script_size_valid:1;
+};
+
+static void cmd_putscript_finish(struct cmd_putscript_context *ctx);
+static bool cmd_putscript_continue_script(struct client_command_context *cmd);
+
+static void client_input_putscript(struct client *client)
+{
+ struct client_command_context *cmd = &client->cmd;
+
+ i_assert(!client->destroyed);
+
+ client->last_input = ioloop_time;
+ timeout_reset(client->to_idle);
+
+ switch (i_stream_read(client->input)) {
+ case -1:
+ /* disconnected */
+ cmd_putscript_finish(cmd->context);
+ /* Reset command so that client_destroy() doesn't try to call
+ cmd_putscript_continue_script() anymore. */
+ _client_reset_command(client);
+ client_destroy(client, "Disconnected in PUTSCRIPT/CHECKSCRIPT");
+ return;
+ case -2:
+ cmd_putscript_finish(cmd->context);
+ if (client->command_pending) {
+ /* uploaded script data, this is handled internally by
+ mailbox_save_continue() */
+ break;
+ }
+
+ /* parameter word is longer than max. input buffer size.
+ this is most likely an error, so skip the new data
+ until newline is found. */
+ client->input_skip_line = TRUE;
+
+ client_send_command_error(cmd, "Too long argument.");
+ cmd->param_error = TRUE;
+ _client_reset_command(client);
+ return;
+ }
+
+ if (cmd->func(cmd)) {
+ /* command execution was finished. Note that if cmd_sync()
+ didn't finish, we didn't get here but the input handler
+ has already been moved. So don't do anything important
+ here..
+
+ reset command once again to reset cmd_sync()'s changes. */
+ _client_reset_command(client);
+
+ if (client->input_pending)
+ client_input(client);
+ }
+}
+
+static void cmd_putscript_finish(struct cmd_putscript_context *ctx)
+{
+ managesieve_parser_destroy(&ctx->save_parser);
+
+ io_remove(&ctx->client->io);
+ o_stream_set_flush_callback(ctx->client->output,
+ client_output, ctx->client);
+
+ if (ctx->save_ctx != NULL) {
+ ctx->client->input_skip_line = TRUE;
+ sieve_storage_save_cancel(&ctx->save_ctx);
+ }
+}
+
+static bool cmd_putscript_continue_cancel(struct client_command_context *cmd)
+{
+ struct cmd_putscript_context *ctx = cmd->context;
+ size_t size;
+
+ (void)i_stream_read(ctx->input);
+ (void)i_stream_get_data(ctx->input, &size);
+ i_stream_skip(ctx->input, size);
+
+ if (cmd->client->input->closed || ctx->input->eof ||
+ ctx->input->v_offset == ctx->script_size) {
+ cmd_putscript_finish(ctx);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+static bool cmd_putscript_cancel(struct cmd_putscript_context *ctx, bool skip)
+{
+ ctx->client->input_skip_line = TRUE;
+
+ if (!skip) {
+ cmd_putscript_finish(ctx);
+ return TRUE;
+ }
+
+ /* we have to read the nonsynced literal so we don't treat the uploaded
+ script as commands. */
+ ctx->client->command_pending = TRUE;
+ ctx->cmd->func = cmd_putscript_continue_cancel;
+ ctx->cmd->context = ctx;
+ return cmd_putscript_continue_cancel(ctx->cmd);
+}
+
+static void cmd_putscript_storage_error(struct cmd_putscript_context *ctx)
+{
+ struct client_command_context *cmd = ctx->cmd;
+
+ if (ctx->scriptname == NULL) {
+ client_command_storage_error(cmd, "Failed to check script");
+ } else {
+ client_command_storage_error(cmd, "Failed to store script `%s'",
+ ctx->scriptname);
+ }
+}
+
+static bool cmd_putscript_save(struct cmd_putscript_context *ctx)
+{
+ /* Commit to save only when this is a putscript command */
+ if (ctx->scriptname == NULL)
+ return TRUE;
+
+ /* Check commit */
+ if (sieve_storage_save_commit(&ctx->save_ctx) < 0) {
+ cmd_putscript_storage_error(ctx);
+ return FALSE;
+ }
+ return TRUE;
+}
+
+static void
+cmd_putscript_finish_script(struct cmd_putscript_context *ctx,
+ struct sieve_script *script)
+{
+ struct client *client = ctx->client;
+ struct client_command_context *cmd = ctx->cmd;
+ struct sieve_error_handler *ehandler;
+ enum sieve_compile_flags cpflags =
+ SIEVE_COMPILE_FLAG_NOGLOBAL | SIEVE_COMPILE_FLAG_UPLOADED;
+ struct sieve_binary *sbin;
+ bool success = TRUE;
+ enum sieve_error error;
+ string_t *errors;
+
+ /* Mark this as an activation when we are replacing the
+ active script */
+ if (sieve_storage_save_will_activate(ctx->save_ctx))
+ cpflags |= SIEVE_COMPILE_FLAG_ACTIVATED;
+
+ /* Prepare error handler */
+ errors = str_new(default_pool, 1024);
+ ehandler = sieve_strbuf_ehandler_create(
+ client->svinst, errors, TRUE,
+ client->set->managesieve_max_compile_errors);
+
+ /* Compile */
+ sbin = sieve_compile_script(script, ehandler, cpflags, &error);
+ if (sbin == NULL) {
+ const char *errormsg = NULL, *action;
+
+ if (error != SIEVE_ERROR_NOT_VALID) {
+ errormsg = sieve_script_get_last_error(script, &error);
+ if (error == SIEVE_ERROR_NONE)
+ errormsg = NULL;
+ }
+
+ action = (ctx->scriptname != NULL ?
+ t_strdup_printf("store script `%s'",
+ ctx->scriptname) :
+ "check script");
+
+ if (errormsg == NULL) {
+ struct event_passthrough *e =
+ client_command_create_finish_event(cmd)->
+ add_str("error", "Compilation failed")->
+ add_int("compile_errors",
+ sieve_get_errors(ehandler))->
+ add_int("compile_warnings",
+ sieve_get_warnings(ehandler));
+ e_debug(e->event(), "Failed to %s: "
+ "Compilation failed (%u errors, %u warnings)",
+ action, sieve_get_errors(ehandler),
+ sieve_get_warnings(ehandler));
+
+ client_send_no(client, str_c(errors));
+ } else {
+ struct event_passthrough *e =
+ client_command_create_finish_event(cmd)->
+ add_str("error", errormsg);
+ e_debug(e->event(), "Failed to %s: %s",
+ action, errormsg);
+
+ client_send_no(client, errormsg);
+ }
+
+ success = FALSE;
+ } else {
+ sieve_close(&sbin);
+
+ if (!cmd_putscript_save(ctx))
+ success = FALSE;
+ }
+
+ /* Finish up */
+ cmd_putscript_finish(ctx);
+
+ /* Report result to user */
+ if (success) {
+ if (ctx->scriptname != NULL) {
+ client->put_count++;
+ client->put_bytes += ctx->script_size;
+ } else {
+ client->check_count++;
+ client->check_bytes += ctx->script_size;
+ }
+
+ struct event_passthrough *e =
+ client_command_create_finish_event(cmd)->
+ add_int("compile_warnings",
+ sieve_get_warnings(ehandler));
+ if (ctx->scriptname != NULL) {
+ e_debug(e->event(), "Stored script `%s' successfully "
+ "(%u warnings)", ctx->scriptname,
+ sieve_get_warnings(ehandler));
+ } else {
+ e_debug(e->event(), "Checked script successfully "
+ "(%u warnings)", sieve_get_warnings(ehandler));
+ }
+
+ if (sieve_get_warnings(ehandler) > 0)
+ client_send_okresp(client, "WARNINGS", str_c(errors));
+ else if (ctx->scriptname != NULL)
+ client_send_ok(client, "PUTSCRIPT completed.");
+ else
+ client_send_ok(client, "Script checked successfully.");
+ }
+
+ sieve_error_handler_unref(&ehandler);
+ str_free(&errors);
+}
+
+static void cmd_putscript_handle_script(struct cmd_putscript_context *ctx)
+{
+ struct client_command_context *cmd = ctx->cmd;
+ struct sieve_script *script;
+
+ /* Obtain script object for uploaded script */
+ script = sieve_storage_save_get_tempscript(ctx->save_ctx);
+
+ /* Check result */
+ if (script == NULL) {
+ cmd_putscript_storage_error(ctx);
+ cmd_putscript_finish(ctx);
+ return;
+ }
+
+ /* If quoted string, the size was not known until now */
+ if (!ctx->script_size_valid) {
+ if (sieve_script_get_size(script, &ctx->script_size) < 0) {
+ cmd_putscript_storage_error(ctx);
+ cmd_putscript_finish(ctx);
+ return;
+ }
+ ctx->script_size_valid = TRUE;
+
+ /* Check quota; max size is already checked */
+ if (ctx->scriptname != NULL &&
+ !managesieve_quota_check_all(cmd, ctx->scriptname,
+ ctx->script_size)) {
+ cmd_putscript_finish(ctx);
+ return;
+ }
+ }
+
+ /* Try to compile and store the script */
+ T_BEGIN {
+ cmd_putscript_finish_script(ctx, script);
+ } T_END;
+}
+
+static bool cmd_putscript_finish_parsing(struct client_command_context *cmd)
+{
+ struct client *client = cmd->client;
+ struct cmd_putscript_context *ctx = cmd->context;
+ const struct managesieve_arg *args;
+ int ret;
+
+ /* if error occurs, the CRLF is already read. */
+ client->input_skip_line = FALSE;
+
+ /* <script literal> */
+ ret = managesieve_parser_read_args(ctx->save_parser, 0, 0, &args);
+ if (ret == -1 || client->output->closed) {
+ if (ctx->storage != NULL) {
+ const char *msg;
+ bool fatal ATTR_UNUSED;
+
+ msg = managesieve_parser_get_error(
+ ctx->save_parser, &fatal);
+ client_send_command_error(cmd, msg);
+ }
+ cmd_putscript_finish(ctx);
+ return TRUE;
+ }
+ if (ret < 0) {
+ /* need more data */
+ return FALSE;
+ }
+
+ if (MANAGESIEVE_ARG_IS_EOL(&args[0])) {
+ /* Eat away the trailing CRLF */
+ client->input_skip_line = TRUE;
+
+ cmd_putscript_handle_script(ctx);
+ return TRUE;
+ }
+
+ client_send_command_error(cmd, "Too many command arguments.");
+ cmd_putscript_finish(ctx);
+ return TRUE;
+}
+
+static bool cmd_putscript_continue_parsing(struct client_command_context *cmd)
+{
+ struct client *client = cmd->client;
+ struct cmd_putscript_context *ctx = cmd->context;
+ const struct managesieve_arg *args;
+ int ret;
+
+ /* if error occurs, the CRLF is already read. */
+ client->input_skip_line = FALSE;
+
+ /* <script literal> */
+ ret = managesieve_parser_read_args(
+ ctx->save_parser, 0, MANAGESIEVE_PARSE_FLAG_STRING_STREAM,
+ &args);
+ if (ret == -1 || client->output->closed) {
+ cmd_putscript_finish(ctx);
+ client_send_command_error(cmd, "Invalid arguments.");
+ client->input_skip_line = TRUE;
+ return TRUE;
+ }
+ if (ret < 0) {
+ /* need more data */
+ return FALSE;
+ }
+
+ /* Validate the script argument */
+ if (!managesieve_arg_get_string_stream(args,&ctx->input)) {
+ client_send_command_error(cmd, "Invalid arguments.");
+ return cmd_putscript_cancel(ctx, FALSE);
+ }
+
+ if (i_stream_get_size(ctx->input, FALSE, &ctx->script_size) > 0) {
+ ctx->script_size_valid = TRUE;
+
+ /* Check quota */
+ if (ctx->scriptname == NULL) {
+ if (!managesieve_quota_check_validsize(
+ cmd, ctx->script_size))
+ return cmd_putscript_cancel(ctx, TRUE);
+ } else {
+ if (!managesieve_quota_check_all(
+ cmd, ctx->scriptname, ctx->script_size))
+ return cmd_putscript_cancel(ctx, TRUE);
+ }
+
+ } else {
+ ctx->max_script_size =
+ managesieve_quota_max_script_size(client);
+ }
+
+ /* save the script */
+ ctx->save_ctx = sieve_storage_save_init(ctx->storage, ctx->scriptname,
+ ctx->input);
+
+ if (ctx->save_ctx == NULL) {
+ /* save initialization failed */
+ cmd_putscript_storage_error(ctx);
+ return cmd_putscript_cancel(ctx, TRUE);
+ }
+
+ /* after literal comes CRLF, if we fail make sure we eat it away */
+ client->input_skip_line = TRUE;
+
+ client->command_pending = TRUE;
+ cmd->func = cmd_putscript_continue_script;
+ return cmd_putscript_continue_script(cmd);
+}
+
+static bool cmd_putscript_continue_script(struct client_command_context *cmd)
+{
+ struct client *client = cmd->client;
+ struct cmd_putscript_context *ctx = cmd->context;
+ size_t size;
+ int ret;
+
+ if (ctx->save_ctx != NULL) {
+ for (;;) {
+ i_assert(!ctx->script_size_valid ||
+ ctx->input->v_offset <= ctx->script_size);
+ if (ctx->max_script_size > 0 &&
+ ctx->input->v_offset > ctx->max_script_size) {
+ (void)managesieve_quota_check_validsize(
+ cmd, ctx->input->v_offset);
+ cmd_putscript_finish(ctx);
+ return TRUE;
+ }
+
+ ret = i_stream_read(ctx->input);
+ if ((ret != -1 || ctx->input->stream_errno != EINVAL ||
+ client->input->eof) &&
+ sieve_storage_save_continue(ctx->save_ctx) < 0) {
+ /* we still have to finish reading the script
+ from client */
+ sieve_storage_save_cancel(&ctx->save_ctx);
+ break;
+ }
+ if (ret == -1 || ret == 0)
+ break;
+ }
+ }
+
+ if (ctx->save_ctx == NULL) {
+ (void)i_stream_read(ctx->input);
+ (void)i_stream_get_data(ctx->input, &size);
+ i_stream_skip(ctx->input, size);
+ }
+
+ if (ctx->input->eof || client->input->closed) {
+ bool failed = FALSE;
+ bool all_written = FALSE;
+
+ if (!ctx->script_size_valid) {
+ if (!client->input->eof &&
+ ctx->input->stream_errno == EINVAL) {
+ client_send_command_error(
+ cmd, t_strdup_printf(
+ "Invalid input: %s",
+ i_stream_get_error(ctx->input)));
+ client->input_skip_line = TRUE;
+ failed = TRUE;
+ }
+ all_written = (ctx->input->eof &&
+ ctx->input->stream_errno == 0);
+
+ } else {
+ all_written = (ctx->input->v_offset == ctx->script_size);
+ }
+
+ /* finished */
+ ctx->input = NULL;
+
+ if (!failed) {
+ if (ctx->save_ctx == NULL) {
+ /* failed above */
+ cmd_putscript_storage_error(ctx);
+ failed = TRUE;
+ } else if (!all_written) {
+ /* client disconnected before it finished sending the
+ whole script. */
+ failed = TRUE;
+ sieve_storage_save_cancel(&ctx->save_ctx);
+ const char *reason = t_strdup_printf(
+ "%s (While appending in PUTSCRIPT/CHECKSCRIPT)",
+ io_stream_get_disconnect_reason(client->input,
+ client->output));
+ client_disconnect(client, reason);
+ } else if (sieve_storage_save_finish(ctx->save_ctx) < 0) {
+ failed = TRUE;
+ cmd_putscript_storage_error(ctx);
+ } else {
+ failed = client->input->closed;
+ }
+ }
+
+ if (failed) {
+ cmd_putscript_finish(ctx);
+ return TRUE;
+ }
+
+ /* finish */
+ client->command_pending = FALSE;
+ managesieve_parser_reset(ctx->save_parser);
+ cmd->func = cmd_putscript_finish_parsing;
+ return cmd_putscript_finish_parsing(cmd);
+ }
+
+ return FALSE;
+}
+
+static bool
+cmd_putscript_start(struct client_command_context *cmd, const char *scriptname)
+{
+ struct cmd_putscript_context *ctx;
+ struct client *client = cmd->client;
+
+ ctx = p_new(cmd->pool, struct cmd_putscript_context, 1);
+ ctx->cmd = cmd;
+ ctx->client = client;
+ ctx->storage = client->storage;
+ ctx->scriptname = scriptname;
+
+ io_remove(&client->io);
+ client->io = io_add(i_stream_get_fd(client->input), IO_READ,
+ client_input_putscript, client);
+ /* putscript is special because we're only waiting on client input, not
+ client output, so disable the standard output handler until we're
+ finished */
+ o_stream_unset_flush_callback(client->output);
+
+ ctx->save_parser = managesieve_parser_create(
+ client->input, client->set->managesieve_max_line_length);
+
+ cmd->func = cmd_putscript_continue_parsing;
+ cmd->context = ctx;
+ return cmd_putscript_continue_parsing(cmd);
+
+}
+
+bool cmd_putscript(struct client_command_context *cmd)
+{
+ const char *scriptname;
+
+ /* <scriptname> */
+ if (!client_read_string_args(cmd, FALSE, 1, &scriptname))
+ return FALSE;
+
+ event_add_str(cmd->event, "script_name", scriptname);
+
+ return cmd_putscript_start(cmd, scriptname);
+}
+
+bool cmd_checkscript(struct client_command_context *cmd)
+{
+ return cmd_putscript_start(cmd, NULL);
+}
diff --git a/pigeonhole/src/managesieve/cmd-renamescript.c b/pigeonhole/src/managesieve/cmd-renamescript.c
new file mode 100644
index 0000000..bc7a99d
--- /dev/null
+++ b/pigeonhole/src/managesieve/cmd-renamescript.c
@@ -0,0 +1,54 @@
+/* Copyright (c) 2002-2018 Pigeonhole authors, see the included COPYING file
+ */
+
+#include "lib.h"
+#include "str.h"
+
+#include "sieve.h"
+#include "sieve-script.h"
+#include "sieve-storage.h"
+
+#include "managesieve-common.h"
+#include "managesieve-commands.h"
+
+bool cmd_renamescript(struct client_command_context *cmd)
+{
+ struct client *client = cmd->client;
+ struct sieve_storage *storage = client->storage;
+ const char *scriptname, *newname;
+ struct sieve_script *script;
+
+ /* <oldname> <newname> */
+ if (!client_read_string_args(cmd, TRUE, 2, &scriptname, &newname))
+ return FALSE;
+
+ event_add_str(cmd->event, "old_script_name", scriptname);
+ event_add_str(cmd->event, "new_script_name", newname);
+
+ script = sieve_storage_open_script(storage, scriptname, NULL);
+ if (script == NULL) {
+ client_command_storage_error(
+ cmd, "Failed to open script `%s' for rename to `%s'",
+ scriptname, newname);
+ return TRUE;
+ }
+
+ if (sieve_script_rename(script, newname) < 0) {
+ client_command_storage_error(
+ cmd, "Failed to rename script `%s' to `%s'",
+ scriptname, newname);
+ } else {
+ client->renamed_count++;
+
+ struct event_passthrough *e =
+ client_command_create_finish_event(cmd);
+ e_debug(e->event(), "Renamed script `%s' to `%s'",
+ scriptname, newname);
+
+ client_send_ok(client, "Renamescript completed.");
+ }
+
+ sieve_script_unref(&script);
+ return TRUE;
+}
+
diff --git a/pigeonhole/src/managesieve/cmd-setactive.c b/pigeonhole/src/managesieve/cmd-setactive.c
new file mode 100644
index 0000000..07844c5
--- /dev/null
+++ b/pigeonhole/src/managesieve/cmd-setactive.c
@@ -0,0 +1,165 @@
+/* Copyright (c) 2002-2018 Pigeonhole authors, see the included COPYING file
+ */
+
+#include "lib.h"
+#include "str.h"
+
+#include "sieve.h"
+#include "sieve-script.h"
+#include "sieve-storage.h"
+
+#include "managesieve-common.h"
+#include "managesieve-commands.h"
+
+static void
+cmd_setactive_activate(struct client_command_context *cmd,
+ const char *scriptname)
+{
+ struct client *client = cmd->client;
+ struct sieve_storage *storage = client->storage;
+ struct sieve_script *script;
+ string_t *errors = NULL;
+ const char *errormsg = NULL;
+ unsigned int warning_count = 0, error_count = 0;
+ bool success = TRUE;
+ int ret;
+
+ event_add_str(cmd->event, "script_name", scriptname);
+
+ script = sieve_storage_open_script(storage, scriptname, NULL);
+ if (script == NULL) {
+ client_command_storage_error(
+ cmd, "Failed to open script `%s' for activation",
+ scriptname);
+ return;
+ }
+
+ if (sieve_script_is_active(script) <= 0) T_BEGIN {
+ /* Script is first being activated; compile it again without the
+ UPLOAD flag. */
+ struct sieve_error_handler *ehandler;
+ enum sieve_compile_flags cpflags =
+ SIEVE_COMPILE_FLAG_NOGLOBAL |
+ SIEVE_COMPILE_FLAG_ACTIVATED;
+ struct sieve_binary *sbin;
+ enum sieve_error error;
+
+ /* Prepare error handler */
+ errors = str_new(default_pool, 1024);
+ ehandler = sieve_strbuf_ehandler_create(
+ client->svinst, errors, TRUE,
+ client->set->managesieve_max_compile_errors);
+
+ /* Compile */
+ sbin = sieve_compile_script(script, ehandler, cpflags, &error);
+ if (sbin == NULL) {
+ if (error != SIEVE_ERROR_NOT_VALID) {
+ errormsg = sieve_script_get_last_error(
+ script, &error);
+ if (error == SIEVE_ERROR_NONE)
+ errormsg = NULL;
+ }
+ success = FALSE;
+ } else {
+ sieve_close(&sbin);
+ }
+
+ warning_count = sieve_get_warnings(ehandler);
+ error_count = sieve_get_errors(ehandler);
+ sieve_error_handler_unref(&ehandler);
+ } T_END;
+
+ /* Activate only when script is valid (or already active) */
+ if (success) {
+ /* Refresh activation no matter what; this can also
+ resolve some erroneous situations. */
+ ret = sieve_script_activate(script, (time_t)-1);
+ if (ret < 0) {
+ client_command_storage_error(
+ cmd, "Failed to activate script `%s'",
+ scriptname);
+ } else {
+ struct event_passthrough *e =
+ client_command_create_finish_event(cmd)->
+ add_int("compile_warnings", warning_count);
+ e_debug(e->event(), "Activated script `%s' "
+ " (%u warnings%s)",
+ scriptname, warning_count,
+ (ret == 0 ? ", redundant" : ""));
+
+ if (warning_count > 0) {
+ client_send_okresp(
+ client, "WARNINGS",
+ str_c(errors));
+ } else {
+ client_send_ok(client,
+ (ret > 0 ?
+ "Setactive completed." :
+ "Script is already active."));
+ }
+ }
+ } else if (errormsg == NULL) {
+ struct event_passthrough *e =
+ client_command_create_finish_event(cmd)->
+ add_str("error", "Compilation failed")->
+ add_int("compile_errors", error_count)->
+ add_int("compile_warnings", warning_count);
+ e_debug(e->event(), "Failed to activate script `%s': "
+ "Compilation failed (%u errors, %u warnings)",
+ scriptname, error_count, warning_count);
+
+ client_send_no(client, str_c(errors));
+ } else {
+ struct event_passthrough *e =
+ client_command_create_finish_event(cmd)->
+ add_str("error", errormsg);
+ e_debug(e->event(), "Failed to activate script `%s': %s",
+ scriptname, errormsg);
+
+ client_send_no(client, errormsg);
+ }
+
+ if (errors != NULL)
+ str_free(&errors);
+ sieve_script_unref(&script);
+}
+
+static void
+cmd_setactive_deactivate(struct client_command_context *cmd)
+{
+ struct client *client = cmd->client;
+ struct sieve_storage *storage = client->storage;
+ int ret;
+
+ ret = sieve_storage_deactivate(storage, (time_t)-1);
+ if (ret < 0) {
+ client_command_storage_error(
+ cmd, "Failed to deactivate script");
+ return;
+ }
+
+ struct event_passthrough *e =
+ client_command_create_finish_event(cmd);
+ e_debug(e->event(), "Deactivated script");
+
+ client_send_ok(client, (ret > 0 ?
+ "Active script is now deactivated." :
+ "No scripts currently active."));
+}
+
+bool cmd_setactive(struct client_command_context *cmd)
+{
+ const char *scriptname;
+
+ /* <scriptname> */
+ if (!client_read_string_args(cmd, TRUE, 1, &scriptname))
+ return FALSE;
+
+ /* Activate, or deactivate */
+ if (*scriptname != '\0')
+ cmd_setactive_activate(cmd, scriptname);
+ else
+ cmd_setactive_deactivate(cmd);
+
+ return TRUE;
+}
diff --git a/pigeonhole/src/managesieve/main.c b/pigeonhole/src/managesieve/main.c
new file mode 100644
index 0000000..321ebe3
--- /dev/null
+++ b/pigeonhole/src/managesieve/main.c
@@ -0,0 +1,401 @@
+/* Copyright (c) 2002-2018 Pigeonhole authors, see the included COPYING file
+ */
+
+#include "lib.h"
+#include "buffer.h"
+#include "ioloop.h"
+#include "istream.h"
+#include "istream-concat.h"
+#include "ostream.h"
+#include "path-util.h"
+#include "str.h"
+#include "base64.h"
+#include "process-title.h"
+#include "restrict-access.h"
+#include "settings-parser.h"
+#include "master-interface.h"
+#include "master-service.h"
+#include "master-login.h"
+#include "mail-user.h"
+#include "mail-storage-service.h"
+
+#include "managesieve-common.h"
+#include "managesieve-commands.h"
+#include "managesieve-capabilities.h"
+
+#include <stdio.h>
+#include <unistd.h>
+
+#define IS_STANDALONE() \
+ (getenv(MASTER_IS_PARENT_ENV) == NULL)
+
+#define MANAGESIEVE_DIE_IDLE_SECS 10
+
+static bool verbose_proctitle = FALSE;
+static struct mail_storage_service_ctx *storage_service;
+static struct master_login *master_login = NULL;
+
+void (*hook_client_created)(struct client **client) = NULL;
+
+struct event_category event_category_managesieve = {
+ .name = "managesieve",
+};
+
+void managesieve_refresh_proctitle(void)
+{
+#define MANAGESIEVE_PROCTITLE_PREFERRED_LEN 80
+ struct client *client;
+ string_t *title = t_str_new(128);
+
+ if (!verbose_proctitle)
+ return;
+
+ str_append_c(title, '[');
+ switch (managesieve_client_count) {
+ case 0:
+ str_append(title, "idling");
+ break;
+ case 1:
+ client = managesieve_clients;
+ str_append(title, client->user->username);
+ if (client->user->conn.remote_ip != NULL) {
+ str_append_c(title, ' ');
+ str_append(title,
+ net_ip2addr(client->user->conn.remote_ip));
+ }
+
+ if (client->cmd.name != NULL &&
+ str_len(title) <= MANAGESIEVE_PROCTITLE_PREFERRED_LEN) {
+ str_append_c(title, ' ');
+ str_append(title, client->cmd.name);
+ }
+ break;
+ default:
+ str_printfa(title, "%u connections", managesieve_client_count);
+ break;
+ }
+ str_append_c(title, ']');
+ process_title_set(str_c(title));
+}
+
+static void client_kill_idle(struct client *client)
+{
+ mail_storage_service_io_activate_user(client->service_user);
+ client_send_bye(client, "Server shutting down.");
+ client_destroy(client, "Server shutting down.");
+}
+
+static void managesieve_die(void)
+{
+ struct client *client, *next;
+ time_t last_io, now = time(NULL);
+ time_t stop_timestamp = now - MANAGESIEVE_DIE_IDLE_SECS;
+ unsigned int stop_msecs;
+
+ for (client = managesieve_clients; client != NULL; client = next) {
+ next = client->next;
+
+ last_io = I_MAX(client->last_input, client->last_output);
+ if (last_io <= stop_timestamp)
+ client_kill_idle(client);
+ else {
+ timeout_remove(&client->to_idle);
+ stop_msecs = (last_io - stop_timestamp) * 1000;
+ client->to_idle = timeout_add(stop_msecs,
+ client_kill_idle, client);
+ }
+ }
+}
+
+static void client_add_istream_prefix(struct client *client,
+ const buffer_t *input)
+{
+ struct istream *inputs[] = {
+ i_stream_create_copy_from_data(input->data, input->used),
+ client->input,
+ NULL
+ };
+ client->input = i_stream_create_concat(inputs);
+ i_stream_copy_fd(client->input, inputs[1]);
+ i_stream_unref(&inputs[0]);
+ i_stream_unref(&inputs[1]);
+
+ i_stream_set_input_pending(client->input, TRUE);
+}
+
+static void client_logged_in(struct client *client)
+{
+ struct ostream *output;
+
+ output = client->output;
+ o_stream_ref(output);
+ o_stream_cork(output);
+ if (!IS_STANDALONE())
+ client_send_ok(client, "Logged in.");
+ (void)client_input(client);
+ o_stream_uncork(output);
+ o_stream_unref(&output);
+}
+
+static int
+client_create_from_input(const struct mail_storage_service_input *input,
+ int fd_in, int fd_out, const buffer_t *input_buf,
+ const char **error_r)
+{
+ struct mail_storage_service_input service_input;
+ struct mail_storage_service_user *user;
+ struct mail_user *mail_user;
+ struct client *client;
+ struct managesieve_settings *set;
+ struct event *event;
+ const char *error;
+
+ event = event_create(NULL);
+ event_add_category(event, &event_category_managesieve);
+ event_add_fields(event, (const struct event_add_field []){
+ { .key = "user", .value = input->username },
+ { .key = "session", .value = input->session_id },
+ { .key = NULL }
+ });
+
+ service_input = *input;
+ service_input.event_parent = event;
+ if (mail_storage_service_lookup_next(storage_service, &service_input,
+ &user, &mail_user, error_r) <= 0) {
+ event_unref(&event);
+ return -1;
+ }
+ restrict_access_allow_coredumps(TRUE);
+
+ set = mail_storage_service_user_get_set(user)[1];
+ if (set->verbose_proctitle)
+ verbose_proctitle = TRUE;
+
+ if (settings_var_expand(&managesieve_setting_parser_info, set,
+ mail_user->pool,
+ mail_user_var_expand_table(mail_user),
+ &error) <= 0) {
+ i_error("Failed to expand settings: %s", error);
+ mail_storage_service_user_unref(&user);
+ mail_user_unref(&mail_user);
+ event_unref(&event);
+ return -1;
+ }
+
+ client = client_create(fd_in, fd_out, input->session_id,
+ event, mail_user, user, set);
+ if (input_buf != NULL && input_buf->used > 0)
+ client_add_istream_prefix(client, input_buf);
+ client_create_finish(client);
+ T_BEGIN {
+ client_logged_in(client);
+ } T_END;
+ event_unref(&event);
+ return 0;
+}
+
+static void main_stdio_run(const char *username)
+{
+ struct mail_storage_service_input input;
+ const char *value, *error, *input_base64;
+ buffer_t *input_buf;
+
+ i_zero(&input);
+ input.module = "managesieve";
+ input.service = "sieve";
+ input.username = username != NULL ? username : getenv("USER");
+ if (input.username == NULL && IS_STANDALONE())
+ input.username = getlogin();
+ if (input.username == NULL)
+ i_fatal("USER environment missing");
+ if ((value = getenv("IP")) != NULL)
+ net_addr2ip(value, &input.remote_ip);
+ if ((value = getenv("LOCAL_IP")) != NULL)
+ net_addr2ip(value, &input.local_ip);
+
+ input_base64 = getenv("CLIENT_INPUT");
+ input_buf = (input_base64 == NULL ?
+ NULL : t_base64_decode_str(input_base64));
+
+ if (client_create_from_input(&input, STDIN_FILENO, STDOUT_FILENO,
+ input_buf, &error) < 0)
+ i_fatal("%s", error);
+}
+
+static void
+login_client_connected(const struct master_login_client *client,
+ const char *username, const char *const *extra_fields)
+{
+#define MSG_BYE_INTERNAL_ERROR "BYE \""CRITICAL_MSG"\"\r\n"
+ struct mail_storage_service_input input;
+ enum mail_auth_request_flags flags = client->auth_req.flags;
+ const char *error;
+ buffer_t input_buf;
+
+ i_zero(&input);
+ input.module = "managesieve";
+ input.service = "sieve";
+ input.local_ip = client->auth_req.local_ip;
+ input.remote_ip = client->auth_req.remote_ip;
+ input.local_port = client->auth_req.local_port;
+ input.remote_port = client->auth_req.remote_port;
+ input.username = username;
+ input.userdb_fields = extra_fields;
+ input.session_id = client->session_id;
+ if ((flags & MAIL_AUTH_REQUEST_FLAG_CONN_SECURED) != 0)
+ input.conn_secured = TRUE;
+ if ((flags & MAIL_AUTH_REQUEST_FLAG_CONN_SSL_SECURED) != 0)
+ input.conn_ssl_secured = TRUE;
+
+ buffer_create_from_const_data(&input_buf, client->data,
+ client->auth_req.data_size);
+ if (client_create_from_input(&input, client->fd, client->fd,
+ &input_buf, &error) < 0) {
+ int fd = client->fd;
+
+ if (write(fd, MSG_BYE_INTERNAL_ERROR,
+ strlen(MSG_BYE_INTERNAL_ERROR)) < 0) {
+ if (errno != EAGAIN && errno != EPIPE)
+ i_error("write(client) failed: %m");
+ }
+ i_error("%s", error);
+ i_close_fd(&fd);
+ master_service_client_connection_destroyed(master_service);
+ }
+}
+
+static void
+login_client_failed(const struct master_login_client *client,
+ const char *errormsg)
+{
+ const char *msg;
+
+ msg = t_strdup_printf("NO \"%s\"\r\n", errormsg);
+ if (write(client->fd, msg, strlen(msg)) < 0) {
+ /* ignored */
+ }
+}
+
+static void client_connected(struct master_service_connection *conn)
+{
+ /* when running standalone, we shouldn't even get here */
+ i_assert(master_login != NULL);
+
+ master_service_client_connection_accept(conn);
+ master_login_add(master_login, conn->fd);
+}
+
+int main(int argc, char *argv[])
+{
+ static const struct setting_parser_info *set_roots[] = {
+ &managesieve_setting_parser_info,
+ NULL
+ };
+ struct master_login_settings login_set;
+ enum master_service_flags service_flags = 0;
+ enum mail_storage_service_flags storage_service_flags = 0;
+ const char *username = NULL, *error = NULL;
+ int c;
+
+ i_zero(&login_set);
+ login_set.postlogin_timeout_secs = MASTER_POSTLOGIN_TIMEOUT_DEFAULT;
+
+ if (IS_STANDALONE() && getuid() == 0 &&
+ net_getpeername(1, NULL, NULL) == 0) {
+ printf("NO \"managesieve binary must not be started from "
+ "inetd, use managesieve-login instead.\"\n");
+ return 1;
+ }
+
+ if (IS_STANDALONE() || getenv("DUMP_CAPABILITY") != NULL) {
+ service_flags |= MASTER_SERVICE_FLAG_STANDALONE |
+ MASTER_SERVICE_FLAG_STD_CLIENT;
+ } else {
+ service_flags |= MASTER_SERVICE_FLAG_KEEP_CONFIG_OPEN;
+ }
+ if (getenv("DUMP_CAPABILITY") != NULL) {
+ service_flags |= MASTER_SERVICE_FLAG_DONT_SEND_STATS |
+ MASTER_SERVICE_FLAG_DISABLE_SSL_SET;
+ }
+
+ master_service = master_service_init("managesieve", service_flags,
+ &argc, &argv, "t:u:");
+ while ((c = master_getopt(master_service)) > 0) {
+ switch (c) {
+ case 't':
+ if (str_to_uint(optarg,
+ &login_set.postlogin_timeout_secs) < 0 ||
+ login_set.postlogin_timeout_secs == 0)
+ i_fatal("Invalid -t parameter: %s", optarg);
+ break;
+ case 'u':
+ storage_service_flags |=
+ MAIL_STORAGE_SERVICE_FLAG_USERDB_LOOKUP;
+ username = optarg;
+ break;
+ default:
+ return FATAL_DEFAULT;
+ }
+ }
+
+ master_service_set_die_callback(master_service, managesieve_die);
+
+ /* plugins may want to add commands, so this needs to be called early */
+ commands_init();
+
+ /* Dump capabilities if requested */
+ if (getenv("DUMP_CAPABILITY") != NULL) {
+ i_set_debug_file("/dev/null");
+ managesieve_capabilities_dump();
+ commands_deinit();
+ master_service_deinit(&master_service);
+ exit(0);
+ }
+
+ if (t_abspath("auth-master", &login_set.auth_socket_path, &error) < 0)
+ i_fatal("t_abspath(%s) failed: %s", "auth-master", error);
+
+ if (argv[optind] != NULL &&
+ t_abspath(argv[optind], &login_set.postlogin_socket_path,
+ &error) < 0) {
+ i_fatal("t_abspath(%s) failed: %s", argv[optind], error);
+ }
+
+ login_set.callback = login_client_connected;
+ login_set.failure_callback = login_client_failed;
+
+ if (!IS_STANDALONE())
+ master_login = master_login_init(master_service, &login_set);
+
+ storage_service =
+ mail_storage_service_init(master_service,
+ set_roots, storage_service_flags);
+ master_service_init_finish(master_service);
+ /* NOTE: login_set.*_socket_path are now invalid due to data stack
+ having been freed */
+
+ /* fake that we're running, so we know if client was destroyed
+ while handling its initial input */
+ io_loop_set_running(current_ioloop);
+
+ if (IS_STANDALONE()) {
+ T_BEGIN {
+ main_stdio_run(username);
+ } T_END;
+ } else {
+ io_loop_set_running(current_ioloop);
+ }
+
+ if (io_loop_is_running(current_ioloop))
+ master_service_run(master_service, client_connected);
+ clients_destroy_all();
+
+ if (master_login != NULL)
+ master_login_deinit(&master_login);
+ mail_storage_service_deinit(&storage_service);
+
+ commands_deinit();
+
+ master_service_deinit(&master_service);
+ return 0;
+}
diff --git a/pigeonhole/src/managesieve/managesieve-capabilities.c b/pigeonhole/src/managesieve/managesieve-capabilities.c
new file mode 100644
index 0000000..c72558f
--- /dev/null
+++ b/pigeonhole/src/managesieve/managesieve-capabilities.c
@@ -0,0 +1,136 @@
+/* Copyright (c) 2002-2018 Pigeonhole authors, see the included COPYING file
+ */
+
+#include "lib.h"
+#include "array.h"
+#include "hostpid.h"
+#include "var-expand.h"
+#include "settings-parser.h"
+#include "master-service.h"
+#include "master-service-settings.h"
+#include "master-service-settings-cache.h"
+
+#include "sieve.h"
+
+#include "managesieve-capabilities.h"
+
+#include <stddef.h>
+#include <unistd.h>
+
+/*
+ * Global plugin settings
+ */
+
+struct plugin_settings {
+ ARRAY(const char *) plugin_envs;
+};
+
+static const struct setting_parser_info **plugin_set_roots;
+
+static const struct setting_define plugin_setting_defines[] = {
+ { .type = SET_STRLIST, .key = "plugin",
+ .offset = offsetof(struct plugin_settings, plugin_envs) },
+
+ SETTING_DEFINE_LIST_END
+};
+
+static const struct setting_parser_info plugin_setting_parser_info = {
+ .module_name = "managesieve",
+ .defines = plugin_setting_defines,
+
+ .type_offset = (size_t)-1,
+ .struct_size = sizeof(struct plugin_settings),
+
+ .parent_offset = (size_t)-1,
+};
+
+static const struct setting_parser_info *default_plugin_set_roots[] = {
+ &plugin_setting_parser_info,
+ NULL
+};
+
+static const struct setting_parser_info **plugin_set_roots =
+ default_plugin_set_roots;
+
+static struct plugin_settings *plugin_settings_read(void)
+{
+ const char *error;
+
+ if (master_service_settings_read_simple(
+ master_service, plugin_set_roots, &error) < 0)
+ i_fatal("Error reading configuration: %s", error);
+
+ return (struct plugin_settings *)
+ master_service_settings_get_others(master_service)[0];
+}
+
+static const char *
+plugin_settings_get(const struct plugin_settings *set, const char *identifier)
+{
+ const char *const *envs;
+ unsigned int i, count;
+
+ if ( !array_is_created(&set->plugin_envs) )
+ return NULL;
+
+ envs = array_get(&set->plugin_envs, &count);
+ for ( i = 0; i < count; i += 2 ) {
+ if ( strcmp(envs[i], identifier) == 0 )
+ return envs[i+1];
+ }
+ return NULL;
+}
+
+/*
+ * Sieve environment
+ */
+
+static const char *sieve_get_setting(void *context, const char *identifier)
+{
+ const struct plugin_settings *set = context;
+
+ return plugin_settings_get(set, identifier);
+}
+
+static const struct sieve_callbacks sieve_callbacks = {
+ NULL,
+ sieve_get_setting
+};
+
+/*
+ * Capability dumping
+ */
+
+void managesieve_capabilities_dump(void)
+{
+ const struct plugin_settings *global_plugin_settings;
+ struct sieve_environment svenv;
+ struct sieve_instance *svinst;
+ const char *notify_cap;
+
+ /* Read plugin settings */
+
+ global_plugin_settings = plugin_settings_read();
+
+ /* Initialize Sieve engine */
+
+ memset((void*)&svenv, 0, sizeof(svenv));
+ svenv.home_dir = "/tmp";
+
+ svinst = sieve_init(&svenv, &sieve_callbacks,
+ (void *) global_plugin_settings, FALSE);
+
+ /* Dump capabilities */
+
+ notify_cap = sieve_get_capabilities(svinst, "notify");
+
+ if (notify_cap == NULL)
+ printf("SIEVE: %s\n", sieve_get_capabilities(svinst, NULL));
+ else {
+ printf("SIEVE: %s, NOTIFY: %s\n",
+ sieve_get_capabilities(svinst, NULL),
+ sieve_get_capabilities(svinst, "notify"));
+ }
+
+ sieve_deinit(&svinst);
+}
diff --git a/pigeonhole/src/managesieve/managesieve-capabilities.h b/pigeonhole/src/managesieve/managesieve-capabilities.h
new file mode 100644
index 0000000..b7503a9
--- /dev/null
+++ b/pigeonhole/src/managesieve/managesieve-capabilities.h
@@ -0,0 +1,6 @@
+#ifndef MANAGESIEVE_CAPABILITIES_H
+#define MANAGESIEVE_CAPABILITIES_H
+
+void managesieve_capabilities_dump(void);
+
+#endif
diff --git a/pigeonhole/src/managesieve/managesieve-client.c b/pigeonhole/src/managesieve/managesieve-client.c
new file mode 100644
index 0000000..bacf460
--- /dev/null
+++ b/pigeonhole/src/managesieve/managesieve-client.c
@@ -0,0 +1,792 @@
+/* Copyright (c) 2002-2018 Pigeonhole authors, see the included COPYING file
+ */
+
+#include "lib.h"
+#include "ioloop.h"
+#include "llist.h"
+#include "str.h"
+#include "hostpid.h"
+#include "net.h"
+#include "istream.h"
+#include "ostream.h"
+#include "iostream.h"
+#include "iostream-rawlog.h"
+#include "var-expand.h"
+#include "time-util.h"
+#include "master-service.h"
+#include "mail-storage-service.h"
+#include "mail-namespace.h"
+
+#include "sieve.h"
+#include "sieve-storage.h"
+
+#include "managesieve-quote.h"
+#include "managesieve-common.h"
+#include "managesieve-commands.h"
+#include "managesieve-client.h"
+
+#include <unistd.h>
+
+extern struct mail_storage_callbacks mail_storage_callbacks;
+struct managesieve_module_register managesieve_module_register = { 0 };
+
+struct client *managesieve_clients = NULL;
+unsigned int managesieve_client_count = 0;
+
+static const char *
+managesieve_sieve_get_setting(void *context, const char *identifier)
+{
+ struct mail_user *mail_user = (struct mail_user *) context;
+
+ if (mail_user == NULL)
+ return NULL;
+
+ return mail_user_plugin_getenv(mail_user, identifier);
+}
+
+static const struct sieve_callbacks managesieve_sieve_callbacks = {
+ NULL,
+ managesieve_sieve_get_setting
+};
+
+static void client_idle_timeout(struct client *client)
+{
+ if (client->cmd.func != NULL) {
+ client_destroy(client,
+ "Disconnected for inactivity in reading our output");
+ } else {
+ client_send_bye(client, "Disconnected for inactivity");
+ client_destroy(client, "Disconnected for inactivity");
+ }
+}
+
+static struct sieve_storage *
+client_get_storage(struct sieve_instance *svinst, struct mail_user *user,
+ int fd_out)
+{
+ struct sieve_storage *storage;
+ enum sieve_error error;
+ const char *errormsg, *byemsg;
+
+ /* Open personal script storage */
+
+ storage = sieve_storage_create_main(svinst, user,
+ SIEVE_STORAGE_FLAG_READWRITE,
+ &error);
+ if (storage == NULL) {
+ switch (error) {
+ case SIEVE_ERROR_NOT_POSSIBLE:
+ byemsg = "BYE \"Sieve processing is disabled for this user.\"\r\n";
+ errormsg = "Failed to open Sieve storage: "
+ "Sieve is disabled for this user";
+ break;
+ case SIEVE_ERROR_NOT_FOUND:
+ byemsg = "BYE \"This user cannot manage personal Sieve scripts.\"\r\n";
+ errormsg = "Failed to open Sieve storage: "
+ "Personal script storage disabled or not found.";
+ break;
+ default:
+ byemsg = t_strflocaltime(
+ "BYE \""CRITICAL_MSG_STAMP"\"\r\n", ioloop_time);
+ errormsg = "Failed to open Sieve storage.";
+ }
+
+ if (write(fd_out, byemsg, strlen(byemsg)) < 0) {
+ if (errno != EAGAIN && errno != EPIPE)
+ i_error("write(client) failed: %m");
+ }
+ i_fatal("%s", errormsg);
+ }
+
+ return storage;
+}
+
+struct client *
+client_create(int fd_in, int fd_out, const char *session_id,
+ struct event *event, struct mail_user *user,
+ struct mail_storage_service_user *service_user,
+ const struct managesieve_settings *set)
+{
+ struct client *client;
+ const char *ident;
+ struct sieve_environment svenv;
+ struct sieve_instance *svinst;
+ struct sieve_storage *storage;
+ pool_t pool;
+
+ /* Initialize Sieve */
+
+ memset((void*)&svenv, 0, sizeof(svenv));
+ svenv.username = user->username;
+ (void)mail_user_get_home(user, &svenv.home_dir);
+ svenv.base_dir = user->set->base_dir;
+ svenv.event_parent = event;
+ svenv.flags = SIEVE_FLAG_HOME_RELATIVE;
+
+ svinst = sieve_init(&svenv, &managesieve_sieve_callbacks,
+ (void *) user, set->mail_debug);
+
+ /* Get Sieve storage */
+
+ storage = client_get_storage(svinst, user, fd_out);
+
+ /* always use nonblocking I/O */
+ net_set_nonblock(fd_in, TRUE);
+ net_set_nonblock(fd_out, TRUE);
+
+ pool = pool_alloconly_create("managesieve client", 1024);
+ client = p_new(pool, struct client, 1);
+ client->pool = pool;
+ client->event = event;
+ event_ref(client->event);
+ client->set = set;
+ client->service_user = service_user;
+ client->session_id = p_strdup(pool, session_id);
+ client->fd_in = fd_in;
+ client->fd_out = fd_out;
+ client->input = i_stream_create_fd(
+ fd_in, set->managesieve_max_line_length);
+ client->output = o_stream_create_fd(fd_out, (size_t)-1);
+
+ o_stream_set_no_error_handling(client->output, TRUE);
+ i_stream_set_name(client->input, "<managesieve client>");
+ o_stream_set_name(client->output, "<managesieve client>");
+
+ o_stream_set_flush_callback(client->output, client_output, client);
+
+ client->last_input = ioloop_time;
+ client->to_idle = timeout_add(CLIENT_IDLE_TIMEOUT_MSECS,
+ client_idle_timeout, client);
+
+ client->cmd.pool = pool_alloconly_create(
+ MEMPOOL_GROWING"client command", 1024*12);
+ client->cmd.client = client;
+ client->cmd.event = event_create(client->event);
+ client->user = user;
+
+ client->svinst = svinst;
+ client->storage = storage;
+
+ ident = mail_user_get_anvil_userip_ident(client->user);
+ if (ident != NULL) {
+ master_service_anvil_send(
+ master_service, t_strconcat("CONNECT\t", my_pid,
+ "\tsieve/", ident,
+ "\n", NULL));
+ client->anvil_sent = TRUE;
+ }
+
+ managesieve_client_count++;
+ DLLIST_PREPEND(&managesieve_clients, client);
+ if (hook_client_created != NULL)
+ hook_client_created(&client);
+
+ managesieve_refresh_proctitle();
+ return client;
+}
+
+void client_create_finish(struct client *client)
+{
+ if (client->set->rawlog_dir[0] != '\0') {
+ (void)iostream_rawlog_create(client->set->rawlog_dir,
+ &client->input, &client->output);
+ }
+ client->parser = managesieve_parser_create(
+ client->input, client->set->managesieve_max_line_length);
+ client->io = io_add_istream(client->input, client_input, client);
+}
+
+static const char *client_stats(struct client *client)
+{
+ const struct var_expand_table logout_tab[] = {
+ { 'i', dec2str(i_stream_get_absolute_offset(client->input)),
+ "input" },
+ { 'o', dec2str(client->output->offset), "output" },
+ { '\0', dec2str(client->put_bytes), "put_bytes" },
+ { '\0', dec2str(client->put_count), "put_count" },
+ { '\0', dec2str(client->get_bytes), "get_bytes" },
+ { '\0', dec2str(client->get_count), "get_count" },
+ { '\0', dec2str(client->check_bytes), "check_bytes" },
+ { '\0', dec2str(client->check_count), "check_count" },
+ { '\0', dec2str(client->deleted_count), "deleted_count" },
+ { '\0', dec2str(client->renamed_count), "renamed_count" },
+ { '\0', client->session_id, "session" },
+ { '\0', NULL, NULL }
+ };
+ const struct var_expand_table *user_tab =
+ mail_user_var_expand_table(client->user);
+ const struct var_expand_table *tab =
+ t_var_expand_merge_tables(logout_tab, user_tab);
+ string_t *str;
+ const char *error;
+
+ str = t_str_new(128);
+ if (var_expand_with_funcs(str, client->set->managesieve_logout_format,
+ tab, mail_user_var_expand_func_table,
+ client->user, &error) < 0) {
+ i_error("Failed to expand managesieve_logout_format=%s: %s",
+ client->set->managesieve_logout_format, error);
+ }
+ return str_c(str);
+}
+
+void client_destroy(struct client *client, const char *reason)
+{
+ bool ret;
+
+ i_assert(!client->handling_input);
+ i_assert(!client->destroyed);
+ client->destroyed = TRUE;
+
+ client_disconnect(client, reason);
+
+ if (client->command_pending) {
+ /* try to deinitialize the command */
+ i_assert(client->cmd.func != NULL);
+
+ i_stream_close(client->input);
+ o_stream_close(client->output);
+
+ client->input_pending = FALSE;
+
+ ret = client->cmd.func(&client->cmd);
+ i_assert(ret);
+ }
+
+ if (client->anvil_sent) {
+ master_service_anvil_send(
+ master_service, t_strconcat(
+ "DISCONNECT\t", my_pid, "\tsieve/",
+ mail_user_get_anvil_userip_ident(client->user),
+ "\n", NULL));
+ }
+
+ managesieve_parser_destroy(&client->parser);
+ io_remove(&client->io);
+ timeout_remove(&client->to_idle_output);
+ timeout_remove(&client->to_idle);
+
+ /* i/ostreams are already closed at this stage, so fd can be closed */
+ net_disconnect(client->fd_in);
+ if (client->fd_in != client->fd_out)
+ net_disconnect(client->fd_out);
+
+ /* Free the user after client is already disconnected. It may start
+ some background work like autoexpunging. */
+ mail_user_unref(&client->user);
+
+ /* free the i/ostreams after mail_user_unref(), which could trigger
+ mail_storage_callbacks notifications that write to the ostream. */
+ i_stream_destroy(&client->input);
+ o_stream_destroy(&client->output);
+
+ sieve_storage_unref(&client->storage);
+ sieve_deinit(&client->svinst);
+
+ event_unref(&client->cmd.event);
+ pool_unref(&client->cmd.pool);
+ mail_storage_service_user_unref(&client->service_user);
+
+ managesieve_client_count--;
+ DLLIST_REMOVE(&managesieve_clients, client);
+ event_unref(&client->event);
+ pool_unref(&client->pool);
+
+ master_service_client_connection_destroyed(master_service);
+ managesieve_refresh_proctitle();
+}
+
+static void client_destroy_timeout(struct client *client)
+{
+ client_destroy(client, NULL);
+}
+
+void client_disconnect(struct client *client, const char *reason)
+{
+ if (client->disconnected)
+ return;
+
+ if (reason == NULL) {
+ reason = io_stream_get_disconnect_reason(client->input,
+ client->output);
+ i_info("%s %s", reason, client_stats(client));
+ } else {
+ i_info("Disconnected: %s %s", reason, client_stats(client));
+ }
+ client->disconnected = TRUE;
+ o_stream_flush(client->output);
+ o_stream_uncork(client->output);
+
+ i_stream_close(client->input);
+ o_stream_close(client->output);
+
+ timeout_remove(&client->to_idle);
+ if (!client->destroyed)
+ client->to_idle = timeout_add(0, client_destroy_timeout, client);
+}
+
+void client_disconnect_with_error(struct client *client, const char *msg)
+{
+ client_send_bye(client, msg);
+ client_disconnect(client, msg);
+}
+
+int client_send_line(struct client *client, const char *data)
+{
+ struct const_iovec iov[2];
+
+ if (client->output->closed)
+ return -1;
+
+ iov[0].iov_base = data;
+ iov[0].iov_len = strlen(data);
+ iov[1].iov_base = "\r\n";
+ iov[1].iov_len = 2;
+
+ if (o_stream_sendv(client->output, iov, 2) < 0)
+ return -1;
+ client->last_output = ioloop_time;
+
+ if (o_stream_get_buffer_used_size(client->output) >=
+ CLIENT_OUTPUT_OPTIMAL_SIZE) {
+ /* buffer full, try flushing */
+ return o_stream_flush(client->output);
+ }
+ return 1;
+}
+
+void client_send_response(struct client *client, const char *oknobye,
+ const char *resp_code, const char *msg)
+{
+ string_t *str;
+
+ str = t_str_new(128);
+ str_append(str, oknobye);
+
+ if (resp_code != NULL) {
+ str_append(str, " (");
+ str_append(str, resp_code);
+ str_append_c(str, ')');
+ }
+
+ if (msg != NULL) {
+ str_append_c(str, ' ');
+ managesieve_quote_append_string(str, msg, TRUE);
+ }
+
+ client_send_line(client, str_c(str));
+}
+
+struct event_passthrough *
+client_command_create_finish_event(struct client_command_context *cmd)
+{
+ struct event_passthrough *e =
+ event_create_passthrough(cmd->event)->
+ set_name("managesieve_command_finished");
+ return e;
+}
+
+void client_send_command_error(struct client_command_context *cmd,
+ const char *msg)
+{
+ struct client *client = cmd->client;
+ const char *error, *cmd_name;
+ bool fatal;
+
+ if (msg == NULL) {
+ msg = managesieve_parser_get_error(client->parser, &fatal);
+ if (fatal) {
+ client_disconnect_with_error(client, msg);
+ return;
+ }
+ }
+
+ if (cmd->name == NULL) {
+ error = t_strconcat("Error in MANAGESIEVE command: ",
+ msg, NULL);
+ } else {
+ cmd_name = t_str_ucase(cmd->name);
+ error = t_strconcat("Error in MANAGESIEVE command ",
+ cmd_name, ": ", msg, NULL);
+ }
+
+ client_send_no(client, error);
+
+ if (++client->bad_counter >= CLIENT_MAX_BAD_COMMANDS) {
+ client_disconnect_with_error(
+ client, "Too many invalid MANAGESIEVE commands.");
+ }
+
+ /* client_read_args() failures rely on this being set, so that the
+ command processing is stopped even while command function returns
+ FALSE. */
+ cmd->param_error = TRUE;
+}
+
+#undef client_command_storage_error
+void client_command_storage_error(struct client_command_context *cmd,
+ const char *source_filename,
+ unsigned int source_linenum,
+ const char *log_prefix, ...)
+{
+ struct event_log_params params = {
+ .log_type = LOG_TYPE_INFO,
+ .source_filename = source_filename,
+ .source_linenum = source_linenum,
+ };
+ struct client *client = cmd->client;
+ struct sieve_storage *storage = client->storage;
+ enum sieve_error error_code;
+ const char *error;
+ va_list args;
+
+ error = sieve_storage_get_last_error(storage, &error_code);
+
+ switch (error_code) {
+ case SIEVE_ERROR_TEMP_FAILURE:
+ client_send_noresp(client, "TRYLATER", error);
+ break;
+ case SIEVE_ERROR_NO_QUOTA:
+ client_send_noresp(client, "QUOTA", error);
+ break;
+ case SIEVE_ERROR_NOT_FOUND:
+ client_send_noresp(client, "NONEXISTENT", error);
+ break;
+ case SIEVE_ERROR_ACTIVE:
+ client_send_noresp(client, "ACTIVE", error);
+ break;
+ case SIEVE_ERROR_EXISTS:
+ client_send_noresp(client, "ALREADYEXISTS", error);
+ break;
+ case SIEVE_ERROR_NOT_POSSIBLE:
+ default:
+ client_send_no(client, error);
+ break;
+ }
+
+ struct event_passthrough *e =
+ client_command_create_finish_event(cmd)->
+ add_str("error", error);
+
+ va_start(args, log_prefix);
+ event_log(e->event(), &params, "%s: %s",
+ t_strdup_vprintf(log_prefix, args), error);
+ va_end(args);
+}
+
+bool client_read_args(struct client_command_context *cmd, unsigned int count,
+ unsigned int flags, bool no_more,
+ const struct managesieve_arg **args_r)
+{
+ const struct managesieve_arg *dummy_args_r = NULL;
+ string_t *str;
+ int ret;
+
+ if (args_r == NULL)
+ args_r = &dummy_args_r;
+
+ i_assert(count <= INT_MAX);
+
+ ret = managesieve_parser_read_args(cmd->client->parser,
+ (no_more ? 0 : count),
+ flags, args_r);
+ if (ret >= 0) {
+ if (count > 0 || no_more) {
+ if (ret < (int)count) {
+ client_send_command_error(
+ cmd, "Missing arguments.");
+ return FALSE;
+ } else if (no_more && ret > (int)count) {
+ client_send_command_error(
+ cmd, "Too many arguments.");
+ return FALSE;
+ }
+ }
+
+ str = t_str_new(256);
+ managesieve_write_args(str, *args_r);
+ cmd->args = p_strdup(cmd->pool, str_c(str));
+
+ event_add_str(cmd->event, "cmd_args", cmd->args);
+
+ /* all parameters read successfully */
+ return TRUE;
+ } else if (ret == -2) {
+ /* need more data */
+ if (cmd->client->input->closed) {
+ /* disconnected */
+ cmd->param_error = TRUE;
+ }
+ return FALSE;
+ } else {
+ /* error */
+ client_send_command_error(cmd, NULL);
+ return FALSE;
+ }
+}
+
+bool client_read_string_args(struct client_command_context *cmd,
+ bool no_more, unsigned int count, ...)
+{
+ const struct managesieve_arg *msieve_args;
+ va_list va;
+ const char *str;
+ unsigned int i;
+ bool result = TRUE;
+
+ if (!client_read_args(cmd, count, 0, no_more, &msieve_args))
+ return FALSE;
+
+ va_start(va, count);
+ for (i = 0; i < count; i++) {
+ const char **ret = va_arg(va, const char **);
+
+ if (MANAGESIEVE_ARG_IS_EOL(&msieve_args[i])) {
+ client_send_command_error(cmd, "Missing arguments.");
+ result = FALSE;
+ break;
+ }
+
+ if (!managesieve_arg_get_string(&msieve_args[i], &str)) {
+ client_send_command_error(cmd, "Invalid arguments.");
+ result = FALSE;
+ break;
+ }
+
+ if (ret != NULL)
+ *ret = str;
+ }
+ va_end(va);
+
+ return result;
+}
+
+void _client_reset_command(struct client *client)
+{
+ pool_t pool;
+ size_t size;
+
+ /* reset input idle time because command output might have taken a long
+ time and we don't want to disconnect client immediately then */
+ client->last_input = ioloop_time;
+ timeout_reset(client->to_idle);
+
+ client->command_pending = FALSE;
+ if (client->io == NULL && !client->disconnected) {
+ i_assert(i_stream_get_fd(client->input) >= 0);
+ client->io = io_add(i_stream_get_fd(client->input),
+ IO_READ, client_input, client);
+ }
+ o_stream_set_flush_callback(client->output, client_output, client);
+
+ event_unref(&client->cmd.event);
+
+ pool = client->cmd.pool;
+ i_zero(&client->cmd);
+
+ p_clear(pool);
+ client->cmd.pool = pool;
+ client->cmd.client = client;
+
+ client->cmd.event = event_create(client->event);
+
+ managesieve_parser_reset(client->parser);
+
+ /* if there's unread data in buffer, remember that there's input pending
+ and we should get around to calling client_input() soon. This is
+ mostly for APPEND/IDLE. */
+ (void)i_stream_get_data(client->input, &size);
+ if (size > 0 && !client->destroyed)
+ client->input_pending = TRUE;
+}
+
+/* Skip incoming data until newline is found,
+ returns TRUE if newline was found. */
+static bool client_skip_line(struct client *client)
+{
+ const unsigned char *data;
+ size_t i, data_size;
+
+ data = i_stream_get_data(client->input, &data_size);
+
+ for (i = 0; i < data_size; i++) {
+ if (data[i] == '\n') {
+ client->input_skip_line = FALSE;
+ i++;
+ break;
+ }
+ }
+
+ i_stream_skip(client->input, i);
+ return !client->input_skip_line;
+}
+
+static bool client_handle_input(struct client_command_context *cmd)
+{
+ struct client *client = cmd->client;
+
+ if (cmd->func != NULL) {
+ bool finished;
+
+ event_push_global(cmd->event);
+ finished = cmd->func(cmd);
+ event_pop_global(cmd->event);
+
+ /* command is being executed - continue it */
+ if (finished || cmd->param_error) {
+ /* command execution was finished */
+ if (!cmd->param_error)
+ client->bad_counter = 0;
+ _client_reset_command(client);
+ return TRUE;
+ }
+
+ /* unfinished */
+ if (client->command_pending)
+ o_stream_set_flush_pending(client->output, TRUE);
+ return FALSE;
+ }
+
+ if (client->input_skip_line) {
+ /* we're just waiting for new line.. */
+ if (!client_skip_line(client))
+ return FALSE;
+
+ /* got the newline */
+ _client_reset_command(client);
+
+ /* pass through to parse next command */
+ }
+
+ if (cmd->name == NULL) {
+ cmd->name = managesieve_parser_read_word(client->parser);
+ if (cmd->name == NULL)
+ return FALSE; /* need more data */
+ cmd->name = p_strdup(cmd->pool, cmd->name);
+ managesieve_refresh_proctitle();
+ }
+
+ if (cmd->name[0] == '\0') {
+ /* command not given - cmd_func is already NULL. */
+ } else {
+ /* find the command function */
+ struct command *command = command_find(cmd->name);
+
+ if (command != NULL)
+ cmd->func = command->func;
+ }
+
+ client->input_skip_line = TRUE;
+ if (cmd->func == NULL) {
+ /* unknown command */
+ client_send_command_error(cmd, "Unknown command.");
+ _client_reset_command(client);
+ } else {
+ i_assert(!client->disconnected);
+
+ event_add_str(cmd->event, "cmd_name", t_str_ucase(cmd->name));
+ client_handle_input(cmd);
+ }
+
+ return TRUE;
+}
+
+void client_input(struct client *client)
+{
+ struct client_command_context *cmd = &client->cmd;
+ bool ret;
+
+ if (client->command_pending) {
+ /* already processing one command. wait. */
+ io_remove(&client->io);
+ return;
+ }
+
+ client->input_pending = FALSE;
+ client->last_input = ioloop_time;
+ timeout_reset(client->to_idle);
+
+ switch (i_stream_read(client->input)) {
+ case -1:
+ /* disconnected */
+ client_destroy(client, NULL);
+ return;
+ case -2:
+ /* parameter word is longer than max. input buffer size.
+ this is most likely an error, so skip the new data
+ until newline is found. */
+ client->input_skip_line = TRUE;
+
+ client_send_command_error(cmd, "Too long argument.");
+ _client_reset_command(client);
+ break;
+ }
+
+ client->handling_input = TRUE;
+ o_stream_cork(client->output);
+ do {
+ T_BEGIN {
+ ret = client_handle_input(cmd);
+ } T_END;
+ } while (ret && !client->disconnected);
+ o_stream_uncork(client->output);
+ client->handling_input = FALSE;
+
+ if (client->command_pending)
+ client->input_pending = TRUE;
+
+ if (client->output->closed)
+ client_destroy(client, NULL);
+}
+
+int client_output(struct client *client)
+{
+ struct client_command_context *cmd = &client->cmd;
+ int ret;
+ bool finished;
+
+ client->last_output = ioloop_time;
+ timeout_reset(client->to_idle);
+ if (client->to_idle_output != NULL)
+ timeout_reset(client->to_idle_output);
+
+ if ((ret = o_stream_flush(client->output)) < 0) {
+ client_destroy(client, NULL);
+ return 1;
+ }
+
+ if (!client->command_pending)
+ return 1;
+
+ /* continue processing command */
+ o_stream_cork(client->output);
+ client->output_pending = TRUE;
+ finished = cmd->func(cmd) || cmd->param_error;
+
+ /* a bit kludgy check. normally we would want to get back to this
+ output handler, but IDLE is a special case which has command
+ pending but without necessarily anything to write. */
+ if (!finished && client->output_pending)
+ o_stream_set_flush_pending(client->output, TRUE);
+
+ o_stream_uncork(client->output);
+
+ if (finished) {
+ /* command execution was finished */
+ client->bad_counter = 0;
+ _client_reset_command(client);
+
+ if (client->input_pending)
+ client_input(client);
+ }
+ return ret;
+}
+
+void clients_destroy_all(void)
+{
+ while (managesieve_clients != NULL) {
+ mail_storage_service_io_activate_user(managesieve_clients->service_user);
+ client_send_bye(managesieve_clients, "Server shutting down.");
+ client_destroy(managesieve_clients, "Server shutting down.");
+ }
+}
diff --git a/pigeonhole/src/managesieve/managesieve-client.h b/pigeonhole/src/managesieve/managesieve-client.h
new file mode 100644
index 0000000..6053eb6
--- /dev/null
+++ b/pigeonhole/src/managesieve/managesieve-client.h
@@ -0,0 +1,162 @@
+#ifndef MANAGESIEVE_CLIENT_H
+#define MANAGESIEVE_CLIENT_H
+
+#include "managesieve-commands.h"
+
+struct client;
+struct sieve_storage;
+struct managesieve_parser;
+struct managesieve_arg;
+
+struct client_command_context {
+ struct client *client;
+ struct event *event;
+
+ pool_t pool;
+ /* Name of this command */
+ const char *name;
+ /* Parameters for this command. These are generated from parsed
+ ManageSieve arguments, so they may not be exactly the same as how
+ client sent them. */
+ const char *args;
+
+ command_func_t *func;
+ void *context;
+
+ bool param_error:1;
+};
+
+struct managesieve_module_register {
+ unsigned int id;
+};
+
+union managesieve_module_context {
+ struct managesieve_module_register *reg;
+};
+extern struct managesieve_module_register managesieve_module_register;
+
+struct client {
+ struct client *prev, *next;
+
+ struct event *event;
+ const char *session_id;
+ int fd_in, fd_out;
+ struct io *io;
+ struct istream *input;
+ struct ostream *output;
+ struct timeout *to_idle, *to_idle_output;
+
+ pool_t pool;
+ struct mail_storage_service_user *service_user;
+ const struct managesieve_settings *set;
+
+ struct mail_user *user;
+
+ struct sieve_instance *svinst;
+ struct sieve_storage *storage;
+
+ time_t last_input, last_output;
+ unsigned int bad_counter;
+
+ struct managesieve_parser *parser;
+ struct client_command_context cmd;
+
+ uoff_t put_bytes;
+ uoff_t get_bytes;
+ uoff_t check_bytes;
+ unsigned int put_count;
+ unsigned int get_count;
+ unsigned int check_count;
+ unsigned int deleted_count;
+ unsigned int renamed_count;
+
+ bool disconnected:1;
+ bool destroyed:1;
+ bool command_pending:1;
+ bool input_pending:1;
+ bool output_pending:1;
+ bool handling_input:1;
+ bool anvil_sent:1;
+ bool input_skip_line:1; /* skip all the data until we've found a new
+ line */
+};
+
+extern struct client *managesieve_clients;
+extern unsigned int managesieve_client_count;
+
+/* Create new client with specified input/output handles. socket specifies
+ if the handle is a socket. */
+struct client *
+client_create(int fd_in, int fd_out, const char *session_id,
+ struct event *event, struct mail_user *user,
+ struct mail_storage_service_user *service_user,
+ const struct managesieve_settings *set);
+void client_create_finish(struct client *client);
+void client_destroy(struct client *client, const char *reason);
+
+void client_dump_capability(struct client *client);
+
+/* Disconnect client connection */
+void client_disconnect(struct client *client, const char *reason);
+void client_disconnect_with_error(struct client *client, const char *msg);
+
+/* Send a line of data to client. Returns 1 if ok, 0 if buffer is getting full,
+ -1 if error */
+int client_send_line(struct client *client, const char *data);
+
+void client_send_response(struct client *client, const char *oknobye,
+ const char *resp_code, const char *msg);
+
+#define client_send_ok(client, msg) \
+ client_send_response(client, "OK", NULL, msg)
+#define client_send_no(client, msg) \
+ client_send_response(client, "NO", NULL, msg)
+#define client_send_bye(client, msg) \
+ client_send_response(client, "BYE", NULL, msg)
+
+#define client_send_okresp(client, resp_code, msg) \
+ client_send_response(client, "OK", resp_code, msg)
+#define client_send_noresp(client, resp_code, msg) \
+ client_send_response(client, "NO", resp_code, msg)
+#define client_send_byeresp(cmd, resp_code, msg) \
+ client_send_response(client, "BYE", resp_code, msg)
+
+struct event_passthrough *
+client_command_create_finish_event(struct client_command_context *cmd);
+
+/* Send BAD command error to client. msg can be NULL. */
+void client_send_command_error(struct client_command_context *cmd,
+ const char *msg);
+
+/* Send storage or sieve-related errors to the client. Returns command finish
+ event with the "error" field set accordingly. */
+void client_command_storage_error(struct client_command_context *cmd,
+ const char *source_filename,
+ unsigned int source_linenum,
+ const char *log_prefix, ...)
+ ATTR_FORMAT(4, 5);
+#define client_command_storage_error(cmd, ...) \
+ client_command_storage_error(cmd, __FILE__, __LINE__, __VA_ARGS__)
+
+/* Read a number of arguments. Returns TRUE if everything was read or
+ FALSE if either needs more data or error occurred. */
+bool client_read_args(struct client_command_context *cmd, unsigned int count,
+ unsigned int flags, bool no_more,
+ const struct managesieve_arg **args_r);
+/* Reads a number of string arguments. ... is a list of pointers where to
+ store the arguments. */
+bool client_read_string_args(struct client_command_context *cmd, bool no_more,
+ unsigned int count, ...);
+
+static inline bool client_read_no_args(struct client_command_context *cmd)
+{
+ return client_read_args(cmd, 0, 0, TRUE, NULL);
+}
+
+void _client_reset_command(struct client *client);
+void client_input(struct client *client);
+int client_output(struct client *client);
+
+void clients_destroy_all(void);
+
+#endif
diff --git a/pigeonhole/src/managesieve/managesieve-commands.c b/pigeonhole/src/managesieve/managesieve-commands.c
new file mode 100644
index 0000000..87e2048
--- /dev/null
+++ b/pigeonhole/src/managesieve/managesieve-commands.c
@@ -0,0 +1,110 @@
+/* Copyright (c) 2002-2018 Pigeonhole authors, see the included COPYING file
+ */
+
+#include "lib.h"
+#include "array.h"
+
+#include "managesieve-common.h"
+#include "managesieve-commands.h"
+
+
+/* May want to combine this somewhere in a commands-common.c to avoid duplicate
+ code
+ */
+
+static const struct command managesieve_base_commands[] = {
+ { "CAPABILITY", cmd_capability },
+ { "LOGOUT", cmd_logout },
+ { "PUTSCRIPT", cmd_putscript },
+ { "CHECKSCRIPT", cmd_checkscript },
+ { "GETSCRIPT", cmd_getscript },
+ { "SETACTIVE", cmd_setactive },
+ { "DELETESCRIPT", cmd_deletescript },
+ { "LISTSCRIPTS", cmd_listscripts },
+ { "HAVESPACE", cmd_havespace },
+ { "RENAMESCRIPT", cmd_renamescript },
+ { "NOOP", cmd_noop }
+};
+
+#define MANAGESIEVE_COMMANDS_COUNT N_ELEMENTS(managesieve_base_commands)
+
+static ARRAY(struct command) managesieve_commands;
+static bool commands_unsorted;
+
+void command_register(const char *name, command_func_t *func)
+{
+ struct command cmd;
+
+ i_zero(&cmd);
+ cmd.name = name;
+ cmd.func = func;
+ array_append(&managesieve_commands, &cmd, 1);
+
+ commands_unsorted = TRUE;
+}
+
+void command_unregister(const char *name)
+{
+ const struct command *cmd;
+ unsigned int i, count;
+
+ cmd = array_get(&managesieve_commands, &count);
+ for (i = 0; i < count; i++) {
+ if (strcasecmp(cmd[i].name, name) == 0) {
+ array_delete(&managesieve_commands, i, 1);
+ return;
+ }
+ }
+
+ i_error("Trying to unregister unknown command '%s'", name);
+}
+
+void command_register_array(const struct command *cmdarr, unsigned int count)
+{
+ commands_unsorted = TRUE;
+ array_append(&managesieve_commands, cmdarr, count);
+}
+
+void command_unregister_array(const struct command *cmdarr, unsigned int count)
+{
+ while (count > 0) {
+ command_unregister(cmdarr->name);
+ count--; cmdarr++;
+ }
+}
+
+static int command_cmp(const struct command *c1, const struct command *c2)
+{
+ return strcasecmp(c1->name, c2->name);
+}
+
+static int command_bsearch(const char *name, const struct command *cmd)
+{
+ return strcasecmp(name, cmd->name);
+}
+
+struct command *command_find(const char *name)
+{
+ if (commands_unsorted) {
+ array_sort(&managesieve_commands, command_cmp);
+ commands_unsorted = FALSE;
+ }
+
+ return array_bsearch(&managesieve_commands, name, command_bsearch);
+}
+
+void commands_init(void)
+{
+ i_array_init(&managesieve_commands, 16);
+ commands_unsorted = FALSE;
+
+ command_register_array(managesieve_base_commands,
+ MANAGESIEVE_COMMANDS_COUNT);
+}
+
+void commands_deinit(void)
+{
+ command_unregister_array(managesieve_base_commands,
+ MANAGESIEVE_COMMANDS_COUNT);
+ array_free(&managesieve_commands);
+}
diff --git a/pigeonhole/src/managesieve/managesieve-commands.h b/pigeonhole/src/managesieve/managesieve-commands.h
new file mode 100644
index 0000000..d922b74
--- /dev/null
+++ b/pigeonhole/src/managesieve/managesieve-commands.h
@@ -0,0 +1,46 @@
+#ifndef MANAGESIEVE_COMMANDS_H
+#define MANAGESIEVE_COMMANDS_H
+
+struct client_command_context;
+
+#include "managesieve-parser.h"
+
+typedef bool command_func_t(struct client_command_context *cmd);
+
+struct command {
+ const char *name;
+ command_func_t *func;
+};
+
+/* Register command. Given name parameter must be permanently stored until
+ command is unregistered. */
+void command_register(const char *name, command_func_t *func);
+void command_unregister(const char *name);
+
+/* Register array of commands. */
+void command_register_array(const struct command *cmdarr, unsigned int count);
+void command_unregister_array(const struct command *cmdarr, unsigned int count);
+
+struct command *command_find(const char *name);
+
+void commands_init(void);
+void commands_deinit(void);
+
+/* MANAGESIEVE commands: */
+
+/* Non-Authenticated State */
+extern bool cmd_logout(struct client_command_context *cmd);
+extern bool cmd_capability(struct client_command_context *cmd);
+extern bool cmd_noop(struct client_command_context *cmd);
+
+/* Authenticated State */
+extern bool cmd_putscript(struct client_command_context *cmd);
+extern bool cmd_checkscript(struct client_command_context *cmd);
+extern bool cmd_getscript(struct client_command_context *cmd);
+extern bool cmd_setactive(struct client_command_context *cmd);
+extern bool cmd_deletescript(struct client_command_context *cmd);
+extern bool cmd_listscripts(struct client_command_context *cmd);
+extern bool cmd_havespace(struct client_command_context *cmd);
+extern bool cmd_renamescript(struct client_command_context *cmd);
+
+#endif
diff --git a/pigeonhole/src/managesieve/managesieve-common.h b/pigeonhole/src/managesieve/managesieve-common.h
new file mode 100644
index 0000000..e1df589
--- /dev/null
+++ b/pigeonhole/src/managesieve/managesieve-common.h
@@ -0,0 +1,31 @@
+#ifndef MANAGESIEVE_COMMON_H
+#define MANAGESIEVE_COMMON_H
+
+#include "pigeonhole-config.h"
+
+/* Disconnect client after idling this many milliseconds */
+#define CLIENT_IDLE_TIMEOUT_MSECS (60*30*1000)
+
+/* If we can't send anything to client for this long, disconnect the client */
+#define CLIENT_OUTPUT_TIMEOUT_MSECS (5*60*1000)
+
+/* Stop buffering more data into output stream after this many bytes */
+#define CLIENT_OUTPUT_OPTIMAL_SIZE 2048
+
+/* Disconnect client when it sends too many bad commands in a row */
+#define CLIENT_MAX_BAD_COMMANDS 20
+
+#define CRITICAL_MSG \
+ "Internal error occurred. Refer to server log for more information."
+#define CRITICAL_MSG_STAMP CRITICAL_MSG " [%Y-%m-%d %H:%M:%S]"
+
+#include "lib.h"
+#include "managesieve-client.h"
+#include "managesieve-settings.h"
+
+extern void (*hook_client_created)(struct client **client);
+extern struct event_category event_category_managesieve;
+
+void managesieve_refresh_proctitle(void);
+
+#endif
diff --git a/pigeonhole/src/managesieve/managesieve-quota.c b/pigeonhole/src/managesieve/managesieve-quota.c
new file mode 100644
index 0000000..07b58ca
--- /dev/null
+++ b/pigeonhole/src/managesieve/managesieve-quota.c
@@ -0,0 +1,98 @@
+/* Copyright (c) 2002-2018 Pigeonhole authors, see the included COPYING file
+ */
+
+#include "lib.h"
+#include "strfuncs.h"
+
+#include "sieve.h"
+#include "sieve-storage.h"
+
+#include "managesieve-client.h"
+#include "managesieve-quota.h"
+
+uint64_t managesieve_quota_max_script_size(struct client *client)
+{
+ return sieve_storage_quota_max_script_size(client->storage);
+}
+
+bool managesieve_quota_check_validsize(struct client_command_context *cmd,
+ size_t size)
+{
+ struct client *client = cmd->client;
+ uint64_t limit;
+
+ if (!sieve_storage_quota_validsize(client->storage, size, &limit)) {
+ const char *error_msg;
+
+ error_msg = t_strdup_printf(
+ "Script is too large (max %llu bytes).",
+ (unsigned long long int)limit);
+
+ struct event_passthrough *e =
+ client_command_create_finish_event(cmd);
+ e_debug(e->event(),
+ "Script size check failed (size %zu bytes): %s",
+ size, error_msg);
+
+ client_send_noresp(client, "QUOTA/MAXSIZE", error_msg);
+ return FALSE;
+ }
+ return TRUE;
+}
+
+bool managesieve_quota_check_all(struct client_command_context *cmd,
+ const char *scriptname, size_t size)
+{
+ struct client *client = cmd->client;
+ enum sieve_storage_quota quota;
+ uint64_t limit;
+ const char *resp_code = NULL, *error_msg = NULL;
+ int ret;
+
+ ret = sieve_storage_quota_havespace(client->storage, scriptname,
+ size, &quota, &limit);
+ if (ret > 0)
+ return TRUE;
+ if (ret < 0) {
+ client_command_storage_error(
+ cmd, "Failed to check quota for script `%s' "
+ "(size %zu bytes)", scriptname, size);
+ return FALSE;
+ }
+
+ switch (quota) {
+ case SIEVE_STORAGE_QUOTA_MAXSIZE:
+ resp_code = "QUOTA/MAXSIZE";
+ error_msg = t_strdup_printf("Script is too large "
+ "(max %llu bytes).",
+ (unsigned long long int)limit);
+ break;
+ case SIEVE_STORAGE_QUOTA_MAXSCRIPTS:
+ resp_code = "QUOTA/MAXSCRIPTS";
+ error_msg = t_strdup_printf("Script count quota exceeded "
+ "(max %llu scripts).",
+ (unsigned long long int)limit);
+ break;
+ case SIEVE_STORAGE_QUOTA_MAXSTORAGE:
+ resp_code = "QUOTA/MAXSTORAGE";
+ error_msg = t_strdup_printf("Script storage quota exceeded "
+ "(max %llu bytes).",
+ (unsigned long long int)limit);
+ break;
+ default:
+ resp_code = "QUOTA";
+ error_msg = "Quota exceeded.";
+ }
+
+ struct event_passthrough *e =
+ client_command_create_finish_event(cmd)->
+ add_str("error", error_msg);
+ e_debug(e->event(),
+ "Quota check failed for script `%s' (size %zu bytes): %s",
+ scriptname, size, error_msg);
+
+ client_send_noresp(client, resp_code, error_msg);
+
+ return FALSE;
+}
+
diff --git a/pigeonhole/src/managesieve/managesieve-quota.h b/pigeonhole/src/managesieve/managesieve-quota.h
new file mode 100644
index 0000000..f6b37bf
--- /dev/null
+++ b/pigeonhole/src/managesieve/managesieve-quota.h
@@ -0,0 +1,11 @@
+#ifndef MANAGESIEVE_QUOTA_H
+#define MANAGESIEVE_QUOTA_H
+
+uint64_t managesieve_quota_max_script_size(struct client *client);
+
+bool managesieve_quota_check_validsize(struct client_command_context *cmd,
+ size_t size);
+bool managesieve_quota_check_all(struct client_command_context *cmd,
+ const char *scriptname, size_t size);
+
+#endif
diff --git a/pigeonhole/src/managesieve/managesieve-settings.c b/pigeonhole/src/managesieve/managesieve-settings.c
new file mode 100644
index 0000000..8e6e88b
--- /dev/null
+++ b/pigeonhole/src/managesieve/managesieve-settings.c
@@ -0,0 +1,170 @@
+/* Copyright (c) 2002-2018 Pigeonhole authors, see the included COPYING file
+ */
+
+#include "lib.h"
+#include "buffer.h"
+#include "settings-parser.h"
+#include "service-settings.h"
+#include "mail-storage-settings.h"
+
+#include "pigeonhole-config.h"
+
+#include "managesieve-settings.h"
+
+#include <stddef.h>
+#include <unistd.h>
+
+static bool managesieve_settings_verify(void *_set, pool_t pool,
+ const char **error_r);
+
+/* <settings checks> */
+static struct file_listener_settings managesieve_unix_listeners_array[] = {
+ { "login/sieve", 0666, "", "" }
+};
+static struct file_listener_settings *managesieve_unix_listeners[] = {
+ &managesieve_unix_listeners_array[0]
+};
+static buffer_t managesieve_unix_listeners_buf = {
+ { { managesieve_unix_listeners, sizeof(managesieve_unix_listeners) } }
+};
+/* </settings checks> */
+
+struct service_settings managesieve_settings_service_settings = {
+ .name = "managesieve",
+ .protocol = "sieve",
+ .type = "",
+ .executable = "managesieve",
+ .user = "",
+ .group = "",
+ .privileged_group = "",
+ .extra_groups = "",
+ .chroot = "",
+
+ .drop_priv_before_exec = FALSE,
+
+ .process_min_avail = 0,
+ .process_limit = 0,
+ .client_limit = 1,
+ .service_count = 1,
+ .idle_kill = 0,
+ .vsz_limit = (uoff_t)-1,
+
+ .unix_listeners = { { &managesieve_unix_listeners_buf,
+ sizeof(managesieve_unix_listeners[0]) } },
+ .fifo_listeners = ARRAY_INIT,
+ .inet_listeners = ARRAY_INIT
+};
+
+#undef DEF
+#define DEF(type, name) \
+ SETTING_DEFINE_STRUCT_##type(#name, name, struct managesieve_settings)
+
+static struct setting_define managesieve_setting_defines[] = {
+ DEF(BOOL, mail_debug),
+ DEF(BOOL, verbose_proctitle),
+ DEF(STR_VARS, rawlog_dir),
+
+ DEF(SIZE, managesieve_max_line_length),
+ DEF(STR, managesieve_implementation_string),
+ DEF(STR, managesieve_client_workarounds),
+ DEF(STR, managesieve_logout_format),
+ DEF(UINT, managesieve_max_compile_errors),
+
+
+ SETTING_DEFINE_LIST_END
+};
+
+static struct managesieve_settings managesieve_default_settings = {
+ .mail_debug = FALSE,
+ .verbose_proctitle = FALSE,
+ .rawlog_dir = "",
+
+ /* RFC-2683 recommends at least 8000 bytes. Some clients however don't
+ break large message sets to multiple commands, so we're pretty
+ liberal by default. */
+ .managesieve_max_line_length = 65536,
+ .managesieve_implementation_string = DOVECOT_NAME " " PIGEONHOLE_NAME,
+ .managesieve_client_workarounds = "",
+ .managesieve_logout_format = "bytes=%i/%o",
+ .managesieve_max_compile_errors = 5
+};
+
+static const struct setting_parser_info *managesieve_setting_dependencies[] = {
+ &mail_user_setting_parser_info,
+ NULL
+};
+
+const struct setting_parser_info managesieve_setting_parser_info = {
+ .module_name = "managesieve",
+ .defines = managesieve_setting_defines,
+ .defaults = &managesieve_default_settings,
+
+ .type_offset = (size_t)-1,
+ .struct_size = sizeof(struct managesieve_settings),
+
+ .parent_offset = (size_t)-1,
+ .parent = NULL,
+
+ .check_func = managesieve_settings_verify,
+ .dependencies = managesieve_setting_dependencies
+};
+
+const struct setting_parser_info *managesieve_settings_set_roots[] = {
+ &managesieve_setting_parser_info,
+ NULL
+};
+
+/* <settings checks> */
+struct managesieve_client_workaround_list {
+ const char *name;
+ enum managesieve_client_workarounds num;
+};
+
+static const struct managesieve_client_workaround_list
+managesieve_client_workaround_list[] = {
+ { NULL, 0 }
+};
+
+static int
+managesieve_settings_parse_workarounds(struct managesieve_settings *set,
+ const char **error_r)
+{
+ enum managesieve_client_workarounds client_workarounds = 0;
+ const struct managesieve_client_workaround_list *list;
+ const char *const *str;
+
+ str = t_strsplit_spaces(set->managesieve_client_workarounds, " ,");
+ for (; *str != NULL; str++) {
+ list = managesieve_client_workaround_list;
+ for (; list->name != NULL; list++) {
+ if (strcasecmp(*str, list->name) == 0) {
+ client_workarounds |= list->num;
+ break;
+ }
+ }
+ if (list->name == NULL) {
+ *error_r = t_strdup_printf(
+ "managesieve_client_workarounds: "
+ "Unknown workaround: %s", *str);
+ return -1;
+ }
+ }
+ set->parsed_workarounds = client_workarounds;
+ return 0;
+}
+
+
+static bool
+managesieve_settings_verify(void *_set, pool_t pool ATTR_UNUSED,
+ const char **error_r)
+{
+ struct managesieve_settings *set = _set;
+
+ if (managesieve_settings_parse_workarounds(set, error_r) < 0)
+ return FALSE;
+ return TRUE;
+}
+
+/* </settings checks> */
+
+const char *managesieve_settings_version = DOVECOT_ABI_VERSION;
diff --git a/pigeonhole/src/managesieve/managesieve-settings.h b/pigeonhole/src/managesieve/managesieve-settings.h
new file mode 100644
index 0000000..a72338b
--- /dev/null
+++ b/pigeonhole/src/managesieve/managesieve-settings.h
@@ -0,0 +1,29 @@
+#ifndef MANAGESIEVE_SETTINGS_H
+#define MANAGESIEVE_SETTINGS_H
+
+struct mail_user_settings;
+
+/* <settings checks> */
+enum managesieve_client_workarounds {
+ WORKAROUND_NONE = 0x00
+};
+/* </settings checks> */
+
+struct managesieve_settings {
+ bool mail_debug;
+ bool verbose_proctitle;
+ const char *rawlog_dir;
+
+ /* managesieve: */
+ uoff_t managesieve_max_line_length;
+ const char *managesieve_implementation_string;
+ const char *managesieve_client_workarounds;
+ const char *managesieve_logout_format;
+ unsigned int managesieve_max_compile_errors;
+
+ enum managesieve_client_workarounds parsed_workarounds;
+};
+
+extern const struct setting_parser_info managesieve_setting_parser_info;
+
+#endif