LDAP receive only needed attributes on search

metzemix at gmx.de metzemix at gmx.de
Wed Feb 13 03:53:02 GMT 2002


Hi jerry, 

here is the patch

------------------------------------------------
--- pdb_ldap-o.c	Wed Feb 13 11:33:46 2002
+++ pdb_ldap-n.c	Wed Feb 13 11:49:36 2002
@@ -184,10 +184,18 @@
 {
 	int scope = LDAP_SCOPE_SUBTREE;
 	int rc;
+	char *attr[]= {  "uid", "pwdLastSet", "logonTime", 
+			"logoffTime", "kickoffTime", "cn",
+			"pwdCanChange", "pwdMustChange",
+			"dislplayName", "homeDrive",
+			"smbHome", "scriptPath",
+			"profilePath", "description",
+			"userWorkstation", "rid",
+			"primaryGroupID", NULL };
 
 	DEBUG(2, ("ldap_search_one_user: searching for:[%s]\n", filter));
 
-	rc = ldap_search_s(ldap_struct, lp_ldap_suffix (), scope, filter, NULL, 0,
result);
+	rc = ldap_search_s(ldap_struct, lp_ldap_suffix (), scope, filter, attr, 0,
result);
 
 	if (rc != LDAP_SUCCESS)	{
 		DEBUG(0,("ldap_search_one_user: Problem during the LDAP search: %s\n", 
@@ -671,6 +679,14 @@
 {
 	int rc;
 	pstring filter;
+	char *attr[]= {  "uid", "pwdLastSet", "logonTime", 
+			"logoffTime", "kickoffTime", "cn",
+			"pwdCanChange", "pwdMustChange",
+			"dislplayName", "homeDrive",
+			"smbHome", "scriptPath",
+			"profilePath", "description",
+			"userWorkstation", "rid",
+			"primaryGroupID", NULL };
 
 	if (!ldap_open_connection(&global_ldap_ent.ldap_struct))
 	{
@@ -686,7 +702,7 @@
 	all_string_sub(filter, "%u", "*", sizeof(pstring));
 
 	rc = ldap_search_s(global_ldap_ent.ldap_struct, lp_ldap_suffix(),
-			   LDAP_SCOPE_SUBTREE, filter, NULL, 0,
+			   LDAP_SCOPE_SUBTREE, filter, attr, 0,
 			   &global_ldap_ent.result);
 
 	if (rc != LDAP_SUCCESS)
---------------------------------------

-- 
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net
-------------- next part --------------
--- pdb_ldap-o.c	Wed Feb 13 11:33:46 2002
+++ pdb_ldap-n.c	Wed Feb 13 11:49:36 2002
@@ -184,10 +184,18 @@
 {
 	int scope = LDAP_SCOPE_SUBTREE;
 	int rc;
+	char *attr[]= {  "uid", "pwdLastSet", "logonTime", 
+			"logoffTime", "kickoffTime", "cn",
+			"pwdCanChange", "pwdMustChange",
+			"dislplayName", "homeDrive",
+			"smbHome", "scriptPath",
+			"profilePath", "description",
+			"userWorkstation", "rid",
+			"primaryGroupID", NULL };
 
 	DEBUG(2, ("ldap_search_one_user: searching for:[%s]\n", filter));
 
-	rc = ldap_search_s(ldap_struct, lp_ldap_suffix (), scope, filter, NULL, 0, result);
+	rc = ldap_search_s(ldap_struct, lp_ldap_suffix (), scope, filter, attr, 0, result);
 
 	if (rc != LDAP_SUCCESS)	{
 		DEBUG(0,("ldap_search_one_user: Problem during the LDAP search: %s\n", 
@@ -671,6 +679,14 @@
 {
 	int rc;
 	pstring filter;
+	char *attr[]= {  "uid", "pwdLastSet", "logonTime", 
+			"logoffTime", "kickoffTime", "cn",
+			"pwdCanChange", "pwdMustChange",
+			"dislplayName", "homeDrive",
+			"smbHome", "scriptPath",
+			"profilePath", "description",
+			"userWorkstation", "rid",
+			"primaryGroupID", NULL };
 
 	if (!ldap_open_connection(&global_ldap_ent.ldap_struct))
 	{
@@ -686,7 +702,7 @@
 	all_string_sub(filter, "%u", "*", sizeof(pstring));
 
 	rc = ldap_search_s(global_ldap_ent.ldap_struct, lp_ldap_suffix(),
-			   LDAP_SCOPE_SUBTREE, filter, NULL, 0,
+			   LDAP_SCOPE_SUBTREE, filter, attr, 0,
 			   &global_ldap_ent.result);
 
 	if (rc != LDAP_SUCCESS)


More information about the samba-technical mailing list