[SCM] Samba Shared Repository - branch v3-4-test updated

Karolin Seeger kseeger at samba.org
Tue Jan 19 03:42:49 MST 2010


The branch, v3-4-test has been updated
       via  20a4052... s3:pdb_ldap: restore Samba 3.0.x behavior and use the first "uid" value.
       via  6402321... s3:smbldap: add smbldap_talloc_first_attribute()
      from  bcb4da8... WHATSNEW: Start release notes for Samba 3.4.6.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-4-test


- Log -----------------------------------------------------------------
commit 20a405288fb1b33c43b31b170f1acc9c82732208
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Jan 5 13:30:42 2010 +0100

    s3:pdb_ldap: restore Samba 3.0.x behavior and use the first "uid" value.
    
    See bug #6157 for more details.
    
    metze
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    (cherry picked from commit 25806f43ddee7e2653e907eea2c6fcc075960fa1)
    (cherry picked from commit ac224452b94865db346ed68dc517f84d40e6303c)

commit 6402321d5bbbb28b335787856b16c3d8556e8e0a
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Jan 5 13:30:19 2010 +0100

    s3:smbldap: add smbldap_talloc_first_attribute()
    
    metze
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    (cherry picked from commit c992127f8a96c37940a6d298c7c6859c47f83d9b)
    (cherry picked from commit 915b7552b71904baf6a452bdc1649e76d8286a14)

-----------------------------------------------------------------------

Summary of changes:
 source3/include/smbldap.h |    3 +++
 source3/lib/smbldap.c     |   34 ++++++++++++++++++++++++++++++++++
 source3/passdb/pdb_ldap.c |    2 +-
 3 files changed, 38 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/smbldap.h b/source3/include/smbldap.h
index 3ac770a..726d5f7 100644
--- a/source3/include/smbldap.h
+++ b/source3/include/smbldap.h
@@ -211,6 +211,9 @@ const char** get_userattr_list( TALLOC_CTX *mem_ctx, int schema_ver );
 char * smbldap_talloc_single_attribute(LDAP *ldap_struct, LDAPMessage *entry,
 				       const char *attribute,
 				       TALLOC_CTX *mem_ctx);
+char * smbldap_talloc_first_attribute(LDAP *ldap_struct, LDAPMessage *entry,
+				      const char *attribute,
+				      TALLOC_CTX *mem_ctx);
 char * smbldap_talloc_smallest_attribute(LDAP *ldap_struct, LDAPMessage *entry,
 					 const char *attribute,
 					 TALLOC_CTX *mem_ctx);
diff --git a/source3/lib/smbldap.c b/source3/lib/smbldap.c
index 8c2b26d..be216c5 100644
--- a/source3/lib/smbldap.c
+++ b/source3/lib/smbldap.c
@@ -333,6 +333,40 @@ ATTRIB_MAP_ENTRY sidmap_attr_list[] = {
 	return result;
 }
 
+ char * smbldap_talloc_first_attribute(LDAP *ldap_struct, LDAPMessage *entry,
+				       const char *attribute,
+				       TALLOC_CTX *mem_ctx)
+{
+	char **values;
+	char *result;
+	size_t converted_size;
+
+	if (attribute == NULL) {
+		return NULL;
+	}
+
+	values = ldap_get_values(ldap_struct, entry, attribute);
+
+	if (values == NULL) {
+		DEBUG(10, ("attribute %s does not exist\n", attribute));
+		return NULL;
+	}
+
+	if (!pull_utf8_talloc(mem_ctx, &result, values[0], &converted_size)) {
+		DEBUG(10, ("pull_utf8_talloc failed\n"));
+		ldap_value_free(values);
+		return NULL;
+	}
+
+	ldap_value_free(values);
+
+#ifdef DEBUG_PASSWORDS
+	DEBUG (100, ("smbldap_get_first_attribute: [%s] = [%s]\n",
+		     attribute, result));
+#endif
+	return result;
+}
+
  char * smbldap_talloc_smallest_attribute(LDAP *ldap_struct, LDAPMessage *entry,
 					  const char *attribute,
 					  TALLOC_CTX *mem_ctx)
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
index 6a5c96f..0d498c8 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -559,7 +559,7 @@ static bool init_sam_from_ldap(struct ldapsam_privates *ldap_state,
 		goto fn_exit;
 	}
 
-	if (!(username = smbldap_talloc_smallest_attribute(priv2ld(ldap_state),
+	if (!(username = smbldap_talloc_first_attribute(priv2ld(ldap_state),
 					entry,
 					"uid",
 					ctx))) {


-- 
Samba Shared Repository


More information about the samba-cvs mailing list