Skip to content

Instantly share code, notes, and snippets.

@vortec
Created March 12, 2014 19:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vortec/9514435 to your computer and use it in GitHub Desktop.
Save vortec/9514435 to your computer and use it in GitHub Desktop.
diff --git a/fspattern/fspattern.c b/fspattern/fspattern.c
new file mode 100644
index 0000000..7afd838
--- /dev/null
+++ b/fspattern/fspattern.c
@@ -0,0 +1,47 @@
+#include "../source3/include/includes.h"
+#include "lib/util/tevent_unix.h"
+#include "lib/util/tevent_ntstatus.h"
+
+static int fspattern_connect(vfs_handle_struct *handle,
+ const char *service,
+ const char *user)
+{
+ FILE *f = fopen("/tmp/mylog.txt", "w");
+ if (f != NULL)
+ {
+ const char *text = "Connection established";
+ fprintf(f, "%s\n", text);
+ //fprintf(f, "service: %s, user: %s", service, user);
+ fclose(f);
+ }
+
+ return SMB_VFS_NEXT_CONNECT(handle, service, user);
+}
+
+static void fspattern_disconnect(vfs_handle_struct *handle)
+{
+ FILE *f = fopen("/tmp/mylog.txt", "w");
+ if (f != NULL)
+ {
+ const char *text = "Connection disconnected.";
+ fprintf(f, "%s\n", text);
+ fclose(f);
+ }
+
+ SMB_VFS_NEXT_DISCONNECT(handle);
+}
+
+
+
+static struct vfs_fn_pointers vfs_fspattern_fns = {
+ .connect_fn = fspattern_connect,
+ .disconnect_fn = fspattern_disconnect
+};
+
+NTSTATUS vfs_fspattern_init(void)
+{
+ return smb_register_vfs(SMB_VFS_INTERFACE_VERSION,
+ "fspattern",
+ &vfs_fspattern_fns);
+}
+
diff --git a/fspattern/version.h b/fspattern/version.h
new file mode 100644
index 0000000..6ab1e7d
--- /dev/null
+++ b/fspattern/version.h
@@ -0,0 +1,14 @@
+/* Autogenerated by waf */
+#define SAMBA_VERSION_MAJOR 4
+#define SAMBA_VERSION_MINOR 1
+#define SAMBA_VERSION_RELEASE 6
+#define SAMBA_VERSION_OFFICIAL_STRING "4.1.6"
+
+#ifdef SAMBA_VERSION_VENDOR_FUNCTION
+# define SAMBA_VERSION_STRING SAMBA_VERSION_VENDOR_FUNCTION
+#else /* SAMBA_VERSION_VENDOR_FUNCTION */
+# define SAMBA_VERSION_STRING "4.1.6"
+#endif
+/* Version for mkrelease.sh:
+SAMBA_VERSION_STRING=4.1.6
+ */
diff --git a/fspattern/wscript_build b/fspattern/wscript_build
new file mode 100644
index 0000000..ff73bb0
--- /dev/null
+++ b/fspattern/wscript_build
@@ -0,0 +1,11 @@
+#!/usr/bin/env python
+
+bld.SAMBA3_MODULE('vfs_fspattern',
+ subsystem='vfs',
+ source='fspattern.c',
+ deps='samba-util',
+ init_function='',
+ internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_fspattern'),
+ enabled=True)
+
+print "hai bro"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment