lists.arthurdejong.org
RSS feed

nss-pam-ldapd commit: r1912 - nss-pam-ldapd/nslcd

[Date Prev][Date Next] [Thread Prev][Thread Next]

nss-pam-ldapd commit: r1912 - nss-pam-ldapd/nslcd



Author: arthur
Date: Sat Jan 12 23:33:00 2013
New Revision: 1912
URL: http://arthurdejong.org/viewvc/nss-pam-ldapd?revision=1912&view=revision

Log:
have myldap_get_ranged_values() return a list of values instead of a set

Modified:
   nss-pam-ldapd/nslcd/myldap.c

Modified: nss-pam-ldapd/nslcd/myldap.c
==============================================================================
--- nss-pam-ldapd/nslcd/myldap.c        Sat Jan 12 23:32:24 2013        (r1911)
+++ nss-pam-ldapd/nslcd/myldap.c        Sat Jan 12 23:33:00 2013        (r1912)
@@ -1410,7 +1410,7 @@
 /* Perform ranged retreival of attributes.
    http://msdn.microsoft.com/en-us/library/aa367017(vs.85).aspx
    http://www.tkk.fi/cc/docs/kerberos/draft-kashi-incremental-00.txt */
-static SET *myldap_get_ranged_values(MYLDAP_ENTRY *entry, const char *attr)
+static char **myldap_get_ranged_values(MYLDAP_ENTRY *entry, const char *attr)
 {
   char **values;
   char *attn;
@@ -1491,7 +1491,13 @@
   if (search != NULL)
     myldap_search_close(search);
   /* return the contents of the set as a list */
-  return set;
+  if (set == NULL)
+    return NULL;
+  values = (char **)set_tolist(set);
+  set_free(set);
+  if (values == NULL)
+    log_log(LOG_CRIT, "myldap_get_ranged_values(): malloc() failed to allocate 
memory");
+  return values;
 }
 
 /* Simple wrapper around ldap_get_values(). */
@@ -1500,7 +1506,6 @@
   char **values;
   int rc;
   int i;
-  SET *set;
   /* check parameters */
   if (!is_valid_entry(entry))
   {
@@ -1533,20 +1538,19 @@
     {
       /* we have a success code but no values, let's try to get ranged
          values */
-      set = myldap_get_ranged_values(entry, attr);
-      if (set == NULL)
+      values = myldap_get_ranged_values(entry, attr);
+      if (values == NULL)
         return NULL;
       /* store values entry so we can free it later on */
       for (i = 0; i < MAX_RANGED_ATTRIBUTES_PER_ENTRY; i++)
         if (entry->rangedattributevalues[i] == NULL)
         {
-          entry->rangedattributevalues[i] = (char **)set_tolist(set);
-          set_free(set);
+          entry->rangedattributevalues[i] = values;
           return (const char **)entry->rangedattributevalues[i];
         }
       /* we found no room to store the values */
       log_log(LOG_ERR, "ldap_get_values() couldn't store results, increase 
MAX_RANGED_ATTRIBUTES_PER_ENTRY");
-      set_free(set);
+      free(values);
       return NULL;
     }
     else
@@ -1610,7 +1614,6 @@
   struct berval **bvalues;
   int rc;
   int i;
-  SET *set;
   /* check parameters */
   if (!is_valid_entry(entry))
   {
@@ -1644,16 +1647,7 @@
     {
       /* we have a success code but no values, let's try to get ranged
          values */
-      set = myldap_get_ranged_values(entry, attr);
-      if (set == NULL)
-        return NULL;
-      values = set_tolist(set);
-      set_free(set);
-      if (values == NULL)
-      {
-        log_log(LOG_CRIT, "myldap_get_values_len(): malloc() failed to 
allocate memory");
-        return NULL;
-      }
+      values = (const char **)myldap_get_ranged_values(entry, attr);
     }
     else
     {
-- 
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-commits/