Hello Davide
I compliment you too for xmail server ...
Just two question/suggestion :
1 - Is it not possible in next 2.0 release to place ANY xmail command line
switchs in the server.tab file as all of these settings are 'server' width ?
Except the debug option and an option or (default) argument to specifing
'working directory' ?
xmail [<working directory>] [-Md]
if <working directory> is ommited, then xmail load server.tab file as
currently implemented
This will avoid two places for server width parameters (some in cmd line,
some in server.tab file)
First think xmail have to do is locate the server.tab file, then read it and
start init , ...
and/or if these 'old' cmd line options are specified in cmd line they
override server.tab files (for test purpose and compatibility with old
implementations)
Options precedence : cmd line then server.tab then defaults
2 - The option to disable some protocol by binding them to localhost is not
the perfect solution as these services will continu to be accessible from
local host ..., so 'customers' processes could access these protocols ...
(in 'mutualised' hosting services as a sample config). Is it not possible to
completly disable them to run, as Henri suggested ?
I tried this in 1.20 source code, and it seems to work fine : (here for
finger and pop3, for a relay only server)
(First tries were done in 1.17 code and tested in production before applying
them to 1.20 currently in test from 1 month with these patchs)
To do this, I introduced new cmd line params '-PD' to disable pop3, and a
'-FD' to disable Finger
(not yet in server.tab file as in question/suggestion 1 ;-) )
With these patchs, minimal service init is allways done, to avoid conflic or
bad common parts init, but no thread (so no bindings) is launched if
disabled flag is set, and test is done at stop to not try to stop inexistant
threads
(Sorry no diff present on the computer used to mail ...)
In POP3Svr.h :
--------------
..
..
..
#define POP3F_STOP_SERVER (1 << 0)
#define POP3F_LOG_ENABLED (1 << 1)
#define POP3F_HANG_ON_BADLOGIN (1 << 2)
//******************************************************************
#define POP3F_DISABLED (1 << 3) // to disable pop3 service
//******************************************************************
..
..
..
In FINGSvr.h :
--------------
..
..
..
#define FINGF_STOP_SERVER (1 << 0)
#define FINGF_LOG_ENABLED (1 << 1)
//******************************************************************
#define FINGF_DISABLED (1 << 2) // to disable finger service
//******************************************************************
..
..
..
In MailSvr.cpp :
----------------
..
..
..
static int SvrSetupFING(int iArgCount, char *pszArgs[])
{
..
..
..
case ('I'):
if ((++ii < iArgCount) &&
(MscGetServerAddress(pszArgs[ii],
SvrAddr[iNumAddr]) == 0))
++iNumAddr;
break;
//******************************************************************
// Added Finger Disabled flag option parsing
case ('D'):
ulFlags |= FINGF_DISABLED;
break;
//******************************************************************
}
}
..
..
..
for (int nn = 0; nn < iNumAddr; nn++)
pFINGCfg->SvrAddr[nn] = SvrAddr[nn];
ShbUnlock(hShbFING);
//******************************************************************
//-Added Finger Disabled flag Test
//--Don't start any thread if Finger Disabled flag is set
if (! ((pFINGCfg->ulFlags) & FINGF_DISABLED)) {
//----------------------------------------------------------------
if ((hFINGThread = SysCreateThread(FINGThreadProc, NULL)) ==
SYS_INVALID_THREAD) {
ShbCloseBlock(hShbFING);
return (ErrGetErrorCode());
}
//--close if------------------------------------------------------
}
//******************************************************************
return (0);
}
static void SvrCleanupFING(void)
{
..
..
..
pFINGCfg->ulFlags |= FINGF_STOP_SERVER;
ShbUnlock(hShbFING);
//******************************************************************
//-Added Finger Disabled flag Test
//--Don't try to stop NO existant threads if never started due to Finger
Disabled flag set
if (! ((pFINGCfg->ulFlags) & FINGF_DISABLED)) {
//----------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////
///
// Wait FINGER
////////////////////////////////////////////////////////////////////////////
///
SysWaitThread(hFINGThread, SVR_EXIT_WAIT);
////////////////////////////////////////////////////////////////////////////
///
// Close FINGER Thread
////////////////////////////////////////////////////////////////////////////
///
SysCloseThread(hFINGThread, 1);
//-close if-------------------------------------------------------
}
//******************************************************************
ShbCloseBlock(hShbFING);
}
static int SvrSetupPOP3(int iArgCount, char *pszArgs[])
{
..
..
..
case ('X'):
if (++ii < iArgCount)
lMaxThreads = atol(pszArgs[ii]);
break;
//******************************************************************
//-Added Pop3 Disabled flag option parsing
case ('D'):
ulFlags |= POP3F_DISABLED;
break; }
//******************************************************************
}
..
..
..
////////////////////////////////////////////////////////////////////////////
///
// Remove POP3 lock files
////////////////////////////////////////////////////////////////////////////
///
UsrClearPop3LocksDir();
//******************************************************************
//-Added Pop3 Disabled flag Test
//--Don't start any thread if Pop3 Disabled flag is set
if (! ((pPOP3Cfg->ulFlags) & POP3F_DISABLED)) {
//----------------------------------------------------------------
if ((hPOP3Thread = SysCreateThread(POP3ThreadProc, NULL)) ==
SYS_INVALID_THREAD) {
ShbCloseBlock(hShbPOP3);
return (ErrGetErrorCode());
}
//-close if-------------------------------------------------------
}
//******************************************************************
return (0);
}
static void SvrCleanupPOP3(void)
{
////////////////////////////////////////////////////////////////////////////
///
// Stop POP3 Thread
////////////////////////////////////////////////////////////////////////////
///
POP3Config *pPOP3Cfg = (POP3Config *) ShbLock(hShbPOP3);
pPOP3Cfg->ulFlags |= POP3F_STOP_SERVER;
ShbUnlock(hShbPOP3);
//******************************************************************
//-Added Disabled flag Test
//--Don't try to stop NO existant threads if never started due to Pop3
Disabled flag set
if (! ((pPOP3Cfg->ulFlags) & POP3F_DISABLED)) {
//----------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////
///
// Wait POP3 Thread
////////////////////////////////////////////////////////////////////////////
///
SysWaitThread(hPOP3Thread, SVR_EXIT_WAIT);
////////////////////////////////////////////////////////////////////////////
///
// Close POP3 Thread
////////////////////////////////////////////////////////////////////////////
///
SysCloseThread(hPOP3Thread, 1);
//-close if-------------------------------------------------------
}
//******************************************************************
ShbCloseBlock(hShbPOP3);
}
..
..
..
Same things can be done for pop3link service, lmail service, smtp service
and smail service (but don't know if disabling smtp or smail is need in some
implementations as if no smtp -> no mail incoming in mailboxs except from
lmail and disabling smail -> no outgoing mail ...)
And a PLUS doing like this :)) : No thread = no bindings at all, so no OS
ressources used ...
Francis
-
To unsubscribe from this list: send the line "unsubscribe xmail" in
the body of a message to [EMAIL PROTECTED]
For general help: send the line "help" in the body of a message to
[EMAIL PROTECTED]