s4:winbind - Fix it another time up
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
Fri, 27 Nov 2009 16:45:20 +0000 (17:45 +0100)
committerMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
Fri, 27 Nov 2009 16:45:20 +0000 (17:45 +0100)
The first fix attempt did break some configurations (incl. "make test").
This now is the right fix with the right comment.

source4/winbind/wb_setup_domains.c

index 6b4fd891c5eac72cb6c38c2b24db9ce52e9fbb13..5ce6500d4d2cec9d3b85cf45288fd7e93d2d4106 100644 (file)
@@ -27,11 +27,23 @@ NTSTATUS wbsrv_setup_domains(struct wbsrv_service *service)
 {
        const struct dom_sid *primary_sid;
 
 {
        const struct dom_sid *primary_sid;
 
+       /*
+        * This is a bit more difficult here: when we are a domain controller
+        * or a joined domain member the first call will work. But if we are
+        * a standalone server or unjoined member then the second is the right
+        * one.
+        */
        primary_sid = secrets_get_domain_sid(service,
                                             service->task->event_ctx,
                                             service->task->lp_ctx,
        primary_sid = secrets_get_domain_sid(service,
                                             service->task->event_ctx,
                                             service->task->lp_ctx,
-                                            lp_sam_name(service->task->lp_ctx));
-       if (!primary_sid) {
+                                            lp_workgroup(service->task->lp_ctx));
+       if (primary_sid == NULL) {
+               primary_sid = secrets_get_domain_sid(service,
+                                                    service->task->event_ctx,
+                                                    service->task->lp_ctx,
+                                                    lp_netbios_name(service->task->lp_ctx));
+       }
+       if (primary_sid == NULL) {
                return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
        }
 
                return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
        }