pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/databases/php-ldap/files Update the LDAP EXOP patch to...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/e9880f23b60d
branches:  trunk
changeset: 362339:e9880f23b60d
user:      manu <manu%pkgsrc.org@localhost>
date:      Fri May 12 08:28:12 2017 +0000

description:
Update the LDAP EXOP patch to build with PHP 5.6.x
Remove the versions for retired PHP 5.4 and 5.5

diffstat:

 databases/php-ldap/files/ldap-ctrl-exop54.patch |  2271 ----------------------
 databases/php-ldap/files/ldap-ctrl-exop55.patch |  2300 -----------------------
 databases/php-ldap/files/ldap-ctrl-exop56.patch |   636 ++---
 3 files changed, 241 insertions(+), 4966 deletions(-)

diffs (truncated from 5652 to 300 lines):

diff -r 7dd237ce5e61 -r e9880f23b60d databases/php-ldap/files/ldap-ctrl-exop54.patch
--- a/databases/php-ldap/files/ldap-ctrl-exop54.patch   Fri May 12 05:14:15 2017 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,2271 +0,0 @@
---- ext/ldap/ldap.c.orig       2015-09-01 22:09:37.000000000 +0200
-+++ ext/ldap/ldap.c    2015-11-08 05:12:41.000000000 +0100
-@@ -66,8 +66,13 @@
- #elif defined(HAVE_LDAP_SASL_SASL_H)
- #include <sasl/sasl.h>
- #endif
- 
-+/* XXX Not detected by configure... */
-+#ifdef LDAP_EXOP_REFRESH
-+#define HAVE_LDAP_REFRESH 1
-+#endif
-+
- typedef struct {
-       LDAP *link;
- #if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC)
-       zval *rebindproc;
-@@ -88,31 +93,46 @@
- #ifdef COMPILE_DL_LDAP
- ZEND_GET_MODULE(ldap)
- #endif
- 
-+
-+/* {{{ proto void _close_ldap_link()
-+   close a connection and free LDAP resources */
- static void _close_ldap_link(zend_rsrc_list_entry *rsrc TSRMLS_DC) /* {{{ */
- {
-       ldap_linkdata *ld = (ldap_linkdata *)rsrc->ptr;
- 
--      ldap_unbind_s(ld->link);
--#if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC)
-+      /* ldap_unbind_s() is deprecated;
-+       * the distinction between ldap_unbind() and ldap_unbind_s() is moot */
-+#ifdef LDAP_API_FEATURE_X_OPENLDAP
-+      ldap_unbind_ext(ld->link, NULL, NULL);
-+#ifdef HAVE_3ARG_SETREBINDPROC
-+
-       if (ld->rebindproc != NULL) {
-               zval_dtor(ld->rebindproc);
-               FREE_ZVAL(ld->rebindproc);
-       }
- #endif
-+#else /* ! LDAP_API_FEATURE_X_OPENLDAP */
-+      ldap_unbind_s(ld->link);
-+#endif /* ! LDAP_API_FEATURE_X_OPENLDAP */
-+
-       efree(ld);
-       LDAPG(num_links)--;
- }
- /* }}} */
- 
-+/* {{{ proto void _free_ldap_result()
-+   free the result of an LDAP operation */
- static void _free_ldap_result(zend_rsrc_list_entry *rsrc TSRMLS_DC) /* {{{ */
- {
-       LDAPMessage *result = (LDAPMessage *)rsrc->ptr;
-       ldap_msgfree(result);
- }
- /* }}} */
- 
-+/* {{{ proto void _free_ldap_result_entry()
-+   free an entry resulting from an LDAP search operation */
- static void _free_ldap_result_entry(zend_rsrc_list_entry *rsrc TSRMLS_DC) /* {{{ */
- {
-       ldap_resultentry *entry = (ldap_resultentry *)rsrc->ptr;
- 
-@@ -203,8 +223,21 @@
-       REGISTER_LONG_CONSTANT("GSLC_SSL_ONEWAY_AUTH", GSLC_SSL_ONEWAY_AUTH, CONST_PERSISTENT | CONST_CS);
-       REGISTER_LONG_CONSTANT("GSLC_SSL_TWOWAY_AUTH", GSLC_SSL_TWOWAY_AUTH, CONST_PERSISTENT | CONST_CS);
- #endif
- 
-+#ifdef LDAP_CONTROL_PASSWORDPOLICYREQUEST
-+      REGISTER_LONG_CONSTANT("PP_passwordExpired", PP_passwordExpired, CONST_PERSISTENT | CONST_CS);
-+      REGISTER_LONG_CONSTANT("PP_accountLocked", PP_accountLocked, CONST_PERSISTENT | CONST_CS);
-+      REGISTER_LONG_CONSTANT("PP_changeAfterReset", PP_changeAfterReset, CONST_PERSISTENT | CONST_CS);
-+      REGISTER_LONG_CONSTANT("PP_passwordModNotAllowed", PP_passwordModNotAllowed, CONST_PERSISTENT | CONST_CS);
-+      REGISTER_LONG_CONSTANT("PP_mustSupplyOldPassword", PP_mustSupplyOldPassword, CONST_PERSISTENT | CONST_CS);
-+      REGISTER_LONG_CONSTANT("PP_insufficientPasswordQuality", PP_insufficientPasswordQuality, CONST_PERSISTENT | CONST_CS);
-+      REGISTER_LONG_CONSTANT("PP_passwordTooShort", PP_passwordTooShort, CONST_PERSISTENT | CONST_CS);
-+      REGISTER_LONG_CONSTANT("PP_passwordTooYoung", PP_passwordTooYoung, CONST_PERSISTENT | CONST_CS);
-+      REGISTER_LONG_CONSTANT("PP_passwordInHistory", PP_passwordInHistory, CONST_PERSISTENT | CONST_CS);
-+      REGISTER_LONG_CONSTANT("PP_noError", PP_noError, CONST_PERSISTENT | CONST_CS);
-+#endif /* LDAP_CONTROL_PASSWORDPOLICYREQUEST */
-+
-       le_link = zend_register_list_destructors_ex(_close_ldap_link, NULL, "ldap link", module_number);
-       le_result = zend_register_list_destructors_ex(_free_ldap_result, NULL, "ldap result", module_number);
-       le_result_entry = zend_register_list_destructors_ex(_free_ldap_result_entry, NULL, "ldap result entry", module_number);
- 
-@@ -285,15 +318,176 @@
-       DISPLAY_INI_ENTRIES();
- }
- /* }}} */
- 
-+
-+/* {{{ proto int _php_parse_referrals_resp()
-+   parse an array of LDAP referrals into a zval array */
-+static int _php_parse_referrals_resp(char ***lreferralsp, zval **referrals)
-+{
-+      int     num_referrals = 0;
-+
-+      if (*lreferralsp != NULL) {
-+              char    **refp = *lreferralsp;
-+
-+              while (*refp) {
-+                      add_next_index_string(*referrals, *refp, 1);
-+                      refp++;
-+                      num_referrals++;
-+              }
-+#ifdef LDAP_API_FEATURE_X_OPENLDAP
-+              ber_memvfree((void **)*lreferralsp);
-+#else
-+              ldap_value_free(*lreferralsp);
-+#endif
-+              *lreferralsp = NULL;
-+      }
-+
-+      return num_referrals;
-+}
-+/* }}} */
-+
-+/* {{{ proto int _php_parse_controls()
-+   parse an array of zvals into an array of LDAP controls */
-+static int _php_parse_controls(zval **ctrls, LDAPControl ***lctrlsp)
-+{
-+      LDAPControl *lctrl, **lctrls, **lctrlp;
-+      zval **ctrlval, **val;
-+      int ncontrols;
-+      char error = 0;
-+
-+              
-+      if ((Z_TYPE_PP(ctrls) != IS_ARRAY) || !(ncontrols = zend_hash_num_elements(Z_ARRVAL_PP(ctrls)))) {
-+              php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expected non-empty array value");
-+              return 0;
-+      }
-+
-+      lctrls = safe_emalloc((1 + ncontrols), sizeof(*lctrls), 0);
-+      *lctrls = NULL;
-+      lctrlp = lctrls;
-+      zend_hash_internal_pointer_reset(Z_ARRVAL_PP(ctrls));
-+      while (zend_hash_get_current_data(Z_ARRVAL_PP(ctrls), (void**)&ctrlval) == SUCCESS) {
-+              if (Z_TYPE_PP(ctrlval) != IS_ARRAY) {
-+                      php_error_docref(NULL TSRMLS_CC, E_WARNING, "The array value must contain only arrays, where each array is a control");
-+                      error = 1;
-+                      break;
-+              }
-+              if (zend_hash_find(Z_ARRVAL_PP(ctrlval), "oid", sizeof("oid"), (void **) &val) == FAILURE) {
-+                      php_error_docref(NULL TSRMLS_CC, E_WARNING, "Control must have an oid key");
-+                      error = 1;
-+                      break;
-+              }
-+              lctrl = *lctrlp = emalloc(sizeof(**lctrlp));
-+              convert_to_string_ex(val);
-+              lctrl->ldctl_oid = Z_STRVAL_PP(val);
-+              if (zend_hash_find(Z_ARRVAL_PP(ctrlval), "value", sizeof("value"), (void **) &val) == SUCCESS) {
-+                      convert_to_string_ex(val);
-+                      lctrl->ldctl_value.bv_val = Z_STRVAL_PP(val);
-+                      lctrl->ldctl_value.bv_len = Z_STRLEN_PP(val);
-+              } else {
-+                      lctrl->ldctl_value.bv_val = NULL;
-+                      lctrl->ldctl_value.bv_len = 0;
-+              }
-+              if (zend_hash_find(Z_ARRVAL_PP(ctrlval), "iscritical", sizeof("iscritical"), (void **) &val) == SUCCESS) {
-+                      convert_to_boolean_ex(val);
-+                      lctrl->ldctl_iscritical = Z_BVAL_PP(val);
-+              } else {
-+                      lctrl->ldctl_iscritical = 0;
-+              }
-+              
-+              ++lctrlp;
-+              *lctrlp = NULL;
-+              zend_hash_move_forward(Z_ARRVAL_PP(ctrls));
-+      }
-+      if (!error) {
-+              *lctrlsp = lctrls;
-+      }
-+      return ncontrols;
-+}
-+/* }}} */
-+
-+/* {{{ proto void _php_free_controls()
-+   frees an array of LDAP controls as parsed (and malloc'ed) by _php_parse_controls */
-+static void _php_free_controls(LDAPControl ***lctrlsp)
-+{
-+      LDAPControl **lctrlp;
-+
-+      for (lctrlp = *lctrlsp; *lctrlp; lctrlp++) {
-+              efree(*lctrlp);
-+      }
-+      efree(*lctrlsp);
-+      *lctrlsp = NULL;
-+}
-+/* }}} */
-+
-+/* {{{ proto void _php_parse_controls_resp()
-+   parse an array of LDAP controls into a zval array */
-+static int _php_parse_controls_resp(LDAPControl ***lctrlsp, zval **ctrls)
-+{
-+      int     num_ctrls = 0;
-+
-+      if (*lctrlsp != NULL) {
-+              int             error = 0;
-+              LDAPControl     **ctrlp = *lctrlsp;
-+
-+              while (*ctrlp) {
-+                      zval *ctrlval = NULL;
-+
-+                      if ( (*ctrlp)->ldctl_oid == NULL ) {
-+                              error = 1;
-+                              break;
-+                      }
-+
-+                      MAKE_STD_ZVAL(ctrlval);
-+                      array_init(ctrlval);
-+
-+                      add_assoc_string(ctrlval, "oid", (*ctrlp)->ldctl_oid, 1);
-+                      if ( (*ctrlp)->ldctl_value.bv_len ) {
-+                              add_assoc_stringl(ctrlval, "value", (*ctrlp)->ldctl_value.bv_val, (*ctrlp)->ldctl_value.bv_len, 1);
-+                      }
-+
-+                      /* As per <draft-ietf-ldapbis-protocol>:
-+                       *
-+                       * 4.1.11
-+
-+   The criticality field only has meaning in controls attached to
-+   request messages (except UnbindRequest). For controls attached to
-+   response messages and the UnbindRequest, the criticality field SHOULD
-+   be FALSE, and MUST be ignored by the receiving protocol peer.
-+
-+                       */
-+
-+                      add_next_index_zval(*ctrls, ctrlval);
-+
-+                      num_ctrls++;
-+                      ctrlp++;
-+              }
-+              ldap_controls_free(*lctrlsp);
-+              *lctrlsp = NULL;
-+
-+              if (error) {
-+                      /* ... */
-+                      return -1;
-+              }
-+      }
-+
-+      return num_ctrls;
-+}
-+/* }}} */
-+
- /* {{{ proto resource ldap_connect([string host [, int port [, string wallet [, string wallet_passwd [, int authmode]]]]])
-    Connect to an LDAP server */
- PHP_FUNCTION(ldap_connect)
- {
-       char *host = NULL;
-       int hostlen;
--      long port = 389; /* Default port */
-+      int port = 
-+#ifdef LDAP_API_FEATURE_X_OPENLDAP
-+      LDAP_PORT
-+#else /* ! LDAP_API_FEATURE_X_OPENLDAP */
-+      389 /* Default port */
-+#endif /* ! LDAP_API_FEATURE_X_OPENLDAP */
-+      ;
- #ifdef HAVE_ORALDAP
-       char *wallet = NULL, *walletpasswd = NULL;
-       int walletlen = 0, walletpasswdlen = 0;
-       long authmode = GSLC_SSL_NO_AUTH;
-@@ -327,23 +521,41 @@
- 
-       ld = ecalloc(1, sizeof(ldap_linkdata));
- 
- #ifdef LDAP_API_FEATURE_X_OPENLDAP
--      if (host != NULL && strchr(host, '/')) {
--              int rc;
-+      /* OpenLDAP provides a specific call to detect valid LDAP URIs;
-+       * ldap_init()/ldap_open() is deprecated, use ldap_initialize() instead.
-+       */
-+      {
-+              int             rc;
-+              char    *url = host;
-+
-+              if (!ldap_is_ldap_url(url)) {
-+                      int     urllen = hostlen + sizeof( "ldap://:65535"; );
-+
-+                      if (port <= 0 || port > 65535) {
-+                              php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid port number: %ld", port);
-+                              RETURN_FALSE;
-+                      }
-+
-+                      url = emalloc(urllen);
-+                      snprintf( url, urllen, "ldap://%s:%d";, host ? host : "", port );
-+              }
-               
--              rc = ldap_initialize(&ldap, host);
-+              rc = ldap_initialize(&ldap, url);
-               if (rc != LDAP_SUCCESS) {
-                       efree(ld);
-                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not create session handle: %s", ldap_err2string(rc));



Home | Main Index | Thread Index | Old Index