PAM die zweite, jetzt mit Appdata Pointer Problem
-
Hallo Zusammen,
hat jemand von Euch schon mal PAM mit Application Parameter verwendet.
Ich versuche derzeit eine eigene Passwordeingabe via PAM in einer GUI Anwendung zu realisieren und bekomme zum verrecken meine Eingabe nicht in die Conv() Routine übergeben.Hier die Struktur:
char *upassword; static struct pam_conv conv = { Conversation, upassword };
Hier die Convertier-Routine
extern "C" int Conversation(int num_msg, const pam_message **msg, pam_response **resp, void *appdata_ptr) { char *data; pam_response *reply; data=(char*)appdata_ptr; if (data == NULL) return PAM_SYSTEM_ERR; reply = (pam_response*) calloc(num_msg, sizeof(pam_response)); if (!reply) return PAM_SYSTEM_ERR; reply[0].resp_retcode = PAM_SUCCESS; reply[0].resp = strdup(data); *resp = reply; return PAM_SUCCESS; }
Hier der Aufruf in der Klasse:
void UserLogin::Button_Ok() { QString Temp; const char *userID; pam_handle_t *pamh=NULL; int retval; userID = (const char*) Operator->GetID().toLatin1(); upassword = (char*) ((const char*) Password.toLatin1()); retval = pam_start("check_user", userID, &conv, &pamh); if (retval == PAM_SUCCESS) { retval = pam_authenticate(pamh, 0); if (retval == PAM_SUCCESS) { retval = pam_acct_mgmt(pamh, 0); if (retval == PAM_SUCCESS) { pam_end(pamh,retval); /*Operator->SetFullName( Temp );*/ done(1); } else { QMessageBox::critical(this, tr("User Login Failure"), tr("Login : wrong password"), QMessageBox::Close); } } else { QMessageBox::critical(this, tr("User Login Failure"), tr("Login : Access diened"), QMessageBox::Close); } } else { QMessageBox::critical(this, tr("User Login Failure"), tr("Error: No PAM-Connection !"), QMessageBox::Close); } if( pam_end(pamh,retval) != PAM_SUCCESS) { QMessageBox::critical(this, tr("User Login Failure"), tr("Error closing PAM-Connection !"), QMessageBox::Close); } }
Ich weiss nicht, wie ich der Routine mein Passwort übergeben soll.
Alle Versuche schlagen derzeit fehl.Der Pointer "appdata_ptr" ist immer NULL und daher keine Prüfung.
Danke für jede Hilfe.
Gruss