opt
/
kaspersky
/
kav4fs
/
src
/
samba
/
src
➕ New
📤 Upload
✎ Editing:
kavsamba_wrap-3.x.c
← Back
/* * $Id: * * This source file is a part of a Kaspersky Antivirus For Samba Servers. * Copyright (C) Kaspersky Lab, 1997-2004 * See License.txt for details * */ #include <includes.h> #include <version.h> #include "kavsamba_common.h" // Samba project tends to remove global includes since api version 28 #if defined SMB_VFS_INTERFACE_VERSION && SMB_VFS_INTERFACE_VERSION > 27 #include "system/filesys.h" #include "smbd/proto.h" #endif //UNFORTUNATELY SLES10 uses patched samba 3.0.28 with VFS_INTERFACE_VERSION 22 //vanilla samba 3.2.X uses VFS_INTERFACE_VERSION 22 too but with new and updated functions prototype //so don't use compare VFS_INTERFACE_VERSION with 22, it won't work, use 3.0/3.2 checks #if defined SAMBA_VERSION_MAJOR && SAMBA_VERSION_MAJOR == 3 #if defined SAMBA_VERSION_MINOR && SAMBA_VERSION_MINOR == 0 #define WRAP_SMB_CLOSE(handle, fsp, fd) SMB_VFS_NEXT_CLOSE(handle, fsp, fd) #define WRAP_SMB_WRITE(handle, fsp, fd, data, n) SMB_VFS_NEXT_WRITE(handle, fsp, fd, data, n) #define WRAP_SMB_PWRITE(handle, fsp, fd, data, n, offset) SMB_VFS_NEXT_PWRITE(handle, fsp, fd, data, n, offset) #define WRAP_SMB_FSTAT(handle, fsp, fd, sbuf) SMB_VFS_NEXT_FSTAT(handle, fsp, fd, sbuf) #elif defined SAMBA_VERSION_MINOR && SAMBA_VERSION_MINOR >= 2 #define WRAP_SMB_CLOSE(handle, fsp, fd) SMB_VFS_NEXT_CLOSE(handle, fsp) #define WRAP_SMB_WRITE(handle, fsp, fd, data, n) SMB_VFS_NEXT_WRITE(handle, fsp, data, n) #define WRAP_SMB_PWRITE(handle, fsp, fd, data, n, offset) SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset) #define WRAP_SMB_FSTAT(handle, fsp, fd, sbuf) SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf) #else #error unsupported samba version minor #endif #elif defined SAMBA_VERSION_MAJOR && SAMBA_VERSION_MAJOR == 4 #ifndef SMB_OFF_T # if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T) # define SMB_OFF_T off64_t # else # define SMB_OFF_T off_t # endif #endif #ifndef SMB_STRUCT_DIR # if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_DIR64) # define SMB_STRUCT_DIR DIR64 # else # define SMB_STRUCT_DIR DIR # endif #endif #define WRAP_SMB_CLOSE(handle, fsp, fd) SMB_VFS_NEXT_CLOSE(handle, fsp) #define WRAP_SMB_WRITE(handle, fsp, fd, data, n) SMB_VFS_NEXT_WRITE(handle, fsp, data, n) #define WRAP_SMB_PWRITE(handle, fsp, fd, data, n, offset) SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset) #define WRAP_SMB_FSTAT(handle, fsp, fd, sbuf) SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf) #else #error unsupported samba version major #endif static const char* default_access = "yes"; static int read_access_value(vfs_handle_struct *handle) { const char *buff; buff = lp_parm_const_string(SNUM(handle->conn), "kavsamba", "access_on_error", default_access); if (!strncmp(buff, "yes", 3) || !strncmp(buff, "true", 4)) return 0; return -1; } static int answer_on_error(vfs_handle_struct *handle) { if (read_access_value(handle)) { errno = EACCES; return -1; } return 0; } #if defined SMB_VFS_INTERFACE_VERSION && SMB_VFS_INTERFACE_VERSION < 21 #define SHARE_NAME connectpath #else #define SHARE_NAME origpath #endif #if defined SMB_VFS_INTERFACE_VERSION && SMB_VFS_INTERFACE_VERSION >16 static int kav_smb_connect(vfs_handle_struct *handle,const char *service, const char *user) { smbd_connect = handle->conn; #else static int kav_smb_connect(vfs_handle_struct *handle, connection_struct *conn, const char *service, const char *user) { smbd_connect = conn; #endif DEBUG(2,("KAV4FS kav_smb_connect\n")); kav_disconnect(); if (!kav_connect()) { return answer_on_error(handle); } return 0; } #if defined SMB_VFS_INTERFACE_VERSION && SMB_VFS_INTERFACE_VERSION >16 static void kav_smb_disconnect(vfs_handle_struct *handle) #else static void kav_smb_disconnect(vfs_handle_struct *handle, connection_struct *conn) #endif { DEBUG(2,("KAV4FS kav_smb_disconnect\n")); kav_disconnect(); smbd_connect = NULL; return; } #if defined SMB_VFS_INTERFACE_VERSION && SMB_VFS_INTERFACE_VERSION >= 26 static int kav_smb_open(vfs_handle_struct *handle,struct smb_filename *smb_fname, files_struct *fsp, int flags, mode_t mode) { connection_struct *conn = handle->conn; const char *fname = smb_fname->base_name; #elif defined SMB_VFS_INTERFACE_VERSION && SMB_VFS_INTERFACE_VERSION >16 static int kav_smb_open(vfs_handle_struct *handle,const char *fname, files_struct *fsp, int flags, mode_t mode) { connection_struct *conn = handle->conn; #else static int kav_smb_open(vfs_handle_struct *handle, connection_struct *conn, const char *fname, int flags, mode_t mode) { #endif enum FileAccessType file_result; char * result_path; int len; struct stat stat_buf; DEBUG(2,("KAV4FS kav_smb_open\n")); if (!kav_connected() && !kav_connect()) { if (answer_on_error(handle)) { DEBUG(2,("KAV4FS no connection, access blocked\n")); return -1; } else { DEBUG(2,("KAV4FS no connection, access granted\n")); goto Done; } } smbd_connect = conn; len = strlen(fname)+strlen(smbd_connect->SHARE_NAME)+2; result_path = malloc(len+1); snprintf(result_path,len,"%s/%s",smbd_connect->SHARE_NAME,fname); //check is it file int lstat_res = lstat(result_path,&stat_buf); if (lstat_res != -1 && !S_ISREG(stat_buf.st_mode)) { if (S_ISDIR(stat_buf.st_mode)) { DEBUG(2,("KAV4FS %s is directory\n", result_path)); ++daemon_connect.dir_in_open; } else DEBUG(2,("KAV4FS %s not file, not directory\n", result_path)); free(result_path); goto Done; } if (daemon_connect.filename && time(NULL) - daemon_connect.last_open < 2) { if (!strcmp(daemon_connect.filename,result_path) && daemon_connect.file_result == FILE_ACCESS_DENY) { DEBUG(2,("KAV4FS block from cache\n")); errno = EACCES; free(result_path); return -1; } } daemon_connect.written = 0; daemon_connect.flags = flags; if (daemon_connect.filename) free (daemon_connect.filename); daemon_connect.filename = result_path; DEBUG(2,("KAV4FS filename is %s\n", daemon_connect.filename)); if (lstat_res || !stat_buf.st_size) { DEBUG(2,("KAV4FS no file %d\n", lstat_res)); if (!kav_connected() && !kav_connect()) { errno = EACCES; return -1; } goto Done; } /* check user permission to file here */ /* if ((fd=open(result_path,flags,mode))<0) { DEBUG(2,("KAV4FS can't open file\n")); return -1; } close(fd); */ file_result = kav_check_file(result_path, FILE_OPEN_OPER, flags, stat_buf.st_dev, stat_buf.st_ino); daemon_connect.file_result = file_result; daemon_connect.last_open = time(NULL); if (file_result == FILE_ACCESS_DENY) { errno = EACCES; return -1; } Done: #if defined SMB_VFS_INTERFACE_VERSION && SMB_VFS_INTERFACE_VERSION >= 26 return SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp,flags, mode); #elif defined SMB_VFS_INTERFACE_VERSION && SMB_VFS_INTERFACE_VERSION > 16 return SMB_VFS_NEXT_OPEN(handle,fname, fsp,flags, mode); #else return SMB_VFS_NEXT_OPEN(handle, conn, fname, flags, mode); #endif } #if defined SAMBA_VERSION_MAJOR && SAMBA_VERSION_MAJOR == 3 && defined SAMBA_VERSION_MINOR && SAMBA_VERSION_MINOR == 0 int kav_smb_close(vfs_handle_struct *handle, files_struct *fsp, int fd) #else int kav_smb_close(vfs_handle_struct *handle, files_struct *fsp) #endif { struct stat stat_buf; enum FileAccessType file_result; DEBUG(2,("KAV4FS kav_smb_close\n")); #if defined SMB_VFS_INTERFACE_VERSION && SMB_VFS_INTERFACE_VERSION >= 26 char *fname = NULL; if (fsp->fsp_name) fname = fsp->fsp_name->base_name; #else char *fname = fsp->fsp_name; #endif //FULL NAME is fsp->conn->connectpath + fname //FIXME on "smbd version 3.4.3-1.17.2-2359-SUSE-CODE11" fname points to 0x100 and call strlen leads to SIGSEGV if (daemon_connect.dir_in_open && fname && !strlen(fname)) { DEBUG(2,("KAV4FS close dir\n")); --daemon_connect.dir_in_open; return WRAP_SMB_CLOSE(handle, fsp, fd); } if (!kav_connected() && !kav_connect()) { if (answer_on_error(handle)) { DEBUG(2,("KAV4FS no connection, access blocked\n")); return -1; } else { DEBUG(2,("KAV4FS no connection, access granted\n")); return WRAP_SMB_CLOSE(handle, fsp, fd); } } if (!daemon_connect.filename) { DEBUG(2,("KAV4FS filename is empty\n")); return WRAP_SMB_CLOSE(handle, fsp, fd); } DEBUG(2,("KAV4FS filename is %s\n", daemon_connect.filename)); if (!smbd_connect || !daemon_connect.written) { DEBUG(2,("KAV4FS smbd_connect %p written %d\n", smbd_connect, daemon_connect.written)); goto Done; } if (lstat(daemon_connect.filename,&stat_buf) || !stat_buf.st_size) { DEBUG(2,("KAV4FS no file %d\n", lstat(daemon_connect.filename,&stat_buf))); return WRAP_SMB_CLOSE(handle, fsp, fd); } file_result = kav_check_file(daemon_connect.filename, FILE_CLOSE_OPER, daemon_connect.flags, stat_buf.st_dev, stat_buf.st_ino); if (file_result == FILE_ACCESS_DENY) { errno = EACCES; return -1; } Done: free(daemon_connect.filename); daemon_connect.filename = NULL; return WRAP_SMB_CLOSE(handle, fsp, fd); } #if defined SAMBA_VERSION_MAJOR && SAMBA_VERSION_MAJOR == 3 && defined SAMBA_VERSION_MINOR && SAMBA_VERSION_MINOR == 0 ssize_t kav_smb_write(vfs_handle_struct *handle, files_struct *fsp, int fd, const void *data, size_t n) #else ssize_t kav_smb_write(vfs_handle_struct *handle, files_struct *fsp, const void *data, size_t n) #endif { DEBUG(2,("KAV4FS kav_smb_write\n")); daemon_connect.written = 1; return WRAP_SMB_WRITE(handle, fsp, fd,data,n); } #if defined SMB_VFS_INTERFACE_VERSION && SMB_VFS_INTERFACE_VERSION >=10 #if defined SAMBA_VERSION_MAJOR && SAMBA_VERSION_MAJOR == 3 && defined SAMBA_VERSION_MINOR && SAMBA_VERSION_MINOR == 0 ssize_t kav_smb_pwrite(vfs_handle_struct *handle, files_struct *fsp, int fd, const void *data, size_t n, SMB_OFF_T offset) #else ssize_t kav_smb_pwrite(vfs_handle_struct *handle, files_struct *fsp, const void *data, size_t n, SMB_OFF_T offset) #endif { DEBUG(2,("KAV4FS kav_smb_pwrite\n")); daemon_connect.written = 1; return WRAP_SMB_PWRITE(handle, fsp, fd, data, n, offset); } #endif #if defined SMB_VFS_INTERFACE_VERSION && SMB_VFS_INTERFACE_VERSION >= 26 int kav_smb_rename(vfs_handle_struct *handle, const struct smb_filename *old_fname, const struct smb_filename *new_fname) { connection_struct *conn = handle->conn; const char *old = old_fname->base_name; //const char *new_ = new_fname->base_name; #elif defined SMB_VFS_INTERFACE_VERSION && SMB_VFS_INTERFACE_VERSION >16 int kav_smb_rename(vfs_handle_struct *handle, const char *old, const char *new_) { connection_struct *conn = handle->conn; #else int kav_smb_rename(vfs_handle_struct *handle, connection_struct *conn, const char *old, const char *new_) { #endif int len; char * result_path; struct stat stat_buf; enum FileAccessType file_result; //DEBUG(2,("kav_smb_rename\n")); smbd_connect = conn; if (daemon_connect.filename) { free(daemon_connect.filename); daemon_connect.filename = NULL; } len = strlen(old)+strlen(smbd_connect->SHARE_NAME)+2; result_path = malloc(len+1); snprintf(result_path,len,"%s/%s",smbd_connect->SHARE_NAME,old); if (lstat(result_path,&stat_buf)) { goto Done; } if (!kav_connected() && !kav_connect()) { if (answer_on_error(handle)) { free(result_path); return -1; } else goto Done; } file_result = kav_notify_file(result_path, FILE_RENAME_OPER, stat_buf.st_dev, stat_buf.st_ino); if (file_result == FILE_ACCESS_DENY) { errno = EACCES; return -1; } Done: free(result_path); #if defined SMB_VFS_INTERFACE_VERSION && SMB_VFS_INTERFACE_VERSION >= 26 return SMB_VFS_NEXT_RENAME(handle, old_fname, new_fname); #elif defined SMB_VFS_INTERFACE_VERSION && SMB_VFS_INTERFACE_VERSION >16 return SMB_VFS_NEXT_RENAME(handle, old, new_); #else return SMB_VFS_NEXT_RENAME(handle, conn, old, new_); #endif } #if defined SMB_VFS_INTERFACE_VERSION && SMB_VFS_INTERFACE_VERSION >= 26 static int kav_smb_unlink(vfs_handle_struct *handle, const struct smb_filename *smb_fname) { connection_struct *conn = handle->conn; const char *path = smb_fname->base_name; #elif defined SMB_VFS_INTERFACE_VERSION && SMB_VFS_INTERFACE_VERSION >16 static int kav_smb_unlink(vfs_handle_struct *handle, const char *path) { connection_struct *conn = handle->conn; #else static int kav_smb_unlink(vfs_handle_struct *handle, connection_struct *conn, const char *path) { #endif int len; char * result_path; struct stat stat_buf; enum FileAccessType file_result; //DEBUG(2,("kav_smb_unlink\n")); smbd_connect = conn; if (daemon_connect.filename) { free(daemon_connect.filename); daemon_connect.filename = NULL; } len = strlen(path)+strlen(smbd_connect->SHARE_NAME)+2; result_path = malloc(len+1); snprintf(result_path,len,"%s/%s",smbd_connect->SHARE_NAME,path); if (lstat(result_path,&stat_buf)) { goto Done; } if (!kav_connected() && !kav_connect()) { if (answer_on_error(handle)) { free(result_path); return -1; } else goto Done; } file_result = kav_notify_file(result_path, FILE_UNLINK_OPER, stat_buf.st_dev, stat_buf.st_ino); if (file_result == FILE_ACCESS_DENY) { errno = EACCES; return -1; } Done: free(result_path); #if defined SMB_VFS_INTERFACE_VERSION && SMB_VFS_INTERFACE_VERSION >= 26 return SMB_VFS_NEXT_UNLINK(handle, smb_fname); #elif defined SMB_VFS_INTERFACE_VERSION && SMB_VFS_INTERFACE_VERSION >16 return SMB_VFS_NEXT_UNLINK(handle, path); #else return SMB_VFS_NEXT_UNLINK(handle, conn, path); #endif } #if defined SMB_VFS_INTERFACE_VERSION && SMB_VFS_INTERFACE_VERSION >= 26 int kav_smb_stat(struct vfs_handle_struct *handle, struct smb_filename *smb_fname) { struct connection_struct *conn = handle->conn; #elif defined SMB_VFS_INTERFACE_VERSION && SMB_VFS_INTERFACE_VERSION >16 int kav_smb_stat(struct vfs_handle_struct *handle, const char *fname, SMB_STRUCT_STAT *sbuf) { struct connection_struct *conn = handle->conn; #else int kav_smb_stat(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *fname, SMB_STRUCT_STAT *sbuf) { #endif //DEBUG(2,("kav_smb_stat\n")); smbd_connect = conn; if (!kav_connected() && !kav_connect()) { if (answer_on_error(handle)) return -1; } #if defined SMB_VFS_INTERFACE_VERSION && SMB_VFS_INTERFACE_VERSION >= 26 return SMB_VFS_NEXT_STAT(handle, smb_fname); #elif defined SMB_VFS_INTERFACE_VERSION && SMB_VFS_INTERFACE_VERSION >16 return SMB_VFS_NEXT_STAT(handle, fname, sbuf); #else return SMB_VFS_NEXT_STAT(handle, conn,fname, sbuf); #endif } #if defined SAMBA_VERSION_MAJOR && SAMBA_VERSION_MAJOR == 3 && defined SAMBA_VERSION_MINOR && SAMBA_VERSION_MINOR == 0 int kav_smb_fstat(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf) #else int kav_smb_fstat(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_STAT *sbuf) #endif { //DEBUG(2,("kav_smb_fstat\n")); if (!smbd_connect) goto Done; if (!kav_connected()&& !kav_connect()) { if (answer_on_error(handle)) return -1; } Done: return WRAP_SMB_FSTAT(handle, fsp,fd,sbuf); } #if defined SMB_VFS_INTERFACE_VERSION && SMB_VFS_INTERFACE_VERSION >= 26 int kav_smb_lstat(struct vfs_handle_struct *handle, struct smb_filename *smb_fname) { struct connection_struct *conn = handle->conn; #elif defined SMB_VFS_INTERFACE_VERSION && SMB_VFS_INTERFACE_VERSION >16 int kav_smb_lstat(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf) { struct connection_struct *conn = handle->conn; #else int kav_smb_lstat(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path, SMB_STRUCT_STAT *sbuf) { #endif //DEBUG(2,("kav_smb_lstat\n")); smbd_connect = conn; if (!kav_connected()&& !kav_connect()) { if (answer_on_error(handle)) return -1; } #if defined SMB_VFS_INTERFACE_VERSION && SMB_VFS_INTERFACE_VERSION >= 26 return SMB_VFS_NEXT_LSTAT(handle, smb_fname); #elif defined SMB_VFS_INTERFACE_VERSION && SMB_VFS_INTERFACE_VERSION >16 return SMB_VFS_NEXT_LSTAT(handle, path,sbuf); #else return SMB_VFS_NEXT_LSTAT(handle, conn,path,sbuf); #endif } #if defined SMB_VFS_INTERFACE_VERSION && SMB_VFS_INTERFACE_VERSION > 34 SMB_STRUCT_DIR * kav_smb_opendir(struct vfs_handle_struct *handle, const struct smb_filename *fname, const char *mask, uint32_t attributes) { struct connection_struct *conn = handle->conn; #elif defined SMB_VFS_INTERFACE_VERSION && SMB_VFS_INTERFACE_VERSION >16 SMB_STRUCT_DIR * kav_smb_opendir(struct vfs_handle_struct *handle, const char *fname, const char *mask, uint32_t attributes) { struct connection_struct *conn = handle->conn; #else #if SMB_VFS_INTERFACE_VERSION >12 DIR * kav_smb_opendir(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *fname, const char *mask, uint32_t attributes) { #else DIR * kav_smb_opendir(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *fname) { #endif #endif //DEBUG(2,("kav_smb_opendir\n")); smbd_connect = conn; if (!kav_connected()&& !kav_connect()) { if (answer_on_error(handle)) return NULL; } #if SMB_VFS_INTERFACE_VERSION > 16 return SMB_VFS_NEXT_OPENDIR(handle, fname, mask,attributes); #else #if SMB_VFS_INTERFACE_VERSION >12 return SMB_VFS_NEXT_OPENDIR(handle,conn,fname, mask,attributes); #else return SMB_VFS_NEXT_OPENDIR(handle,conn,fname); #endif #endif } /* #if defined SMB_VFS_INTERFACE_VERSION && SMB_VFS_INTERFACE_VERSION >=12 ssize_t kav_smb_aio_write(vfs_handle_struct *handle, files_struct *fsp, SMB_STRUCT_AIOCB *aiocb) { DEBUG(2,("kav_smb_aio_write\n")); daemon_connect.written = 1; return SMB_VFS_NEXT_AIO_WRITE(handle, fsp, aiocb); } #endif #if defined SAMBA_VERSION_MINOR && SAMBA_VERSION_MINOR == 0 static ssize_t kav_smb_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fsp, int fromfd, const DATA_BLOB *hdr, SMB_OFF_T offset, size_t n) { DEBUG(2,("kav_smb_sendfile\n")); daemon_connect.written = 1; return SMB_VFS_NEXT_SENDFILE(handle, tofd, fsp, fromfd, hdr, offset, n); } #elif defined SAMBA_VERSION_MINOR && SAMBA_VERSION_MINOR == 2 static ssize_t kav_smb_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fromfsp, const DATA_BLOB *hdr, SMB_OFF_T offset, size_t n) { DEBUG(2,("kav_smb_sendfile\n")); daemon_connect.written = 1; return SMB_VFS_NEXT_SENDFILE(handle, tofd, fromfsp, hdr, offset, n); } #endif */ #if defined SMB_VFS_INTERFACE_VERSION && SMB_VFS_INTERFACE_VERSION >= 26 static struct vfs_fn_pointers kav_smb_fns = { .connect_fn = kav_smb_connect, #if defined SMB_VFS_INTERFACE_VERSION && SMB_VFS_INTERFACE_VERSION >= 30 .disconnect_fn = kav_smb_disconnect, #else .disconnect = kav_smb_disconnect, #endif #if defined SMB_VFS_INTERFACE_VERSION && SMB_VFS_INTERFACE_VERSION >= 28 .open_fn = kav_smb_open, #else .open = kav_smb_open, #endif .close_fn = kav_smb_close, #if defined SMB_VFS_INTERFACE_VERSION && SMB_VFS_INTERFACE_VERSION >= 30 .write_fn = kav_smb_write, .pwrite_fn = kav_smb_pwrite, .rename_fn = kav_smb_rename, .unlink_fn = kav_smb_unlink, .stat_fn = kav_smb_stat, .fstat_fn = kav_smb_fstat, .lstat_fn = kav_smb_lstat, .opendir_fn = kav_smb_opendir #else .write = kav_smb_write, .pwrite = kav_smb_pwrite, .rename = kav_smb_rename, .unlink = kav_smb_unlink, .stat = kav_smb_stat, .fstat = kav_smb_fstat, .lstat = kav_smb_lstat, .opendir = kav_smb_opendir #endif }; #else static vfs_op_tuple kav_smb_ops[] = { {SMB_VFS_OP(kav_smb_connect), SMB_VFS_OP_CONNECT, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(kav_smb_disconnect), SMB_VFS_OP_DISCONNECT, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(kav_smb_open), SMB_VFS_OP_OPEN, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(kav_smb_close), SMB_VFS_OP_CLOSE, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(kav_smb_write), SMB_VFS_OP_WRITE, SMB_VFS_LAYER_TRANSPARENT}, #if defined SMB_VFS_INTERFACE_VERSION && SMB_VFS_INTERFACE_VERSION >=10 {SMB_VFS_OP(kav_smb_pwrite), SMB_VFS_OP_PWRITE, SMB_VFS_LAYER_TRANSPARENT}, #endif {SMB_VFS_OP(kav_smb_rename), SMB_VFS_OP_RENAME, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(kav_smb_unlink), SMB_VFS_OP_UNLINK, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(kav_smb_stat), SMB_VFS_OP_STAT, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(kav_smb_fstat), SMB_VFS_OP_FSTAT, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(kav_smb_lstat), SMB_VFS_OP_LSTAT, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(kav_smb_opendir), SMB_VFS_OP_OPENDIR, SMB_VFS_LAYER_TRANSPARENT}, /* #if defined SMB_VFS_INTERFACE_VERSION && SMB_VFS_INTERFACE_VERSION >=12 {SMB_VFS_OP(kav_smb_aio_write), SMB_VFS_OP_AIO_WRITE, SMB_VFS_LAYER_TRANSPARENT}, #endif {SMB_VFS_OP(kav_smb_sendfile), SMB_VFS_OP_SENDFILE, SMB_VFS_LAYER_TRANSPARENT}, */ {NULL, SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} }; #endif #if defined SMB_VFS_INTERFACE_VERSION && SMB_VFS_INTERFACE_VERSION < 26 NTSTATUS init_module(void) { init_stuff(); return smb_register_vfs(SMB_VFS_INTERFACE_VERSION,KAVSAMBA_3X_MODULE_NAME, kav_smb_ops); } #endif //samba team renames init function in 3.2.x version #if defined SAMBA_VERSION_MAJOR && SAMBA_VERSION_MAJOR == 3 #if defined SAMBA_VERSION_MINOR && SAMBA_VERSION_MINOR >= 2 NTSTATUS init_samba_module(void) { init_stuff(); return smb_register_vfs(SMB_VFS_INTERFACE_VERSION,KAVSAMBA_3X_MODULE_NAME, #if defined SMB_VFS_INTERFACE_VERSION && SMB_VFS_INTERFACE_VERSION >= 26 &kav_smb_fns); #else kav_smb_ops); #endif } #endif #endif #if defined SAMBA_VERSION_MAJOR && SAMBA_VERSION_MAJOR == 4 //samba guys rename init function again NTSTATUS samba_init_module(void) { init_stuff(); return smb_register_vfs(SMB_VFS_INTERFACE_VERSION,KAVSAMBA_3X_MODULE_NAME, &kav_smb_fns); } #endif
💾 Save Changes
Cancel
📤 Upload File
×
Select File
Upload
Cancel
➕ Create New
×
Type
📄 File
📁 Folder
Name
Create
Cancel
✎ Rename Item
×
Current Name
New Name
Rename
Cancel
🔐 Change Permissions
×
Target File
Permission (e.g., 0755, 0644)
0755
0644
0777
Apply
Cancel