HACK: winbind only one connection to our domain
authorStefan Metzmacher <metze@samba.org>
Tue, 6 Apr 2010 12:48:33 +0000 (14:48 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 29 Apr 2010 13:53:15 +0000 (15:53 +0200)
source3/winbindd/winbindd.c
source3/winbindd/winbindd.h
source3/winbindd/winbindd_cm.c
source3/winbindd/winbindd_dual.c

index 4d00269970ece66ab6fb854914a4fb8e7e485515..b177bede8de097ede11ef588d1ae8c96fec08236 100644 (file)
@@ -1012,6 +1012,8 @@ bool winbindd_use_cache(void)
        return !opt_nocache;
 }
 
+bool wb_is_parent = true;
+
 /* Main function */
 
 int main(int argc, char **argv, char **envp)
@@ -1208,6 +1210,8 @@ int main(int argc, char **argv, char **envp)
                exit(1);
        }
 
+       wb_is_parent = true;
+
        /* Setup signal handlers */
 
        if (!winbindd_setup_sig_term_handler(true))
index f1815ac870bb71ec07c1b77fe3b4933ff32d55b7..f13067df4ad49e939fce7e72c30060189d1caacc 100644 (file)
@@ -385,4 +385,6 @@ struct WINBINDD_CCACHE_ENTRY {
 #define WINBINDD_PAM_AUTH_KRB5_RENEW_TIME 2592000 /* one month */
 #define DOM_SEQUENCE_NONE ((uint32)-1)
 
+extern bool wb_is_parent;
+
 #endif /* _WINBINDD_H */
index 54abce301274e459ca5ea35b7585f0046bd9733b..e1cc3705782137a56b1cbb15f9562d009810ec00 100644 (file)
@@ -180,6 +180,10 @@ static bool fork_child_dc_connect(struct winbindd_domain *domain)
        pid_t parent_pid = sys_getpid();
        char *lfile = NULL;
 
+if (wb_is_parent) {
+DEBUG(0,("fork_child_dc_connect called in the parent\n"));
+smb_panic(__location__);
+}
        if (domain->dc_probe_pid != (pid_t)-1) {
                /*
                 * We might already have a DC probe
@@ -1665,6 +1669,10 @@ static NTSTATUS init_dc_connection_network(struct winbindd_domain *domain)
 
 NTSTATUS init_dc_connection(struct winbindd_domain *domain)
 {
+if (wb_is_parent) {
+DEBUG(0,("init_dc_connection called in the parent\n"));
+smb_panic(__location__);
+}
        if (domain->internal) {
                return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
        }
@@ -1687,6 +1695,9 @@ static NTSTATUS init_dc_connection_rpc(struct winbindd_domain *domain)
        }
 
        if (!domain->internal && domain->conn.cli == NULL) {
+               DEBUG(0,("METZE: domain[%s] without inbound trust\n",
+                       domain->name));
+               smb_panic(__location__);
                /* happens for trusted domains without inbound trust */
                return NT_STATUS_TRUSTED_DOMAIN_FAILURE;
        }
index 4f314cf59f59ab5dd86a1c3cd06922d51f717765..4de94f4a55e7b6952c7c41c51fb2c7fe6911bbdf 100644 (file)
@@ -1106,6 +1106,8 @@ bool winbindd_reinit_after_fork(const char *logfilename)
        struct winbindd_domain *domain;
        struct winbindd_child *cl;
 
+       wb_is_parent = false;
+
        if (!NT_STATUS_IS_OK(reinit_after_fork(winbind_messaging_context(),
                                               winbind_event_context(),
                                               true))) {
@@ -1213,6 +1215,12 @@ static bool fork_domain_child(struct winbindd_child *child)
        struct winbindd_response response;
        struct winbindd_domain *primary_domain = NULL;
 
+if (!wb_is_parent) {
+       DEBUG(0,("try to fork a domain[%s] child from a child[%d] parent[%d]\n",
+               child->domain?child->domain->name:"no_domain", sys_getpid(), getppid()));
+       smb_panic(__location__);
+}
+
        if (child->domain) {
                DEBUG(10, ("fork_domain_child called for domain '%s'\n",
                           child->domain->name));
@@ -1285,12 +1293,12 @@ static bool fork_domain_child(struct winbindd_child *child)
                 * in start-up mode */
                if (!(child->domain->internal)) {
                        set_domain_online_request(child->domain);
-                       if (!(child->domain->primary)) {
+/*                     if (!(child->domain->primary)) {
                                primary_domain->startup = True;
                                primary_domain->startup_time = time(NULL);
                                set_domain_online_request(primary_domain);
                        }
-               }
+*/             }
        }
 
        /*
@@ -1316,7 +1324,7 @@ static bool fork_domain_child(struct winbindd_child *child)
                         * set_dc_type_and_flags_trustinfo()
                         * for details.
                         */
-                       set_domain_online_request(primary_domain);
+                       //set_domain_online_request(primary_domain);
                }
 
                child->lockout_policy_event = event_add_timed(