Adapted to new KPasswordEdit::password() signature. This relates to bug 2961.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/3/head
Michele Calgaro 6 years ago
parent 00c0d0cbd6
commit f1b7f3a2d2
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -29,15 +29,6 @@ import org.trinitydesktop.qt.TQWidget;
and thus include any passwords that were in memory. and thus include any passwords that were in memory.
</li> </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> @author Geert Jansen <jansen@kde.org>
@short A password input dialog. @short A password input dialog.

@ -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,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,TQWidget* arg5) : KPasswordDialog(arg1,arg2,arg3,arg4,arg5) {};
KPasswordDialogJBridge(KPasswordDialog::Types arg1,bool arg2,int arg3,const TQString& arg4) : KPasswordDialog(arg1,arg2,arg3,arg4) {}; 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); return (bool) KPasswordDialog::checkPassword(arg1);
} }
void protected_slotOk() { void protected_slotOk() {
@ -452,8 +452,9 @@ Java_org_trinitydesktop_koala_KPasswordDialog_allowEmptyPasswords(JNIEnv* env, j
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_org_trinitydesktop_koala_KPasswordDialog_checkPassword(JNIEnv* env, jobject obj, jstring arg1) Java_org_trinitydesktop_koala_KPasswordDialog_checkPassword(JNIEnv* env, jobject obj, jstring arg1)
{ {
static TQCString* _qstring_arg1 = 0; static TQString* _qstring_arg1 = 0;
jboolean xret = (jboolean) ((KPasswordDialogJBridge*) QtSupport::getQt(env, obj))->protected_checkPassword((const char*) QtSupport::toCharString(env, arg1, &_qstring_arg1)); jboolean xret = (jboolean) ((KPasswordDialogJBridge*) QtSupport::getQt(env, obj))->protected_checkPassword((const TQString&)*(TQString*) QtSupport::toTQString(env, arg1, &_qstring_arg1)
);
return xret; return xret;
} }
@ -502,13 +503,13 @@ JNIEXPORT jint JNICALL
Java_org_trinitydesktop_koala_KPasswordDialog_getNewPassword(JNIEnv* env, jclass cls, jobject password, jstring prompt) Java_org_trinitydesktop_koala_KPasswordDialog_getNewPassword(JNIEnv* env, jclass cls, jobject password, jstring prompt)
{ {
(void) cls; (void) cls;
static TQCString* _qcstring_password = 0; static TQString* _qstring_password = 0;
if (_qcstring_password == 0) { if (_qstring_password == 0) {
_qcstring_password = new TQCString(); _qstring_password = new TQString();
} }
static TQString* _qstring_prompt = 0; static TQString* _qstring_prompt = 0;
jint xret = (jint) KPasswordDialogJBridge::getNewPassword((TQCString&)*(TQCString*) _qcstring_password, (TQString)*(TQString*) QtSupport::toTQString(env, prompt, &_qstring_prompt)); jint xret = (jint) KPasswordDialogJBridge::getNewPassword((TQString&)*(TQString*) _qstring_password, (TQString)*(TQString*) QtSupport::toTQString(env, prompt, &_qstring_prompt));
QtSupport::fromTQCStringToStringBuffer(env, _qcstring_password, password); QtSupport::fromTQStringToStringBuffer(env, _qstring_password, password);
return xret; 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) Java_org_trinitydesktop_koala_KPasswordDialog_getPassword__Ljava_lang_StringBuffer_2Ljava_lang_String_2(JNIEnv* env, jclass cls, jobject password, jstring prompt)
{ {
(void) cls; (void) cls;
static TQCString* _qcstring_password = 0; static TQString* _qstring_password = 0;
if (_qcstring_password == 0) { if (_qstring_password == 0) {
_qcstring_password = new TQCString(); _qstring_password = new TQString();
} }
static TQString* _qstring_prompt = 0; static TQString* _qstring_prompt = 0;
jint xret = (jint) KPasswordDialogJBridge::getPassword((TQCString&)*(TQCString*) _qcstring_password, (TQString)*(TQString*) QtSupport::toTQString(env, prompt, &_qstring_prompt)); jint xret = (jint) KPasswordDialogJBridge::getPassword((TQString&)*(TQString*) _qstring_password, (TQString)*(TQString*) QtSupport::toTQString(env, prompt, &_qstring_prompt));
QtSupport::fromTQCStringToStringBuffer(env, _qcstring_password, password); QtSupport::fromTQStringToStringBuffer(env, _qstring_password, password);
return xret; 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) 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; (void) cls;
static TQCString* _qcstring_password = 0; static TQString* _qstring_password = 0;
if (_qcstring_password == 0) { if (_qstring_password == 0) {
_qcstring_password = new TQCString(); _qstring_password = new TQString();
} }
static TQString* _qstring_prompt = 0; static TQString* _qstring_prompt = 0;
int* _int_keep = QtSupport::toIntPtr(env, keep); 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); jint xret = (jint) KPasswordDialogJBridge::getPassword((TQString&)*(TQString*) _qstring_password, (TQString)*(TQString*) QtSupport::toTQString(env, prompt, &_qstring_prompt), (int*) _int_keep);
QtSupport::fromTQCStringToStringBuffer(env, _qcstring_password, password); QtSupport::fromTQStringToStringBuffer(env, _qstring_password, password);
env->SetIntArrayRegion(keep, 0, 1, (jint *) _int_keep); env->SetIntArrayRegion(keep, 0, 1, (jint *) _int_keep);
return xret; return xret;
} }
@ -651,9 +652,9 @@ Java_org_trinitydesktop_koala_KPasswordDialog_passwordStrengthWarningLevel(JNIEn
JNIEXPORT jstring JNICALL JNIEXPORT jstring JNICALL
Java_org_trinitydesktop_koala_KPasswordDialog_password(JNIEnv* env, jobject obj) Java_org_trinitydesktop_koala_KPasswordDialog_password(JNIEnv* env, jobject obj)
{ {
const char* _qstring; TQString _qstring;
_qstring = ((KPasswordDialog*) QtSupport::getQt(env, obj))->password(); _qstring = ((KPasswordDialog*) QtSupport::getQt(env, obj))->password();
return QtSupport::fromCharString(env, (char *) _qstring); return QtSupport::fromTQString(env, &_qstring);
} }
JNIEXPORT jstring JNICALL JNIEXPORT jstring JNICALL

@ -584,9 +584,9 @@ static TQCString* _qstring_name = 0;
JNIEXPORT jstring JNICALL JNIEXPORT jstring JNICALL
Java_org_trinitydesktop_koala_KPasswordEdit_password(JNIEnv* env, jobject obj) Java_org_trinitydesktop_koala_KPasswordEdit_password(JNIEnv* env, jobject obj)
{ {
const char* _qstring; TQString _qstring;
_qstring = ((KPasswordEdit*) QtSupport::getQt(env, obj))->password(); _qstring = ((KPasswordEdit*) QtSupport::getQt(env, obj))->password();
return QtSupport::fromCharString(env, (char *) _qstring); return QtSupport::fromTQString(env, &_qstring);
} }
JNIEXPORT void JNICALL JNIEXPORT void JNICALL

Loading…
Cancel
Save