summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tdejava/koala/org/trinitydesktop/koala/KPasswordDialog.java9
-rw-r--r--tdejava/koala/tdejava/KPasswordDialog.cpp41
-rw-r--r--tdejava/koala/tdejava/KPasswordEdit.cpp4
3 files changed, 23 insertions, 31 deletions
diff --git a/tdejava/koala/org/trinitydesktop/koala/KPasswordDialog.java b/tdejava/koala/org/trinitydesktop/koala/KPasswordDialog.java
index 592bf288..b205d7c9 100644
--- a/tdejava/koala/org/trinitydesktop/koala/KPasswordDialog.java
+++ b/tdejava/koala/org/trinitydesktop/koala/KPasswordDialog.java
@@ -29,15 +29,6 @@ import org.trinitydesktop.qt.TQWidget;
and thus include any passwords that were in memory.
</li>
- <li>
- You should delete passwords as soon as they are not needed anymore.
- The functions getPassword() and getNewPassword() return the
- password as a String. I believe this is safer than a String. A String
- stores its characters internally as 16-bit wide values, so conversions are
- needed, both for creating the String and by using it. The temporary
- memory used for these conversion is probably not erased. This could lead
- to stray passwords in memory, even if you think you erased all of them.
- </li>
@author Geert Jansen <jansen@kde.org>
@short A password input dialog.
diff --git a/tdejava/koala/tdejava/KPasswordDialog.cpp b/tdejava/koala/tdejava/KPasswordDialog.cpp
index 7ab6aa66..f76aad7d 100644
--- a/tdejava/koala/tdejava/KPasswordDialog.cpp
+++ b/tdejava/koala/tdejava/KPasswordDialog.cpp
@@ -16,7 +16,7 @@ public:
KPasswordDialogJBridge(KPasswordDialog::Types arg1,bool arg2,int arg3,const TQString& arg4,TQWidget* arg5,const char* arg6) : KPasswordDialog(arg1,arg2,arg3,arg4,arg5,arg6) {};
KPasswordDialogJBridge(KPasswordDialog::Types arg1,bool arg2,int arg3,const TQString& arg4,TQWidget* arg5) : KPasswordDialog(arg1,arg2,arg3,arg4,arg5) {};
KPasswordDialogJBridge(KPasswordDialog::Types arg1,bool arg2,int arg3,const TQString& arg4) : KPasswordDialog(arg1,arg2,arg3,arg4) {};
- bool protected_checkPassword(const char* arg1) {
+ bool protected_checkPassword(const TQString &arg1) {
return (bool) KPasswordDialog::checkPassword(arg1);
}
void protected_slotOk() {
@@ -452,8 +452,9 @@ Java_org_trinitydesktop_koala_KPasswordDialog_allowEmptyPasswords(JNIEnv* env, j
JNIEXPORT jboolean JNICALL
Java_org_trinitydesktop_koala_KPasswordDialog_checkPassword(JNIEnv* env, jobject obj, jstring arg1)
{
-static TQCString* _qstring_arg1 = 0;
- jboolean xret = (jboolean) ((KPasswordDialogJBridge*) QtSupport::getQt(env, obj))->protected_checkPassword((const char*) QtSupport::toCharString(env, arg1, &_qstring_arg1));
+static TQString* _qstring_arg1 = 0;
+ jboolean xret = (jboolean) ((KPasswordDialogJBridge*) QtSupport::getQt(env, obj))->protected_checkPassword((const TQString&)*(TQString*) QtSupport::toTQString(env, arg1, &_qstring_arg1)
+ );
return xret;
}
@@ -502,13 +503,13 @@ JNIEXPORT jint JNICALL
Java_org_trinitydesktop_koala_KPasswordDialog_getNewPassword(JNIEnv* env, jclass cls, jobject password, jstring prompt)
{
(void) cls;
-static TQCString* _qcstring_password = 0;
- if (_qcstring_password == 0) {
- _qcstring_password = new TQCString();
+static TQString* _qstring_password = 0;
+ if (_qstring_password == 0) {
+ _qstring_password = new TQString();
}
static TQString* _qstring_prompt = 0;
- jint xret = (jint) KPasswordDialogJBridge::getNewPassword((TQCString&)*(TQCString*) _qcstring_password, (TQString)*(TQString*) QtSupport::toTQString(env, prompt, &_qstring_prompt));
- QtSupport::fromTQCStringToStringBuffer(env, _qcstring_password, password);
+ jint xret = (jint) KPasswordDialogJBridge::getNewPassword((TQString&)*(TQString*) _qstring_password, (TQString)*(TQString*) QtSupport::toTQString(env, prompt, &_qstring_prompt));
+ QtSupport::fromTQStringToStringBuffer(env, _qstring_password, password);
return xret;
}
@@ -516,13 +517,13 @@ JNIEXPORT jint JNICALL
Java_org_trinitydesktop_koala_KPasswordDialog_getPassword__Ljava_lang_StringBuffer_2Ljava_lang_String_2(JNIEnv* env, jclass cls, jobject password, jstring prompt)
{
(void) cls;
-static TQCString* _qcstring_password = 0;
- if (_qcstring_password == 0) {
- _qcstring_password = new TQCString();
+static TQString* _qstring_password = 0;
+ if (_qstring_password == 0) {
+ _qstring_password = new TQString();
}
static TQString* _qstring_prompt = 0;
- jint xret = (jint) KPasswordDialogJBridge::getPassword((TQCString&)*(TQCString*) _qcstring_password, (TQString)*(TQString*) QtSupport::toTQString(env, prompt, &_qstring_prompt));
- QtSupport::fromTQCStringToStringBuffer(env, _qcstring_password, password);
+ jint xret = (jint) KPasswordDialogJBridge::getPassword((TQString&)*(TQString*) _qstring_password, (TQString)*(TQString*) QtSupport::toTQString(env, prompt, &_qstring_prompt));
+ QtSupport::fromTQStringToStringBuffer(env, _qstring_password, password);
return xret;
}
@@ -530,14 +531,14 @@ JNIEXPORT jint JNICALL
Java_org_trinitydesktop_koala_KPasswordDialog_getPassword__Ljava_lang_StringBuffer_2Ljava_lang_String_2_3I(JNIEnv* env, jclass cls, jobject password, jstring prompt, jintArray keep)
{
(void) cls;
-static TQCString* _qcstring_password = 0;
- if (_qcstring_password == 0) {
- _qcstring_password = new TQCString();
+static TQString* _qstring_password = 0;
+ if (_qstring_password == 0) {
+ _qstring_password = new TQString();
}
static TQString* _qstring_prompt = 0;
int* _int_keep = QtSupport::toIntPtr(env, keep);
- jint xret = (jint) KPasswordDialogJBridge::getPassword((TQCString&)*(TQCString*) _qcstring_password, (TQString)*(TQString*) QtSupport::toTQString(env, prompt, &_qstring_prompt), (int*) _int_keep);
- QtSupport::fromTQCStringToStringBuffer(env, _qcstring_password, password);
+ jint xret = (jint) KPasswordDialogJBridge::getPassword((TQString&)*(TQString*) _qstring_password, (TQString)*(TQString*) QtSupport::toTQString(env, prompt, &_qstring_prompt), (int*) _int_keep);
+ QtSupport::fromTQStringToStringBuffer(env, _qstring_password, password);
env->SetIntArrayRegion(keep, 0, 1, (jint *) _int_keep);
return xret;
}
@@ -651,9 +652,9 @@ Java_org_trinitydesktop_koala_KPasswordDialog_passwordStrengthWarningLevel(JNIEn
JNIEXPORT jstring JNICALL
Java_org_trinitydesktop_koala_KPasswordDialog_password(JNIEnv* env, jobject obj)
{
- const char* _qstring;
+ TQString _qstring;
_qstring = ((KPasswordDialog*) QtSupport::getQt(env, obj))->password();
- return QtSupport::fromCharString(env, (char *) _qstring);
+ return QtSupport::fromTQString(env, &_qstring);
}
JNIEXPORT jstring JNICALL
diff --git a/tdejava/koala/tdejava/KPasswordEdit.cpp b/tdejava/koala/tdejava/KPasswordEdit.cpp
index 6cadb6cf..a58d8f71 100644
--- a/tdejava/koala/tdejava/KPasswordEdit.cpp
+++ b/tdejava/koala/tdejava/KPasswordEdit.cpp
@@ -584,9 +584,9 @@ static TQCString* _qstring_name = 0;
JNIEXPORT jstring JNICALL
Java_org_trinitydesktop_koala_KPasswordEdit_password(JNIEnv* env, jobject obj)
{
- const char* _qstring;
+ TQString _qstring;
_qstring = ((KPasswordEdit*) QtSupport::getQt(env, obj))->password();
- return QtSupport::fromCharString(env, (char *) _qstring);
+ return QtSupport::fromTQString(env, &_qstring);
}
JNIEXPORT void JNICALL