summaryrefslogtreecommitdiffstats
path: root/krb5-php8.patch
diff options
context:
space:
mode:
Diffstat (limited to 'krb5-php8.patch')
-rw-r--r--krb5-php8.patch166
1 files changed, 166 insertions, 0 deletions
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