Jan 312011
 

Original Author: Simon J. Mudd
postfix-2.9-20110130-multiline-greeting.patch
[download#17]

diff -C1 -r postfix-2.9-20110130/src/smtpd/smtpd.c postfix-2.9-20110130.patched/src/smtpd/smtpd.c
*** postfix-2.9-20110130/src/smtpd/smtpd.c      Wed Jan 26 01:30:14 2011
--- postfix-2.9-20110130.patched/src/smtpd/smtpd.c      Mon Jan 31 13:35:51 2011
***************
*** 4529,4531 ****
            } else {
!               smtpd_chat_reply(state, "220 %s", var_smtpd_banner);
            }
--- 4529,4531 ----
            } else {
!               smtpd_chat_reply_multiline(state, 220, var_smtpd_banner);
            }
diff -C1 -r postfix-2.9-20110130/src/smtpd/smtpd_chat.c postfix-2.9-20110130.patched/src/smtpd/smtpd_chat.c
*** postfix-2.9-20110130/src/smtpd/smtpd_chat.c Tue Jan 25 21:53:32 2011
--- postfix-2.9-20110130.patched/src/smtpd/smtpd_chat.c Mon Jan 31 13:35:51 2011
***************
*** 64,65 ****
--- 64,66 ----
  #include <stdarg.h>
+ #include <ctype.h>

***************
*** 217,218 ****
--- 218,274 ----
        state->flags |= SMTPD_FLAG_HANGUP;
+ }
+
+ /* trim_line - remove trailing whitespace and return a pointer to the first */
+ /* non-space char in the string.  Based on TRIM() in ../util/dict.c         */
+ /* WARNING: this function is DESTRUCTIVE.                                   */
+
+ static char *trim_line( char *line ) {
+     char *p;
+
+     for (p=line + strlen(line); p > line && ISSPACE(p[-1]); p--);
+        *p = 0;
+
+     while ( ISSPACE(*line) )
+        ++line;
+
+     return ( line );
+ }
+
+ /* smtpd_chat_reply_multiline - convert multline string into seperate */
+ /* lines, sending each one to smtpd_chat_reply()                      */
+
+ #define LINE_SEPARATOR "\n"
+
+ void smtpd_chat_reply_multiline(SMTPD_STATE *state, int smtp_reply_code, char *format,...)
+ {
+     va_list ap;
+     char    *line, *line2;     /* one line (of the multiline) reply */
+     size_t   size;             /* size of a single line             */
+     static VSTRING *temp_line; /* SMTP reply before unescapeing     */
+     static VSTRING *multiline; /* SMTP reply after unescaping       */
+
+     /* First-time intialization. */
+     if (!temp_line)
+        temp_line = vstring_alloc(512);
+     if (!multiline)
+        multiline = vstring_alloc(512);
+
+     va_start(ap, format);
+     vstring_vsprintf(temp_line, format, ap);
+     va_end(ap);
+
+     /* unescape lines with "\\n", converting them to "\n" */
+     unescape( multiline, STR(temp_line) );
+
+     line = STR(multiline);
+     while ( (size = strcspn(line, LINE_SEPARATOR)) < strlen(line) ) {
+        *(line + size) = 0;
+
+        line2 = trim_line(line);
+        smtpd_chat_reply(state, "%03d-%s", smtp_reply_code, line2);
+
+        line += size + 1;
+     }
+     line2 = trim_line(line);
+     smtpd_chat_reply(state, "%03d %s", smtp_reply_code, line2);
  }
diff -C1 -r postfix-2.9-20110130/src/smtpd/smtpd_chat.h postfix-2.9-20110130.patched/src/smtpd/smtpd_chat.h
*** postfix-2.9-20110130/src/smtpd/smtpd_chat.h Tue Apr 25 01:48:28 2006
--- postfix-2.9-20110130.patched/src/smtpd/smtpd_chat.h Mon Jan 31 13:35:51 2011
***************
*** 17,18 ****
--- 17,19 ----
  extern void PRINTFLIKE(2, 3) smtpd_chat_reply(SMTPD_STATE *, const char *, ...);
+ extern void smtpd_chat_reply_multiline(SMTPD_STATE *, int, char *, ...);
  extern void smtpd_chat_notify(SMTPD_STATE *);
Jul 032009
 

Pertama download kernel source kernel 2.6.26.

# wget -t0 -c http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.26.tar.bz2

Download iptables 1.4.1 source.

# wget -t0 -c http://www.netfilter.org/projects/iptables/files/iptables-1.4.1.tar.bz2

Download patch l7 + IMQ (untuk kernel dan iptables) yg sudah saya modifikasi jadi satu bundle.
[download#3]
[download#4]

Extract, patch dan compile kernel source(to RPM)

# tar xjf linux-2.6.26.tar.bz2
# cd linux-2.6.26
# patch -p1 < ../linux-2.6.26-layer7-imq.patch
patching file drivers/net/imq.c
patching file drivers/net/Kconfig
patching file drivers/net/Makefile
patching file include/linux/imq.h
patching file include/linux/netfilter/xt_IMQ.h
patching file include/linux/netfilter/xt_layer7.h
patching file include/linux/netfilter_ipv4/ipt_IMQ.h
patching file include/linux/netfilter_ipv6/ip6t_IMQ.h
patching file include/linux/skbuff.h
patching file include/net/netfilter/nf_conntrack.h
patching file include/net/netfilter/nf_queue.h
patching file net/core/dev.c
patching file net/core/skbuff.c
patching file net/netfilter/Kconfig
patching file net/netfilter/Makefile
patching file net/netfilter/nf_conntrack_core.c
patching file net/netfilter/nf_conntrack_standalone.c
patching file net/netfilter/nf_queue.c
patching file net/netfilter/regexp/regexp.c
patching file net/netfilter/regexp/regexp.h
patching file net/netfilter/regexp/regmagic.h
patching file net/netfilter/regexp/regsub.c
patching file net/netfilter/xt_IMQ.c
patching file net/netfilter/xt_layer7.c

# cp /boot/config-`uname -r` .config
# make clean
# make menuconfig

Continue reading »