r1824: nicer handling of NBT session replies, and handling of bad packets
authorAndrew Tridgell <tridge@samba.org>
Sat, 14 Aug 2004 18:24:33 +0000 (18:24 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:58:00 +0000 (12:58 -0500)
with the async SMB code

source/libcli/raw/clitransport.c
source/libcli/raw/rawrequest.c

index 784a6f17989f2a989674a66fc717aa6180bc12eb..03a0540be044787d72de147b3eff0cd983d68151 100644 (file)
@@ -353,6 +353,12 @@ static void smbcli_transport_finish_recv(struct smbcli_transport *transport)
        req->in.size = len;
        req->in.allocated = req->in.size;
 
+       /* handle NBT session replies */
+       if (req->in.buffer[0] != 0) {
+               req->status = NT_STATUS_OK;
+               goto async;
+       }
+
        /* handle non-SMB replies */
        if (req->in.size < NBT_HDR_SIZE + MIN_SMB_SIZE) {
                req->state = SMBCLI_REQUEST_ERROR;
index 70e924a99fd7ad468a393c105bf75ffd52e6b8b7..bc87af4297d17089e319a0c7ad7511f8ba8a1257 100644 (file)
@@ -252,7 +252,7 @@ static void smbcli_req_grow_allocation(struct smbcli_request *req, uint_t new_si
   To cope with this req->out.ptr is supplied. This will be updated to
   point at the same offset into the packet as before this call
 */
-static void smbcli_req_grow_data(struct smbcli_request *req, uint_t new_size)
+void smbcli_req_grow_data(struct smbcli_request *req, uint_t new_size)
 {
        int delta;
 
@@ -299,7 +299,7 @@ BOOL smbcli_request_receive(struct smbcli_request *req)
                event_loop_once(req->transport->event.ctx);
        }
 
-       return True;
+       return req->state == SMBCLI_REQUEST_DONE;
 }