s3: fix crash in winbindd
authorBo Yang <boyang@novell.com>
Wed, 29 Apr 2009 01:50:41 +0000 (09:50 +0800)
committerBo Yang <boyang@novell.com>
Wed, 29 Apr 2009 01:50:41 +0000 (09:50 +0800)
source3/libsmb/async_smb.c
source3/rpc_client/rpc_transport_np.c

index 6faf96c207f6e397ce0dcc7af3fa789c2e19cc37..17040b8c9f43eaeae7038658c2ee74db23932cb1 100644 (file)
@@ -604,6 +604,10 @@ bool cli_smb_req_send(struct tevent_req *req)
        struct cli_smb_state *state = tevent_req_data(
                req, struct cli_smb_state);
 
+       if (state->cli->fd == -1) {
+               return false;
+       }
+
        return cli_smb_req_iov_send(req, state, state->iov, state->iov_count);
 }
 
index 40d68dd2eabc6808920551c96ec19602f3e9c2eb..dceacf68157353fa6f7aaf83cde2daff36c7e948 100644 (file)
@@ -31,6 +31,12 @@ struct rpc_transport_np_state {
 static int rpc_transport_np_state_destructor(struct rpc_transport_np_state *s)
 {
        bool ret;
+
+       if (s->cli->fd == -1) {
+               DEBUG(10, ("socket was closed, no need to send close request.\n"));
+               return 0;
+       }
+       
        ret = cli_close(s->cli, s->fnum);
        if (!ret) {
                DEBUG(1, ("rpc_transport_np_state_destructor: cli_close "