--- /dev/null
+postlicyd
+
+*.o
+.*.d
+.*.swp
--- /dev/null
+ postlicyd: a postfix policy daemon with a lot of features
+ ~~~~~~~~~
+________________________________________________________________________
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+3. The names of its contributors may not be used to endorse or promote
+ products derived from this software without specific prior written
+ permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS
+BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGE.
--- /dev/null
+##############################################################################
+# postlicyd: a postfix policy daemon with a lot of features #
+# ~~~~~~~~~ #
+# ________________________________________________________________________ #
+# #
+# Redistribution and use in source and binary forms, with or without #
+# modification, are permitted provided that the following conditions #
+# are met: #
+# #
+# 1. Redistributions of source code must retain the above copyright #
+# notice, this list of conditions and the following disclaimer. #
+# 2. Redistributions in binary form must reproduce the above copyright #
+# notice, this list of conditions and the following disclaimer in the #
+# documentation and/or other materials provided with the distribution. #
+# 3. The names of its contributors may not be used to endorse or promote #
+# products derived from this software without specific prior written #
+# permission. #
+# #
+# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND #
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE #
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR #
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS #
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR #
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF #
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS #
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN #
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) #
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF #
+# THE POSSIBILITY OF SUCH DAMAGE. #
+##############################################################################
+
+include mk/cflags.mk
+
+PROGRAMS = postlicyd
+
+postlicyd_SOURCES = \
+ policy.h \
+ policy.c \
+ postlicyd.c
+
+postlicyd_LIBADD = -ludns
+
+# RULES ###################################################################{{{
+
+all: $(PROGRAMS)
+
+clean:
+ $(RM) $(PROGRAMS)
+ $(RM) *.o
+
+distclean: clean
+
+headers: HEADACHEOPTS=-c mk/headache.cfg -h COPYING
+headers:
+ @which headache > /dev/null || \
+ ( echo "package headache not installed" ; exit 1 )
+ @git ls-files | egrep '(\.h|\.c|Makefile|*\.mk)$$' | xargs -t headache $(HEADACHEOPTS)
+
+%.o: %.c Makefile
+ $(CC) $(CFLAGS) -MMD -MT ".$*.d $@" -MF .$*.d -g -c -o $@ $<
+
+%.d: %.c Makefile
+ $(CC) $(CFLAGS) -MM -MT ".$*.d $@" -MF .$*.d $<
+
+.SECONDEXPANSION:
+
+$(PROGRAMS): $$(patsubst %.c,%.o,$$($$@_SOURCES)) Makefile
+ $(CC) -o $@ $(CFLAGS) $(filter %.o,$^) $(LDFLAGS) $($@_LIBADD) $(filter %.a,$^)
+
+-include $(foreach p,$(PROGRAMS),$(patsubst %.c,%.d,$(filter %.c,$p_SOURCES)))
+
+###########################################################################}}}
--- /dev/null
+##############################################################################
+# postlicyd: a postfix policy daemon with a lot of features #
+# ~~~~~~~~~ #
+# ________________________________________________________________________ #
+# #
+# Redistribution and use in source and binary forms, with or without #
+# modification, are permitted provided that the following conditions #
+# are met: #
+# #
+# 1. Redistributions of source code must retain the above copyright #
+# notice, this list of conditions and the following disclaimer. #
+# 2. Redistributions in binary form must reproduce the above copyright #
+# notice, this list of conditions and the following disclaimer in the #
+# documentation and/or other materials provided with the distribution. #
+# 3. The names of its contributors may not be used to endorse or promote #
+# products derived from this software without specific prior written #
+# permission. #
+# #
+# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND #
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE #
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR #
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS #
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR #
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF #
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS #
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN #
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) #
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF #
+# THE POSSIBILITY OF SUCH DAMAGE. #
+##############################################################################
+
+GCCVERSION:=$(shell $(CC) -dumpversion)
+GCCMACHINE:=$(shell $(CC) -dumpmachine)
+OBJSUFFIX:=-$(GCCMACHINE:-linux-gnu=)-$(GCCVERSION)
+
+ifneq (,$(filter 4.%,$(GCCVERSION)))
+ GCC4=1
+endif
+
+LDFLAGS += -Wl,--warn-common
+
+# Use pipes and not temp files.
+CFLAGS += -pipe
+# optimize even more
+CFLAGS += -O2
+# let the type char be unsigned by default
+CFLAGS += -funsigned-char
+CFLAGS += -fstrict-aliasing
+# turn on all common warnings
+CFLAGS += -Wall
+# turn on extra warnings
+CFLAGS += $(if $(GCC4),-Wextra,-W)
+# treat warnings as errors
+CFLAGS += -Werror
+CFLAGS += -Wchar-subscripts
+# warn about undefined preprocessor identifiers
+CFLAGS += -Wundef
+# warn about local variable shadowing another local variable
+CFLAGS += -Wshadow
+# warn about casting of pointers to increased alignment requirements
+CFLAGS += -Wcast-align
+# make string constants const
+CFLAGS += -Wwrite-strings
+# warn about implicit conversions with side effects
+# fgets, calloc and friends take an int, not size_t...
+#CFLAGS += -Wconversion
+# warn about comparisons between signed and unsigned values
+CFLAGS += -Wsign-compare
+# warn about unused declared stuff
+CFLAGS += -Wunused
+# don not warn about unused return value
+CFLAGS += -Wno-unused-value
+# warn about variable use before initialization
+CFLAGS += -Wuninitialized
+# warn about pointer arithmetic on void* and function pointers
+CFLAGS += -Wpointer-arith
+# warn about multiple declarations
+CFLAGS += -Wredundant-decls
+# warn if the format string is not a string literal
+CFLAGS += -Wformat-nonliteral
+# do not warn about strftime format with y2k issues
+CFLAGS += -Wno-format-y2k
+# barf if we change constness
+#CFLAGS += -Wcast-qual
+
--- /dev/null
+# C source
+| ".*\\.[ch]" -> frame open:"/*" line:"*" close:"*/" width:72
+# Misc
+| ".*Makefile.*" -> frame open:"#" line:"#" close:"#" width:72
+| ".*\\.mk" -> frame open:"#" line:"#" close:"#" width:72
--- /dev/null
+/******************************************************************************/
+/* postlicyd: a postfix policy daemon with a lot of features */
+/* ~~~~~~~~~ */
+/* ________________________________________________________________________ */
+/* */
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+/* */
+/* 1. Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* 2. Redistributions in binary form must reproduce the above copyright */
+/* notice, this list of conditions and the following disclaimer in the */
+/* documentation and/or other materials provided with the distribution. */
+/* 3. The names of its contributors may not be used to endorse or promote */
+/* products derived from this software without specific prior written */
+/* permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND */
+/* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE */
+/* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
+/* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS */
+/* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR */
+/* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF */
+/* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS */
+/* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */
+/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) */
+/* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF */
+/* THE POSSIBILITY OF SUCH DAMAGE. */
+/******************************************************************************/
+
+/*
+ * Copyright (C) 2006 Pierre Habouzit
+ */
+
+#include "policy.h"
+
--- /dev/null
+/******************************************************************************/
+/* postlicyd: a postfix policy daemon with a lot of features */
+/* ~~~~~~~~~ */
+/* ________________________________________________________________________ */
+/* */
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+/* */
+/* 1. Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* 2. Redistributions in binary form must reproduce the above copyright */
+/* notice, this list of conditions and the following disclaimer in the */
+/* documentation and/or other materials provided with the distribution. */
+/* 3. The names of its contributors may not be used to endorse or promote */
+/* products derived from this software without specific prior written */
+/* permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND */
+/* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE */
+/* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
+/* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS */
+/* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR */
+/* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF */
+/* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS */
+/* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */
+/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) */
+/* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF */
+/* THE POSSIBILITY OF SUCH DAMAGE. */
+/******************************************************************************/
+
+/*
+ * Copyright (C) 2006 Pierre Habouzit
+ */
+
+#ifndef POSTLICYD_POLICY_H
+#define POSTLICYD_POLICY_H
+
+enum protocol_state {
+ STATE_CONNECT,
+ STATE_HELO, /* or EHLO */
+ STATE_MAIL,
+ STATE_RCPT,
+ STATE_DATE,
+ STATE_EOM,
+ STATE_VRFY,
+ STATE_ETRN,
+};
+
+typedef struct policy_request {
+ unsigned ready : 1;
+ unsigned state : 4;
+ unsigned esmtp : 1;
+
+ const char *helo_name;
+ const char *queue_id;
+ const char *sender;
+ const char *recipient;
+ const char *recipient_count;
+ const char *client_address;
+ const char *client_name;
+ const char *rclient_name;
+ const char *instance;
+
+ /* postfix 2.2+ */
+ const char *sasl_method;
+ const char *sasl_username;
+ const char *sasl_sender;
+ const char *size;
+ const char *ccert_subject;
+ const char *ccert_issuer;
+ const char *ccsert_fingerprint;
+
+ /* postfix 2.3+ */
+ const char *encryption_protocol;
+ const char *encryption_cipher;
+ const char *encryption_keysize;
+ const char *etrn_domain;
+} policy_request;
+
+
+#endif
--- /dev/null
+/******************************************************************************/
+/* postlicyd: a postfix policy daemon with a lot of features */
+/* ~~~~~~~~~ */
+/* ________________________________________________________________________ */
+/* */
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+/* */
+/* 1. Redistributions of source code must retain the above copyright */
+/* notice, this list of conditions and the following disclaimer. */
+/* 2. Redistributions in binary form must reproduce the above copyright */
+/* notice, this list of conditions and the following disclaimer in the */
+/* documentation and/or other materials provided with the distribution. */
+/* 3. The names of its contributors may not be used to endorse or promote */
+/* products derived from this software without specific prior written */
+/* permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND */
+/* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE */
+/* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
+/* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS */
+/* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR */
+/* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF */
+/* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS */
+/* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */
+/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) */
+/* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF */
+/* THE POSSIBILITY OF SUCH DAMAGE. */
+/******************************************************************************/
+
+/*
+ * Copyright (C) 2006 Pierre Habouzit
+ */
+
+int main(void)
+{
+ return 0;
+}