1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
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
|