s3-param Remove special case for global_myname(), rename to lp_netbios_name()
[kai/samba.git] / source3 / winbindd / winbindd_pam_auth_crap.c
index dc2dc3e2657001b4b68d050156ef5307a5e3f799..2fb5111510c78bd8c82913fe084662ee7afa9dc6 100644 (file)
@@ -35,7 +35,6 @@ struct tevent_req *winbindd_pam_auth_crap_send(
        struct tevent_req *req, *subreq;
        struct winbindd_pam_auth_crap_state *state;
        struct winbindd_domain *domain;
-       const char *domain_name;
 
        req = tevent_req_create(mem_ctx, &state,
                                struct winbindd_pam_auth_crap_state);
@@ -48,6 +47,8 @@ struct tevent_req *winbindd_pam_auth_crap_send(
                sizeof(request->data.auth_crap.user)-1] = '\0';
        request->data.auth_crap.domain[
                sizeof(request->data.auth_crap.domain)-1] = '\0';
+       request->data.auth_crap.workstation[
+               sizeof(request->data.auth_crap.workstation)-1] = '\0';
 
        DEBUG(3, ("[%5lu]: pam auth crap domain: [%s] user: %s\n",
                  (unsigned long)cli->pid,
@@ -59,25 +60,23 @@ struct tevent_req *winbindd_pam_auth_crap_send(
                return tevent_req_post(req, ev);
        }
 
-       domain_name = NULL;
-
-       if (request->data.auth_crap.domain[0] != '\0') {
-               domain_name = request->data.auth_crap.domain;
-       } else if (lp_winbind_use_default_domain()) {
-               domain_name = lp_workgroup();
-       }
-
-       domain = NULL;
-
-       if (domain_name != NULL) {
-               domain = find_auth_domain(request->flags, domain_name);
+       if ((request->data.auth_crap.domain[0] == '\0')
+           && lp_winbind_use_default_domain()) {
+               fstrcpy(request->data.auth_crap.domain,
+                       lp_workgroup());
        }
 
+       domain = find_auth_domain(
+               request->flags, request->data.auth_crap.domain);
        if (domain == NULL) {
                tevent_req_nterror(req, NT_STATUS_NO_SUCH_USER);
                return tevent_req_post(req, ev);
        }
 
+       if (request->data.auth_crap.workstation[0] == '\0') {
+               fstrcpy(request->data.auth_crap.workstation, lp_netbios_name());
+       }
+
        subreq = wb_domain_request_send(state, winbind_event_context(), domain,
                                        request);
        if (tevent_req_nomem(subreq, req)) {