This commit is contained in:
mutec 2020-12-20 00:36:29 +01:00
parent ff7a72120e
commit 0c01fdc5b4
No known key found for this signature in database
GPG key ID: 7A323A632F05D0BC
2 changed files with 66 additions and 66 deletions

124
gnupg.c
View file

@ -42,7 +42,7 @@ PHPC_OBJ_DEFINE_HANDLER_VAR(gnupg);
if (this) { \ if (this) { \
PHPC_THIS_FETCH_FROM_ZVAL(gnupg, this); \ PHPC_THIS_FETCH_FROM_ZVAL(gnupg, this); \
if (!PHPC_THIS) { \ if (!PHPC_THIS) { \
php_error_docref(NULL TSRMLS_CC, E_WARNING, \ php_error_docref(NULL, E_WARNING, \
"Invalid or unitialized gnupg object"); \ "Invalid or unitialized gnupg object"); \
RETURN_FALSE; \ RETURN_FALSE; \
} \ } \
@ -59,21 +59,21 @@ PHPC_OBJ_DEFINE_HANDLER_VAR(gnupg);
if (PHPC_THIS) { \ if (PHPC_THIS) { \
switch (PHPC_THIS->errormode) { \ switch (PHPC_THIS->errormode) { \
case 1: \ case 1: \
php_error_docref(NULL TSRMLS_CC, E_WARNING, \ php_error_docref(NULL, E_WARNING, \
(char*)error); \ (char*)error); \
break; \ break; \
case 2: \ case 2: \
zend_throw_exception(\ zend_throw_exception(\
zend_exception_get_default(TSRMLS_C), \ zend_exception_get_default(), \
(char*) error, \ (char*) error, \
0 TSRMLS_CC \ 0 \
); \ ); \
break; \ break; \
default: \ default: \
PHPC_THIS->errortxt = (char*)error; \ PHPC_THIS->errortxt = (char*)error; \
} \ } \
} else { \ } else { \
php_error_docref(NULL TSRMLS_CC, E_WARNING, (char*)error); \ php_error_docref(NULL, E_WARNING, (char*)error); \
} \ } \
do { \ do { \
if (return_value) { \ if (return_value) { \
@ -83,7 +83,7 @@ PHPC_OBJ_DEFINE_HANDLER_VAR(gnupg);
/* }}} */ /* }}} */
/* {{{ php_gnupg_free_encryptkeys */ /* {{{ php_gnupg_free_encryptkeys */
static void php_gnupg_free_encryptkeys(PHPC_THIS_DECLARE(gnupg) TSRMLS_DC) static void php_gnupg_free_encryptkeys(PHPC_THIS_DECLARE(gnupg))
{ {
if (PHPC_THIS) { if (PHPC_THIS) {
int idx; int idx;
@ -101,7 +101,7 @@ static void php_gnupg_free_encryptkeys(PHPC_THIS_DECLARE(gnupg) TSRMLS_DC)
/* }}} */ /* }}} */
/* {{{ php_gnupg_this_free */ /* {{{ php_gnupg_this_free */
static void php_gnupg_this_free(PHPC_THIS_DECLARE(gnupg) TSRMLS_DC) static void php_gnupg_this_free(PHPC_THIS_DECLARE(gnupg))
{ {
if (PHPC_THIS) { if (PHPC_THIS) {
if (PHPC_THIS->ctx) { if (PHPC_THIS->ctx) {
@ -111,7 +111,7 @@ static void php_gnupg_this_free(PHPC_THIS_DECLARE(gnupg) TSRMLS_DC)
PHPC_THIS->ctx = NULL; PHPC_THIS->ctx = NULL;
} }
/* basic cleanup */ /* basic cleanup */
php_gnupg_free_encryptkeys(PHPC_THIS TSRMLS_CC); php_gnupg_free_encryptkeys(PHPC_THIS);
zend_hash_destroy(PHPC_THIS->signkeys); zend_hash_destroy(PHPC_THIS->signkeys);
FREE_HASHTABLE(PHPC_THIS->signkeys); FREE_HASHTABLE(PHPC_THIS->signkeys);
zend_hash_destroy(PHPC_THIS->decryptkeys); zend_hash_destroy(PHPC_THIS->decryptkeys);
@ -121,7 +121,7 @@ static void php_gnupg_this_free(PHPC_THIS_DECLARE(gnupg) TSRMLS_DC)
/* }}} */ /* }}} */
/* {{{ php_gnupg_this_init */ /* {{{ php_gnupg_this_init */
static void php_gnupg_this_init(PHPC_THIS_DECLARE(gnupg) TSRMLS_DC) static void php_gnupg_this_init(PHPC_THIS_DECLARE(gnupg))
{ {
/* init the gpgme-lib and set the default values */ /* init the gpgme-lib and set the default values */
gpgme_ctx_t ctx; gpgme_ctx_t ctx;
@ -148,7 +148,7 @@ static void php_gnupg_this_init(PHPC_THIS_DECLARE(gnupg) TSRMLS_DC)
#endif #endif
/* {{{ php_gnupg_this_make */ /* {{{ php_gnupg_this_make */
static void php_gnupg_this_make(PHPC_THIS_DECLARE(gnupg), zval *options TSRMLS_DC) static void php_gnupg_this_make(PHPC_THIS_DECLARE(gnupg), zval *options)
{ {
if (PHPC_THIS->err == GPG_ERR_NO_ERROR) { if (PHPC_THIS->err == GPG_ERR_NO_ERROR) {
char *file_name = GNUPG_PATH; char *file_name = GNUPG_PATH;
@ -176,10 +176,10 @@ static void php_gnupg_this_make(PHPC_THIS_DECLARE(gnupg), zval *options TSRMLS_D
/* }}} */ /* }}} */
/* {{{ php_gnupg_res_dtor */ /* {{{ php_gnupg_res_dtor */
static void php_gnupg_res_dtor(phpc_res_entry_t *rsrc TSRMLS_DC) /* {{{ */ static void php_gnupg_res_dtor(phpc_res_entry_t *rsrc) /* {{{ */
{ {
PHPC_THIS_DECLARE(gnupg) = rsrc->ptr; PHPC_THIS_DECLARE(gnupg) = rsrc->ptr;
php_gnupg_this_free(PHPC_THIS TSRMLS_CC); php_gnupg_this_free(PHPC_THIS);
efree(PHPC_THIS); efree(PHPC_THIS);
} }
/* }}} */ /* }}} */
@ -189,7 +189,7 @@ PHPC_OBJ_HANDLER_FREE(gnupg)
{ {
PHPC_OBJ_HANDLER_FREE_INIT(gnupg); PHPC_OBJ_HANDLER_FREE_INIT(gnupg);
php_gnupg_this_free(PHPC_THIS TSRMLS_CC); php_gnupg_this_free(PHPC_THIS);
PHPC_OBJ_HANDLER_FREE_DESTROY(); PHPC_OBJ_HANDLER_FREE_DESTROY();
} }
@ -199,7 +199,7 @@ PHPC_OBJ_HANDLER_CREATE_EX(gnupg)
{ {
PHPC_OBJ_HANDLER_CREATE_EX_INIT(gnupg); PHPC_OBJ_HANDLER_CREATE_EX_INIT(gnupg);
php_gnupg_this_init(PHPC_THIS TSRMLS_CC); php_gnupg_this_init(PHPC_THIS);
PHPC_OBJ_HANDLER_CREATE_EX_RETURN(gnupg); PHPC_OBJ_HANDLER_CREATE_EX_RETURN(gnupg);
} }
@ -481,7 +481,7 @@ ZEND_GET_MODULE(gnupg)
#define PHP_GNUPG_SET_CLASS_CONST(_name, _value) \ #define PHP_GNUPG_SET_CLASS_CONST(_name, _value) \
zend_declare_class_constant_long(gnupg_class_entry, \ zend_declare_class_constant_long(gnupg_class_entry, \
_name, sizeof(_name) - 1, _value TSRMLS_CC) _name, sizeof(_name) - 1, _value)
#define PHP_GNUPG_REG_CONST(_name, _value) \ #define PHP_GNUPG_REG_CONST(_name, _value) \
REGISTER_LONG_CONSTANT(_name, _value, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(_name, _value, CONST_CS | CONST_PERSISTENT);
@ -741,13 +741,13 @@ PHP_METHOD(gnupg, __construct)
zval *options = NULL; zval *options = NULL;
PHPC_THIS_DECLARE(gnupg); PHPC_THIS_DECLARE(gnupg);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|a", if (zend_parse_parameters(ZEND_NUM_ARGS(), "|a",
&options) == FAILURE) { &options) == FAILURE) {
return; return;
} }
PHPC_THIS_FETCH(gnupg); PHPC_THIS_FETCH(gnupg);
php_gnupg_this_make(PHPC_THIS, options TSRMLS_CC); php_gnupg_this_make(PHPC_THIS, options);
} }
/* }}} */ /* }}} */
@ -759,14 +759,14 @@ PHP_FUNCTION(gnupg_init)
zval *options = NULL; zval *options = NULL;
PHPC_THIS_DECLARE(gnupg); PHPC_THIS_DECLARE(gnupg);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|a", if (zend_parse_parameters(ZEND_NUM_ARGS(), "|a",
&options) == FAILURE) { &options) == FAILURE) {
return; return;
} }
PHPC_THIS = emalloc(sizeof(PHPC_OBJ_STRUCT_NAME(gnupg))); PHPC_THIS = emalloc(sizeof(PHPC_OBJ_STRUCT_NAME(gnupg)));
php_gnupg_this_init(PHPC_THIS TSRMLS_CC); php_gnupg_this_init(PHPC_THIS);
php_gnupg_this_make(PHPC_THIS, options TSRMLS_CC); php_gnupg_this_make(PHPC_THIS, options);
PHPC_RES_RETURN(PHPC_RES_REGISTER(PHPC_THIS, le_gnupg)); PHPC_RES_RETURN(PHPC_RES_REGISTER(PHPC_THIS, le_gnupg));
} }
/* }}} */ /* }}} */
@ -783,12 +783,12 @@ PHP_FUNCTION(gnupg_setarmor)
GNUPG_GETOBJ(); GNUPG_GETOBJ();
if (this) { if (this) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", if (zend_parse_parameters(ZEND_NUM_ARGS(), "l",
&armor) == FAILURE) { &armor) == FAILURE) {
return; return;
} }
} else { } else {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl",
&res, &armor) == FAILURE) { &res, &armor) == FAILURE) {
return; return;
} }
@ -812,12 +812,12 @@ PHP_FUNCTION(gnupg_seterrormode)
GNUPG_GETOBJ(); GNUPG_GETOBJ();
if (this) { if (this) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", if (zend_parse_parameters(ZEND_NUM_ARGS(), "l",
&errormode) == FAILURE) { &errormode) == FAILURE) {
return; return;
} }
} else { } else {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl",
&res, &errormode) == FAILURE) { &res, &errormode) == FAILURE) {
return; return;
} }
@ -849,12 +849,12 @@ PHP_FUNCTION(gnupg_setsignmode)
GNUPG_GETOBJ(); GNUPG_GETOBJ();
if (this) { if (this) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", if (zend_parse_parameters(ZEND_NUM_ARGS(), "l",
&signmode) == FAILURE) { &signmode) == FAILURE) {
return; return;
} }
} else { } else {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl",
&res, &signmode) == FAILURE) { &res, &signmode) == FAILURE) {
return; return;
} }
@ -885,7 +885,7 @@ PHP_FUNCTION(gnupg_getengineinfo)
GNUPG_GETOBJ(); GNUPG_GETOBJ();
if (!this) { if (!this) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &res) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &res) == FAILURE) {
return; return;
} }
GNUPG_RES_FETCH(); GNUPG_RES_FETCH();
@ -908,7 +908,7 @@ PHP_FUNCTION(gnupg_geterror)
GNUPG_GETOBJ(); GNUPG_GETOBJ();
if (!this) { if (!this) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &res) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &res) == FAILURE) {
return; return;
} }
GNUPG_RES_FETCH(); GNUPG_RES_FETCH();
@ -948,12 +948,12 @@ PHP_FUNCTION(gnupg_keyinfo)
GNUPG_GETOBJ(); GNUPG_GETOBJ();
if (this) { if (this) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|b",
&searchkey, &searchkey_len, &secret_only) == FAILURE) { &searchkey, &searchkey_len, &secret_only) == FAILURE) {
return; return;
} }
} else { } else {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|b", if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|b",
&res, &searchkey, &searchkey_len, &secret_only) == FAILURE) { &res, &searchkey, &searchkey_len, &secret_only) == FAILURE) {
return; return;
} }
@ -1089,12 +1089,12 @@ PHP_FUNCTION(gnupg_addsignkey)
GNUPG_GETOBJ(); GNUPG_GETOBJ();
if (this) { if (this) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s",
&key_id, &key_id_len, &passphrase, &passphrase_len) == FAILURE) { &key_id, &key_id_len, &passphrase, &passphrase_len) == FAILURE) {
return; return;
} }
} else { } else {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|s", if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|s",
&res, &key_id, &key_id_len, &passphrase, &passphrase_len) == FAILURE) { &res, &key_id, &key_id_len, &passphrase, &passphrase_len) == FAILURE) {
return; return;
} }
@ -1137,12 +1137,12 @@ PHP_FUNCTION(gnupg_adddecryptkey)
GNUPG_GETOBJ(); GNUPG_GETOBJ();
if (this) { if (this) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss",
&key_id, &key_id_len, &passphrase, &passphrase_len) == FAILURE) { &key_id, &key_id_len, &passphrase, &passphrase_len) == FAILURE) {
return; return;
} }
} else { } else {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss", if (zend_parse_parameters(ZEND_NUM_ARGS(), "rss",
&res, &key_id, &key_id_len, &passphrase, &passphrase_len) == FAILURE) { &res, &key_id, &key_id_len, &passphrase, &passphrase_len) == FAILURE) {
return; return;
} }
@ -1177,12 +1177,12 @@ PHP_FUNCTION(gnupg_addencryptkey)
GNUPG_GETOBJ(); GNUPG_GETOBJ();
if (this) { if (this) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", if (zend_parse_parameters(ZEND_NUM_ARGS(), "s",
&key_id, &key_id_len) == FAILURE) { &key_id, &key_id_len) == FAILURE) {
return; return;
} }
} else { } else {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs",
&res, &key_id, &key_id_len) == FAILURE) { &res, &key_id, &key_id_len) == FAILURE) {
return; return;
} }
@ -1215,7 +1215,7 @@ PHP_FUNCTION(gnupg_clearsignkeys)
GNUPG_GETOBJ(); GNUPG_GETOBJ();
if (!this) { if (!this) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &res) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &res) == FAILURE) {
return; return;
} }
GNUPG_RES_FETCH(); GNUPG_RES_FETCH();
@ -1235,12 +1235,12 @@ PHP_FUNCTION(gnupg_clearencryptkeys)
GNUPG_GETOBJ(); GNUPG_GETOBJ();
if (!this) { if (!this) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &res) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &res) == FAILURE) {
return; return;
} }
GNUPG_RES_FETCH(); GNUPG_RES_FETCH();
} }
php_gnupg_free_encryptkeys(PHPC_THIS TSRMLS_CC); php_gnupg_free_encryptkeys(PHPC_THIS);
RETURN_TRUE; RETURN_TRUE;
} }
@ -1254,7 +1254,7 @@ PHP_FUNCTION(gnupg_cleardecryptkeys)
GNUPG_GETOBJ(); GNUPG_GETOBJ();
if (!this) { if (!this) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &res) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &res) == FAILURE) {
return; return;
} }
GNUPG_RES_FETCH(); GNUPG_RES_FETCH();
@ -1282,12 +1282,12 @@ PHP_FUNCTION(gnupg_sign)
GNUPG_GETOBJ(); GNUPG_GETOBJ();
if (this) { if (this) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", if (zend_parse_parameters(ZEND_NUM_ARGS(), "s",
&value, &value_len) == FAILURE) { &value, &value_len) == FAILURE) {
return; return;
} }
} else { } else {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs",
&res, &value, &value_len) == FAILURE) { &res, &value, &value_len) == FAILURE) {
return; return;
} }
@ -1354,12 +1354,12 @@ PHP_FUNCTION(gnupg_encrypt)
GNUPG_GETOBJ(); GNUPG_GETOBJ();
if (this) { if (this) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", if (zend_parse_parameters(ZEND_NUM_ARGS(), "s",
&value, &value_len) == FAILURE) { &value, &value_len) == FAILURE) {
return; return;
} }
} else { } else {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs",
&res, &value, &value_len) == FAILURE) { &res, &value, &value_len) == FAILURE) {
return; return;
} }
@ -1419,12 +1419,12 @@ PHP_FUNCTION(gnupg_encryptsign)
GNUPG_GETOBJ(); GNUPG_GETOBJ();
if (this) { if (this) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", if (zend_parse_parameters(ZEND_NUM_ARGS(), "s",
&value, &value_len) == FAILURE) { &value, &value_len) == FAILURE) {
return; return;
} }
} else { } else {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs",
&res, &value, &value_len) == FAILURE) { &res, &value, &value_len) == FAILURE) {
return; return;
} }
@ -1507,12 +1507,12 @@ PHP_FUNCTION(gnupg_verify)
GNUPG_GETOBJ(); GNUPG_GETOBJ();
if (this) { if (this) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz|z", if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz|z",
&signed_text, &signature, &plain_text) == FAILURE) { &signed_text, &signature, &plain_text) == FAILURE) {
return; return;
} }
} else { } else {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rzz|z", if (zend_parse_parameters(ZEND_NUM_ARGS(), "rzz|z",
&res, &signed_text, &signature, &plain_text) == FAILURE) { &res, &signed_text, &signature, &plain_text) == FAILURE) {
return; return;
} }
@ -1595,12 +1595,12 @@ PHP_FUNCTION(gnupg_decrypt)
GNUPG_GETOBJ(); GNUPG_GETOBJ();
if (this) { if (this) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", if (zend_parse_parameters(ZEND_NUM_ARGS(), "s",
&enctxt, &enctxt_len) == FAILURE) { &enctxt, &enctxt_len) == FAILURE) {
return; return;
} }
} else { } else {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs",
&res, &enctxt, &enctxt_len) == FAILURE) { &res, &enctxt, &enctxt_len) == FAILURE) {
return; return;
} }
@ -1660,12 +1660,12 @@ PHP_FUNCTION(gnupg_decryptverify)
GNUPG_GETOBJ(); GNUPG_GETOBJ();
if (this) { if (this) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz", if (zend_parse_parameters(ZEND_NUM_ARGS(), "sz",
&enctxt, &enctxt_len, &plaintext) == FAILURE) { &enctxt, &enctxt_len, &plaintext) == FAILURE) {
return; return;
} }
} else { } else {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsz", if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsz",
&res, &enctxt, &enctxt_len, &plaintext) == FAILURE) { &res, &enctxt, &enctxt_len, &plaintext) == FAILURE) {
return; return;
} }
@ -1726,12 +1726,12 @@ PHP_FUNCTION(gnupg_export)
GNUPG_GETOBJ(); GNUPG_GETOBJ();
if (this) { if (this) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", if (zend_parse_parameters(ZEND_NUM_ARGS(), "s",
&searchkey, &searchkey_len) == FAILURE) { &searchkey, &searchkey_len) == FAILURE) {
return; return;
} }
} else { } else {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs",
&res, &searchkey, &searchkey_len) == FAILURE) { &res, &searchkey, &searchkey_len) == FAILURE) {
return; return;
} }
@ -1769,12 +1769,12 @@ PHP_FUNCTION(gnupg_import)
GNUPG_GETOBJ(); GNUPG_GETOBJ();
if (this) { if (this) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", if (zend_parse_parameters(ZEND_NUM_ARGS(), "s",
&importkey, &importkey_len) == FAILURE) { &importkey, &importkey_len) == FAILURE) {
return; return;
} }
} else { } else {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs",
&res, &importkey, &importkey_len) == FAILURE) { &res, &importkey, &importkey_len) == FAILURE) {
return; return;
} }
@ -1823,12 +1823,12 @@ PHP_FUNCTION(gnupg_deletekey)
GNUPG_GETOBJ(); GNUPG_GETOBJ();
if (this) { if (this) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|l",
&key, &key_len, &allow_secret) == FAILURE) { &key, &key_len, &allow_secret) == FAILURE) {
return; return;
} }
} else { } else {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|l",
&res, &key, &key_len, &allow_secret) == FAILURE) { &res, &key, &key_len, &allow_secret) == FAILURE) {
return; return;
} }
@ -1862,12 +1862,12 @@ PHP_FUNCTION(gnupg_gettrustlist)
GNUPG_GETOBJ(); GNUPG_GETOBJ();
if (this) { if (this) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", if (zend_parse_parameters(ZEND_NUM_ARGS(), "s",
&pattern, &pattern_len) == FAILURE) { &pattern, &pattern_len) == FAILURE) {
return; return;
} }
} else { } else {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs",
&res, &pattern, &pattern_len) == FAILURE) { &res, &pattern, &pattern_len) == FAILURE) {
return; return;
} }
@ -1910,12 +1910,12 @@ PHP_FUNCTION(gnupg_listsignatures)
GNUPG_GETOBJ(); GNUPG_GETOBJ();
if (this) { if (this) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", if (zend_parse_parameters(ZEND_NUM_ARGS(), "s",
&keyid, &keyid_len) == FAILURE) { &keyid, &keyid_len) == FAILURE) {
return; return;
} }
} else { } else {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs",
&res, &keyid, &keyid_len) == FAILURE) { &res, &keyid, &keyid_len) == FAILURE) {
return; return;
} }

