[PHP-DEV] CVS update: php31/ext/ldap From: zeev (php-dev <email protected>)
Date: 06/26/98

Date: Friday June 26, 1998 @ 12:52
Author: zeev

Update of /repository/php31/ext/ldap
In directory asf:/tmp/cvs-serv8683/ext/ldap

Modified Files:
        ldap.c
Log Message:
I doubt that's all that missing, but here it is anyway

Index: php31/ext/ldap/ldap.c
diff -c php31/ext/ldap/ldap.c:1.2 php31/ext/ldap/ldap.c:1.3
*** php31/ext/ldap/ldap.c:1.2 Wed May 27 06:20:42 1998
--- php31/ext/ldap/ldap.c Fri Jun 26 12:52:51 1998
***************
*** 29,35 ****
   */
   
  
! /* $Id: ldap.c,v 1.2 1998/05/27 10:20:42 rasmus Exp $ */
  
  #ifndef MSVC5
  #include "config.h"
--- 29,35 ----
   */
   
  
! /* $Id: ldap.c,v 1.3 1998/06/26 16:52:51 zeev Exp $ */
  
  #ifndef MSVC5
  #include "config.h"
***************
*** 270,276 ****
  
          php3_printf("<table>"
                                  "<tr><td>Total links:</td><td>%d/%s</td></tr>\n"
! "<tr><td>RCS Version:</td><td>$Id: ldap.c,v 1.2 1998/05/27 10:20:42 rasmus Exp $</td></tr>\n"
  #if HAVE_NSLDAP
                                  "<tr><td>SDK Version:</td><td>%f</td></tr>"
                                  "<tr><td>Highest LDAP Protocol Supported:</td><td>%f</td></tr>"
--- 270,276 ----
  
          php3_printf("<table>"
                                  "<tr><td>Total links:</td><td>%d/%s</td></tr>\n"
! "<tr><td>RCS Version:</td><td>$Id: ldap.c,v 1.3 1998/06/26 16:52:51 zeev Exp $</td></tr>\n"
  #if HAVE_NSLDAP
                                  "<tr><td>SDK Version:</td><td>%f</td></tr>"
                                  "<tr><td>Highest LDAP Protocol Supported:</td><td>%f</td></tr>"
***************
*** 553,559 ****
                          ldap_base_dn = base_dn->value.str.val;
                          ldap_filter = filter->value.str.val;
  
! num_attribs = hash_num_elements(attrs->value.ht);
                          if ((ldap_attrs = emalloc((num_attribs+1) * sizeof(char *))) == NULL) {
                                  php3_error(E_WARNING, "LDAP: Could not allocate memory");
                                  RETURN_FALSE;
--- 553,559 ----
                          ldap_base_dn = base_dn->value.str.val;
                          ldap_filter = filter->value.str.val;
  
! num_attribs = _php3_hashnum_elements(attrs->value.ht);
                          if ((ldap_attrs = emalloc((num_attribs+1) * sizeof(char *))) == NULL) {
                                  php3_error(E_WARNING, "LDAP: Could not allocate memory");
                                  RETURN_FALSE;
***************
*** 561,567 ****
                          }
  
                          for(i=0; i<num_attribs; i++) {
! if (hash_index_find(attrs->value.ht, i, (void **) &attr) == FAILURE) {
                                          php3_error(E_WARNING, "LDAP: Array initialization wrong");
                                          RETURN_FALSE;
                                          return;
--- 561,567 ----
                          }
  
                          for(i=0; i<num_attribs; i++) {
! if (_php3_hashindex_find(attrs->value.ht, i, (void **) &attr) == FAILURE) {
                                          php3_error(E_WARNING, "LDAP: Array initialization wrong");
                                          RETURN_FALSE;
                                          return;
***************
*** 779,785 ****
                          }
                          free(ldap_value);
  
! hash_update(tmp1.value.ht, _php3_strtolower(attribute), strlen(attribute)+1, (void *) &tmp2, sizeof(pval), NULL);
                          add_index_string(&tmp1, attr_count, attribute, 1);
  
                          attr_count++;
--- 779,785 ----
                          }
                          free(ldap_value);
  
! _php3_hashupdate(tmp1.value.ht, _php3_strtolower(attribute), strlen(attribute)+1, (void *) &tmp2, sizeof(pval), NULL);
                          add_index_string(&tmp1, attr_count, attribute, 1);
  
                          attr_count++;
***************
*** 790,796 ****
                  dn = ldap_get_dn(ldap, ldap_result_entry);
                  add_assoc_string(&tmp1, "dn", dn, 1);
  
! hash_index_update(return_value->value.ht, entry_count, (void *) &tmp1, sizeof(pval), NULL);
                  
                  entry_count++;
                  ldap_result_entry = ldap_next_entry(ldap, ldap_result_entry);
--- 790,796 ----
                  dn = ldap_get_dn(ldap, ldap_result_entry);
                  add_assoc_string(&tmp1, "dn", dn, 1);
  
! _php3_hashindex_update(return_value->value.ht, entry_count, (void *) &tmp1, sizeof(pval), NULL);
                  
                  entry_count++;
                  ldap_result_entry = ldap_next_entry(ldap, ldap_result_entry);
***************
*** 928,934 ****
                  }
                  free(ldap_value);
  
! hash_update(return_value->value.ht, attribute, strlen(attribute)+1, (void *) &tmp, sizeof(pval), NULL);
                  add_index_string(return_value, count, attribute, 1);
  
                  count++;
--- 928,934 ----
                  }
                  free(ldap_value);
  
! _php3_hashupdate(return_value->value.ht, attribute, strlen(attribute)+1, (void *) &tmp, sizeof(pval), NULL);
                  add_index_string(return_value, count, attribute, 1);
  
                  count++;
***************
*** 1094,1123 ****
          convert_to_string(dn);
          ldap_dn = dn->value.str.val;
  
! num_attribs = hash_num_elements(entry->value.ht);
  
          ldap_mods = emalloc((num_attribs+1) * sizeof(LDAPMod *));
  
! hash_internal_pointer_reset(entry->value.ht);
  
          for(i=0; i<num_attribs; i++) {
                  ldap_mods[i] = emalloc(sizeof(LDAPMod));
  
                  ldap_mods[i]->mod_op = oper;
  
! if (hash_get_current_key(entry->value.ht, &attribute, &index) == HASH_KEY_IS_STRING) {
                          ldap_mods[i]->mod_type = estrdup(attribute);
                          efree(attribute);
                  } else {
                          php3_error(E_WARNING, "LDAP: Unknown Attribute in the data");
                  }
  
! hash_get_current_data(entry->value.ht, (void **) &value);
  
                  if (value->type != IS_ARRAY) {
                          num_values = 1;
                  } else {
! num_values = hash_num_elements(value->value.ht);
                  }
  
                  ldap_mods[i]->mod_values = emalloc((num_values+1) * sizeof(char *));
--- 1094,1123 ----
          convert_to_string(dn);
          ldap_dn = dn->value.str.val;
  
! num_attribs = _php3_hashnum_elements(entry->value.ht);
  
          ldap_mods = emalloc((num_attribs+1) * sizeof(LDAPMod *));
  
! _php3_hashinternal_pointer_reset(entry->value.ht);
  
          for(i=0; i<num_attribs; i++) {
                  ldap_mods[i] = emalloc(sizeof(LDAPMod));
  
                  ldap_mods[i]->mod_op = oper;
  
! if (_php3_hashget_current_key(entry->value.ht, &attribute, &index) == HASH_KEY_IS_STRING) {
                          ldap_mods[i]->mod_type = estrdup(attribute);
                          efree(attribute);
                  } else {
                          php3_error(E_WARNING, "LDAP: Unknown Attribute in the data");
                  }
  
! _php3_hashget_current_data(entry->value.ht, (void **) &value);
  
                  if (value->type != IS_ARRAY) {
                          num_values = 1;
                  } else {
! num_values = _php3_hashnum_elements(value->value.ht);
                  }
  
                  ldap_mods[i]->mod_values = emalloc((num_values+1) * sizeof(char *));
***************
*** 1127,1140 ****
                          ldap_mods[i]->mod_values[0] = value->value.str.val;
                  } else {
                          for(j=0; j<num_values; j++) {
! hash_index_find(value->value.ht, j, (void **) &ivalue);
                                  convert_to_string(ivalue);
                                  ldap_mods[i]->mod_values[j] = ivalue->value.str.val;
                          }
                  }
                  ldap_mods[i]->mod_values[num_values] = NULL;
  
! hash_move_forward(entry->value.ht);
          }
          ldap_mods[num_attribs] = NULL;
  
--- 1127,1140 ----
                          ldap_mods[i]->mod_values[0] = value->value.str.val;
                  } else {
                          for(j=0; j<num_values; j++) {
! _php3_hashindex_find(value->value.ht, j, (void **) &ivalue);
                                  convert_to_string(ivalue);
                                  ldap_mods[i]->mod_values[j] = ivalue->value.str.val;
                          }
                  }
                  ldap_mods[i]->mod_values[num_values] = NULL;
  
! _php3_hashmove_forward(entry->value.ht);
          }
          ldap_mods[num_attribs] = NULL;