mirror of
https://github.com/php-gnupg/php-gnupg.git
synced 2024-11-22 14:27:09 +00:00
Merge pull request #1 from remicollet/issue-zts
Fix callbacks prototype, to match exactly what expected.
This commit is contained in:
commit
ed1ace4128
1 changed files with 12 additions and 8 deletions
20
gnupg.c
20
gnupg.c
|
@ -395,14 +395,16 @@ PHP_MINFO_FUNCTION(gnupg)
|
||||||
|
|
||||||
/* {{{ passphrase_cb */
|
/* {{{ passphrase_cb */
|
||||||
gpgme_error_t passphrase_cb(
|
gpgme_error_t passphrase_cb(
|
||||||
PHPC_THIS_DECLARE(gnupg),
|
void *hook,
|
||||||
const char *uid_hint, const char *passphrase_info,
|
const char *uid_hint, const char *passphrase_info,
|
||||||
int last_was_bad, int fd TSRMLS_DC)
|
int last_was_bad, int fd)
|
||||||
{
|
{
|
||||||
char uid[17];
|
char uid[17];
|
||||||
int idx;
|
int idx;
|
||||||
char *passphrase = NULL;
|
char *passphrase = NULL;
|
||||||
zval *return_value = NULL;
|
zval *return_value = NULL;
|
||||||
|
PHPC_THIS_DECLARE(gnupg) = hook;
|
||||||
|
TSRMLS_FETCH();
|
||||||
|
|
||||||
if (last_was_bad) {
|
if (last_was_bad) {
|
||||||
GNUPG_ERR("Incorrent passphrase");
|
GNUPG_ERR("Incorrent passphrase");
|
||||||
|
@ -431,14 +433,16 @@ gpgme_error_t passphrase_cb(
|
||||||
|
|
||||||
/* {{{ passphrase_decrypt_cb */
|
/* {{{ passphrase_decrypt_cb */
|
||||||
gpgme_error_t passphrase_decrypt_cb (
|
gpgme_error_t passphrase_decrypt_cb (
|
||||||
PHPC_THIS_DECLARE(gnupg),
|
void *hook,
|
||||||
const char *uid_hint, const char *passphrase_info,
|
const char *uid_hint, const char *passphrase_info,
|
||||||
int last_was_bad, int fd TSRMLS_DC)
|
int last_was_bad, int fd)
|
||||||
{
|
{
|
||||||
char uid[17];
|
char uid[17];
|
||||||
int idx;
|
int idx;
|
||||||
char *passphrase = NULL;
|
char *passphrase = NULL;
|
||||||
zval *return_value = NULL;
|
zval *return_value = NULL;
|
||||||
|
PHPC_THIS_DECLARE(gnupg) = hook;
|
||||||
|
TSRMLS_FETCH();
|
||||||
|
|
||||||
if (last_was_bad) {
|
if (last_was_bad) {
|
||||||
GNUPG_ERR("Incorrent passphrase");
|
GNUPG_ERR("Incorrent passphrase");
|
||||||
|
@ -927,7 +931,7 @@ PHP_FUNCTION(gnupg_sign)
|
||||||
GNUPG_RES_FETCH();
|
GNUPG_RES_FETCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
gpgme_set_passphrase_cb(PHPC_THIS->ctx, (void *)passphrase_cb, PHPC_THIS);
|
gpgme_set_passphrase_cb(PHPC_THIS->ctx, passphrase_cb, PHPC_THIS);
|
||||||
if ((PHPC_THIS->err = gpgme_data_new_from_mem(&in, value, value_len, 0)) != GPG_ERR_NO_ERROR) {
|
if ((PHPC_THIS->err = gpgme_data_new_from_mem(&in, value, value_len, 0)) != GPG_ERR_NO_ERROR) {
|
||||||
GNUPG_ERR("could not create in-data buffer");
|
GNUPG_ERR("could not create in-data buffer");
|
||||||
return;
|
return;
|
||||||
|
@ -1063,7 +1067,7 @@ PHP_FUNCTION(gnupg_encryptsign)
|
||||||
GNUPG_ERR("no key for encryption set");
|
GNUPG_ERR("no key for encryption set");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
gpgme_set_passphrase_cb(PHPC_THIS->ctx, (void *)passphrase_cb, PHPC_THIS);
|
gpgme_set_passphrase_cb(PHPC_THIS->ctx, passphrase_cb, PHPC_THIS);
|
||||||
if ((PHPC_THIS->err = gpgme_data_new_from_mem (&in, value, value_len, 0)) != GPG_ERR_NO_ERROR) {
|
if ((PHPC_THIS->err = gpgme_data_new_from_mem (&in, value, value_len, 0)) != GPG_ERR_NO_ERROR) {
|
||||||
GNUPG_ERR("could not create in-data buffer");
|
GNUPG_ERR("could not create in-data buffer");
|
||||||
return;
|
return;
|
||||||
|
@ -1227,7 +1231,7 @@ PHP_FUNCTION(gnupg_decrypt)
|
||||||
GNUPG_RES_FETCH();
|
GNUPG_RES_FETCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
gpgme_set_passphrase_cb(PHPC_THIS->ctx, (void *)passphrase_decrypt_cb, PHPC_THIS);
|
gpgme_set_passphrase_cb(PHPC_THIS->ctx, passphrase_decrypt_cb, PHPC_THIS);
|
||||||
|
|
||||||
if ((PHPC_THIS->err = gpgme_data_new_from_mem(&in, enctxt, enctxt_len, 0)) != GPG_ERR_NO_ERROR) {
|
if ((PHPC_THIS->err = gpgme_data_new_from_mem(&in, enctxt, enctxt_len, 0)) != GPG_ERR_NO_ERROR) {
|
||||||
GNUPG_ERR("could not create in-data buffer");
|
GNUPG_ERR("could not create in-data buffer");
|
||||||
|
@ -1291,7 +1295,7 @@ PHP_FUNCTION(gnupg_decryptverify)
|
||||||
}
|
}
|
||||||
PHPC_PZVAL_DEREF(plaintext);
|
PHPC_PZVAL_DEREF(plaintext);
|
||||||
|
|
||||||
gpgme_set_passphrase_cb(PHPC_THIS->ctx, (void *)passphrase_decrypt_cb, PHPC_THIS);
|
gpgme_set_passphrase_cb(PHPC_THIS->ctx, passphrase_decrypt_cb, PHPC_THIS);
|
||||||
|
|
||||||
if ((PHPC_THIS->err = gpgme_data_new_from_mem(&in, enctxt, enctxt_len, 0)) != GPG_ERR_NO_ERROR) {
|
if ((PHPC_THIS->err = gpgme_data_new_from_mem(&in, enctxt, enctxt_len, 0)) != GPG_ERR_NO_ERROR) {
|
||||||
GNUPG_ERR("could not create in-data buffer");
|
GNUPG_ERR("could not create in-data buffer");
|
||||||
|
|
Loading…
Reference in a new issue