- Removed some potentially harmful (deadlock) code.

- Put some printf into debugging #ifdef



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2784 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2010-04-25 19:26:37 +00:00
parent a6b5e8c364
commit 78644a2441
2 changed files with 223 additions and 203 deletions

View File

@ -104,7 +104,7 @@ gpg_error_t pgp_pwd_callback(void *hook, const char *uid_hint, const char *passp
} }
AuthGPG::AuthGPG() AuthGPG::AuthGPG()
:gpgmeInit(false),gpgmeKeySelected(false),autorisePasswordCallbackNotify(true),p3Config(CONFIG_TYPE_AUTHGPG) :gpgmeInit(false),gpgmeKeySelected(false),p3Config(CONFIG_TYPE_AUTHGPG)
{ {
{ {
RsStackReadWriteMutex stack(pgpMtx, RsReadWriteMutex::WRITE_LOCK); /******* LOCKED ******/ RsStackReadWriteMutex stack(pgpMtx, RsReadWriteMutex::WRITE_LOCK); /******* LOCKED ******/
@ -307,196 +307,202 @@ bool AuthGPG::storeAllKeys_timed() {
bool AuthGPG::storeAllKeys_locked() bool AuthGPG::storeAllKeys_locked()
{ {
#ifdef GPG_DEBUG #ifdef GPG_DEBUG
std::cerr << "AuthGPG::storeAllKeys_locked()" << std::endl; std::cerr << "AuthGPG::storeAllKeys_locked()" << std::endl;
#endif #endif
pgpMtx.writeLock(); std::list<std::string> gpg_change_trust_list;
gpg_error_t ERR;
if (!gpgmeInit)
{ {
std::cerr << "AuthGPG::storeAllKeys_locked() Error since GPG is not initialised" << std::endl; RsStackReadWriteMutex stack(pgpMtx, RsReadWriteMutex::WRITE_LOCK);
return false;
}
#ifdef GPG_DEBUG gpg_error_t ERR;
std::cerr << "AuthGPG::storeAllKeys_locked() clearing existing ones" << std::endl; if (!gpgmeInit)
#endif
/* enable SIG mode */
gpgme_keylist_mode_t origmode = gpgme_get_keylist_mode(CTX);
gpgme_keylist_mode_t mode = origmode | GPGME_KEYLIST_MODE_SIGS;
gpgme_set_keylist_mode(CTX, mode);
/* store keys */
gpgme_key_t KEY = NULL;
/* Initiates a key listing 0 = All Keys */
if (GPG_ERR_NO_ERROR != gpgme_op_keylist_start (CTX, "", 0))
{
std::cerr << "AuthGPG::storeAllKeys_locked() Error iterating through KeyList" << std::endl;
// if (rsicontrol != NULL) {
// rsicontrol->getNotify().notifyErrorMsg(0,0,"Error reading gpg keyring, cannot acess key list.");
// }
gpgme_set_keylist_mode(CTX, origmode);
return false;
}
/* Loop until end of key */
mStoreKeyTime = time(NULL);
ERR = gpgme_op_keylist_next (CTX, &KEY);
if (GPG_ERR_NO_ERROR != ERR) {
std::cerr << "AuthGPG::storeAllKeys_locked() didn't find any gpg key in the keyring" << std::endl;
// if (rsicontrol != NULL) {
// rsicontrol->getNotify().notifyErrorMsg(0,0,"Error reading gpg keyring, cannot find any key in the list.");
// }
return false;
} else {
//let's start a new list
mKeyList.clear();
}
std::list<std::string> gpg_change_trust_list;
for(int i = 0;GPG_ERR_NO_ERROR == ERR; i++)
{
/* store in pqiAuthDetails */
gpgcert nu;
/* NB subkeys is a linked list and can contain multiple keys.
* first key is primary.
*/
if ((!KEY->subkeys) || (!KEY->uids))
{ {
std::cerr << "AuthGPG::storeAllKeys_locked() Invalid Key in List... skipping" << std::endl; std::cerr << "AuthGPG::storeAllKeys_locked() Error since GPG is not initialised" << std::endl;
continue; return false;
} }
/* In general MainSubKey is used to sign all others!
* Don't really need to worry about other ids either.
*/
gpgme_subkey_t mainsubkey = KEY->subkeys;
nu.id = mainsubkey->keyid;
nu.fpr = mainsubkey->fpr;
#ifdef GPG_DEBUG #ifdef GPG_DEBUG
std::cerr << "MAIN KEYID: " << nu.id << " FPR: " << nu.fpr << std::endl; std::cerr << "AuthGPG::storeAllKeys_locked() clearing existing ones" << std::endl;
gpgme_subkey_t subkeylist = KEY->subkeys;
while(subkeylist != NULL)
{
std::cerr << "\tKEYID: " << subkeylist->keyid << " FPR: " << subkeylist->fpr << std::endl;
subkeylist = subkeylist->next;
}
#endif #endif
/* enable SIG mode */
gpgme_keylist_mode_t origmode = gpgme_get_keylist_mode(CTX);
gpgme_keylist_mode_t mode = origmode | GPGME_KEYLIST_MODE_SIGS;
/* NB uids is a linked list and can contain multiple ids. gpgme_set_keylist_mode(CTX, mode);
* first id is primary.
*/ /* store keys */
gpgme_user_id_t mainuid = KEY->uids; gpgme_key_t KEY = NULL;
nu.name = mainuid->name;
nu.email = mainuid->email; /* Initiates a key listing 0 = All Keys */
gpgme_key_sig_t mainsiglist = mainuid->signatures; if (GPG_ERR_NO_ERROR != gpgme_op_keylist_start (CTX, "", 0))
std::map<std::string, bool>::iterator itAccept;
if (mAcceptToConnectMap.end() != (itAccept = mAcceptToConnectMap.find(nu.id))) {
nu.accept_connection = itAccept->second;
} else {
nu.accept_connection = false;
mAcceptToConnectMap[nu.id] = false;
}
nu.ownsign = false;
while(mainsiglist != NULL)
{ {
if (mainsiglist->status == GPG_ERR_NO_ERROR) std::cerr << "AuthGPG::storeAllKeys_locked() Error iterating through KeyList" << std::endl;
// if (rsicontrol != NULL) {
// rsicontrol->getNotify().notifyErrorMsg(0,0,"Error reading gpg keyring, cannot acess key list.");
// }
gpgme_set_keylist_mode(CTX, origmode);
return false;
}
/* Loop until end of key */
mStoreKeyTime = time(NULL);
ERR = gpgme_op_keylist_next (CTX, &KEY);
if (GPG_ERR_NO_ERROR != ERR) {
std::cerr << "AuthGPG::storeAllKeys_locked() didn't find any gpg key in the keyring" << std::endl;
// if (rsicontrol != NULL) {
// rsicontrol->getNotify().notifyErrorMsg(0,0,"Error reading gpg keyring, cannot find any key in the list.");
// }
return false;
} else {
//let's start a new list
mKeyList.clear();
}
for(int i = 0;GPG_ERR_NO_ERROR == ERR; i++)
{
/* store in pqiAuthDetails */
gpgcert nu;
/* NB subkeys is a linked list and can contain multiple keys.
* first key is primary.
*/
if ((!KEY->subkeys) || (!KEY->uids))
{ {
/* add as a signature ... even if the std::cerr << "AuthGPG::storeAllKeys_locked() Invalid Key in List... skipping" << std::endl;
* we haven't go the peer yet. continue;
* (might be yet to come). }
*/
std::string keyid = mainsiglist->keyid; /* In general MainSubKey is used to sign all others!
if (nu.signers.end() == std::find( * Don't really need to worry about other ids either.
nu.signers.begin(), */
nu.signers.end(),keyid)) gpgme_subkey_t mainsubkey = KEY->subkeys;
nu.id = mainsubkey->keyid;
nu.fpr = mainsubkey->fpr;
#ifdef GPG_DEBUG
std::cerr << "MAIN KEYID: " << nu.id << " FPR: " << nu.fpr << std::endl;
gpgme_subkey_t subkeylist = KEY->subkeys;
while(subkeylist != NULL)
{
std::cerr << "\tKEYID: " << subkeylist->keyid << " FPR: " << subkeylist->fpr << std::endl;
subkeylist = subkeylist->next;
}
#endif
/* NB uids is a linked list and can contain multiple ids.
* first id is primary.
*/
gpgme_user_id_t mainuid = KEY->uids;
nu.name = mainuid->name;
nu.email = mainuid->email;
gpgme_key_sig_t mainsiglist = mainuid->signatures;
std::map<std::string, bool>::iterator itAccept;
if (mAcceptToConnectMap.end() != (itAccept = mAcceptToConnectMap.find(nu.id))) {
nu.accept_connection = itAccept->second;
} else {
nu.accept_connection = false;
mAcceptToConnectMap[nu.id] = false;
}
nu.ownsign = false;
while(mainsiglist != NULL)
{
if (mainsiglist->status == GPG_ERR_NO_ERROR)
{ {
nu.signers.push_back(keyid); /* add as a signature ... even if the
* we haven't go the peer yet.
* (might be yet to come).
*/
std::string keyid = mainsiglist->keyid;
if (nu.signers.end() == std::find(
nu.signers.begin(),
nu.signers.end(),keyid))
{
nu.signers.push_back(keyid);
}
if (keyid == mOwnGpgId) {
nu.ownsign = true;
}
} }
if (keyid == mOwnGpgId) { mainsiglist = mainsiglist->next;
nu.ownsign = true;
}
} }
mainsiglist = mainsiglist->next;
}
#ifdef GPG_DEBUG #ifdef GPG_DEBUG
gpgme_user_id_t uidlist = KEY->uids; gpgme_user_id_t uidlist = KEY->uids;
while(uidlist != NULL) while(uidlist != NULL)
{
std::cerr << "\tUID: " << uidlist->uid;
std::cerr << " NAME: " << uidlist->name;
std::cerr << " EMAIL: " << uidlist->email;
std::cerr << " VALIDITY: " << uidlist->validity;
std::cerr << std::endl;
gpgme_key_sig_t usiglist = uidlist->signatures;
while(usiglist != NULL)
{ {
std::cerr << "\t\tSIG KEYID: " << usiglist->keyid; std::cerr << "\tUID: " << uidlist->uid;
std::cerr << " UID: " << usiglist->uid; std::cerr << " NAME: " << uidlist->name;
std::cerr << " NAME: " << usiglist->name; std::cerr << " EMAIL: " << uidlist->email;
std::cerr << " EMAIL: " << usiglist->email; std::cerr << " VALIDITY: " << uidlist->validity;
std::cerr << " VALIDITY: " << (usiglist->status == GPG_ERR_NO_ERROR);
std::cerr << std::endl; std::cerr << std::endl;
gpgme_key_sig_t usiglist = uidlist->signatures;
while(usiglist != NULL)
{
std::cerr << "\t\tSIG KEYID: " << usiglist->keyid;
std::cerr << " UID: " << usiglist->uid;
std::cerr << " NAME: " << usiglist->name;
std::cerr << " EMAIL: " << usiglist->email;
std::cerr << " VALIDITY: " << (usiglist->status == GPG_ERR_NO_ERROR);
std::cerr << std::endl;
usiglist = usiglist->next; usiglist = usiglist->next;
}
uidlist = uidlist->next;
} }
uidlist = uidlist->next;
}
#endif #endif
/* signatures are attached to uids... but only supplied /* signatures are attached to uids... but only supplied
* if GPGME_KEYLIST_MODE_SIGS is on. * if GPGME_KEYLIST_MODE_SIGS is on.
* signature notation supplied is GPGME_KEYLIST_MODE_SIG_NOTATION is on * signature notation supplied is GPGME_KEYLIST_MODE_SIG_NOTATION is on
*/ */
nu.trustLvl = KEY->owner_trust; nu.trustLvl = KEY->owner_trust;
nu.validLvl = mainuid->validity; nu.validLvl = mainuid->validity;
/* grab a reference, so the key remains */ /* grab a reference, so the key remains */
gpgme_key_ref(KEY); gpgme_key_ref(KEY);
nu.key = KEY; nu.key = KEY;
/* store in map */ /* store in map */
mKeyList[nu.id] = nu; mKeyList[nu.id] = nu;
if (nu.trustLvl < 2 && nu.accept_connection) { #ifdef GPG_DEBUG
//add it to the list of key that we will force the trust to 2 std::cerr << "nu.name" << nu.name << std::endl;
gpg_change_trust_list.push_back(nu.id); std::cerr << "nu.trustLvl" << nu.trustLvl << std::endl;
} std::cerr << "nu.accept_connection" << nu.accept_connection << std::endl;
#endif
if (nu.trustLvl < 2 && nu.accept_connection) {
//add it to the list of key that we will force the trust to 2
gpg_change_trust_list.push_back(nu.id);
}
//store own key //store own key
if (nu.id == mOwnGpgId) { if (nu.id == mOwnGpgId) {
mOwnGpgCert = nu; mOwnGpgCert = nu;
} }
ERR = gpgme_op_keylist_next (CTX, &KEY); ERR = gpgme_op_keylist_next (CTX, &KEY);
} }
if (GPG_ERR_NO_ERROR != gpgme_op_keylist_end(CTX))
{
std::cerr << "Error ending KeyList" << std::endl;
gpgme_set_keylist_mode(CTX, origmode);
return false;
}
if (GPG_ERR_NO_ERROR != gpgme_op_keylist_end(CTX))
{
std::cerr << "Error ending KeyList" << std::endl;
gpgme_set_keylist_mode(CTX, origmode); gpgme_set_keylist_mode(CTX, origmode);
return false;
} }
gpgme_set_keylist_mode(CTX, origmode); std::list<std::string>::iterator it;
pgpMtx.writeUnlock(); for(it = gpg_change_trust_list.begin(); it != gpg_change_trust_list.end(); it++)
{
std::list<std::string>::iterator it; privateTrustCertificate(*it, 3);
for(it = gpg_change_trust_list.begin(); it != gpg_change_trust_list.end(); it++) }
{
privateTrustCertificate(*it, 3);
}
return true; return true;
@ -1284,15 +1290,15 @@ bool AuthGPG::setAcceptToConnectGPGCertificate(std::string gpg_id, bool acceptan
/* reload stuff now ... */ /* reload stuff now ... */
storeAllKeys_locked(); storeAllKeys_locked();
pgpMtx.writeLock(); {
certmap::iterator it; RsStackReadWriteMutex stack(pgpMtx, RsReadWriteMutex::WRITE_LOCK);
if (mKeyList.end() == (it = mKeyList.find(gpg_id))) { certmap::iterator it;
return false; if (mKeyList.end() == (it = mKeyList.find(gpg_id))) {
} return false;
it->second.accept_connection = acceptance; }
mAcceptToConnectMap[gpg_id] = acceptance; it->second.accept_connection = acceptance;
mAcceptToConnectMap[gpg_id] = acceptance;
pgpMtx.writeUnlock(); }
storeAllKeys_locked(); storeAllKeys_locked();
IndicateConfigChanged(); IndicateConfigChanged();
@ -1430,28 +1436,30 @@ int AuthGPG::privateTrustCertificate(std::string id, int trustlvl)
return 0; return 0;
} }
pgpMtx.writeLock(); {
gpgcert trustCert = mKeyList.find(id)->second; RsStackReadWriteMutex stack(pgpMtx, RsReadWriteMutex::WRITE_LOCK);
gpgme_key_t trustKey = trustCert.key;
std::string trustString; gpgcert trustCert = mKeyList.find(id)->second;
std::ostringstream trustStrOut; gpgme_key_t trustKey = trustCert.key;
trustStrOut << trustlvl; std::string trustString;
class TrustParams sparams(trustStrOut.str()); std::ostringstream trustStrOut;
class EditParams params(TRUST_START, &sparams); trustStrOut << trustlvl;
gpgme_data_t out; class TrustParams sparams(trustStrOut.str());
gpg_error_t ERR; class EditParams params(TRUST_START, &sparams);
gpgme_data_t out;
gpg_error_t ERR;
if(GPG_ERR_NO_ERROR != (ERR = gpgme_data_new(&out))) { if(GPG_ERR_NO_ERROR != (ERR = gpgme_data_new(&out))) {
return 0; return 0;
} }
if(GPG_ERR_NO_ERROR != (ERR = gpgme_op_edit(CTX, trustKey, trustCallback, &params, out))) if(GPG_ERR_NO_ERROR != (ERR = gpgme_op_edit(CTX, trustKey, trustCallback, &params, out)))
return 0; return 0;
//the key ref has changed, we got to get rid of the old reference. //the key ref has changed, we got to get rid of the old reference.
trustCert.key = NULL; trustCert.key = NULL;
pgpMtx.writeUnlock(); }
storeAllKeys_locked(); storeAllKeys_locked();
@ -1600,6 +1608,7 @@ static std::string setKeyPairParams(bool useRsa, unsigned int blen,
* from the keyring * from the keyring
*/ */
#ifdef UNUSED_CODE
static gpgme_key_t getKey(gpgme_ctx_t CTX, std::string name, std::string comment, std::string email) { static gpgme_key_t getKey(gpgme_ctx_t CTX, std::string name, std::string comment, std::string email) {
gpgme_key_t key; gpgme_key_t key;
@ -1643,6 +1652,7 @@ static gpgme_key_t getKey(gpgme_ctx_t CTX, std::string name, std::string comment
} }
return NULL; return NULL;
} }
#endif
/* Callback function for key signing */ /* Callback function for key signing */
@ -1653,7 +1663,7 @@ static gpg_error_t keySignCallback(void *opaque, gpgme_status_code_t status, \
class EditParams *params = (class EditParams *)opaque; class EditParams *params = (class EditParams *)opaque;
class SignParams *sparams = (class SignParams *)params->oParams; class SignParams *sparams = (class SignParams *)params->oParams;
const char *result = NULL; const char *result = NULL;
#ifdef GPG_DEBUG
fprintf(stderr,"keySignCallback status: %d args: %s, params->state: %d\n", status, args, params->state); fprintf(stderr,"keySignCallback status: %d args: %s, params->state: %d\n", status, args, params->state);
/* printf stuff out */ /* printf stuff out */
@ -1695,6 +1705,7 @@ static gpg_error_t keySignCallback(void *opaque, gpgme_status_code_t status, \
fprintf(stderr,"keySignCallback params->state SIGN_ENTER_PASSPHRASE\n"); fprintf(stderr,"keySignCallback params->state SIGN_ENTER_PASSPHRASE\n");
if (params->state == SIGN_ERROR) if (params->state == SIGN_ERROR)
fprintf(stderr,"keySignCallback params->state SIGN_ERROR"); fprintf(stderr,"keySignCallback params->state SIGN_ERROR");
#endif
if(status == GPGME_STATUS_EOF || if(status == GPGME_STATUS_EOF ||
@ -1714,7 +1725,9 @@ static gpg_error_t keySignCallback(void *opaque, gpgme_status_code_t status, \
switch (params->state) switch (params->state)
{ {
case SIGN_START: case SIGN_START:
#ifdef GPG_DEBUG
fprintf(stderr,"keySignCallback SIGN_START\n"); fprintf(stderr,"keySignCallback SIGN_START\n");
#endif
if (status == GPGME_STATUS_GET_LINE && if (status == GPGME_STATUS_GET_LINE &&
(!std::string("keyedit.prompt").compare(args))) (!std::string("keyedit.prompt").compare(args)))
@ -1729,7 +1742,9 @@ static gpg_error_t keySignCallback(void *opaque, gpgme_status_code_t status, \
} }
break; break;
case SIGN_COMMAND: case SIGN_COMMAND:
#ifdef GPG_DEBUG
fprintf(stderr,"keySignCallback SIGN_COMMAND\n"); fprintf(stderr,"keySignCallback SIGN_COMMAND\n");
#endif
if (status == GPGME_STATUS_GET_BOOL && if (status == GPGME_STATUS_GET_BOOL &&
(!std::string("keyedit.sign_all.okay").compare(args))) (!std::string("keyedit.sign_all.okay").compare(args)))
@ -1775,7 +1790,9 @@ static gpg_error_t keySignCallback(void *opaque, gpgme_status_code_t status, \
} }
break; break;
case SIGN_UIDS: case SIGN_UIDS:
#ifdef GPG_DEBUG
fprintf(stderr,"keySignCallback SIGN_UIDS\n"); fprintf(stderr,"keySignCallback SIGN_UIDS\n");
#endif
if (status == GPGME_STATUS_GET_LINE && if (status == GPGME_STATUS_GET_LINE &&
(!std::string("sign_uid.expire").compare(args))) (!std::string("sign_uid.expire").compare(args)))
@ -1809,7 +1826,9 @@ static gpg_error_t keySignCallback(void *opaque, gpgme_status_code_t status, \
} }
break; break;
case SIGN_SET_EXPIRE: case SIGN_SET_EXPIRE:
#ifdef GPG_DEBUG
fprintf(stderr,"keySignCallback SIGN_SET_EXPIRE\n"); fprintf(stderr,"keySignCallback SIGN_SET_EXPIRE\n");
#endif
if (status == GPGME_STATUS_GET_LINE && if (status == GPGME_STATUS_GET_LINE &&
(!std::string("sign_uid.class").compare(args))) (!std::string("sign_uid.class").compare(args)))
@ -1824,7 +1843,9 @@ static gpg_error_t keySignCallback(void *opaque, gpgme_status_code_t status, \
} }
break; break;
case SIGN_SET_CHECK_LEVEL: case SIGN_SET_CHECK_LEVEL:
#ifdef GPG_DEBUG
fprintf(stderr,"keySignCallback SIGN_SET_CHECK_LEVEL\n"); fprintf(stderr,"keySignCallback SIGN_SET_CHECK_LEVEL\n");
#endif
if (status == GPGME_STATUS_GET_BOOL && if (status == GPGME_STATUS_GET_BOOL &&
(!std::string("sign_uid.okay").compare(args))) (!std::string("sign_uid.okay").compare(args)))
@ -1839,7 +1860,9 @@ static gpg_error_t keySignCallback(void *opaque, gpgme_status_code_t status, \
} }
break; break;
case SIGN_ENTER_PASSPHRASE: case SIGN_ENTER_PASSPHRASE:
#ifdef GPG_DEBUG
fprintf(stderr,"keySignCallback SIGN_ENTER_PASSPHRASE\n"); fprintf(stderr,"keySignCallback SIGN_ENTER_PASSPHRASE\n");
#endif
if (status == GPGME_STATUS_GOOD_PASSPHRASE) if (status == GPGME_STATUS_GOOD_PASSPHRASE)
{ {
@ -1852,7 +1875,9 @@ static gpg_error_t keySignCallback(void *opaque, gpgme_status_code_t status, \
} }
break; break;
case SIGN_CONFIRM: case SIGN_CONFIRM:
#ifdef GPG_DEBUG
fprintf(stderr,"keySignCallback SIGN_CONFIRM\n"); fprintf(stderr,"keySignCallback SIGN_CONFIRM\n");
#endif
if (status == GPGME_STATUS_GET_LINE && if (status == GPGME_STATUS_GET_LINE &&
(!std::string("keyedit.prompt").compare(args))) (!std::string("keyedit.prompt").compare(args)))
@ -1867,7 +1892,9 @@ static gpg_error_t keySignCallback(void *opaque, gpgme_status_code_t status, \
} }
break; break;
case SIGN_QUIT: case SIGN_QUIT:
#ifdef GPG_DEBUG
fprintf(stderr,"keySignCallback SIGN_QUIT\n"); fprintf(stderr,"keySignCallback SIGN_QUIT\n");
#endif
if (status == GPGME_STATUS_GET_BOOL && if (status == GPGME_STATUS_GET_BOOL &&
(!std::string("keyedit.save.okay").compare(args))) (!std::string("keyedit.save.okay").compare(args)))
@ -1882,7 +1909,9 @@ static gpg_error_t keySignCallback(void *opaque, gpgme_status_code_t status, \
} }
break; break;
case SIGN_ERROR: case SIGN_ERROR:
#ifdef GPG_DEBUG
fprintf(stderr,"keySignCallback SIGN_ERROR\n"); fprintf(stderr,"keySignCallback SIGN_ERROR\n");
#endif
if (status == GPGME_STATUS_GET_LINE && if (status == GPGME_STATUS_GET_LINE &&
(!std::string("keyedit.prompt").compare(args))) (!std::string("keyedit.prompt").compare(args)))
@ -1904,7 +1933,9 @@ static gpg_error_t keySignCallback(void *opaque, gpgme_status_code_t status, \
if (result) if (result)
{ {
#ifdef GPG_DEBUG
fprintf(stderr,"keySignCallback result:%s\n", result); fprintf(stderr,"keySignCallback result:%s\n", result);
#endif
#ifndef WINDOWS_SYS #ifndef WINDOWS_SYS
if (*result) if (*result)
{ {
@ -1941,6 +1972,7 @@ static gpgme_error_t trustCallback(void *opaque, gpgme_status_code_t status, \
const char *result = NULL; const char *result = NULL;
/* printf stuff out */ /* printf stuff out */
#ifdef GPG_DEBUG
if (status == GPGME_STATUS_EOF) if (status == GPGME_STATUS_EOF)
fprintf(stderr,"keySignCallback GPGME_STATUS_EOF\n"); fprintf(stderr,"keySignCallback GPGME_STATUS_EOF\n");
if (status == GPGME_STATUS_GOT_IT) if (status == GPGME_STATUS_GOT_IT)
@ -1973,6 +2005,7 @@ static gpgme_error_t trustCallback(void *opaque, gpgme_status_code_t status, \
fprintf(stderr,"keySignCallback params->state TRUST_QUIT\n"); fprintf(stderr,"keySignCallback params->state TRUST_QUIT\n");
if (params->state == TRUST_ERROR) if (params->state == TRUST_ERROR)
fprintf(stderr,"keySignCallback params->state TRUST_ERROR\n"); fprintf(stderr,"keySignCallback params->state TRUST_ERROR\n");
#endif
if(status == GPGME_STATUS_EOF || if(status == GPGME_STATUS_EOF ||
@ -2159,11 +2192,3 @@ bool AuthGPG::loadList(std::list<RsItem*> load)
return true; return true;
} }
void AuthGPG::setAutorisePasswordCallbackNotify(bool autorise) {
autorisePasswordCallbackNotify = autorise;
return;
}
bool AuthGPG::getAutorisePasswordCallbackNotify() {
return autorisePasswordCallbackNotify;
}

View File

@ -130,9 +130,6 @@ class AuthGPG : public p3Config
bool printKeys(); bool printKeys();
void setAutorisePasswordCallbackNotify(bool);
bool getAutorisePasswordCallbackNotify();
/*********************************************************************************/ /*********************************************************************************/
/************************* STAGE 1 ***********************************************/ /************************* STAGE 1 ***********************************************/
/*********************************************************************************/ /*********************************************************************************/
@ -253,8 +250,6 @@ private:
bool gpgmeKeySelected; bool gpgmeKeySelected;
bool autorisePasswordCallbackNotify;
gpgme_engine_info_t INFO; gpgme_engine_info_t INFO;
gpgme_ctx_t CTX; gpgme_ctx_t CTX;