s3:smbd: handle SMB2 in deadtime_fn() and avoid disconnecting non idle clients
[nivanova/samba-autobuild/.git] / source3 / smbd / process.c
index 6068816ad98ff19229cfd1a9b0743fed1e743fbe..dd120f9bd2785beb62556bdfe37c34d63ff6f45f 100644 (file)
@@ -2349,9 +2349,21 @@ static bool keepalive_fn(const struct timeval *now, void *private_data)
 static bool deadtime_fn(const struct timeval *now, void *private_data)
 {
        struct smbd_server_connection *sconn = smbd_server_conn;
+
+       if (sconn->allow_smb2) {
+               /* TODO: implement real idle check */
+               if (sconn->smb2.sessions.list) {
+                       return true;
+               }
+               DEBUG( 2, ( "Closing idle SMB2 connection\n" ) );
+               messaging_send(smbd_messaging_context(), procid_self(),
+                              MSG_SHUTDOWN, &data_blob_null);
+               return false;
+       }
+
        if ((conn_num_open(sconn) == 0)
            || (conn_idle_all(sconn, now->tv_sec))) {
-               DEBUG( 2, ( "Closing idle connection\n" ) );
+               DEBUG( 2, ( "Closing idle SMB1 connection\n" ) );
                messaging_send(smbd_messaging_context(), procid_self(),
                               MSG_SHUTDOWN, &data_blob_null);
                return False;