[1846] in Moira Commits
/svn/moira r3992 - trunk/moira/incremental/ldap
daemon@ATHENA.MIT.EDU (Garry Zacheiss)
Sun Mar 14 22:52:31 2010
Date: Sun, 14 Mar 2010 22:52:24 -0400
From: Garry Zacheiss <zacheiss@MIT.EDU>
Message-Id: <201003150252.o2F2qOxD025295@drugstore.mit.edu>
To: moira-commits@mit.edu
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Author: zacheiss
Date: 2010-03-14 22:52:24 -0400 (Sun, 14 Mar 2010)
New Revision: 3992
Modified:
trunk/moira/incremental/ldap/winad.c
Log:
And some more from mark.
Modified: trunk/moira/incremental/ldap/winad.c
===================================================================
--- trunk/moira/incremental/ldap/winad.c 2010-03-15 02:11:58 UTC (rev 3991)
+++ trunk/moira/incremental/ldap/winad.c 2010-03-15 02:52:24 UTC (rev 3992)
@@ -4211,6 +4211,67 @@
memset(filesys_name, '\0', sizeof(filesys_name));
sprintf(filesys_name, "%s.po", user_name);
+ group_count = 0;
+ group_base = NULL;
+
+ memset(displayName, '\0', sizeof(displayName));
+
+ if (strlen(MoiraId) != 0)
+ {
+ if(ActiveDirectory)
+ {
+ sprintf(filter, "(&(objectClass=user)(mitMoiraId=%s))", MoiraId);
+ }
+ else
+ {
+ sprintf(filter,
+ "(&(objectClass=mitPerson)(mitMoiraId=%s))", MoiraId);
+ }
+
+ attr_array[0] = "cn";
+ attr_array[1] = NULL;
+ if ((rc = linklist_build(ldap_handle, dn_path, filter, attr_array,
+ &group_base, &group_count,
+ LDAP_SCOPE_SUBTREE)) != 0)
+ {
+ com_err(whoami, 0, "Unable to process user %s : %s",
+ user_name, ldap_err2string(rc));
+ return(rc);
+ }
+ }
+
+ if (group_count != 1)
+ {
+ linklist_free(group_base);
+ group_base = NULL;
+ group_count = 0;
+ sprintf(filter, "(sAMAccountName=%s)", user_name);
+ attr_array[0] = "cn";
+ attr_array[1] = NULL;
+ sprintf(temp, "%s,%s", user_ou, dn_path);
+ if ((rc = linklist_build(ldap_handle, temp, filter, attr_array,
+ &group_base, &group_count,
+ LDAP_SCOPE_SUBTREE)) != 0)
+ {
+ com_err(whoami, 0, "Unable to process user %s : %s",
+ user_name, ldap_err2string(rc));
+ return(rc);
+ }
+ }
+
+ if (group_count != 1)
+ {
+ com_err(whoami, 0, "Unable to find user %s in directory",
+ user_name);
+ linklist_free(group_base);
+ return(AD_NO_USER_FOUND);
+ }
+
+ strcpy(distinguished_name, group_base->dn);
+
+ linklist_free(group_base);
+ group_count = 0;
+
if (Exchange)
{
if(contact_create(ldap_handle, dn_path, contact_mail, contact_ou))
@@ -4279,70 +4340,12 @@
return(rc);
}
}
- }
- }
- group_count = 0;
- group_base = NULL;
-
- memset(displayName, '\0', sizeof(displayName));
-
- if (strlen(MoiraId) != 0)
- {
- if(ActiveDirectory)
- {
- sprintf(filter, "(&(objectClass=user)(mitMoiraId=%s))", MoiraId);
+ linklist_free(group_base);
+ group_count = 0;
}
- else
- {
- sprintf(filter,
- "(&(objectClass=mitPerson)(mitMoiraId=%s))", MoiraId);
- }
-
- attr_array[0] = "cn";
- attr_array[1] = NULL;
- if ((rc = linklist_build(ldap_handle, dn_path, filter, attr_array,
- &group_base, &group_count,
- LDAP_SCOPE_SUBTREE)) != 0)
- {
- com_err(whoami, 0, "Unable to process user %s : %s",
- user_name, ldap_err2string(rc));
- return(rc);
- }
}
- if (group_count != 1)
- {
- linklist_free(group_base);
- group_base = NULL;
- group_count = 0;
- sprintf(filter, "(sAMAccountName=%s)", user_name);
- attr_array[0] = "cn";
- attr_array[1] = NULL;
- sprintf(temp, "%s,%s", user_ou, dn_path);
- if ((rc = linklist_build(ldap_handle, temp, filter, attr_array,
- &group_base, &group_count,
- LDAP_SCOPE_SUBTREE)) != 0)
- {
- com_err(whoami, 0, "Unable to process user %s : %s",
- user_name, ldap_err2string(rc));
- return(rc);
- }
- }
-
- if (group_count != 1)
- {
- com_err(whoami, 0, "Unable to find user %s in directory",
- user_name);
- linklist_free(group_base);
- return(AD_NO_USER_FOUND);
- }
-
- strcpy(distinguished_name, group_base->dn);
-
- linklist_free(group_base);
- group_count = 0;
-
if(!ActiveDirectory)
{
if (rc = moira_connect())