fix smb_direct_listener_accept_recv ...
authorStefan Metzmacher <metze@samba.org>
Sat, 1 Oct 2016 09:22:38 +0000 (11:22 +0200)
committerStefan Metzmacher <metze@samba.org>
Fri, 1 Jun 2018 12:35:15 +0000 (14:35 +0200)
libcli/smb/smb_direct.c

index b8689ce34470c296fb599a877a6da6fe2999b3b8..b217aa9d5f5b52aaafa5ef17aad1cbaefc487f74 100644 (file)
@@ -3017,43 +3017,51 @@ DEBUG(0,("%s:%s: here...\n", __location__, __func__));
                ZERO_STRUCTP(raddr);
        }
 
-       if (tevent_req_is_nterror(req, &status)) {
-               DEBUG(0,("%s:%s: here...[%s]\n", __location__, __func__, nt_errstr(status)));
-               tevent_req_received(req);
-               return status;
-       }
+       if (tevent_req_is_in_progress(req)) {
+               /*
+                * We don't call tevent_req_received()
+                * because the caller can leave this alive
+                * in order to consume more connections
+                */
+               if (l->ready == NULL) {
+       DEBUG(0,("%s:%s: here...\n", __location__, __func__));
+                       return NT_STATUS_NO_MORE_ENTRIES;
+               }
 
-       /*
-        * We don't call tevent_req_received()
-        * because the caller can leave this alive
-        * in order to consume more connections
-        */
-       if (l->ready == NULL) {
-DEBUG(0,("%s:%s: here...\n", __location__, __func__));
-               return NT_STATUS_NO_MORE_ENTRIES;
-       }
+               c = l->ready;
+               DLIST_REMOVE(l->ready, c);
+               c->l = NULL;
 
-       c = l->ready;
-       DLIST_REMOVE(l->ready, c);
-       c->l = NULL;
+               if (l->ready != NULL) {
+                       tevent_req_defer_callback(req, state->ev);
+                       tevent_req_notify_callback(req);
+               }
 
-       if (l->ready != NULL) {
-               tevent_req_defer_callback(req, state->ev);
-               tevent_req_notify_callback(req);
+               *fd = c->sock.tmp_fd;
+               c->sock.tmp_fd = -1;
+               if (laddr != NULL) {
+                       ZERO_STRUCTP(laddr);
+               }
+               if (raddr != NULL) {
+                       ZERO_STRUCTP(raddr);
+               }
+       DEBUG(0,("%s:%s: here...\n", __location__, __func__));
+               *_c = talloc_move(mem_ctx, &c);
+               return NT_STATUS_OK;
        }
 
-       *fd = c->sock.tmp_fd;
-       c->sock.tmp_fd = -1;
-       if (laddr != NULL) {
-               ZERO_STRUCTP(laddr);
-       }
-       if (raddr != NULL) {
-               ZERO_STRUCTP(raddr);
+       if (tevent_req_is_nterror(req, &status)) {
+               DEBUG(0,("%s:%s: here...[%s] %s\n", __location__, __func__, nt_errstr(status),
+                       tevent_req_print(req, req)));
+               tevent_req_received(req);
+               return status;
        }
-DEBUG(0,("%s:%s: here...\n", __location__, __func__));
-       *_c = talloc_move(mem_ctx, &c);
-       return NT_STATUS_OK;
 
+       /* should never be reached */
+       DEBUG(0,("%s:%s: here...[%s] %s\n", __location__, __func__, nt_errstr(status),
+               tevent_req_print(req, req)));
+       tevent_req_received(req);
+       return NT_STATUS_INTERNAL_ERROR;
 }
 
 #endif /* SMB_TRANSPORT_ENABLE_RDMA */