Renamed methods decrypt/undecrypt to unlock/lock.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/39/head
Michele Calgaro 5 years ago
parent b4754b0e6f
commit bd99134817
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -1804,7 +1804,7 @@ TQStringVariantMap HALBackend::unmount(const TQString &id)
return result; return result;
} }
TQStringVariantMap HALBackend::decrypt(const TQString &id, const TQString &password) TQStringVariantMap HALBackend::unlock(const TQString &id, const TQString &password)
{ {
TQStringVariantMap result; TQStringVariantMap result;
@ -1831,7 +1831,7 @@ TQStringVariantMap HALBackend::decrypt(const TQString &id, const TQString &passw
"org.freedesktop.Hal.Device.Volume.Crypto", "org.freedesktop.Hal.Device.Volume.Crypto",
"Setup"); "Setup");
if (msg == NULL) { if (msg == NULL) {
kdDebug() << "decrypt failed for " << udi << ": could not create dbus message\n"; kdDebug() << "unlock failed for " << udi << ": could not create dbus message\n";
result["errStr"] = i18n("Internal error"); result["errStr"] = i18n("Internal error");
result["result"] = false; result["result"] = false;
return result; return result;
@ -1840,7 +1840,7 @@ TQStringVariantMap HALBackend::decrypt(const TQString &id, const TQString &passw
TQCString pwdUtf8 = password.utf8(); TQCString pwdUtf8 = password.utf8();
const char *pwd_utf8 = pwdUtf8; const char *pwd_utf8 = pwdUtf8;
if (!dbus_message_append_args (msg, DBUS_TYPE_STRING, &pwd_utf8, DBUS_TYPE_INVALID)) { if (!dbus_message_append_args (msg, DBUS_TYPE_STRING, &pwd_utf8, DBUS_TYPE_INVALID)) {
kdDebug() << "decrypt failed for " << udi << ": could not append args to dbus message\n"; kdDebug() << "unlock failed for " << udi << ": could not append args to dbus message\n";
dbus_message_unref (msg); dbus_message_unref (msg);
result["errStr"] = i18n("Internal error"); result["errStr"] = i18n("Internal error");
result["result"] = false; result["result"] = false;
@ -1852,7 +1852,7 @@ TQStringVariantMap HALBackend::decrypt(const TQString &id, const TQString &passw
dbus_error_is_set (&error)) dbus_error_is_set (&error))
{ {
TQString qerror = i18n("Internal Error"); TQString qerror = i18n("Internal Error");
kdDebug() << "decrypt failed for " << udi << ": " << error.name << " " << error.message << endl; kdDebug() << "unlock failed for " << udi << ": " << error.name << " " << error.message << endl;
if (strcmp (error.name, "org.freedesktop.Hal.Device.Volume.Crypto.SetupPasswordError") == 0) { if (strcmp (error.name, "org.freedesktop.Hal.Device.Volume.Crypto.SetupPasswordError") == 0) {
qerror = i18n("Wrong password"); qerror = i18n("Wrong password");
} }
@ -1873,7 +1873,7 @@ TQStringVariantMap HALBackend::decrypt(const TQString &id, const TQString &passw
return result; return result;
} }
TQStringVariantMap HALBackend::undecrypt(const TQString &id) TQStringVariantMap HALBackend::lock(const TQString &id)
{ {
TQStringVariantMap result; TQStringVariantMap result;
@ -1900,14 +1900,14 @@ TQStringVariantMap HALBackend::undecrypt(const TQString &id)
"org.freedesktop.Hal.Device.Volume.Crypto", "org.freedesktop.Hal.Device.Volume.Crypto",
"Teardown"); "Teardown");
if (msg == NULL) { if (msg == NULL) {
kdDebug() << "teardown failed for " << udi << ": could not create dbus message\n"; kdDebug() << "lock failed for " << udi << ": could not create dbus message\n";
result["errStr"] = i18n("Internal error"); result["errStr"] = i18n("Internal error");
result["result"] = false; result["result"] = false;
return result; return result;
} }
if (!dbus_message_append_args (msg, DBUS_TYPE_INVALID)) { if (!dbus_message_append_args (msg, DBUS_TYPE_INVALID)) {
kdDebug() << "teardown failed for " << udi << ": could not append args to dbus message\n"; kdDebug() << "lock failed for " << udi << ": could not append args to dbus message\n";
dbus_message_unref (msg); dbus_message_unref (msg);
result["errStr"] = i18n("Internal error"); result["errStr"] = i18n("Internal error");
result["result"] = false; result["result"] = false;
@ -1919,7 +1919,7 @@ TQStringVariantMap HALBackend::undecrypt(const TQString &id)
dbus_error_is_set (&error)) dbus_error_is_set (&error))
{ {
TQString qerror = i18n("Internal Error"); TQString qerror = i18n("Internal Error");
kdDebug() << "teardown failed for " << udi << ": " << error.name << " " << error.message << endl; kdDebug() << "lock failed for " << udi << ": " << error.name << " " << error.message << endl;
dbus_error_free (&error); dbus_error_free (&error);
dbus_message_unref (msg); dbus_message_unref (msg);
while (dbus_connection_dispatch(dbus_connection) == DBUS_DISPATCH_DATA_REMAINS) ; while (dbus_connection_dispatch(dbus_connection) == DBUS_DISPATCH_DATA_REMAINS) ;

@ -86,8 +86,8 @@ public:
TQStringVariantMap mount(const TQString &id); TQStringVariantMap mount(const TQString &id);
TQStringVariantMap mount(const Medium *medium); TQStringVariantMap mount(const Medium *medium);
TQStringVariantMap unmount(const TQString &id); TQStringVariantMap unmount(const TQString &id);
TQStringVariantMap decrypt(const TQString &id, const TQString &password); TQStringVariantMap unlock(const TQString &id, const TQString &password);
TQStringVariantMap undecrypt(const TQString &id); TQStringVariantMap lock(const TQString &id);
private: private:
/** /**

@ -294,7 +294,7 @@ TQStringVariantMap MediaManager::unmount(const TQString &uid)
#endif #endif
} }
TQStringVariantMap MediaManager::decrypt(const TQString &uid, const TQString &password) TQStringVariantMap MediaManager::unlock(const TQString &uid, const TQString &password)
{ {
TQStringVariantMap result; TQStringVariantMap result;
/* /*
@ -304,7 +304,7 @@ TQStringVariantMap MediaManager::decrypt(const TQString &uid, const TQString &pa
result["result"] = false; result["result"] = false;
return result; return result;
} }
return m_tdebackend->decrypt(uid, password); return m_tdebackend->unlock(uid, password);
#elif defined COMPILE_HALBACKEND #elif defined COMPILE_HALBACKEND
*/ */
#if defined COMPILE_HALBACKEND #if defined COMPILE_HALBACKEND
@ -313,7 +313,7 @@ TQStringVariantMap MediaManager::decrypt(const TQString &uid, const TQString &pa
result["result"] = false; result["result"] = false;
return result; return result;
} }
return m_halbackend->decrypt(uid, password); return m_halbackend->unlock(uid, password);
#else #else
// if (!m_fstabbackend) { // if (!m_fstabbackend) {
@ -321,11 +321,11 @@ TQStringVariantMap MediaManager::decrypt(const TQString &uid, const TQString &pa
result["result"] = false; result["result"] = false;
return result; return result;
// } // }
// return m_fstabbackend->decrypt(uid, password); // return m_fstabbackend->unlock(uid, password);
#endif #endif
} }
TQStringVariantMap MediaManager::undecrypt(const TQString &uid) TQStringVariantMap MediaManager::lock(const TQString &uid)
{ {
TQStringVariantMap result; TQStringVariantMap result;
/* /*
@ -335,7 +335,7 @@ TQStringVariantMap MediaManager::undecrypt(const TQString &uid)
result["result"] = false; result["result"] = false;
return result; return result;
} }
return m_tdebackend->undecrypt(uid); return m_tdebackend->lock(uid);
#elif defined COMPILE_HALBACKEND #elif defined COMPILE_HALBACKEND
*/ */
#if defined COMPILE_HALBACKEND #if defined COMPILE_HALBACKEND
@ -344,14 +344,14 @@ TQStringVariantMap MediaManager::undecrypt(const TQString &uid)
result["result"] = false; result["result"] = false;
return result; return result;
} }
return m_halbackend->undecrypt(uid); return m_halbackend->lock(uid);
#else #else
// if (!m_fstabbackend) { // if (!m_fstabbackend) {
result["errStr"] = i18n("Feature only available with HAL or TDE hardware backend"); result["errStr"] = i18n("Feature only available with HAL or TDE hardware backend");
result["result"] = false; result["result"] = false;
return result; return result;
// } // }
// return m_fstabbackend->undecrypt(uid); // return m_fstabbackend->lock(uid);
#endif #endif
} }
@ -379,7 +379,7 @@ TQStringVariantMap MediaManager::unmountByNode(const TQString &deviceNode)
return unmount(medium->id()); return unmount(medium->id());
} }
TQStringVariantMap MediaManager::decryptByNode(const TQString &deviceNode, const TQString &password) TQStringVariantMap MediaManager::unlockByNode(const TQString &deviceNode, const TQString &password)
{ {
const Medium *medium = m_mediaList.findByNode(deviceNode); const Medium *medium = m_mediaList.findByNode(deviceNode);
if (!medium) { if (!medium) {
@ -388,10 +388,10 @@ TQStringVariantMap MediaManager::decryptByNode(const TQString &deviceNode, const
result["result"] = false; result["result"] = false;
return result; return result;
} }
return decrypt(medium->id(), password); return unlock(medium->id(), password);
} }
TQStringVariantMap MediaManager::undecryptByNode(const TQString &deviceNode) TQStringVariantMap MediaManager::lockByNode(const TQString &deviceNode)
{ {
const Medium *medium = m_mediaList.findByNode(deviceNode); const Medium *medium = m_mediaList.findByNode(deviceNode);
if (!medium) { if (!medium) {
@ -400,7 +400,7 @@ TQStringVariantMap MediaManager::undecryptByNode(const TQString &deviceNode)
result["result"] = false; result["result"] = false;
return result; return result;
} }
return undecrypt(medium->id()); return lock(medium->id());
} }
TQString MediaManager::nameForLabel(const TQString &label) TQString MediaManager::nameForLabel(const TQString &label)

@ -49,13 +49,13 @@ k_dcop:
TQStringVariantMap mount(const TQString &uid); TQStringVariantMap mount(const TQString &uid);
TQStringVariantMap unmount(const TQString &uid); TQStringVariantMap unmount(const TQString &uid);
TQStringVariantMap decrypt(const TQString &uid, const TQString &password); TQStringVariantMap unlock(const TQString &uid, const TQString &password);
TQStringVariantMap undecrypt(const TQString &uid); TQStringVariantMap lock(const TQString &uid);
TQStringVariantMap mountByNode(const TQString &deviceNode); TQStringVariantMap mountByNode(const TQString &deviceNode);
TQStringVariantMap unmountByNode(const TQString &deviceNode); TQStringVariantMap unmountByNode(const TQString &deviceNode);
TQStringVariantMap decryptByNode(const TQString &deviceNode, const TQString &password); TQStringVariantMap unlockByNode(const TQString &deviceNode, const TQString &password);
TQStringVariantMap undecryptByNode(const TQString &deviceNode); TQStringVariantMap lockByNode(const TQString &deviceNode);
TQString nameForLabel(const TQString &label); TQString nameForLabel(const TQString &label);
ASYNC setUserLabel(const TQString &name, const TQString &label); ASYNC setUserLabel(const TQString &name, const TQString &label);

@ -55,7 +55,7 @@
TDEBackend::TDEBackend(MediaList &list, TQObject* parent) TDEBackend::TDEBackend(MediaList &list, TQObject* parent)
: TQObject() : TQObject()
, BackendBase(list) , BackendBase(list)
, m_decryptDialog(0) , m_unlockDialog(0)
, m_parent(parent) , m_parent(parent)
{ {
// Initialize the TDE device manager // Initialize the TDE device manager
@ -929,7 +929,7 @@ TQStringList TDEBackend::mountoptions(const TQString &name)
} }
if (medium->isEncrypted()) { if (medium->isEncrypted()) {
// if not decrypted yet then there are no mountoptions // if not unlocked yet then there are no mountoptions
return TQStringList(); return TQStringList();
} }
@ -1177,7 +1177,7 @@ bool TDEBackend::setMountoptions(const TQString &name, const TQStringList &optio
} }
void TDEBackend::slotPasswordReady() { void TDEBackend::slotPasswordReady() {
m_decryptionPassword = m_decryptDialog->getPassword(); m_decryptionPassword = m_unlockDialog->getPassword();
m_decryptPasswordValid = true; m_decryptPasswordValid = true;
} }
@ -1267,22 +1267,22 @@ TQStringVariantMap TDEBackend::mount(const Medium *medium)
while (continue_trying_to_decrypt == true) { while (continue_trying_to_decrypt == true) {
m_decryptPasswordValid = false; m_decryptPasswordValid = false;
m_decryptDialog = new Dialog(sdevice->deviceNode(), iconName); m_unlockDialog = new Dialog(sdevice->deviceNode(), iconName);
m_decryptDialog->show(); m_unlockDialog->show();
connect(m_decryptDialog, TQT_SIGNAL (user1Clicked()), this, TQT_SLOT (slotPasswordReady())); connect(m_unlockDialog, TQT_SIGNAL (user1Clicked()), this, TQT_SLOT (slotPasswordReady()));
connect(m_decryptDialog, TQT_SIGNAL (cancelClicked()), this, TQT_SLOT (slotPasswordCancel())); connect(m_unlockDialog, TQT_SIGNAL (cancelClicked()), this, TQT_SLOT (slotPasswordCancel()));
connect(this, TQT_SIGNAL (signalDecryptionPasswordError(TQString)), m_decryptDialog, TQT_SLOT (slotDialogError(TQString))); connect(this, TQT_SIGNAL (signalDecryptionPasswordError(TQString)), m_unlockDialog, TQT_SLOT (slotDialogError(TQString)));
while (m_decryptPasswordValid == false) { while (m_decryptPasswordValid == false) {
tqApp->processEvents(); tqApp->processEvents();
} }
m_decryptDialog->setEnabled(false); m_unlockDialog->setEnabled(false);
tqApp->processEvents(); tqApp->processEvents();
if (m_decryptionPassword.isNull()) { if (m_decryptionPassword.isNull()) {
delete m_decryptDialog; delete m_unlockDialog;
result["errStr"] = i18n("Decryption aborted"); result["errStr"] = i18n("Decryption aborted");
result["result"] = false; result["result"] = false;
return result; return result;
@ -1317,7 +1317,7 @@ TQStringVariantMap TDEBackend::mount(const Medium *medium)
if (mountResult.contains("retCode") && mountResult["retCode"].toInt() == 25600) { if (mountResult.contains("retCode") && mountResult["retCode"].toInt() == 25600) {
// Probable LUKS failure // Probable LUKS failure
// Retry // Retry
m_decryptDialog->setEnabled(true); m_unlockDialog->setEnabled(true);
continue_trying_to_decrypt = true; continue_trying_to_decrypt = true;
} }
else { else {
@ -1334,7 +1334,7 @@ TQStringVariantMap TDEBackend::mount(const Medium *medium)
continue_trying_to_decrypt = false; continue_trying_to_decrypt = false;
} }
delete m_decryptDialog; delete m_unlockDialog;
} }
} }
} }

@ -71,8 +71,8 @@ public:
TQStringVariantMap mount(const TQString &id); TQStringVariantMap mount(const TQString &id);
TQStringVariantMap mount(const Medium *medium); TQStringVariantMap mount(const Medium *medium);
TQStringVariantMap unmount(const TQString &id); TQStringVariantMap unmount(const TQString &id);
// TQStringVariantMap decrypt(const TQString &id, const TQString &password); // TQStringVariantMap unlock(const TQString &id, const TQString &password);
// TQStringVariantMap undecrypt(const TQString &id); // TQStringVariantMap lock(const TQString &id);
private: private:
/** /**
@ -138,7 +138,7 @@ private:
TQString driveUDIFromDeviceUID(TQString uuid); TQString driveUDIFromDeviceUID(TQString uuid);
// Decryption // Decryption
Dialog* m_decryptDialog; Dialog* m_unlockDialog;
TQString m_decryptionPassword; TQString m_decryptionPassword;
bool m_decryptPasswordValid; bool m_decryptPasswordValid;

Loading…
Cancel
Save