1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
#!/bin/sh -e
## 08_init.dpatch by Adam D. Barratt <debian-bts@adam-barratt.org.uk>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Enable inetd/standalone (bug#77934)
if [ $# -lt 1 ]; then
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1
fi
[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
patch_opts="${patch_opts:--f --no-backup-if-mismatch}"
case "$1" in
-patch) patch $patch_opts -p1 < $0;;
-unpatch) patch $patch_opts -p1 -R < $0;;
*)
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1;;
esac
exit 0
@DPATCH@
diff -Nru solid-pop3d-0.15-7/src/main.c solid-pop3d-0.15/src/main.c
--- solid-pop3d-0.15-7/src/main.c Tue Jan 13 11:42:49 2004
+++ solid-pop3d-0.15/src/main.c Tue Jan 13 12:13:25 2004
@@ -248,6 +248,9 @@
#ifdef STATISTICS
int logstatistics = 1;
#endif
+#if defined(DEBIAN) && defined(STANDALONE)
+int standalone = 0;
+#endif
void check_wccount(void) {
if (wccount != 0)
@@ -1051,11 +1058,19 @@
umask(0077);
chdir("/");
+#if defined(DEBIAN) && defined(STANDALONE)
+ if (!standalone) {
+ pop_openlog();
+ if (atexit(pop_closelog) < 0)
+ exit(1);
+ }
+#else
#ifndef STANDALONE
pop_openlog();
if (atexit(pop_closelog) < 0)
exit(1);
#endif
+#endif
if (setrlimit(RLIMIT_CORE, &corelimit) < 0) {
pop_error("setrlimit");
exit(1);
@@ -1122,8 +1137,13 @@
#endif
#endif /* RESOLVE_HOSTNAME */
#ifdef LOG_CONNECT
+#if defined(DEBIAN) && defined(STANDALONE)
+ if (!standalone)
+ pop_log(pop_priority, "connect from %.384s", ahname);
+#else
#ifndef STANDALONE
pop_log(pop_priority, "connect from %.384s", ahname);
+#endif
#endif
#endif
#endif /* LOG_EXTEND || LOG_CONNECT */
diff -Nru solid-pop3d-0.15-7/src/standalone.c solid-pop3d-0.15/src/standalone.c
--- solid-pop3d-0.15-7/src/standalone.c Sun Apr 30 21:56:21 2000
+++ solid-pop3d-0.15/src/standalone.c Tue Jan 13 12:13:25 2004
@@ -48,6 +48,9 @@
#endif
extern int do_session(int, char **);
+#if defined(DEBIAN) && defined(STANDALONE)
+extern int standalone;
+#endif
static volatile int blocked;
static volatile int pending;
int sckt;
@@ -103,6 +106,21 @@
time_t now;
pid_t spid;
+#if defined(DEBIAN) && defined(STANDALONE)
+ /* Basic code pinched from Exim4's inetd detection */
+ if (getpeername(0, (struct sockaddr *)(&address), &tmpaddrln) == 0 ) {
+ int family = ((struct sockaddr *)(&address))->sa_family;
+ standalone = !(family == AF_INET || family == AF_INET6);
+ if (!standalone) {
+ do_session(argc,argv);
+ /* do_session should never return */
+ exit(1);
+ }
+ }
+ else {
+ standalone = 1;
+ }
+#endif
pop_openlog();
if (atexit(pop_closelog) < 0) {
pop_error("atexit");
|