Ignore:
Timestamp:
Apr 9, 2010, 3:20:58 PM (15 years ago)
Author:
Silvan Scherrer
Message:

Samba 3.5.x: update to 3.5.2

Location:
vendor/current/source3/winbindd
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source3/winbindd/wb_next_grent.c

    r414 r427  
    5050        state->gstate = gstate;
    5151        state->gr = gr;
     52        state->max_nesting = max_nesting;
    5253
    5354        if (state->gstate->next_group >= state->gstate->num_groups) {
  • vendor/current/source3/winbindd/winbindd.c

    r414 r427  
    571571        state->pid = state->request->pid;
    572572
     573        state->cmd_name = "unknown request";
     574        state->recv_fn = NULL;
     575
    573576        /* Process command */
    574577
     
    591594                struct tevent_req *req;
    592595
    593                 DEBUG(10, ("process_request: Handling async request %s\n",
    594                            atable->cmd_name));
     596                state->cmd_name = atable->cmd_name;
     597                state->recv_fn = atable->recv_req;
     598
     599                DEBUG(10, ("process_request: Handling async request %d:%s\n",
     600                           (int)state->pid, state->cmd_name));
    595601
    596602                req = atable->send_req(state->mem_ctx, winbind_event_context(),
     
    603609                }
    604610                tevent_req_set_callback(req, wb_request_done, state);
    605                 state->recv_fn = atable->recv_req;
    606611                return;
    607612        }
     
    621626                        DEBUG(10,("process_request: request fn %s\n",
    622627                                  table->winbindd_cmd_name ));
     628                        state->cmd_name = table->winbindd_cmd_name;
    623629                        table->fn(state);
    624630                        break;
     
    639645        NTSTATUS status;
    640646
    641         state->response = talloc_zero(state, struct winbindd_response);
     647        state->response = talloc_zero(state->mem_ctx,
     648                                      struct winbindd_response);
    642649        if (state->response == NULL) {
     650                DEBUG(0, ("wb_request_done[%d:%s]: talloc_zero failed - removing client\n",
     651                          (int)state->pid, state->cmd_name));
    643652                remove_client(state);
    644653                return;
     
    649658        status = state->recv_fn(req, state->response);
    650659        TALLOC_FREE(req);
     660
     661        DEBUG(10,("wb_request_done[%d:%s]: %s\n",
     662                  (int)state->pid, state->cmd_name, nt_errstr(status)));
     663
    651664        if (!NT_STATUS_IS_OK(status)) {
    652                 DEBUG(10, ("returning %s\n", nt_errstr(status)));
    653665                request_error(state);
    654666                return;
     
    682694                                 state->response);
    683695        if (req == NULL) {
     696                DEBUG(10,("request_finished[%d:%s]: wb_resp_write_send() failed\n",
     697                          (int)state->pid, state->cmd_name));
    684698                remove_client(state);
    685699                return;
     
    700714                close(state->sock);
    701715                state->sock = -1;
    702                 DEBUG(2, ("Could not write response to client: %s\n",
    703                           strerror(err)));
     716                DEBUG(2, ("Could not write response[%d:%s] to client: %s\n",
     717                          (int)state->pid, state->cmd_name, strerror(err)));
    704718                remove_client(state);
    705719                return;
    706720        }
     721
     722        DEBUG(10,("winbind_client_response_written[%d:%s]: deliverd response to client\n",
     723                  (int)state->pid, state->cmd_name));
    707724
    708725        TALLOC_FREE(state->mem_ctx);
    709726        state->response = NULL;
     727        state->cmd_name = "no request";
     728        state->recv_fn = NULL;
    710729
    711730        req = wb_req_read_send(state, winbind_event_context(), state->sock,
  • vendor/current/source3/winbindd/winbindd.h

    r414 r427  
    5757
    5858        TALLOC_CTX *mem_ctx;                      /* memory per request */
     59        const char *cmd_name;
    5960        NTSTATUS (*recv_fn)(struct tevent_req *req,
    6061                            struct winbindd_response *presp);
  • vendor/current/source3/winbindd/winbindd_cm.c

    r414 r427  
    16071607static bool connection_ok(struct winbindd_domain *domain)
    16081608{
    1609         if (domain->conn.cli == NULL) {
    1610                 DEBUG(8, ("connection_ok: Connection to %s for domain %s has NULL "
    1611                           "cli!\n", domain->dcname, domain->name));
    1612                 return False;
    1613         }
    1614 
    1615         if (!domain->conn.cli->initialised) {
    1616                 DEBUG(3, ("connection_ok: Connection to %s for domain %s was never "
    1617                           "initialised!\n", domain->dcname, domain->name));
    1618                 return False;
    1619         }
    1620 
    1621         if (domain->conn.cli->fd == -1) {
    1622                 DEBUG(3, ("connection_ok: Connection to %s for domain %s has died or was "
    1623                           "never started (fd == -1)\n",
     1609        bool ok;
     1610
     1611        ok = cli_state_is_connected(domain->conn.cli);
     1612        if (!ok) {
     1613                DEBUG(3, ("connection_ok: Connection to %s for domain %s is not connected\n",
    16241614                          domain->dcname, domain->name));
    16251615                return False;
     
    16471637        }
    16481638
     1639        if (!winbindd_can_contact_domain(domain)) {
     1640                invalidate_cm_connection(&domain->conn);
     1641                domain->initialized = True;
     1642                return NT_STATUS_OK;
     1643        }
     1644
    16491645        if (connection_ok(domain)) {
    16501646                if (!domain->initialized) {
     
    16731669
    16741670        return init_dc_connection_network(domain);
     1671}
     1672
     1673static NTSTATUS init_dc_connection_rpc(struct winbindd_domain *domain)
     1674{
     1675        NTSTATUS status;
     1676
     1677        status = init_dc_connection(domain);
     1678        if (!NT_STATUS_IS_OK(status)) {
     1679                return status;
     1680        }
     1681
     1682        if (!domain->internal && domain->conn.cli == NULL) {
     1683                /* happens for trusted domains without inbound trust */
     1684                return NT_STATUS_TRUSTED_DOMAIN_FAILURE;
     1685        }
     1686
     1687        return NT_STATUS_OK;
    16751688}
    16761689
     
    17701783                        domain->initialized = True;
    17711784
    1772                         if ( !winbindd_can_contact_domain( domain) )
    1773                                 domain->internal = True;
    1774 
    17751785                        break;
    17761786                }               
     
    20242034        char *domain_name = NULL;
    20252035
    2026         result = init_dc_connection(domain);
     2036        result = init_dc_connection_rpc(domain);
    20272037        if (!NT_STATUS_IS_OK(result)) {
    20282038                return result;
     
    20312041        conn = &domain->conn;
    20322042
    2033         if (conn->samr_pipe != NULL) {
     2043        if (rpccli_is_connected(conn->samr_pipe)) {
    20342044                goto done;
    20352045        }
    20362046
     2047        TALLOC_FREE(conn->samr_pipe);
    20372048
    20382049        /*
     
    22062217        DEBUG(10,("cm_connect_lsa_tcp\n"));
    22072218
    2208         status = init_dc_connection(domain);
     2219        status = init_dc_connection_rpc(domain);
    22092220        if (!NT_STATUS_IS_OK(status)) {
    22102221                return status;
     
    22162227            conn->lsa_pipe_tcp->transport->transport == NCACN_IP_TCP &&
    22172228            conn->lsa_pipe_tcp->auth->auth_level == DCERPC_AUTH_LEVEL_PRIVACY &&
    2218             rpc_pipe_tcp_connection_ok(conn->lsa_pipe_tcp)) {
     2229            rpccli_is_connected(conn->lsa_pipe_tcp)) {
    22192230                goto done;
    22202231        }
     
    22522263        struct netlogon_creds_CredentialState *p_creds;
    22532264
    2254         result = init_dc_connection(domain);
     2265        result = init_dc_connection_rpc(domain);
    22552266        if (!NT_STATUS_IS_OK(result))
    22562267                return result;
     
    22582269        conn = &domain->conn;
    22592270
    2260         if (conn->lsa_pipe != NULL) {
     2271        if (rpccli_is_connected(conn->lsa_pipe)) {
    22612272                goto done;
    22622273        }
     2274
     2275        TALLOC_FREE(conn->lsa_pipe);
    22632276
    22642277        if ((conn->cli->user_name[0] == '\0') ||
     
    23822395        *cli = NULL;
    23832396
    2384         result = init_dc_connection(domain);
     2397        result = init_dc_connection_rpc(domain);
    23852398        if (!NT_STATUS_IS_OK(result)) {
    23862399                return result;
     
    23892402        conn = &domain->conn;
    23902403
    2391         if (conn->netlogon_pipe != NULL) {
     2404        if (rpccli_is_connected(conn->netlogon_pipe)) {
    23922405                *cli = conn->netlogon_pipe;
    23932406                return NT_STATUS_OK;
    23942407        }
     2408
     2409        TALLOC_FREE(conn->netlogon_pipe);
    23952410
    23962411        result = cli_rpc_pipe_open_noauth(conn->cli,
     
    24722487                          "was %s\n", nt_errstr(result)));
    24732488
    2474                 /* make sure we return something besides OK */
    2475                 return !NT_STATUS_IS_OK(result) ? result : NT_STATUS_PIPE_NOT_AVAILABLE;
     2489                invalidate_cm_connection(conn);
     2490                return result;
    24762491        }
    24772492
  • vendor/current/source3/winbindd/winbindd_dual.c

    r414 r427  
    14641464                maxfd = state.sock;
    14651465
     1466                /*
     1467                 * Initialize this high as event_add_to_select_args()
     1468                 * uses a timeval_min() on this and next_event. Fix
     1469                 * from Roel van Meer <rolek@alt001.com>.
     1470                 */
     1471                t.tv_sec = 999999;
     1472                t.tv_usec = 0;
     1473
    14661474                event_add_to_select_args(winbind_event_context(), &now,
    14671475                                         &r_fds, &w_fds, &t, &maxfd);
  • vendor/current/source3/winbindd/winbindd_pam.c

    r414 r427  
    13611361                   our connection. */
    13621362
    1363                 if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL)) {
     1363                if (!rpccli_is_connected(netlogon_pipe)) {
    13641364                        retry = true;
    13651365                        continue;
     
    19361936                   our connection. */
    19371937
    1938                 if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL)) {
     1938                if (!rpccli_is_connected(netlogon_pipe)) {
    19391939                        retry = true;
    19401940                        continue;
  • vendor/current/source3/winbindd/winbindd_reconnect.c

    r414 r427  
    2828extern struct winbindd_methods msrpc_methods;
    2929
     30static bool reconnect_need_retry(NTSTATUS status)
     31{
     32        if (NT_STATUS_IS_OK(status)) {
     33                return false;
     34        }
     35
     36        if (!NT_STATUS_IS_ERR(status)) {
     37                return false;
     38        }
     39
     40        if (NT_STATUS_EQUAL(status, NT_STATUS_NONE_MAPPED)) {
     41                return false;
     42        }
     43
     44        if (NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_USER)) {
     45                return false;
     46        }
     47
     48        if (NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_GROUP)) {
     49                return false;
     50        }
     51
     52        if (NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_ALIAS)) {
     53                return false;
     54        }
     55
     56        if (NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_MEMBER)) {
     57                return false;
     58        }
     59
     60        if (NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_DOMAIN)) {
     61                return false;
     62        }
     63
     64        if (NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_PRIVILEGE)) {
     65                return false;
     66        }
     67
     68        if (NT_STATUS_EQUAL(status, NT_STATUS_NO_MEMORY)) {
     69                return false;
     70        }
     71
     72        return true;
     73}
     74
    3075/* List all users */
    3176static NTSTATUS query_user_list(struct winbindd_domain *domain,
     
    3984                                               num_entries, info);
    4085
    41         if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL))
     86        if (reconnect_need_retry(result))
    4287                result = msrpc_methods.query_user_list(domain, mem_ctx,
    4388                                                       num_entries, info);
     
    56101                                               num_entries, info);
    57102
    58         if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL))
     103        if (reconnect_need_retry(result))
    59104                result = msrpc_methods.enum_dom_groups(domain, mem_ctx,
    60105                                                       num_entries, info);
     
    74119                                                 num_entries, info);
    75120
    76         if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL))
     121        if (reconnect_need_retry(result))
    77122                result = msrpc_methods.enum_local_groups(domain, mem_ctx,
    78123                                                         num_entries, info);
     
    95140                                           flags, sid, type);
    96141
    97         if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL))
     142        if (reconnect_need_retry(result))
    98143                result = msrpc_methods.name_to_sid(domain, mem_ctx,
    99144                                                   domain_name, name, flags,
     
    118163                                           domain_name, name, type);
    119164
    120         if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL))
     165        if (reconnect_need_retry(result))
    121166                result = msrpc_methods.sid_to_name(domain, mem_ctx, sid,
    122167                                                   domain_name, name, type);
     
    139184                                             rids, num_rids,
    140185                                             domain_name, names, types);
    141         if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL)) {
     186        if (reconnect_need_retry(result)) {
    142187                result = msrpc_methods.rids_to_names(domain, mem_ctx, sid,
    143188                                                     rids, num_rids,
     
    160205                                          user_info);
    161206
    162         if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL))
     207        if (reconnect_need_retry(result))
    163208                result = msrpc_methods.query_user(domain, mem_ctx, user_sid,
    164209                                                  user_info);
     
    179224                                                 user_gids);
    180225
    181         if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL))
     226        if (reconnect_need_retry(result))
    182227                result = msrpc_methods.lookup_usergroups(domain, mem_ctx,
    183228                                                         user_sid, num_groups,
     
    199244                                                  alias_rids);
    200245
    201         if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL))
     246        if (reconnect_need_retry(result))
    202247                result = msrpc_methods.lookup_useraliases(domain, mem_ctx,
    203248                                                          num_sids, sids,
     
    224269                                               name_types);
    225270
    226         if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL))
     271        if (reconnect_need_retry(result))
    227272                result = msrpc_methods.lookup_groupmem(domain, mem_ctx,
    228273                                                       group_sid, type,
     
    241286        result = msrpc_methods.sequence_number(domain, seq);
    242287
    243         if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL))
     288        if (reconnect_need_retry(result))
    244289                result = msrpc_methods.sequence_number(domain, seq);
    245290
     
    256301        result = msrpc_methods.lockout_policy(domain, mem_ctx, policy);
    257302
    258         if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL))
     303        if (reconnect_need_retry(result))
    259304                result = msrpc_methods.lockout_policy(domain, mem_ctx, policy);
    260305
     
    271316        result = msrpc_methods.password_policy(domain, mem_ctx, policy);
    272317
    273         if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL))
     318        if (reconnect_need_retry(result))
    274319                result = msrpc_methods.password_policy(domain, mem_ctx, policy);
    275320       
     
    286331        result = msrpc_methods.trusted_domains(domain, mem_ctx, trusts);
    287332
    288         if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL))
     333        if (reconnect_need_retry(result))
    289334                result = msrpc_methods.trusted_domains(domain, mem_ctx,
    290335                                                       trusts);
Note: See TracChangeset for help on using the changeset viewer.