# HG changeset patch # User meillo@marmaro.de # Date 1278619293 -7200 # Node ID 5b621742b2e76530b76f998b03ab048d45beabc7 # Parent 3914d7cabfbc1e250ac15f48d81b08a3928a96e0 removed the mserver feature i.e. the functionality itself in the code the `mserver' value of online_detect and `mserver_iface' config options and the --enable-mserver configure option All functionality, however, is still available through mservdetect diff -r 3914d7cabfbc -r 5b621742b2e7 INSTALL --- a/INSTALL Thu Jul 08 14:04:39 2010 +0200 +++ b/INSTALL Thu Jul 08 22:01:33 2010 +0200 @@ -72,9 +72,6 @@ you cannot even use pine. In short, use of this option is discouraged unless your resources are extremely limited. ---enable-mserver enable online detection by connecting to the mserver -(masqdialer system). - --with-libcryto instead of using the md5 and hmac functions within the package, link dynamically with libcrypto. This applies only if you have pop3 or SMTP AUTH enabled. Makes only sense if your resources are limited and you have @@ -179,8 +176,8 @@ * if you are using the masqdialer system, you just have to set the variables online_detect to pipe and online_pipe to something like - /usr/bin/mservdetect localhost 222 - if mserver is running on localhost and listens on port 222. See the + /usr/bin/mservdetect localhost 224 + if mserver is running on localhost and listens on port 224. See the man page to mservdetect(1). * otherwise you have to add two commands in your ip-up script: diff -r 3914d7cabfbc -r 5b621742b2e7 acconfig.h --- a/acconfig.h Thu Jul 08 14:04:39 2010 +0200 +++ b/acconfig.h Thu Jul 08 22:01:33 2010 +0200 @@ -20,8 +20,6 @@ #undef ENABLE_IDENT -#undef ENABLE_MSERVER - #undef CONF_DIR #undef DATA_DIR diff -r 3914d7cabfbc -r 5b621742b2e7 config.h.in --- a/config.h.in Thu Jul 08 14:04:39 2010 +0200 +++ b/config.h.in Thu Jul 08 22:01:33 2010 +0200 @@ -21,8 +21,6 @@ #undef ENABLE_IDENT -#undef ENABLE_MSERVER - #undef CONF_DIR #undef DATA_DIR @@ -53,9 +51,6 @@ /* If Maildirs are enabled */ #undef ENABLE_MAILDIR -/* If mserver support is enabled */ -#undef ENABLE_MSERVER - /* If the POP3 support is enabled */ #undef ENABLE_POP3 diff -r 3914d7cabfbc -r 5b621742b2e7 configure --- a/configure Thu Jul 08 14:04:39 2010 +0200 +++ b/configure Thu Jul 08 22:01:33 2010 +0200 @@ -711,7 +711,6 @@ enable_maildir with_libcrypto enable_ident -enable_mserver with_liblockfile with_logdir with_spooldir @@ -1355,7 +1354,6 @@ --enable-auth enable AUTH (RFC 2554) client support --enable-maildir enable qmail style maildir support --enable-ident enable ident (RFC 1413) support - --enable-mserver enable mserver support Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -5352,19 +5350,6 @@ fi -# Check whether --enable-mserver was given. -if test "${enable_mserver+set}" = set; then : - enableval=$enable_mserver; if test "x$enable_mserver" != 'xno'; then - mserver_enabled='yes' - fi -fi - -if test "x$mserver_enabled" = xyes; then - -$as_echo "#define ENABLE_MSERVER 1" >>confdefs.h - -fi - # Check whether --with-liblockfile was given. if test "${with_liblockfile+set}" = set; then : diff -r 3914d7cabfbc -r 5b621742b2e7 configure.ac --- a/configure.ac Thu Jul 08 14:04:39 2010 +0200 +++ b/configure.ac Thu Jul 08 22:01:33 2010 +0200 @@ -216,17 +216,6 @@ fi AC_SUBST(IDENT_LIBS) -dnl mserver support (default is to not use it) -AC_ARG_ENABLE(mserver, - [ --enable-mserver enable mserver support], - if test "x$enable_mserver" != 'xno'; then - mserver_enabled='yes' - fi, - ) -if test "x$mserver_enabled" = xyes; then - AC_DEFINE(ENABLE_MSERVER, 1, [If mserver support is enabled]) -fi - dnl liblockfile AC_ARG_WITH(liblockfile, [ --with-liblockfile use liblock (for Debian)], diff -r 3914d7cabfbc -r 5b621742b2e7 examples/masqmail.conf --- a/examples/masqmail.conf Thu Jul 08 14:04:39 2010 +0200 +++ b/examples/masqmail.conf Thu Jul 08 22:01:33 2010 +0200 @@ -55,10 +55,6 @@ # online detection: # -# for 'mserver' uncomment next 2 lines and optionally change mserver_iface: -#online_detect = mserver -#mserver_iface = "localhost:222" - # for 'file' uncomment next 2 lines #online_detect = file #online_file = "/var/run/masqmail/masqmail-route" diff -r 3914d7cabfbc -r 5b621742b2e7 man/masqmail.conf.5 --- a/man/masqmail.conf.5 Thu Jul 08 14:04:39 2010 +0200 +++ b/man/masqmail.conf.5 Thu Jul 08 22:01:33 2010 +0200 @@ -357,7 +357,7 @@ \fBonline_detect = \fIstring\fR Defines the method masqmail uses to detect whether there is currently an online connection. -It can have the values \fIfile\fR, \fIpipe\fR, or \fImserver\fR. +It can have the values \fIfile\fR or \fIpipe\fR. When it is set to \fIfile\fR, masqmail first checks for the existence of \fBonline_file\fR (see below) and if it exists, it reads it. @@ -367,12 +367,6 @@ When it is set to \fIpipe\fR, masqmail calls the executable given by the \fBonline_pipe\fR option (see below) and reads the current online status from its standard output. -When it is set to \fImserver\fR, masqmail connects to the masqdialer server -using the value of \fBmserver_iface\fR and asks it whether a connection exists and for the name, -which should be the name of the current connection as defined with \fBconnect_route.\fIname\fR. -\fBThe mserver detection method is OBSOLETE.\fR -See mserver_iface for a note on how to replace it. - No matter how masqmail detects the online status, only messages that are accepted at online time will be delivered using the connection. The spool still has to be emptied with masqmail \fB\-qo\fIconnection\fR. @@ -416,21 +410,14 @@ Example: \fI/bin/echo foo\fR (This tells masqmail to be always online with connection `foo'.) -.TP -\fBmserver_iface = \fIinterface\fR - -\fBThis option is OBSOLETE\fP, use +For querying a masqdialer server +(= asking it whether a connection exists and what its name is) +use: online_method=pipe -online_pipe="/usr/bin/mservdetect localhost 222" +online_pipe="/usr/bin/mservdetect localhost 224" -instead. - -The interface the masqdialer server is listening to. -Usually this will be "localhost:224" if mserver is running on the same host as masqmail. -But using this option, you can also let masqmail run on another host by setting -\fBmserver_iface\fR to another hostname, e.g. "foo:224". .TP \fBget.\fIname\fR = \fIfile\fR diff -r 3914d7cabfbc -r 5b621742b2e7 src/Makefile.am --- a/src/Makefile.am Thu Jul 08 14:04:39 2010 +0200 +++ b/src/Makefile.am Thu Jul 08 22:01:33 2010 +0200 @@ -12,7 +12,6 @@ readsock.h\ smtp_out.h\ lookup.h\ - mserver.h\ accept.c\ address.c\ alias.c\ @@ -32,7 +31,6 @@ lookup.c\ masqmail.c\ message.c\ - mserver.c\ online.c\ parse.c\ peopen.c\ @@ -72,10 +70,8 @@ mservdetect_SOURCES=\ masqmail.h\ readsock.h\ - mserver.h\ mservdetect.c\ interface.c\ - mserver.c\ readsock.c\ peopen.c diff -r 3914d7cabfbc -r 5b621742b2e7 src/Makefile.in --- a/src/Makefile.in Thu Jul 08 14:04:39 2010 +0200 +++ b/src/Makefile.in Thu Jul 08 22:01:33 2010 +0200 @@ -53,16 +53,16 @@ expand.$(OBJEXT) fail_msg.$(OBJEXT) get.$(OBJEXT) \ header.$(OBJEXT) interface.$(OBJEXT) local.$(OBJEXT) \ log.$(OBJEXT) listen.$(OBJEXT) lookup.$(OBJEXT) \ - masqmail.$(OBJEXT) message.$(OBJEXT) mserver.$(OBJEXT) \ - online.$(OBJEXT) parse.$(OBJEXT) peopen.$(OBJEXT) \ - permissions.$(OBJEXT) pop3_in.$(OBJEXT) readsock.$(OBJEXT) \ - rewrite.$(OBJEXT) route.$(OBJEXT) queue.$(OBJEXT) \ - smtp_in.$(OBJEXT) smtp_out.$(OBJEXT) spool.$(OBJEXT) \ - tables.$(OBJEXT) timeival.$(OBJEXT) + masqmail.$(OBJEXT) message.$(OBJEXT) online.$(OBJEXT) \ + parse.$(OBJEXT) peopen.$(OBJEXT) permissions.$(OBJEXT) \ + pop3_in.$(OBJEXT) readsock.$(OBJEXT) rewrite.$(OBJEXT) \ + route.$(OBJEXT) queue.$(OBJEXT) smtp_in.$(OBJEXT) \ + smtp_out.$(OBJEXT) spool.$(OBJEXT) tables.$(OBJEXT) \ + timeival.$(OBJEXT) masqmail_OBJECTS = $(am_masqmail_OBJECTS) masqmail_DEPENDENCIES = am_mservdetect_OBJECTS = mservdetect.$(OBJEXT) interface.$(OBJEXT) \ - mserver.$(OBJEXT) readsock.$(OBJEXT) peopen.$(OBJEXT) + readsock.$(OBJEXT) peopen.$(OBJEXT) mservdetect_OBJECTS = $(am_mservdetect_OBJECTS) mservdetect_DEPENDENCIES = am_readtest_OBJECTS = readsock.$(OBJEXT) readtest.$(OBJEXT) @@ -240,7 +240,6 @@ readsock.h\ smtp_out.h\ lookup.h\ - mserver.h\ accept.c\ address.c\ alias.c\ @@ -260,7 +259,6 @@ lookup.c\ masqmail.c\ message.c\ - mserver.c\ online.c\ parse.c\ peopen.c\ @@ -300,10 +298,8 @@ mservdetect_SOURCES = \ masqmail.h\ readsock.h\ - mserver.h\ mservdetect.c\ interface.c\ - mserver.c\ readsock.c\ peopen.c @@ -466,7 +462,6 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/masqmail.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/message.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mservdetect.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mserver.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/online.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parse.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/peopen.Po@am__quote@ diff -r 3914d7cabfbc -r 5b621742b2e7 src/conf.c --- a/src/conf.c Thu Jul 08 14:04:39 2010 +0200 +++ b/src/conf.c Thu Jul 08 22:01:33 2010 +0200 @@ -551,8 +551,6 @@ conf.online_file = g_strdup(rval); else if (strcmp(lval, "online_pipe") == 0) conf.online_pipe = g_strdup(rval); - else if (strcmp(lval, "mserver_iface") == 0) - conf.mserver_iface = parse_interface(rval, 224); else if (strcmp(lval, "do_queue") == 0) conf.do_queue = parse_boolean(rval); else if (strncmp(lval, "get.", 4) == 0) { diff -r 3914d7cabfbc -r 5b621742b2e7 src/masqmail.c --- a/src/masqmail.c Thu Jul 08 14:04:39 2010 +0200 +++ b/src/masqmail.c Thu Jul 08 22:01:33 2010 +0200 @@ -577,7 +577,6 @@ gchar *with_auth = ""; gchar *with_maildir = ""; gchar *with_ident = ""; - gchar *with_mserver = ""; #ifdef ENABLE_RESOLVER with_resolver = " +resolver"; @@ -597,12 +596,9 @@ #ifdef ENABLE_IDENT with_ident = " +ident"; #endif -#ifdef ENABLE_MSERVER - with_mserver = " +mserver"; -#endif - printf("%s %s%s%s%s%s%s%s%s\n", PACKAGE, VERSION, with_resolver, with_smtp_server, - with_pop3, with_auth, with_maildir, with_ident, with_mserver); + printf("%s %s%s%s%s%s%s%s\n", PACKAGE, VERSION, with_resolver, with_smtp_server, + with_pop3, with_auth, with_maildir, with_ident); exit(EXIT_SUCCESS); } diff -r 3914d7cabfbc -r 5b621742b2e7 src/masqmail.h --- a/src/masqmail.h Thu Jul 08 14:04:39 2010 +0200 +++ b/src/masqmail.h Thu Jul 08 22:01:33 2010 +0200 @@ -210,7 +210,6 @@ gchar *online_detect; gchar *online_file; gchar *online_pipe; - interface *mserver_iface; GList *get_names; GList *online_gets; /* list of pairs which point to lists */ diff -r 3914d7cabfbc -r 5b621742b2e7 src/mservdetect.c --- a/src/mservdetect.c Thu Jul 08 14:04:39 2010 +0200 +++ b/src/mservdetect.c Thu Jul 08 22:01:33 2010 +0200 @@ -16,23 +16,65 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* + +#include "config.h" #include "masqmail.h" #include "readsock.h" -#include "mserver.h" -*/ -#include "config.h" -/* ugly hack */ -#ifndef ENABLE_MSERVER -#define ENABLE_MSERVER 1 -#include "mserver.c" -#else -#include "masqmail.h" -#include "readsock.h" -#include "mserver.h" -#endif /* ENABLE_MSERVER */ +gchar* +mserver_detect_online(interface * iface) +{ + struct sockaddr_in saddr; + gchar *ret = NULL; + + if (init_sockaddr(&saddr, iface)) { + int sock = socket(PF_INET, SOCK_STREAM, 0); + int dup_sock; + if (connect(sock, (struct sockaddr *) (&saddr), sizeof(saddr)) == 0) { + FILE *in, *out; + char buf[256]; + + dup_sock = dup(sock); + out = fdopen(sock, "w"); + in = fdopen(dup_sock, "r"); + + if (read_sockline(in, buf, 256, 15, READSOCKL_CHUG)) { + if (strncmp(buf, "READY", 5) == 0) { + fprintf(out, "STAT\n"); + fflush(out); + if (read_sockline(in, buf, 256, 15, READSOCKL_CHUG)) { + if (strncmp(buf, "DOWN", 4) == 0) { + ret = NULL; + } else if (strncmp(buf, "UP", 2) == 0) { + gchar *p = buf + 3; + while ((*p != ':') && *p) + p++; + if (*p) { + *p = 0; + p++; + if ((atoi(p) >= 0) && *p) + ret = g_strdup(buf + 3); + } else + logwrite(LOG_ALERT, "unexpected response from mserver after STAT cmd: %s", buf); + } else { + logwrite(LOG_ALERT, "unexpected response from mserver after STAT cmd: %s", buf); + } + } + } + fprintf(out, "QUIT"); + fflush(out); + + close(sock); + close(dup_sock); + fclose(in); + fclose(out); + } + } + } + return ret; +} + void logwrite(int pri, const char *fmt, ...) diff -r 3914d7cabfbc -r 5b621742b2e7 src/mserver.c --- a/src/mserver.c Thu Jul 08 14:04:39 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -/* MasqMail - Copyright (C) 1999/2000/2001 Oliver Kurth - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#include "masqmail.h" -#include "readsock.h" -#include "mserver.h" - -#ifdef ENABLE_MSERVER - -gchar* -mserver_detect_online(interface * iface) -{ - struct sockaddr_in saddr; - gchar *ret = NULL; - - if (init_sockaddr(&saddr, iface)) { - int sock = socket(PF_INET, SOCK_STREAM, 0); - int dup_sock; - if (connect(sock, (struct sockaddr *) (&saddr), sizeof(saddr)) == 0) { - FILE *in, *out; - char buf[256]; - - dup_sock = dup(sock); - out = fdopen(sock, "w"); - in = fdopen(dup_sock, "r"); - - if (read_sockline(in, buf, 256, 15, READSOCKL_CHUG)) { - if (strncmp(buf, "READY", 5) == 0) { - fprintf(out, "STAT\n"); - fflush(out); - if (read_sockline(in, buf, 256, 15, READSOCKL_CHUG)) { - if (strncmp(buf, "DOWN", 4) == 0) { - ret = NULL; - } else if (strncmp(buf, "UP", 2) == 0) { - gchar *p = buf + 3; - while ((*p != ':') && *p) - p++; - if (*p) { - *p = 0; - p++; - if ((atoi(p) >= 0) && *p) - ret = g_strdup(buf + 3); - } else - logwrite(LOG_ALERT, "unexpected response from mserver after STAT cmd: %s", buf); - } else { - logwrite(LOG_ALERT, "unexpected response from mserver after STAT cmd: %s", buf); - } - } - } - fprintf(out, "QUIT"); - fflush(out); - - close(sock); - close(dup_sock); - fclose(in); - fclose(out); - } - } - } - return ret; -} - -#endif diff -r 3914d7cabfbc -r 5b621742b2e7 src/mserver.h --- a/src/mserver.h Thu Jul 08 14:04:39 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -/* MasqMail - Copyright (C) 2001 Oliver Kurth - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -gchar *mserver_detect_online(interface * iface); diff -r 3914d7cabfbc -r 5b621742b2e7 src/online.c --- a/src/online.c Thu Jul 08 14:04:39 2010 +0200 +++ b/src/online.c Thu Jul 08 22:01:33 2010 +0200 @@ -21,7 +21,6 @@ #include #include "masqmail.h" -#include "mserver.h" #include "peopen.h" gchar *connection_name; @@ -117,11 +116,6 @@ return NULL; } -#ifdef ENABLE_MSERVER - } else if (strcmp(conf.online_detect, "mserver") == 0) { - DEBUG(3) debugf("connection method 'mserver'\n"); - return mserver_detect_online(conf.mserver_iface); -#endif } else if (strcmp(conf.online_detect, "pipe") == 0) { DEBUG(3) debugf("connection method 'pipe'\n"); if (conf.online_pipe)