cvs: pecl /gnupg config.m4 gnupg.c gnupg_keylistiterator.c package.xml package2.xml php_gnupg.h php_gnupg_keylistiterator.h

From: Date: Thu, 16 Mar 2006 15:52:43 +0000
Subject: cvs: pecl /gnupg config.m4 gnupg.c gnupg_keylistiterator.c package.xml package2.xml php_gnupg.h php_gnupg_keylistiterator.h
Groups: php.pecl.cvs 
Request: Send a blank email to pecl-cvs+get-5477@lists.php.net to get a copy of this message
traufeisen Thu Mar 16 15:52:43 2006 UTC Modified files: /pecl/gnupg config.m4 gnupg.c gnupg_keylistiterator.c package.xml package2.xml php_gnupg.h php_gnupg_keylistiterator.h Log: improved PHP4 compatibility and config.m4 passphrase-errors now takes care of the actual errormode

http://cvs.php.net/viewcvs.cgi/pecl/gnupg/config.m4?r1=1.5&r2=1.6&diff_format=u Index: pecl/gnupg/config.m4 diff -u pecl/gnupg/config.m4:1.5 pecl/gnupg/config.m4:1.6 --- pecl/gnupg/config.m4:1.5 Thu Feb 2 13:00:21 2006 +++ pecl/gnupg/config.m4 Thu Mar 16 15:52:43 2006 @@ -1,8 +1,8 @@ -dnl $Id: config.m4,v 1.5 2006/02/02 13:00:21 traufeisen Exp $ +dnl $Id: config.m4,v 1.6 2006/03/16 15:52:43 traufeisen Exp $ dnl config.m4 for extension gnupg PHP_ARG_WITH(gnupg, for gnupg support, -[ --with-gnupg[=DIR] Include gnupg support]) +[ --with-gnupg[=dir] Include gnupg support]) if test "$PHP_GNUPG" != "no"; then SEARCH_PATH="/usr/local/include /usr/include /usr/local/include/gpgme/ /usr/include/gpgme/" http://cvs.php.net/viewcvs.cgi/pecl/gnupg/gnupg.c?r1=1.19&r2=1.20&diff_format=u Index: pecl/gnupg/gnupg.c diff -u pecl/gnupg/gnupg.c:1.19 pecl/gnupg/gnupg.c:1.20 --- pecl/gnupg/gnupg.c:1.19 Wed Nov 30 12:13:18 2005 +++ pecl/gnupg/gnupg.c Thu Mar 16 15:52:43 2006 @@ -6,11 +6,11 @@ | modification, are permitted provided that the conditions mentioned | | in the accompanying LICENSE file are met. | +--------------------------------------------------------------------+ - | Copyright (c) 2005, Thilo Raufeisen <traufeisen@php.net> | + | Copyright (c) 2006, Thilo Raufeisen <traufeisen@php.net> | +--------------------------------------------------------------------+ */ -/* $Id: gnupg.c,v 1.19 2005/11/30 12:13:18 traufeisen Exp $ */ +/* $Id: gnupg.c,v 1.20 2006/03/16 15:52:43 traufeisen Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -27,24 +27,26 @@ static int le_gnupg; -#define PHP_GNUPG_VERSION "0.7beta" +#define PHP_GNUPG_VERSION "1.1" #ifdef ZEND_ENGINE_2 static zend_object_handlers gnupg_object_handlers; #endif /* {{{ defs */ +#ifdef ZEND_ENGINE_2 + #define GNUPG_GETOBJ() \ - zval *this = getThis(); \ - gnupg_object *intern; \ - zval *res; \ - if(this){ \ - intern = (gnupg_object*) zend_object_store_get_object(getThis() TSRMLS_CC); \ - if(!intern){ \ - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid or unitialized gnupg object"); \ - RETURN_FALSE; \ - } \ - } + zval *this = getThis(); \ + gnupg_object *intern; \ + zval *res; \ + if(this){ \ + intern = (gnupg_object*) zend_object_store_get_object(getThis() TSRMLS_CC); \ + if(!intern){ \ + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid or unitialized gnupg object"); \ + RETURN_FALSE; \ + } \ + } #define GNUPG_ERR(error) \ if(intern){ \ @@ -61,7 +63,26 @@ }else{ \ php_error_docref(NULL TSRMLS_CC, E_WARNING, (char*)error); \ } \ - RETVAL_FALSE; + if(return_value){ \ + RETVAL_FALSE; \ + } +#else +#define GNUPG_ERR(error) \ + if(intern && intern->errormode!=1) { \ + intern->errortxt = (char*)error; \ + }else{ \ + php_error_docref(NULL TSRMLS_CC, E_WARNING, (char*)error); \ + } \ + if(return_value){ \ + RETVAL_FALSE; \ + } + +#define GNUPG_GETOBJ() \ + zval *this = NULL; \ + zval *res; \ + gnupg_object *intern; + +#endif /* }}} */ /* {{{ free encryptkeys */ @@ -196,7 +217,24 @@ ZEND_ME(gnupg, seterrormode, NULL, ZEND_ACC_PUBLIC) {NULL, NULL, NULL} }; +/* }}} */ + +/* {{{ class constants */ +static void gnupg_declare_long_constant(const char *const_name, long value TSRMLS_DC){ +#if PHP_MAJOR_VERSION > 5 || PHP_MINOR_VERSION >= 1 + zend_declare_class_constant_long(gnupg_class_entry, (char*)const_name, strlen(const_name), value TSRMLS_CC); +#else + zval *constant = malloc(sizeof(*constant)); + ZVAL_LONG(constant,value); + INIT_PZVAL(constant); + zend_hash_update(&gnupg_class_entry->constants_table, (char*)const_name, strlen(const_name)+1, &constant, sizeof(zval*), NULL); +#endif +} +/* }}} */ + #endif /* ZEND_ENGINE_2 */ + +/* {{{ functionlist gnupg */ static zend_function_entry gnupg_functions[] = { PHP_FE(gnupg_init, NULL) PHP_FE(gnupg_keyinfo, NULL) @@ -226,20 +264,6 @@ }; /* }}} */ -/* {{{ class constants */ -static void gnupg_declare_long_constant(const char *const_name, long value TSRMLS_DC){ -#if PHP_MAJOR_VERSION > 5 || PHP_MINOR_VERSION >= 1 - zend_declare_class_constant_long(gnupg_class_entry, (char*)const_name, strlen(const_name), value TSRMLS_CC); -#else - zval *constant = malloc(sizeof(*constant)); - ZVAL_LONG(constant,value); - INIT_PZVAL(constant); - zend_hash_update(&gnupg_class_entry->constants_table, (char*)const_name, strlen(const_name)+1, &constant, sizeof(zval*), NULL); -#endif - -} -/* }}} */ - /* {{{ gnupg_module_entry */ zend_module_entry gnupg_module_entry = { @@ -359,9 +383,10 @@ char uid[16]; int idx; char *passphrase = NULL; + zval *return_value = NULL; if(last_was_bad){ - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Incorrent passphrase"); + GNUPG_ERR("Incorrent passphrase"); return 1; } for(idx=0;idx<16;idx++){ @@ -369,11 +394,11 @@ } uid[16] = '\0'; if(zend_hash_find(intern->signkeys,(char *) uid,17,(void **) &passphrase)==FAILURE){ - php_error_docref(NULL TSRMLS_CC, E_WARNING, "no passphrase set"); + GNUPG_ERR("no passphrase set"); return 1; } if(!passphrase){ - php_error_docref(NULL TSRMLS_CC, E_WARNING, "no passphrase set"); + GNUPG_ERR("no passphrase set"); return 1; } @@ -386,9 +411,10 @@ char uid[16]; int idx; char *passphrase = NULL; + zval *return_value = NULL; if(last_was_bad){ - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Incorrent passphrase"); + GNUPG_ERR("Incorrent passphrase"); return 1; } for(idx=0;idx<16;idx++){ @@ -396,11 +422,11 @@ } uid[16] = '\0'; if(zend_hash_find(intern->decryptkeys,(char *) uid,17,(void **) &passphrase)==FAILURE){ - php_error_docref(NULL TSRMLS_CC, E_WARNING, "no passphrase set"); + GNUPG_ERR("no passphrase set"); return 1; } if(!passphrase){ - php_error_docref(NULL TSRMLS_CC, E_WARNING, "no passphrase set"); + GNUPG_ERR("no passphrase set"); return 1; } write (fd, passphrase, strlen(passphrase)); @@ -880,9 +906,12 @@ return; } if((intern->err = gpgme_op_sign(intern->ctx, in, out, intern->signmode))!=GPG_ERR_NO_ERROR){ - GNUPG_ERR("data signing failed"); + if(!intern->errortxt){ + GNUPG_ERR("data signing failed"); + } gpgme_data_release(in); gpgme_data_release(out); + RETVAL_FALSE; return; } result = gpgme_op_sign_result (intern->ctx); @@ -1015,9 +1044,12 @@ return; } if((intern->err = gpgme_op_encrypt_sign(intern->ctx, intern->encryptkeys, GPGME_ENCRYPT_ALWAYS_TRUST, in, out))!=GPG_ERR_NO_ERROR){ - GNUPG_ERR("encrypt-sign failed"); + if(!intern->errortxt){ + GNUPG_ERR("encrypt-sign failed"); + } gpgme_data_release(in); gpgme_data_release(out); + RETVAL_FALSE; return; } @@ -1096,7 +1128,7 @@ }else{ /* no separate signature was passed * so we assume that it is a clearsigned message - * text no becomes the signature + * text now becomes the signature * creating the text-databuffer is still needed */ if((intern->err = gpgme_data_new_from_mem (&gpgme_sig, text, text_len, 0))!=GPG_ERR_NO_ERROR){ @@ -1169,9 +1201,12 @@ return; } if((intern->err = gpgme_op_decrypt (intern->ctx, in, out))!=GPG_ERR_NO_ERROR){ - GNUPG_ERR("decrypt failed"); + if(!intern->errortxt){ + GNUPG_ERR("decrypt failed"); + } gpgme_data_release(in); gpgme_data_release(out); + RETVAL_FALSE; return; } result = gpgme_op_decrypt_result (intern->ctx); @@ -1233,9 +1268,12 @@ return; } if((intern->err = gpgme_op_decrypt_verify (intern->ctx, in, out))!=GPG_ERR_NO_ERROR){ - GNUPG_ERR("decrypt-verify failed"); + if(!intern->errortxt){ + GNUPG_ERR("decrypt-verify failed"); + } gpgme_data_release(in); gpgme_data_release(out); + RETVAL_FALSE; return; } userret = gpgme_data_release_and_get_mem(out,&ret_size); http://cvs.php.net/viewcvs.cgi/pecl/gnupg/gnupg_keylistiterator.c?r1=1.7&r2=1.8&diff_format=u Index: pecl/gnupg/gnupg_keylistiterator.c diff -u pecl/gnupg/gnupg_keylistiterator.c:1.7 pecl/gnupg/gnupg_keylistiterator.c:1.8 --- pecl/gnupg/gnupg_keylistiterator.c:1.7 Wed Nov 30 12:13:18 2005 +++ pecl/gnupg/gnupg_keylistiterator.c Thu Mar 16 15:52:43 2006 @@ -6,11 +6,11 @@ | modification, are permitted provided that the conditions mentioned | | in the accompanying LICENSE file are met. | +--------------------------------------------------------------------+ - | Copyright (c) 2005, Thilo Raufeisen <traufeisen@php.net> | + | Copyright (c) 2006, Thilo Raufeisen <traufeisen@php.net> | +--------------------------------------------------------------------+ */ -/* $Id: gnupg_keylistiterator.c,v 1.7 2005/11/30 12:13:18 traufeisen Exp $ */ +/* $Id: gnupg_keylistiterator.c,v 1.8 2006/03/16 15:52:43 traufeisen Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" http://cvs.php.net/viewcvs.cgi/pecl/gnupg/package.xml?r1=1.12&r2=1.13&diff_format=u Index: pecl/gnupg/package.xml diff -u pecl/gnupg/package.xml:1.12 pecl/gnupg/package.xml:1.13 --- pecl/gnupg/package.xml:1.12 Thu Dec 29 19:55:29 2005 +++ pecl/gnupg/package.xml Thu Mar 16 15:52:43 2006 @@ -14,11 +14,12 @@ </maintainer> </maintainers> <release> - <version>1.0</version> - <date>2005-12-29</date> + <version>1.1</version> + <date>2006-03-16</date> <license>BSD, revised</license> <state>stable</state> - <notes>bump to stable</notes> + <notes>improved PHP4 compatibility +passphrase-errors now takes care of the errormode</notes> <deps> <dep type="php" rel="ge" version="4.3"/> </deps> @@ -44,6 +45,13 @@ </release> <changelog> <release> + <version>1.1</version> + <date>2006-03-16</date> + <state>stable</state> + <notes>improved PHP4 compatibility +passphrase-errors now takes care of the errormode</notes> + </release> + <release> <version>1.0</version> <date>2005-12-29</date> <state>stable</state> http://cvs.php.net/viewcvs.cgi/pecl/gnupg/package2.xml?r1=1.12&r2=1.13&diff_format=u Index: pecl/gnupg/package2.xml diff -u pecl/gnupg/package2.xml:1.12 pecl/gnupg/package2.xml:1.13 --- pecl/gnupg/package2.xml:1.12 Thu Dec 29 19:55:29 2005 +++ pecl/gnupg/package2.xml Thu Mar 16 15:52:43 2006 @@ -15,18 +15,19 @@ <email>traufeisen@php.net</email> <active>yes</active> </lead> - <date>2005-12-29</date> - <time>20:49:15</time> + <date>2006-03-16</date> + <time>16:50:53</time> <version> - <release>1.0</release> - <api>1.0</api> + <release>1.1</release> + <api>1.1</api> </version> <stability> <release>stable</release> <api>stable</api> </stability> <license>BSD, revised</license> - <notes>bump to stable + <notes>improved PHP4 compatibility +passphrase-errors now takes care of the errormode </notes> <contents> <dir name="/"> @@ -66,6 +67,21 @@ <changelog> <release> <version> + <release>1.1</release> + <api>1.1</api> + </version> + <stability> + <release>stable</release> + <api>stable</api> + </stability> + <date>2006-03-16</date> + <license>BSD, revised</license> + <notes>improved PHP4 compatibility +passphrase-errors now takes care of the errormode + </notes> + </release> + <release> + <version> <release>1.0</release> <api>1.0</api> </version> http://cvs.php.net/viewcvs.cgi/pecl/gnupg/php_gnupg.h?r1=1.14&r2=1.15&diff_format=u Index: pecl/gnupg/php_gnupg.h diff -u pecl/gnupg/php_gnupg.h:1.14 pecl/gnupg/php_gnupg.h:1.15 --- pecl/gnupg/php_gnupg.h:1.14 Tue Nov 29 20:54:36 2005 +++ pecl/gnupg/php_gnupg.h Thu Mar 16 15:52:43 2006 @@ -6,11 +6,11 @@ | modification, are permitted provided that the conditions mentioned | | in the accompanying LICENSE file are met. | +--------------------------------------------------------------------+ - | Copyright (c) 2005, Thilo Raufeisen <traufeisen@php.net> | + | Copyright (c) 2006, Thilo Raufeisen <traufeisen@php.net> | +--------------------------------------------------------------------+ */ -/* $Id: php_gnupg.h,v 1.14 2005/11/29 20:54:36 traufeisen Exp $ */ +/* $Id: php_gnupg.h,v 1.15 2006/03/16 15:52:43 traufeisen Exp $ */ #ifndef PHP_GNUPG_H #define PHP_GNUPG_H http://cvs.php.net/viewcvs.cgi/pecl/gnupg/php_gnupg_keylistiterator.h?r1=1.4&r2=1.5&diff_format=u Index: pecl/gnupg/php_gnupg_keylistiterator.h diff -u pecl/gnupg/php_gnupg_keylistiterator.h:1.4 pecl/gnupg/php_gnupg_keylistiterator.h:1.5 --- pecl/gnupg/php_gnupg_keylistiterator.h:1.4 Tue Nov 29 20:54:36 2005 +++ pecl/gnupg/php_gnupg_keylistiterator.h Thu Mar 16 15:52:43 2006 @@ -6,11 +6,11 @@ | modification, are permitted provided that the conditions mentioned | | in the accompanying LICENSE file are met. | +--------------------------------------------------------------------+ - | Copyright (c) 2005, Thilo Raufeisen <traufeisen@php.net> | + | Copyright (c) 2006, Thilo Raufeisen <traufeisen@php.net> | +--------------------------------------------------------------------+ */ -/* $Id: php_gnupg_keylistiterator.h,v 1.4 2005/11/29 20:54:36 traufeisen Exp $ */ +/* $Id: php_gnupg_keylistiterator.h,v 1.5 2006/03/16 15:52:43 traufeisen Exp $ */ #ifndef PHP_GNUPG_KEYLISTITERATOR_H #define PHP_GNUPG_KEYLISTITERATOR_H
« previous php.pecl.cvs (#5477) next »