Package: xmail
Version: 1.21-1

Symlinks from /var/lib/xmail to config files in /etc/xmail gets overwritten
by XMail with real files when changes in configuration are made using XMail
control protocol (using web frontend, for example).
That create a lot of confusion which config is actually the real config and
brake the whole idea of keeping configuration in /etc via symlinks.

The config files are not edited in place but new config is created as temp
file, current config copied to another temp file, current config unlinked,
then new config copied to current.

There are code like this all over XMail source:

UsrUtils.cpp:

int UsrRemoveAlias(const char *pszDomain, const char *pszAlias)
{
        char szAlsFilePath[SYS_MAX_PATH] = "";
        UsrGetAliasFilePath(szAlsFilePath, sizeof(szAlsFilePath));
        char szTmpFile[SYS_MAX_PATH] = "";
        SysGetTmpFile(szTmpFile);
<skiped>
        char szTmpAlsFilePath[SYS_MAX_PATH] = "";
        sprintf(szTmpAlsFilePath, "%s.tmp", szAlsFilePath);
        if (MscMoveFile(szAlsFilePath, szTmpAlsFilePath) < 0) {
                RLckUnlockEX(hResLock);
                return (ErrGetErrorCode());
        }
        if (MscMoveFile(szTmpFile, szAlsFilePath) < 0) {
                MscMoveFile(szTmpAlsFilePath, szAlsFilePath);
                RLckUnlockEX(hResLock);
                return (ErrGetErrorCode());
        }
        SysRemove(szTmpAlsFilePath);


and MscMoveFile():

int MscMoveFile(char const *pszOldName, char const *pszNewName)
{
        if (MscCopyFile(pszNewName, pszOldName) < 0)
                return (ErrGetErrorCode());
        return (SysRemove(pszOldName));
}
int MscCopyFile(const char *pszCopyTo, const char *pszCopyFrom)
{
        return (MscCopyFileLL(pszCopyTo, pszCopyFrom, "wb"));
}
static int MscCopyFileLL(const char *pszCopyTo, const char *pszCopyFrom,
                         char const *pszMode)
{

        FILE *pFileIn = fopen(pszCopyFrom, "rb");
<skiped>
        FILE *pFileOut = fopen(pszCopyTo, pszMode);
...
int SysRemove(const char *pszFileName)
{
        if (unlink(pszFileName) != 0) {
...


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to