+ if (strlen(DomainNames[k]) == 0)
+ continue;
+ for (i = 0; i < argc; i++)
+ {
+ if (orig_argv[i] != NULL)
+ free(orig_argv[i]);
+ orig_argv[i] = strdup(argv[i]);
+ }
+
+ memset(PrincipalName, '\0', sizeof(PrincipalName));
+ memset(ldap_domain, '\0', sizeof(ldap_domain));
+ memset(ServerList, '\0', sizeof(ServerList[0]) * MAX_SERVER_NAMES);
+ memset(default_server, '\0', sizeof(default_server));
+ memset(dn_path, '\0', sizeof(dn_path));
+ UseSFU30 = 0;
+ NoChangeConfigFile = 0;
+ beforec = atoi(orig_argv[2]);
+ afterc = atoi(orig_argv[3]);
+ table = orig_argv[1];
+ before = &orig_argv[4];
+ after = &orig_argv[4 + beforec];
+
+ if (afterc == 0)
+ after = NULL;
+
+ if (beforec == 0)
+ before = NULL;
+
+ if (ReadConfigFile(DomainNames[k]))
+ {
+ continue;
+ }
+
+ OldUseSFU30 = UseSFU30;
+
+ for (i = 0; i < 5; i++)
+ {
+ ldap_handle = (LDAP *)NULL;
+ if (!(rc = ad_connect(&ldap_handle, ldap_domain, dn_path, "", "",
+ default_server, 1, ServerList)))
+ {
+ com_err(whoami, 0, "connected to domain %s", DomainNames[k]);
+ break;
+ }
+
+ if (ldap_handle == NULL)
+ {
+ if (!NoChangeConfigFile)
+ {
+ for (j = 0; j < MAX_SERVER_NAMES; j++)
+ {
+ if (ServerList[j] != NULL)
+ {
+ free(ServerList[j]);
+ ServerList[j] = NULL;
+ }
+ }
+ if (rc = GetServerList(ldap_domain, ServerList))
+ {
+ com_err("incremental", 0,
+ "winad.incr cannot bind to any server in domain %s",
+ DomainNames[k]);
+ continue;
+ }
+ }
+ }
+ }
+
+ if ((rc) || (ldap_handle == NULL))
+ {
+ critical_alert("incremental",
+ "winad.incr cannot connect to any server in domain %s",
+ DomainNames[k]);
+ continue;
+ }
+
+ for (i = 0; i < (int)strlen(table); i++)
+ table[i] = tolower(table[i]);
+
+ if (!strcmp(table, "users"))
+ do_user(ldap_handle, dn_path, ldap_domain, before, beforec, after,
+ afterc);
+ else if (!strcmp(table, "list"))
+ do_list(ldap_handle, dn_path, ldap_domain, before, beforec, after,
+ afterc);
+ else if (!strcmp(table, "imembers"))
+ do_member(ldap_handle, dn_path, ldap_domain, before, beforec, after,
+ afterc);
+ else if (!strcmp(table, "containers"))
+ do_container(ldap_handle, dn_path, ldap_domain, before, beforec, after,
+ afterc);
+ else if (!strcmp(table, "mcntmap"))
+ do_mcntmap(ldap_handle, dn_path, ldap_domain, before, beforec, after,
+ afterc);