smbd: Add some structure protection for durable reconnect
[samba.git] / source3 / smbd / durable.c
index 602a96e1fe56bc874f738893685046a931b101ce..1f6113e4cc9d2953250131a01d194615d7e6a645 100644 (file)
@@ -194,10 +194,7 @@ NTSTATUS vfs_default_durable_disconnect(struct files_struct *fsp,
 
        /* Ensure any pending write time updates are done. */
        if (fsp->update_write_time_event) {
-               update_write_time_handler(fsp->conn->sconn->ev_ctx,
-                                       fsp->update_write_time_event,
-                                       timeval_current(),
-                                       (void *)fsp);
+               fsp_flush_write_time_update(fsp);
        }
 
        /*
@@ -305,30 +302,6 @@ static bool vfs_default_durable_reconnect_check_stat(
 {
        int ret;
 
-       if (cookie_st->st_ex_dev != fsp_st->st_ex_dev) {
-               DEBUG(1, ("vfs_default_durable_reconnect (%s): "
-                         "stat_ex.%s differs: "
-                         "cookie:%llu != stat:%llu, "
-                         "denying durable reconnect\n",
-                         name,
-                         "st_ex_dev",
-                         (unsigned long long)cookie_st->st_ex_dev,
-                         (unsigned long long)fsp_st->st_ex_dev));
-               return false;
-       }
-
-       if (cookie_st->st_ex_ino != fsp_st->st_ex_ino) {
-               DEBUG(1, ("vfs_default_durable_reconnect (%s): "
-                         "stat_ex.%s differs: "
-                         "cookie:%llu != stat:%llu, "
-                         "denying durable reconnect\n",
-                         name,
-                         "st_ex_ino",
-                         (unsigned long long)cookie_st->st_ex_ino,
-                         (unsigned long long)fsp_st->st_ex_ino));
-               return false;
-       }
-
        if (cookie_st->st_ex_mode != fsp_st->st_ex_mode) {
                DEBUG(1, ("vfs_default_durable_reconnect (%s): "
                          "stat_ex.%s differs: "
@@ -573,10 +546,11 @@ NTSTATUS vfs_default_durable_reconnect(struct connection_struct *conn,
         * call below.
         */
 
-       ZERO_STRUCT(cookie);
-
-       ndr_err = ndr_pull_struct_blob(&old_cookie, talloc_tos(), &cookie,
-                       (ndr_pull_flags_fn_t)ndr_pull_vfs_default_durable_cookie);
+       ndr_err = ndr_pull_struct_blob_all(
+               &old_cookie,
+               talloc_tos(),
+               &cookie,
+               (ndr_pull_flags_fn_t)ndr_pull_vfs_default_durable_cookie);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                status = ndr_map_error2ntstatus(ndr_err);
                return status;