Commit 5045e043 authored by Volker Krause's avatar Volker Krause
Browse files

Read passwords from config file which are still using legacy "encryption".

svn path=/trunk/KDE/kdepim/mailtransport/; revision=620552
parent 04d6142d
......@@ -13,6 +13,7 @@ set(mailtransport_lib_srcs
sendmailjob.cpp
smtpjob.cpp
precommandjob.cpp
legacydecrypt.cpp
)
kde4_automoc(${mailtransport_lib_srcs})
......
......@@ -11,7 +11,6 @@ Migration
---------
- password migration within kwallet (for kmail and knode), requires KWallet to
be fixed first
- reading passwords from config file still using legacy encryption
TransportManager
----------------
......
......@@ -16,11 +16,14 @@ $currentGroup = "";
$source = $ARGV[0];
%kmail_key_map = ( "pass", "password-kmail" );
%knode_key_map = (
"server", "host",
"needsLogon", "auth",
"timeout", "",
"holdTime", ""
"holdTime", "",
"pass", "password-knode"
);
while (<STDIN>) {
......@@ -47,6 +50,7 @@ while (<STDIN>) {
# Move over keys from the transport groups
if ( $source eq "kmail" && $currentGroup =~ /^Transport/ ) {
$key = $kmail_key_map{$key} if exists $kmail_key_map{$key};
if ( $key eq "authtype" ) {
$value =~ s/-/_/g;
}
......
/*
Copyright (c) 2007 Volker Krause <vkrause@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library 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 Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#include "legacydecrypt.h"
using namespace KPIM;
QString Legacy::decryptKMail(const QString & data)
{
QString result;
for ( int i = 0; i < data.length(); ++i )
result += (data[i].unicode() < 0x20) ? data[i] :
QChar(0x1001F - data[i].unicode());
return result;
}
QString Legacy::decryptKNode(const QString & data)
{
uint i, val, len = data.length();
QString result;
for ( i = 0; i < len; ++i )
{
val = data[i].toLatin1();
val -= ' ';
val = (255-' ') - val;
result += (char)(val + ' ');
}
return result;
}
/*
Copyright (c) 2007 Volker Krause <vkrause@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library 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 Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#ifndef KPIM_LEGACYDECRYPT_H
#define KPIM_LEGACYDECRYPT_H
#include <qstring.h>
namespace KPIM {
/**
Methods to read passwords from config files still using legacy encryption.
*/
class Legacy
{
public:
/**
Read data encrypted using KMail's legacy encryption.
*/
static QString decryptKMail( const QString &data );
/**
Read data encrypted using KNode's legacy encryption.
*/
static QString decryptKNode( const QString &data );
};
}
#endif
......@@ -20,6 +20,7 @@
#include "transport.h"
#include "transportmanager.h"
#include "mailtransport_defs.h"
#include "legacydecrypt.h"
#include <kdebug.h>
#include <klocale.h>
......@@ -92,8 +93,12 @@ void Transport::usrReadConfig()
// try to find a password in the config file otherwise
KConfigGroup group( config(), currentGroup() );
mPassword = KStringHandler::obscure( group.readEntry( "password" ) );
// TODO legacy password migration from KMail/KNode
if ( group.hasKey( "password" ) )
mPassword = KStringHandler::obscure( group.readEntry( "password" ) );
else if ( group.hasKey( "password-kmail" ) )
mPassword = Legacy::decryptKMail( group.readEntry( "password-kmail" ) );
else if ( group.hasKey( "password-knode" ) )
mPassword = Legacy::decryptKNode( group.readEntry( "password-knode" ) );
if ( !mPassword.isEmpty() ) {
mPasswordLoaded = true;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment