Skip to content

Instantly share code, notes, and snippets.

@vortec
Created March 12, 2014 19:00
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/9513890 to your computer and use it in GitHub Desktop.
Save vortec/9513890 to your computer and use it in GitHub Desktop.
#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);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment