Ignore:
Timestamp:
Apr 9, 2010, 3:51:41 PM (16 years ago)
Author:
Silvan Scherrer
Message:

Samba 3.5.x: trunk update to 3.5.2

Location:
trunk/server
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/server

  • trunk/server/source3/rpc_client/cli_pipe.c

    r414 r429  
    30323032}
    30333033
     3034
     3035
    30343036unsigned int rpccli_set_timeout(struct rpc_pipe_client *rpc_cli,
    30353037                                unsigned int timeout)
    30363038{
    3037         struct cli_state *cli;
    3038 
    3039         if (rpc_cli->transport->transport == NCACN_NP) {
    3040                 cli = rpc_pipe_np_smb_conn(rpc_cli);
    3041                 if (cli == NULL) {
    3042                         return 0;
    3043                 }
    3044                 return cli_set_timeout(cli, timeout);
    3045         }
    3046 
    3047         if (rpc_cli->transport->transport == NCACN_IP_TCP ||
    3048             rpc_cli->transport->transport == NCALRPC) {
    3049                 return rpccli_set_sock_timeout(rpc_cli, timeout);
    3050         }
    3051 
    3052         if (rpc_cli->transport->transport == NCACN_INTERNAL) {
    3053                 cli = rpc_pipe_smbd_smb_conn(rpc_cli);
    3054                 if (!cli) {
    3055                         return 0;
    3056                 }
    3057                 return cli_set_timeout(cli, timeout);
    3058         }
    3059 
    3060         return 0;
     3039        unsigned int old;
     3040
     3041        if (rpc_cli->transport == NULL) {
     3042                return RPCCLI_DEFAULT_TIMEOUT;
     3043        }
     3044
     3045        if (rpc_cli->transport->set_timeout == NULL) {
     3046                return RPCCLI_DEFAULT_TIMEOUT;
     3047        }
     3048
     3049        old = rpc_cli->transport->set_timeout(rpc_cli->transport->priv, timeout);
     3050        if (old == 0) {
     3051                return RPCCLI_DEFAULT_TIMEOUT;
     3052        }
     3053
     3054        return old;
     3055}
     3056
     3057bool rpccli_is_connected(struct rpc_pipe_client *rpc_cli)
     3058{
     3059        if (rpc_cli == NULL) {
     3060                return false;
     3061        }
     3062
     3063        if (rpc_cli->transport == NULL) {
     3064                return false;
     3065        }
     3066
     3067        return rpc_cli->transport->is_connected(rpc_cli->transport->priv);
    30613068}
    30623069
     
    35633570}
    35643571
    3565 static int rpc_pipe_client_np_destructor(struct rpc_pipe_client *p)
    3566 {
     3572struct rpc_pipe_client_np_ref {
    35673573        struct cli_state *cli;
    3568 
    3569         cli = rpc_pipe_np_smb_conn(p);
    3570         if (cli != NULL) {
    3571                 DLIST_REMOVE(cli->pipe_list, p);
    3572         }
     3574        struct rpc_pipe_client *pipe;
     3575};
     3576
     3577static int rpc_pipe_client_np_ref_destructor(struct rpc_pipe_client_np_ref *np_ref)
     3578{
     3579        DLIST_REMOVE(np_ref->cli->pipe_list, np_ref->pipe);
    35733580        return 0;
    35743581}
     
    35933600        struct rpc_pipe_client *result;
    35943601        NTSTATUS status;
     3602
    35953603
    35963604        /* sanity check to protect against crashes */
     
    36313639        result->transport->transport = NCACN_NP;
    36323640
    3633         DLIST_ADD(cli->pipe_list, result);
    3634         talloc_set_destructor(result, rpc_pipe_client_np_destructor);
     3641        np_ref = talloc(result->transport, struct rpc_pipe_client_np_ref);
     3642        if (np_ref == NULL) {
     3643                TALLOC_FREE(result);
     3644                return NT_STATUS_NO_MEMORY;
     3645        }
     3646        np_ref->cli = cli;
     3647        np_ref->pipe = result;
     3648
     3649        DLIST_ADD(np_ref->cli->pipe_list, np_ref->pipe);
     3650        talloc_set_destructor(np_ref, rpc_pipe_client_np_ref_destructor);
    36353651
    36363652        *presult = result;
Note: See TracChangeset for help on using the changeset viewer.