vfs: Move reparse point functions to util_reparse.c
authorVolker Lendecke <vl@samba.org>
Thu, 11 Jun 2020 13:15:02 +0000 (15:15 +0200)
committerJeremy Allison <jra@samba.org>
Mon, 15 Jun 2020 19:25:39 +0000 (19:25 +0000)
Shamelessly copied from from Jeremy's smb2-unix branch :-)

No change in behaviour, but we will have to cope with reparse points in the
future.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Jun 15 19:25:40 UTC 2020 on sn-devel-184

source3/modules/util_reparse.c [new file with mode: 0644]
source3/modules/util_reparse.h [new file with mode: 0644]
source3/modules/vfs_default.c
source3/modules/wscript_build

diff --git a/source3/modules/util_reparse.c b/source3/modules/util_reparse.c
new file mode 100644 (file)
index 0000000..fe259b5
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Unix SMB/CIFS implementation.
+ * Utility functions for reparse points.
+ *
+ * Copyright (C) Jeremy Allison 2018
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "includes.h"
+#include "util_reparse.h"
+
+NTSTATUS fsctl_get_reparse_point(struct files_struct *fsp,
+                                TALLOC_CTX *ctx,
+                                char **out_data,
+                                uint32_t max_out_len,
+                                uint32_t *out_len)
+{
+       DBG_DEBUG("Called on %s\n", fsp_fnum_dbg(fsp));
+       return NT_STATUS_NOT_A_REPARSE_POINT;
+}
+
+NTSTATUS fsctl_set_reparse_point(struct files_struct *fsp,
+                                TALLOC_CTX *ctx,
+                                const uint8_t *in_data,
+                                uint32_t in_len)
+{
+       DBG_DEBUG("Called on %s\n", fsp_fnum_dbg(fsp));
+       return NT_STATUS_NOT_A_REPARSE_POINT;
+}
+
+NTSTATUS fsctl_del_reparse_point(struct files_struct *fsp,
+                                TALLOC_CTX *ctx,
+                                const uint8_t *in_data,
+                                uint32_t in_len)
+{
+       DBG_DEBUG("Called on %s\n", fsp_fnum_dbg(fsp));
+       return NT_STATUS_NOT_A_REPARSE_POINT;
+}
diff --git a/source3/modules/util_reparse.h b/source3/modules/util_reparse.h
new file mode 100644 (file)
index 0000000..102605e
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Unix SMB/CIFS implementation.
+ * Utility functions for reparse points.
+ *
+ * Copyright (C) Jeremy Allison 2018
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __UTIL_REPARSE_H__
+#define __UTIL_REPARSE_H__
+
+NTSTATUS fsctl_get_reparse_point(struct files_struct *fsp,
+                                TALLOC_CTX *ctx,
+                                char **out_data,
+                                uint32_t max_out_len,
+                                uint32_t *out_len);
+
+NTSTATUS fsctl_set_reparse_point(struct files_struct *fsp,
+                                TALLOC_CTX *ctx,
+                                const uint8_t *in_data,
+                                uint32_t in_len);
+
+NTSTATUS fsctl_del_reparse_point(struct files_struct *fsp,
+                                TALLOC_CTX *ctx,
+                                const uint8_t *in_data,
+                                uint32_t in_len);
+
+#endif /* __UTIL_REPARSE_H__ */
index fb9d16efd6b8f1e51399befc936929b5e48949a3..cf5e1cbc296c25e67ccde38a72eed208cc9892f9 100644 (file)
@@ -35,6 +35,7 @@
 #include "lib/pthreadpool/pthreadpool_tevent.h"
 #include "librpc/gen_ndr/ndr_ioctl.h"
 #include "offload_token.h"
+#include "util_reparse.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_VFS
@@ -1367,18 +1368,21 @@ static NTSTATUS vfswrap_fsctl(struct vfs_handle_struct *handle,
 
        case FSCTL_GET_REPARSE_POINT:
        {
-               /* Fail it with STATUS_NOT_A_REPARSE_POINT */
-               DEBUG(10, ("FSCTL_GET_REPARSE_POINT: called on %s. "
-                          "Status: NOT_IMPLEMENTED\n", fsp_fnum_dbg(fsp)));
-               return NT_STATUS_NOT_A_REPARSE_POINT;
+               status = fsctl_get_reparse_point(
+                       fsp, ctx, out_data, max_out_len, out_len);
+               return status;
        }
 
        case FSCTL_SET_REPARSE_POINT:
        {
-               /* Fail it with STATUS_NOT_A_REPARSE_POINT */
-               DEBUG(10, ("FSCTL_SET_REPARSE_POINT: called on %s. "
-                          "Status: NOT_IMPLEMENTED\n", fsp_fnum_dbg(fsp)));
-               return NT_STATUS_NOT_A_REPARSE_POINT;
+               status = fsctl_set_reparse_point(fsp, ctx, _in_data, in_len);
+               return status;
+       }
+
+       case FSCTL_DELETE_REPARSE_POINT:
+       {
+               status = fsctl_del_reparse_point(fsp, ctx, _in_data, in_len);
+               return status;
        }
 
        case FSCTL_GET_SHADOW_COPY_DATA:
index 7f056f2b7f77f7e04d6038f7b8fdb327f7770ada..09528f38070e9442d6b126066a3a29cd4f507bcf 100644 (file)
@@ -39,6 +39,10 @@ bld.SAMBA3_SUBSYSTEM('OFFLOAD_TOKEN',
                     source='offload_token.c',
                     deps='samba-util')
 
+bld.SAMBA3_SUBSYSTEM('UTIL_REPARSE',
+                    source='util_reparse.c',
+                    deps='samba-util')
+
 bld.SAMBA3_SUBSYSTEM('HASH_INODE',
                     source='hash_inode.c',
                     deps='gnutls')
@@ -50,7 +54,7 @@ bld.SAMBA3_SUBSYSTEM('HASH_INODE',
 bld.SAMBA3_MODULE('vfs_default',
                  subsystem='vfs',
                  source='vfs_default.c',
-                 deps='samba-util NDR_DFSBLOBS OFFLOAD_TOKEN',
+                 deps='samba-util NDR_DFSBLOBS OFFLOAD_TOKEN UTIL_REPARSE',
                  init_function='',
                  internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_default'),
                  enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_default'))