diff options
author | Remi Collet <remi@remirepo.net> | 2020-09-03 10:30:56 +0200 |
---|---|---|
committer | Remi Collet <remi@remirepo.net> | 2020-09-03 10:30:56 +0200 |
commit | 031085e89852a47a2a0a89e218d2965dc8794d7b (patch) | |
tree | 17a4ea3e1dfd4958c2522ce1f098f4261efd5ede | |
parent | d3a246cc09e483fe1498c608f526f4f4a30e88b9 (diff) |
add upstream patch for PHP 8
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | krb5-php8.patch | 166 | ||||
-rw-r--r-- | php-pecl-krb5.spec | 19 |
3 files changed, 179 insertions, 8 deletions
@@ -1,5 +1,7 @@ +clog package-*.xml *.tgz +*.tar.bz2 *.tar.gz *.tar.xz *.tar.xz.asc diff --git a/krb5-php8.patch b/krb5-php8.patch new file mode 100644 index 0000000..23113b4 --- /dev/null +++ b/krb5-php8.patch @@ -0,0 +1,166 @@ +Index: compat.h +=================================================================== +--- compat.h (révision 350496) ++++ compat.h (copie de travail) +@@ -1,7 +1,22 @@ + #ifndef PHP_KRB5_COMPAT_H + #define PHP_KRB5_COMPAT_H + ++#if PHP_MAJOR_VERSION < 8 + ++#define OBJ_FOR_PROP(zv) (zv) ++ ++#else ++ ++#define OBJ_FOR_PROP(zv) Z_OBJ_P(zv) ++ ++#define TSRMLS_D void ++#define TSRMLS_DC ++#define TSRMLS_C ++#define TSRMLS_CC ++#define TSRMLS_FETCH() ++ ++#endif ++ + #if PHP_MAJOR_VERSION < 7 + struct _zend_string { + char *val; +Index: kadm.c +=================================================================== +--- kadm.c (révision 350496) ++++ kadm.c (copie de travail) +@@ -450,8 +450,8 @@ + princname = zend_read_property(krb5_ce_kadm5_principal, princ, "princname", + sizeof("princname"),1 TSRMLS_CC); + #else +- princname = zend_read_property(krb5_ce_kadm5_principal, princ, "princname", +- sizeof("princname"),1, NULL TSRMLS_CC); ++ princname = zend_read_property(krb5_ce_kadm5_principal, OBJ_FOR_PROP(princ), "princname", ++ sizeof("princname"),1, NULL); + #endif + if ( principal->data.principal ) { + krb5_free_principal(obj->ctx, principal->data.principal); +@@ -466,7 +466,7 @@ + zend_string_release(pnamestr); + principal->update_mask |= KADM5_PRINCIPAL; + principal->conn = obj; +- zend_update_property(krb5_ce_kadm5_principal, princ, "connection", sizeof("connection"), getThis() TSRMLS_CC); ++ zend_update_property(krb5_ce_kadm5_principal, OBJ_FOR_PROP(princ), "connection", sizeof("connection"), getThis() TSRMLS_CC); + + retval = kadm5_create_principal(obj->handle, &principal->data, principal->update_mask, pw); + if(retval != KADM5_OK) { +@@ -585,7 +585,7 @@ + policy->update_mask |= KADM5_POLICY; + policy->conn = obj; + policy->data.policy = policy->policy; +- zend_update_property(krb5_ce_kadm5_policy, zpolicy, "connection", sizeof("connection"), getThis() TSRMLS_CC); ++ zend_update_property(krb5_ce_kadm5_policy, OBJ_FOR_PROP(zpolicy), "connection", sizeof("connection"), getThis() TSRMLS_CC); + + retval = kadm5_create_policy(obj->handle, &policy->data, policy->update_mask); + if(retval != KADM5_OK) { +Index: kadm5_policy.c +=================================================================== +--- kadm5_policy.c (révision 350496) ++++ kadm5_policy.c (copie de travail) +@@ -199,7 +199,7 @@ + obj->policy = estrndup(spolicy, spolicy_len); + + if(connobj && Z_TYPE_P(connobj) == IS_OBJECT) { +- zend_update_property(krb5_ce_kadm5_principal, getThis(), "connection", sizeof("connection"), connobj TSRMLS_CC); ++ zend_update_property(krb5_ce_kadm5_principal, OBJ_FOR_PROP(getThis()), "connection", sizeof("connection"), connobj TSRMLS_CC); + this->conn = KRB5_KADM(connobj); + + #if PHP_MAJOR_VERSION < 7 +@@ -239,7 +239,7 @@ + #if PHP_MAJOR_VERSION < 7 + #define KRB5_KADM_POLICY_GET_CONNECTION zend_read_property(krb5_ce_kadm5_policy, getThis(), "connection", sizeof("connection"),1 TSRMLS_CC); + #else +-#define KRB5_KADM_POLICY_GET_CONNECTION zend_read_property(krb5_ce_kadm5_policy, getThis(), "connection", sizeof("connection"),1, NULL TSRMLS_CC); ++#define KRB5_KADM_POLICY_GET_CONNECTION zend_read_property(krb5_ce_kadm5_policy, OBJ_FOR_PROP(getThis()), "connection", sizeof("connection"),1, NULL); + #endif + + /* {{{ proto KADM5Policy::load() +Index: kadm5_principal.c +=================================================================== +--- kadm5_principal.c (révision 350496) ++++ kadm5_principal.c (copie de travail) +@@ -200,10 +200,10 @@ + } + KRB5_SET_ERROR_HANDLING(EH_NORMAL); + +- zend_update_property_string(krb5_ce_kadm5_principal, getThis(), "princname", sizeof("princname"), sprinc TSRMLS_CC); ++ zend_update_property_string(krb5_ce_kadm5_principal, OBJ_FOR_PROP(getThis()), "princname", sizeof("princname"), sprinc TSRMLS_CC); + + if(obj && Z_TYPE_P(obj) == IS_OBJECT) { +- zend_update_property(krb5_ce_kadm5_principal, getThis(), "connection", sizeof("connection"), obj TSRMLS_CC); ++ zend_update_property(krb5_ce_kadm5_principal, OBJ_FOR_PROP(getThis()), "connection", sizeof("connection"), obj TSRMLS_CC); + this->conn = KRB5_KADM(obj); + + if ( noload != TRUE ) { +@@ -246,13 +246,13 @@ + #if PHP_MAJOR_VERSION < 7 + #define KRB5_KADM_PRINCIPAL_GET_CONNECTION zend_read_property(krb5_ce_kadm5_principal, getThis(), "connection", sizeof("connection"),1 TSRMLS_CC) + #else +-#define KRB5_KADM_PRINCIPAL_GET_CONNECTION zend_read_property(krb5_ce_kadm5_principal, getThis(), "connection", sizeof("connection"),1, NULL TSRMLS_CC) ++#define KRB5_KADM_PRINCIPAL_GET_CONNECTION zend_read_property(krb5_ce_kadm5_principal, OBJ_FOR_PROP(getThis()), "connection", sizeof("connection"),1, NULL) + #endif + + #if PHP_MAJOR_VERSION < 7 + #define KRB5_KADM_PRINCIPAL_GET_PRINCNAME zend_read_property(krb5_ce_kadm5_principal, getThis(), "princname", sizeof("princname"),1 TSRMLS_CC) + #else +-#define KRB5_KADM_PRINCIPAL_GET_PRINCNAME zend_read_property(krb5_ce_kadm5_principal, getThis(), "princname", sizeof("princname"),1, NULL TSRMLS_CC) ++#define KRB5_KADM_PRINCIPAL_GET_PRINCNAME zend_read_property(krb5_ce_kadm5_principal, OBJ_FOR_PROP(getThis()), "princname", sizeof("princname"),1, NULL) + #endif + + /* {{{ proto KADM5Principal KADM5Principal::load() +Index: krb5.c +=================================================================== +--- krb5.c (révision 350496) ++++ krb5.c (copie de travail) +@@ -32,7 +32,6 @@ + + #include "config.h" + #include "php_krb5.h" +-#include "compat.h" + + #include "ext/standard/info.h" + #include "ext/standard/base64.h" +Index: negotiate_auth.c +=================================================================== +--- negotiate_auth.c (révision 350496) ++++ negotiate_auth.c (copie de travail) +@@ -445,16 +445,17 @@ + + const char *prompt = "WWW-Authenticate: "; + size_t promptLen = strlen(prompt); ++ char *buf; + +- ctr.line = emalloc(promptLen+encoded->len+1); +- strncpy(ctr.line, prompt, promptLen); +- strncpy(ctr.line + promptLen, encoded->val, encoded->len); +- ctr.line[promptLen+encoded->len] = 0; ++ ctr.line = buf = emalloc(promptLen + encoded->len + 1); ++ strncpy(buf, prompt, promptLen + 1); ++ strncpy(buf + promptLen, encoded->val, encoded->len + 1); ++ buf[promptLen+encoded->len] = 0; + ctr.response_code = 200; + sapi_header_op(SAPI_HEADER_ADD, &ctr TSRMLS_CC); + zend_string_release(encoded); + +- efree(ctr.line); ++ efree(buf); + gss_release_buffer(&minor_status, &output_token); + } + RETURN_TRUE; +Index: php_krb5.h +=================================================================== +--- php_krb5.h (révision 350496) ++++ php_krb5.h (copie de travail) +@@ -29,6 +29,7 @@ + + #include "php.h" + #include "Zend/zend_exceptions.h" ++#include "compat.h" + #include "php_krb5_gssapi.h" + + #ifdef HAVE_KADM5 diff --git a/php-pecl-krb5.spec b/php-pecl-krb5.spec index 9c0d034..b46be2f 100644 --- a/php-pecl-krb5.spec +++ b/php-pecl-krb5.spec @@ -32,11 +32,13 @@ Summary: Kerberos authentification extension Name: %{?sub_prefix}php-pecl-%{pecl_name} Version: 1.1.3 -Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} License: MIT URL: https://pecl.php.net/package/%{pecl_name} Source0: https://pecl.php.net/get/%{pecl_name}-%{version}.tgz +Patch0: %{pecl_name}-php8.patch + BuildRequires: %{?dtsprefix}gcc BuildRequires: krb5-devel >= 1.8 BuildRequires: pkgconfig(com_err) @@ -56,31 +58,28 @@ Provides: %{?scl_prefix}php-pecl-%{pecl_name} = %{version}-%{rele Provides: %{?scl_prefix}php-pecl-%{pecl_name}%{?_isa} = %{version}-%{release} %endif -%if "%{?vendor}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel} +%if "%{?packager}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel} # Other third party repo stuff %if "%{php_version}" > "5.6" Obsoletes: php56u-pecl-%{pecl_name} <= %{version} -Obsoletes: php56w-pecl-%{pecl_name} <= %{version} %endif %if "%{php_version}" > "7.0" Obsoletes: php70u-pecl-%{pecl_name} <= %{version} -Obsoletes: php70w-pecl-%{pecl_name} <= %{version} %endif %if "%{php_version}" > "7.1" Obsoletes: php71u-pecl-%{pecl_name} <= %{version} -Obsoletes: php71w-pecl-%{pecl_name} <= %{version} %endif %if "%{php_version}" > "7.2" Obsoletes: php72u-pecl-%{pecl_name} <= %{version} -Obsoletes: php72w-pecl-%{pecl_name} <= %{version} %endif %if "%{php_version}" > "7.3" Obsoletes: php73-pecl-%{pecl_name} <= %{version} -Obsoletes: php73w-pecl-%{pecl_name} <= %{version} %endif %if "%{php_version}" > "7.4" Obsoletes: php74-pecl-%{pecl_name} <= %{version} -Obsoletes: php74w-pecl-%{pecl_name} <= %{version} +%endif +%if "%{php_version}" > "8.0" +Obsoletes: php80-pecl-%{pecl_name} <= %{version} %endif %endif @@ -119,6 +118,7 @@ mv %{pecl_name}-%{version} NTS %{?_licensedir:sed -e '/LICENSE/s/role="doc"/role="src"/' -i package.xml} cd NTS +%patch0 -p0 -b .up # Sanity check, really often broken extver=$(sed -n '/#define PHP_KRB5_VERSION/{s/.* "//;s/".*$//;p}' php_krb5.h) @@ -252,6 +252,9 @@ cd ../ZTS %changelog +* Thu Sep 3 2020 Remi Collet <remi@remirepo.net> - 1.1.3-2 +- add upstream patch for PHP 8 + * Wed Feb 26 2020 Remi Collet <remi@remirepo.net> - 1.1.3-1 - update to 1.1.3 - fix License = MIT |