View file

@ -41,7 +41,7 @@ PHPC_OBJ_DEFINE_HANDLER_VAR(gnupg_keylistiterator);
if (this) { \ if (this) { \
PHPC_THIS_FETCH_FROM_ZVAL(gnupg_keylistiterator, this); \ PHPC_THIS_FETCH_FROM_ZVAL(gnupg_keylistiterator, this); \
if (!PHPC_THIS) { \ if (!PHPC_THIS) { \
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid or unitialized gnupg object"); \ php_error_docref(NULL, E_WARNING, "Invalid or unitialized gnupg object"); \
RETURN_FALSE; \ RETURN_FALSE; \
} \ } \
} \ } \
@ -110,7 +110,7 @@ int _gnupg_keylistiterator_init(INIT_FUNC_ARGS)
PHPC_OBJ_SET_HANDLER_OFFSET(gnupg_keylistiterator); PHPC_OBJ_SET_HANDLER_OFFSET(gnupg_keylistiterator);
PHPC_OBJ_SET_HANDLER_FREE(gnupg_keylistiterator); PHPC_OBJ_SET_HANDLER_FREE(gnupg_keylistiterator);
zend_class_implements(gnupg_keylistiterator_class_entry TSRMLS_CC, 1, zend_ce_iterator); zend_class_implements(gnupg_keylistiterator_class_entry, 1, zend_ce_iterator);
le_gnupg_keylistiterator = zend_register_list_destructors_ex(NULL, NULL, "ctx_keylistiterator", module_number); le_gnupg_keylistiterator = zend_register_list_destructors_ex(NULL, NULL, "ctx_keylistiterator", module_number);
@ -131,7 +131,7 @@ PHP_METHOD(gnupg_keylistiterator, __construct)
GNUPG_GET_ITERATOR(); GNUPG_GET_ITERATOR();
if (args > 0) { if (args > 0) {
if (zend_parse_parameters(args TSRMLS_CC, "|s", &pattern, &pattern_len) == FAILURE) { if (zend_parse_parameters(args, "|s", &pattern, &pattern_len) == FAILURE) {
return; return;
} }
PHPC_THIS->pattern = estrdup(pattern); PHPC_THIS->pattern = estrdup(pattern);
@ -181,7 +181,7 @@ PHP_METHOD(gnupg_keylistiterator,rewind)
if ((PHPC_THIS->err = gpgme_op_keylist_start( if ((PHPC_THIS->err = gpgme_op_keylist_start(
PHPC_THIS->ctx, PHPC_THIS->pattern ? PHPC_THIS->pattern : "", 0)) != GPG_ERR_NO_ERROR){ PHPC_THIS->ctx, PHPC_THIS->pattern ? PHPC_THIS->pattern : "", 0)) != GPG_ERR_NO_ERROR){
zend_throw_exception(zend_exception_get_default(TSRMLS_C), (char *)gpg_strerror(PHPC_THIS->err), 1 TSRMLS_CC); zend_throw_exception(zend_exception_get_default(), (char *)gpg_strerror(PHPC_THIS->err), 1);
} }
if ((PHPC_THIS->err = gpgme_op_keylist_next(PHPC_THIS->ctx, &PHPC_THIS->gpgkey)) != GPG_ERR_NO_ERROR){ if ((PHPC_THIS->err = gpgme_op_keylist_next(PHPC_THIS->ctx, &PHPC_THIS->gpgkey)) != GPG_ERR_NO_ERROR){
RETURN_FALSE; RETURN_FALSE;