diff options
Diffstat (limited to 'source4/ntvfs')
36 files changed, 263 insertions, 215 deletions
diff --git a/source4/ntvfs/cifs/vfs_cifs.c b/source4/ntvfs/cifs/vfs_cifs.c index 27bf1ead24..91ca08d2de 100644 --- a/source4/ntvfs/cifs/vfs_cifs.c +++ b/source4/ntvfs/cifs/vfs_cifs.c @@ -99,10 +99,12 @@ NTSTATUS ntvfs_cifs_init(void); #define CIFS_DOMAIN "cifs:domain" #define CIFS_SHARE "cifs:share" #define CIFS_USE_MACHINE_ACCT "cifs:use-machine-account" +#define CIFS_USE_S4U2PROXY "cifs:use-s4u2proxy" #define CIFS_MAP_GENERIC "cifs:map-generic" #define CIFS_MAP_TRANS2 "cifs:map-trans2" #define CIFS_USE_MACHINE_ACCT_DEFAULT false +#define CIFS_USE_S4U2PROXY_DEFAULT false #define CIFS_MAP_GENERIC_DEFAULT false #define CIFS_MAP_TRANS2_DEFAULT true @@ -150,6 +152,7 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs, struct cli_credentials *credentials; bool machine_account; + bool s4u2proxy; const char* sharename; switch (tcon->generic.level) { @@ -187,6 +190,7 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs, } machine_account = share_bool_option(scfg, CIFS_USE_MACHINE_ACCT, CIFS_USE_MACHINE_ACCT_DEFAULT); + s4u2proxy = share_bool_option(scfg, CIFS_USE_S4U2PROXY, CIFS_USE_S4U2PROXY_DEFAULT); p = talloc_zero(ntvfs, struct cvfs_private); if (!p) { @@ -226,9 +230,54 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs, } else if (req->session_info->credentials) { DEBUG(5, ("CIFS backend: Using delegated credentials\n")); credentials = req->session_info->credentials; + } else if (s4u2proxy) { + struct ccache_container *ccc = NULL; + const char *err_str = NULL; + int ret; + char *impersonate_principal; + char *self_service; + char *target_service; + + impersonate_principal = talloc_asprintf(req, "%s@%s", + req->session_info->info->account_name, + req->session_info->info->domain_name); + + self_service = talloc_asprintf(req, "cifs/%s", + lpcfg_netbios_name(ntvfs->ctx->lp_ctx)); + + target_service = talloc_asprintf(req, "cifs/%s", host); + + DEBUG(5, ("CIFS backend: Using S4U2Proxy credentials\n")); + + credentials = cli_credentials_init(p); + cli_credentials_set_conf(credentials, ntvfs->ctx->lp_ctx); + if (domain) { + cli_credentials_set_domain(credentials, domain, CRED_SPECIFIED); + } + status = cli_credentials_set_machine_account(credentials, ntvfs->ctx->lp_ctx); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + cli_credentials_invalidate_ccache(credentials, CRED_SPECIFIED); + cli_credentials_set_impersonate_principal(credentials, + impersonate_principal, + self_service); + cli_credentials_set_target_service(credentials, target_service); + ret = cli_credentials_get_ccache(credentials, + ntvfs->ctx->event_ctx, + ntvfs->ctx->lp_ctx, + &ccc, + &err_str); + if (ret != 0) { + status = NT_STATUS_CROSSREALM_DELEGATION_FAILURE; + DEBUG(1,("S4U2Proxy: cli_credentials_get_ccache() gave: ret[%d] str[%s] - %s\n", + ret, err_str, nt_errstr(status))); + return status; + } + } else { DEBUG(1,("CIFS backend: NO delegated credentials found: You must supply server, user and password or the client must supply delegated credentials\n")); - return NT_STATUS_INVALID_PARAMETER; + return NT_STATUS_INTERNAL_ERROR; } /* connect to the server, using the smbd event context */ diff --git a/source4/ntvfs/cifs_posix_cli/svfs_util.c b/source4/ntvfs/cifs_posix_cli/svfs_util.c index d8a7909390..f351c5840e 100644 --- a/source4/ntvfs/cifs_posix_cli/svfs_util.c +++ b/source4/ntvfs/cifs_posix_cli/svfs_util.c @@ -41,16 +41,15 @@ char *cifspsx_unix_path(struct ntvfs_module_context *ntvfs, { struct cifspsx_private *p = ntvfs->private_data; char *ret; + char *name_lower = strlower_talloc(p, name); if (*name != '\\') { - ret = talloc_asprintf(req, "%s/%s", p->connectpath, name); + ret = talloc_asprintf(req, "%s/%s", p->connectpath, name_lower); } else { - ret = talloc_asprintf(req, "%s%s", p->connectpath, name); + ret = talloc_asprintf(req, "%s%s", p->connectpath, name_lower); } all_string_sub(ret, "\\", "/", 0); - - strlower(ret + strlen(p->connectpath)); - + talloc_free(name_lower); return ret; } @@ -85,9 +84,8 @@ struct cifspsx_dir *cifspsx_list_unix(TALLOC_CTX *mem_ctx, struct ntvfs_request /* the wildcard pattern is the last part */ mask = p+1; - low_mask = talloc_strdup(mem_ctx, mask); + low_mask = strlower_talloc(mem_ctx, mask); if (!low_mask) { return NULL; } - strlower(low_mask); odir = opendir(dir->unix_dir); if (!odir) { return NULL; } @@ -102,12 +100,11 @@ struct cifspsx_dir *cifspsx_list_unix(TALLOC_CTX *mem_ctx, struct ntvfs_request continue; } - low_name = talloc_strdup(mem_ctx, dent->d_name); + low_name = strlower_talloc(mem_ctx, dent->d_name); if (!low_name) { continue; } - strlower(low_name); /* check it matches the wildcard pattern */ - if (ms_fnmatch(low_mask, low_name, PROTOCOL_NT1) != 0) { + if (ms_fnmatch_protocol(low_mask, low_name, PROTOCOL_NT1) != 0) { continue; } diff --git a/source4/ntvfs/cifs_posix_cli/vfs_cifs_posix.c b/source4/ntvfs/cifs_posix_cli/vfs_cifs_posix.c index 2a8c69e220..949b6dbbb7 100644 --- a/source4/ntvfs/cifs_posix_cli/vfs_cifs_posix.c +++ b/source4/ntvfs/cifs_posix_cli/vfs_cifs_posix.c @@ -150,7 +150,7 @@ static NTSTATUS cifspsx_unlink(struct ntvfs_module_context *ntvfs, /* ignoring wildcards ... */ if (unlink(unix_path) == -1) { - return map_nt_error_from_unix(errno); + return map_nt_error_from_unix_common(errno); } return NT_STATUS_OK; @@ -179,7 +179,7 @@ static NTSTATUS cifspsx_chkpath(struct ntvfs_module_context *ntvfs, unix_path = cifspsx_unix_path(ntvfs, req, cp->chkpath.in.path); if (stat(unix_path, &st) == -1) { - return map_nt_error_from_unix(errno); + return map_nt_error_from_unix_common(errno); } if (!S_ISDIR(st.st_mode)) { @@ -294,7 +294,7 @@ static NTSTATUS cifspsx_qpathinfo(struct ntvfs_module_context *ntvfs, DEBUG(19,("cifspsx_qpathinfo: file %s\n", unix_path)); if (stat(unix_path, &st) == -1) { DEBUG(19,("cifspsx_qpathinfo: file %s errno=%d\n", unix_path, errno)); - return map_nt_error_from_unix(errno); + return map_nt_error_from_unix_common(errno); } DEBUG(19,("cifspsx_qpathinfo: file %s, stat done\n", unix_path)); return cifspsx_map_fileinfo(ntvfs, req, info, &st, unix_path); @@ -320,7 +320,7 @@ static NTSTATUS cifspsx_qfileinfo(struct ntvfs_module_context *ntvfs, } if (fstat(f->fd, &st) == -1) { - return map_nt_error_from_unix(errno); + return map_nt_error_from_unix_common(errno); } return cifspsx_map_fileinfo(ntvfs, req,info, &st, f->name); @@ -389,13 +389,13 @@ static NTSTATUS cifspsx_open(struct ntvfs_module_context *ntvfs, case NTCREATEX_DISP_CREATE: if (mkdir(unix_path, 0755) == -1) { DEBUG(9,("cifspsx_open: mkdir %s errno=%d\n", unix_path, errno)); - return map_nt_error_from_unix(errno); + return map_nt_error_from_unix_common(errno); } break; case NTCREATEX_DISP_OPEN_IF: if (mkdir(unix_path, 0755) == -1 && errno != EEXIST) { DEBUG(9,("cifspsx_open: mkdir %s errno=%d\n", unix_path, errno)); - return map_nt_error_from_unix(errno); + return map_nt_error_from_unix_common(errno); } break; } @@ -404,13 +404,13 @@ static NTSTATUS cifspsx_open(struct ntvfs_module_context *ntvfs, do_open: fd = open(unix_path, flags, 0644); if (fd == -1) { - return map_nt_error_from_unix(errno); + return map_nt_error_from_unix_common(errno); } if (fstat(fd, &st) == -1) { DEBUG(9,("cifspsx_open: fstat errno=%d\n", errno)); close(fd); - return map_nt_error_from_unix(errno); + return map_nt_error_from_unix_common(errno); } status = ntvfs_handle_new(ntvfs, req, &handle); @@ -459,7 +459,7 @@ static NTSTATUS cifspsx_mkdir(struct ntvfs_module_context *ntvfs, unix_path = cifspsx_unix_path(ntvfs, req, md->mkdir.in.path); if (mkdir(unix_path, 0777) == -1) { - return map_nt_error_from_unix(errno); + return map_nt_error_from_unix_common(errno); } return NT_STATUS_OK; @@ -478,7 +478,7 @@ static NTSTATUS cifspsx_rmdir(struct ntvfs_module_context *ntvfs, unix_path = cifspsx_unix_path(ntvfs, req, rd->in.path); if (rmdir(unix_path) == -1) { - return map_nt_error_from_unix(errno); + return map_nt_error_from_unix_common(errno); } return NT_STATUS_OK; @@ -502,7 +502,7 @@ static NTSTATUS cifspsx_rename(struct ntvfs_module_context *ntvfs, unix_path2 = cifspsx_unix_path(ntvfs, req, ren->rename.in.pattern2); if (rename(unix_path1, unix_path2) == -1) { - return map_nt_error_from_unix(errno); + return map_nt_error_from_unix_common(errno); } return NT_STATUS_OK; @@ -541,7 +541,7 @@ static NTSTATUS cifspsx_read(struct ntvfs_module_context *ntvfs, rd->readx.in.maxcnt, rd->readx.in.offset); if (ret == -1) { - return map_nt_error_from_unix(errno); + return map_nt_error_from_unix_common(errno); } rd->readx.out.nread = ret; @@ -577,7 +577,7 @@ static NTSTATUS cifspsx_write(struct ntvfs_module_context *ntvfs, wr->writex.in.count, wr->writex.in.offset); if (ret == -1) { - return map_nt_error_from_unix(errno); + return map_nt_error_from_unix_common(errno); } wr->writex.out.nwritten = ret; @@ -648,7 +648,7 @@ static NTSTATUS cifspsx_close(struct ntvfs_module_context *ntvfs, } if (close(f->fd) == -1) { - return map_nt_error_from_unix(errno); + return map_nt_error_from_unix_common(errno); } DLIST_REMOVE(p->open_files, f); @@ -738,7 +738,7 @@ static NTSTATUS cifspsx_setfileinfo(struct ntvfs_module_context *ntvfs, case RAW_SFILEINFO_END_OF_FILE_INFORMATION: if (ftruncate(f->fd, info->end_of_file_info.in.size) == -1) { - return map_nt_error_from_unix(errno); + return map_nt_error_from_unix_common(errno); } break; case RAW_SFILEINFO_SETATTRE: @@ -784,7 +784,7 @@ static NTSTATUS cifspsx_fsinfo(struct ntvfs_module_context *ntvfs, if (sys_fsusage(p->connectpath, &fs->generic.out.blocks_free, &fs->generic.out.blocks_total) == -1) { - return map_nt_error_from_unix(errno); + return map_nt_error_from_unix_common(errno); } fs->generic.out.block_size = 512; @@ -824,7 +824,7 @@ static NTSTATUS cifspsx_fsattr(struct ntvfs_module_context *ntvfs, } if (stat(p->connectpath, &st) == -1) { - return map_nt_error_from_unix(errno); + return map_nt_error_from_unix_common(errno); } unix_to_nt_time(&fs->generic.out.create_time, st.st_ctime); diff --git a/source4/ntvfs/common/brlock.c b/source4/ntvfs/common/brlock.c index 94041d2014..a6232f8596 100644 --- a/source4/ntvfs/common/brlock.c +++ b/source4/ntvfs/common/brlock.c @@ -26,7 +26,7 @@ #include "includes.h" #include "system/filesys.h" -#include <tdb.h> +#include "tdb_compat.h" #include "messaging/messaging.h" #include "lib/messaging/irpc.h" #include "libcli/libcli.h" @@ -38,26 +38,26 @@ static const struct brlock_ops *ops; /* set the brl backend ops */ -void brl_set_ops(const struct brlock_ops *new_ops) +void brlock_set_ops(const struct brlock_ops *new_ops) { ops = new_ops; } /* Open up the brlock database. Close it down using talloc_free(). We - need the messaging_ctx to allow for pending lock notifications. + need the imessaging_ctx to allow for pending lock notifications. */ -struct brl_context *brl_init(TALLOC_CTX *mem_ctx, struct server_id server, +struct brl_context *brlock_init(TALLOC_CTX *mem_ctx, struct server_id server, struct loadparm_context *lp_ctx, - struct messaging_context *messaging_ctx) + struct imessaging_context *imessaging_ctx) { if (ops == NULL) { brl_tdb_init_ops(); } - return ops->brl_init(mem_ctx, server, lp_ctx, messaging_ctx); + return ops->brl_init(mem_ctx, server, lp_ctx, imessaging_ctx); } -struct brl_handle *brl_create_handle(TALLOC_CTX *mem_ctx, struct ntvfs_handle *ntvfs, DATA_BLOB *file_key) +struct brl_handle *brlock_create_handle(TALLOC_CTX *mem_ctx, struct ntvfs_handle *ntvfs, DATA_BLOB *file_key) { return ops->brl_create_handle(mem_ctx, ntvfs, file_key); } @@ -69,7 +69,7 @@ struct brl_handle *brl_create_handle(TALLOC_CTX *mem_ctx, struct ntvfs_handle *n someone else closing an overlapping lock range) a messaging notification is sent, identified by the notify_ptr */ -NTSTATUS brl_lock(struct brl_context *brl, +NTSTATUS brlock_lock(struct brl_context *brl, struct brl_handle *brlh, uint32_t smbpid, uint64_t start, uint64_t size, @@ -83,7 +83,7 @@ NTSTATUS brl_lock(struct brl_context *brl, /* Unlock a range of bytes. */ -NTSTATUS brl_unlock(struct brl_context *brl, +NTSTATUS brlock_unlock(struct brl_context *brl, struct brl_handle *brlh, uint32_t smbpid, uint64_t start, uint64_t size) @@ -96,7 +96,7 @@ NTSTATUS brl_unlock(struct brl_context *brl, given up trying to establish a lock or when they have succeeded in getting it. In either case they no longer need to be notified. */ -NTSTATUS brl_remove_pending(struct brl_context *brl, +NTSTATUS brlock_remove_pending(struct brl_context *brl, struct brl_handle *brlh, void *notify_ptr) { @@ -107,7 +107,7 @@ NTSTATUS brl_remove_pending(struct brl_context *brl, /* Test if we are allowed to perform IO on a region of an open file */ -NTSTATUS brl_locktest(struct brl_context *brl, +NTSTATUS brlock_locktest(struct brl_context *brl, struct brl_handle *brlh, uint32_t smbpid, uint64_t start, uint64_t size, @@ -120,7 +120,7 @@ NTSTATUS brl_locktest(struct brl_context *brl, /* Remove any locks associated with a open file. */ -NTSTATUS brl_close(struct brl_context *brl, +NTSTATUS brlock_close(struct brl_context *brl, struct brl_handle *brlh) { return ops->brl_close(brl, brlh); @@ -129,7 +129,7 @@ NTSTATUS brl_close(struct brl_context *brl, /* Get a number of locks associated with a open file. */ -NTSTATUS brl_count(struct brl_context *brl, +NTSTATUS brlock_count(struct brl_context *brl, struct brl_handle *brlh, int *count) { diff --git a/source4/ntvfs/common/brlock.h b/source4/ntvfs/common/brlock.h index e5e618d045..703538f073 100644 --- a/source4/ntvfs/common/brlock.h +++ b/source4/ntvfs/common/brlock.h @@ -24,7 +24,7 @@ struct brlock_ops { struct brl_context *(*brl_init)(TALLOC_CTX *, struct server_id , struct loadparm_context *lp_ctx, - struct messaging_context *); + struct imessaging_context *); struct brl_handle *(*brl_create_handle)(TALLOC_CTX *, struct ntvfs_handle *, DATA_BLOB *); NTSTATUS (*brl_lock)(struct brl_context *, struct brl_handle *, @@ -52,7 +52,7 @@ struct brlock_ops { }; -void brl_set_ops(const struct brlock_ops *new_ops); +void brlock_set_ops(const struct brlock_ops *new_ops); void brl_tdb_init_ops(void); void brl_ctdb_init_ops(void); diff --git a/source4/ntvfs/common/brlock_tdb.c b/source4/ntvfs/common/brlock_tdb.c index 35d4c27d0f..817448377c 100644 --- a/source4/ntvfs/common/brlock_tdb.c +++ b/source4/ntvfs/common/brlock_tdb.c @@ -26,9 +26,9 @@ #include "includes.h" #include "system/filesys.h" -#include <tdb.h> +#include "tdb_compat.h" #include "messaging/messaging.h" -#include "tdb_wrap.h" +#include "lib/util/tdb_wrap.h" #include "lib/messaging/irpc.h" #include "libcli/libcli.h" #include "cluster/cluster.h" @@ -48,7 +48,7 @@ struct brl_context { struct tdb_wrap *w; struct server_id server; - struct messaging_context *messaging_ctx; + struct imessaging_context *imessaging_ctx; }; /* @@ -89,12 +89,12 @@ static bool brl_invalid_lock_range(uint64_t start, uint64_t size) /* Open up the brlock.tdb database. Close it down using - talloc_free(). We need the messaging_ctx to allow for + talloc_free(). We need the imessaging_ctx to allow for pending lock notifications. */ static struct brl_context *brl_tdb_init(TALLOC_CTX *mem_ctx, struct server_id server, struct loadparm_context *lp_ctx, - struct messaging_context *messaging_ctx) + struct imessaging_context *imessaging_ctx) { struct brl_context *brl; @@ -110,7 +110,7 @@ static struct brl_context *brl_tdb_init(TALLOC_CTX *mem_ctx, struct server_id se } brl->server = server; - brl->messaging_ctx = messaging_ctx; + brl->imessaging_ctx = imessaging_ctx; return brl; } @@ -333,7 +333,7 @@ static NTSTATUS brl_tdb_lock(struct brl_context *brl, } } - dbuf = tdb_fetch(brl->w->tdb, kbuf); + dbuf = tdb_fetch_compat(brl->w->tdb, kbuf); lock.context.smbpid = smbpid; lock.context.server = brl->server; @@ -419,7 +419,7 @@ static void brl_tdb_notify_unlock(struct brl_context *brl, if (locks[i].lock_type == PENDING_WRITE_LOCK) { last_notice = i; } - messaging_send_ptr(brl->messaging_ctx, locks[i].context.server, + imessaging_send_ptr(brl->imessaging_ctx, locks[i].context.server, MSG_BRL_RETRY, locks[i].notify_ptr); } } @@ -468,7 +468,7 @@ static NTSTATUS brl_tdb_unlock(struct brl_context *brl, return NT_STATUS_INTERNAL_DB_CORRUPTION; } - dbuf = tdb_fetch(brl->w->tdb, kbuf); + dbuf = tdb_fetch_compat(brl->w->tdb, kbuf); if (!dbuf.dptr) { tdb_chainunlock(brl->w->tdb, kbuf); return NT_STATUS_RANGE_NOT_LOCKED; @@ -568,7 +568,7 @@ static NTSTATUS brl_tdb_remove_pending(struct brl_context *brl, return NT_STATUS_INTERNAL_DB_CORRUPTION; } - dbuf = tdb_fetch(brl->w->tdb, kbuf); + dbuf = tdb_fetch_compat(brl->w->tdb, kbuf); if (!dbuf.dptr) { tdb_chainunlock(brl->w->tdb, kbuf); return NT_STATUS_RANGE_NOT_LOCKED; @@ -639,7 +639,7 @@ static NTSTATUS brl_tdb_locktest(struct brl_context *brl, return NT_STATUS_INVALID_LOCK_RANGE; } - dbuf = tdb_fetch(brl->w->tdb, kbuf); + dbuf = tdb_fetch_compat(brl->w->tdb, kbuf); if (dbuf.dptr == NULL) { return NT_STATUS_OK; } @@ -686,7 +686,7 @@ static NTSTATUS brl_tdb_close(struct brl_context *brl, return NT_STATUS_INTERNAL_DB_CORRUPTION; } - dbuf = tdb_fetch(brl->w->tdb, kbuf); + dbuf = tdb_fetch_compat(brl->w->tdb, kbuf); if (!dbuf.dptr) { tdb_chainunlock(brl->w->tdb, kbuf); return NT_STATUS_OK; @@ -751,7 +751,7 @@ static NTSTATUS brl_tdb_count(struct brl_context *brl, struct brl_handle *brlh, return NT_STATUS_INTERNAL_DB_CORRUPTION; } - dbuf = tdb_fetch(brl->w->tdb, kbuf); + dbuf = tdb_fetch_compat(brl->w->tdb, kbuf); if (!dbuf.dptr) { tdb_chainunlock(brl->w->tdb, kbuf); return NT_STATUS_OK; @@ -779,5 +779,5 @@ static const struct brlock_ops brlock_tdb_ops = { void brl_tdb_init_ops(void) { - brl_set_ops(&brlock_tdb_ops); + brlock_set_ops(&brlock_tdb_ops); } diff --git a/source4/ntvfs/common/notify.c b/source4/ntvfs/common/notify.c index 0b5f91bfe1..98f17a6565 100644 --- a/source4/ntvfs/common/notify.c +++ b/source4/ntvfs/common/notify.c @@ -25,12 +25,12 @@ #include "includes.h" #include "system/filesys.h" -#include <tdb.h> +#include "../lib/tdb_compat/tdb_compat.h" #include "../lib/util/util_tdb.h" #include "messaging/messaging.h" -#include "tdb_wrap.h" +#include "lib/util/tdb_wrap.h" #include "lib/messaging/irpc.h" -#include "librpc/gen_ndr/ndr_s4_notify.h" +#include "librpc/gen_ndr/ndr_notify.h" #include "../lib/util/dlinklist.h" #include "ntvfs/common/ntvfs_common.h" #include "ntvfs/sysdep/sys_notify.h" @@ -41,7 +41,7 @@ struct notify_context { struct tdb_wrap *w; struct server_id server; - struct messaging_context *messaging_ctx; + struct imessaging_context *imessaging_ctx; struct notify_list *list; struct notify_array *array; int seqnum; @@ -63,7 +63,7 @@ struct notify_list { #define NOTIFY_ENABLE_DEFAULT true static NTSTATUS notify_remove_all(struct notify_context *notify); -static void notify_handler(struct messaging_context *msg_ctx, void *private_data, +static void notify_handler(struct imessaging_context *msg_ctx, void *private_data, uint32_t msg_type, struct server_id server_id, DATA_BLOB *data); /* @@ -71,18 +71,18 @@ static void notify_handler(struct messaging_context *msg_ctx, void *private_data */ static int notify_destructor(struct notify_context *notify) { - messaging_deregister(notify->messaging_ctx, MSG_PVFS_NOTIFY, notify); + imessaging_deregister(notify->imessaging_ctx, MSG_PVFS_NOTIFY, notify); notify_remove_all(notify); return 0; } /* Open up the notify.tdb database. You should close it down using - talloc_free(). We need the messaging_ctx to allow for notifications + talloc_free(). We need the imessaging_ctx to allow for notifications via internal messages */ struct notify_context *notify_init(TALLOC_CTX *mem_ctx, struct server_id server, - struct messaging_context *messaging_ctx, + struct imessaging_context *imessaging_ctx, struct loadparm_context *lp_ctx, struct tevent_context *ev, struct share_config *scfg) @@ -109,7 +109,7 @@ struct notify_context *notify_init(TALLOC_CTX *mem_ctx, struct server_id server, } notify->server = server; - notify->messaging_ctx = messaging_ctx; + notify->imessaging_ctx = imessaging_ctx; notify->list = NULL; notify->array = NULL; notify->seqnum = tdb_get_seqnum(notify->w->tdb); @@ -118,7 +118,7 @@ struct notify_context *notify_init(TALLOC_CTX *mem_ctx, struct server_id server, /* register with the messaging subsystem for the notify message type */ - messaging_register(notify->messaging_ctx, notify, + imessaging_register(notify->imessaging_ctx, notify, MSG_PVFS_NOTIFY, notify_handler); notify->sys_notify_ctx = sys_notify_context_create(scfg, notify, ev); @@ -247,7 +247,7 @@ static NTSTATUS notify_save(struct notify_context *notify) /* handle incoming notify messages */ -static void notify_handler(struct messaging_context *msg_ctx, void *private_data, +static void notify_handler(struct imessaging_context *msg_ctx, void *private_data, uint32_t msg_type, struct server_id server_id, DATA_BLOB *data) { struct notify_context *notify = talloc_get_type(private_data, struct notify_context); @@ -563,7 +563,7 @@ static void notify_send(struct notify_context *notify, struct notify_entry *e, return; } - status = messaging_send(notify->messaging_ctx, e->server, + status = imessaging_send(notify->imessaging_ctx, e->server, MSG_PVFS_NOTIFY, &data); talloc_free(tmp_ctx); } diff --git a/source4/ntvfs/common/opendb.c b/source4/ntvfs/common/opendb.c index 12fe7015a7..29081ef7d6 100644 --- a/source4/ntvfs/common/opendb.c +++ b/source4/ntvfs/common/opendb.c @@ -55,7 +55,7 @@ void odb_set_ops(const struct opendb_ops *new_ops) /* Open up the openfiles.tdb database. Close it down using - talloc_free(). We need the messaging_ctx to allow for pending open + talloc_free(). We need the imessaging_ctx to allow for pending open notifications. */ struct odb_context *odb_init(TALLOC_CTX *mem_ctx, diff --git a/source4/ntvfs/common/opendb_tdb.c b/source4/ntvfs/common/opendb_tdb.c index 881fd5b57a..9884e1f8b0 100644 --- a/source4/ntvfs/common/opendb_tdb.c +++ b/source4/ntvfs/common/opendb_tdb.c @@ -40,9 +40,9 @@ #include "includes.h" #include "system/filesys.h" -#include <tdb.h> +#include "../lib/tdb_compat/tdb_compat.h" #include "messaging/messaging.h" -#include "tdb_wrap.h" +#include "lib/util/tdb_wrap.h" #include "lib/messaging/irpc.h" #include "librpc/gen_ndr/ndr_opendb.h" #include "ntvfs/ntvfs.h" @@ -74,13 +74,13 @@ struct odb_lock { } can_open; }; -static NTSTATUS odb_oplock_break_send(struct messaging_context *msg_ctx, +static NTSTATUS odb_oplock_break_send(struct imessaging_context *msg_ctx, struct opendb_entry *e, uint8_t level); /* Open up the openfiles.tdb database. Close it down using - talloc_free(). We need the messaging_ctx to allow for pending open + talloc_free(). We need the imessaging_ctx to allow for pending open notifications. */ static struct odb_context *odb_tdb_init(TALLOC_CTX *mem_ctx, @@ -238,7 +238,7 @@ static NTSTATUS odb_pull_record(struct odb_lock *lck, struct opendb_file *file) DATA_BLOB blob; enum ndr_err_code ndr_err; - dbuf = tdb_fetch(odb->w->tdb, lck->key); + dbuf = tdb_fetch_compat(odb->w->tdb, lck->key); if (dbuf.dptr == NULL) { return NT_STATUS_OBJECT_NAME_NOT_FOUND; } @@ -294,7 +294,7 @@ static NTSTATUS odb_push_record(struct odb_lock *lck, struct opendb_file *file) /* send an oplock break to a client */ -static NTSTATUS odb_oplock_break_send(struct messaging_context *msg_ctx, +static NTSTATUS odb_oplock_break_send(struct imessaging_context *msg_ctx, struct opendb_entry *e, uint8_t level) { @@ -311,7 +311,7 @@ static NTSTATUS odb_oplock_break_send(struct messaging_context *msg_ctx, blob = data_blob_const(&op_break, sizeof(op_break)); - status = messaging_send(msg_ctx, e->server, + status = imessaging_send(msg_ctx, e->server, MSG_NTVFS_OPLOCK_BREAK, &blob); NT_STATUS_NOT_OK_RETURN(status); @@ -611,7 +611,7 @@ static NTSTATUS odb_tdb_close_file(struct odb_lock *lck, void *file_handle, /* send any pending notifications, removing them once sent */ for (i=0;i<lck->file.num_pending;i++) { - messaging_send_ptr(odb->ntvfs_ctx->msg_ctx, + imessaging_send_ptr(odb->ntvfs_ctx->msg_ctx, lck->file.pending[i].server, MSG_PVFS_RETRY_OPEN, lck->file.pending[i].notify_ptr); @@ -666,7 +666,7 @@ static NTSTATUS odb_tdb_update_oplock(struct odb_lock *lck, void *file_handle, /* send any pending notifications, removing them once sent */ for (i=0;i<lck->file.num_pending;i++) { - messaging_send_ptr(odb->ntvfs_ctx->msg_ctx, + imessaging_send_ptr(odb->ntvfs_ctx->msg_ctx, lck->file.pending[i].server, MSG_PVFS_RETRY_OPEN, lck->file.pending[i].notify_ptr); diff --git a/source4/ntvfs/ipc/vfs_ipc.c b/source4/ntvfs/ipc/vfs_ipc.c index 185e72cfb0..fc9ff4fb12 100644 --- a/source4/ntvfs/ipc/vfs_ipc.c +++ b/source4/ntvfs/ipc/vfs_ipc.c @@ -353,7 +353,7 @@ static void ipc_open_done(struct tevent_req *subreq) &p->allocation_size); TALLOC_FREE(subreq); if (ret == -1) { - status = map_nt_error_from_unix(sys_errno); + status = map_nt_error_from_unix_common(sys_errno); goto reply; } @@ -602,7 +602,7 @@ static void ipc_read_done(struct tevent_req *subreq) ret = tstream_readv_pdu_queue_recv(subreq, &sys_errno); TALLOC_FREE(subreq); if (ret == -1) { - status = map_nt_error_from_unix(sys_errno); + status = map_nt_error_from_unix_common(sys_errno); goto reply; } @@ -687,7 +687,7 @@ static void ipc_write_done(struct tevent_req *subreq) ret = tstream_writev_queue_recv(subreq, &sys_errno); TALLOC_FREE(subreq); if (ret == -1) { - status = map_nt_error_from_unix(sys_errno); + status = map_nt_error_from_unix_common(sys_errno); goto reply; } @@ -1009,7 +1009,7 @@ static void ipc_trans_writev_done(struct tevent_req *subreq) status = NT_STATUS_PIPE_DISCONNECTED; goto reply; } else if (ret == -1) { - status = map_nt_error_from_unix(sys_errno); + status = map_nt_error_from_unix_common(sys_errno); goto reply; } @@ -1045,7 +1045,7 @@ static void ipc_trans_readv_done(struct tevent_req *subreq) ret = tstream_readv_pdu_queue_recv(subreq, &sys_errno); TALLOC_FREE(subreq); if (ret == -1) { - status = map_nt_error_from_unix(sys_errno); + status = map_nt_error_from_unix_common(sys_errno); goto reply; } @@ -1215,7 +1215,7 @@ static void ipc_ioctl_writev_done(struct tevent_req *subreq) ret = tstream_writev_queue_recv(subreq, &sys_errno); TALLOC_FREE(subreq); if (ret == -1) { - status = map_nt_error_from_unix(sys_errno); + status = map_nt_error_from_unix_common(sys_errno); goto reply; } @@ -1251,7 +1251,7 @@ static void ipc_ioctl_readv_done(struct tevent_req *subreq) ret = tstream_readv_pdu_queue_recv(subreq, &sys_errno); TALLOC_FREE(subreq); if (ret == -1) { - status = map_nt_error_from_unix(sys_errno); + status = map_nt_error_from_unix_common(sys_errno); goto reply; } diff --git a/source4/ntvfs/nbench/vfs_nbench.c b/source4/ntvfs/nbench/vfs_nbench.c index 35cd86f34d..565f2dafed 100644 --- a/source4/ntvfs/nbench/vfs_nbench.c +++ b/source4/ntvfs/nbench/vfs_nbench.c @@ -165,10 +165,9 @@ static NTSTATUS nbench_disconnect(struct ntvfs_module_context *ntvfs) static void nbench_unlink_send(struct ntvfs_request *req) { union smb_unlink *unl = req->async_states->private_data; - nbench_log(req, "Unlink \"%s\" 0x%x %s\n", unl->unlink.in.pattern, unl->unlink.in.attrib, - get_nt_error_c_code(req->async_states->status)); + get_nt_error_c_code(req, req->async_states->status)); PASS_THRU_REP_POST(req); } @@ -213,7 +212,7 @@ static void nbench_chkpath_send(struct ntvfs_request *req) nbench_log(req, "Chkpath \"%s\" %s\n", cp->chkpath.in.path, - get_nt_error_c_code(req->async_states->status)); + get_nt_error_c_code(req, req->async_states->status)); PASS_THRU_REP_POST(req); } @@ -239,7 +238,7 @@ static void nbench_qpathinfo_send(struct ntvfs_request *req) nbench_log(req, "QUERY_PATH_INFORMATION \"%s\" %d %s\n", info->generic.in.file.path, info->generic.level, - get_nt_error_c_code(req->async_states->status)); + get_nt_error_c_code(req, req->async_states->status)); PASS_THRU_REP_POST(req); } @@ -264,7 +263,7 @@ static void nbench_qfileinfo_send(struct ntvfs_request *req) nbench_log(req, "QUERY_FILE_INFORMATION %s %d %s\n", nbench_ntvfs_handle_string(req, info->generic.in.file.ntvfs), info->generic.level, - get_nt_error_c_code(req->async_states->status)); + get_nt_error_c_code(req, req->async_states->status)); PASS_THRU_REP_POST(req); } @@ -289,7 +288,7 @@ static void nbench_setpathinfo_send(struct ntvfs_request *req) nbench_log(req, "SET_PATH_INFORMATION \"%s\" %d %s\n", st->generic.in.file.path, st->generic.level, - get_nt_error_c_code(req->async_states->status)); + get_nt_error_c_code(req, req->async_states->status)); PASS_THRU_REP_POST(req); } @@ -321,7 +320,7 @@ static void nbench_open_send(struct ntvfs_request *req) io->ntcreatex.in.create_options, io->ntcreatex.in.open_disposition, nbench_ntvfs_handle_string(req, io->ntcreatex.out.file.ntvfs), - get_nt_error_c_code(req->async_states->status)); + get_nt_error_c_code(req, req->async_states->status)); break; default: @@ -373,7 +372,7 @@ static void nbench_rmdir_send(struct ntvfs_request *req) nbench_log(req, "Rmdir \"%s\" %s\n", rd->in.path, - get_nt_error_c_code(req->async_states->status)); + get_nt_error_c_code(req, req->async_states->status)); PASS_THRU_REP_POST(req); } @@ -400,7 +399,7 @@ static void nbench_rename_send(struct ntvfs_request *req) nbench_log(req, "Rename \"%s\" \"%s\" %s\n", ren->rename.in.pattern1, ren->rename.in.pattern2, - get_nt_error_c_code(req->async_states->status)); + get_nt_error_c_code(req, req->async_states->status)); break; default: @@ -459,7 +458,7 @@ static void nbench_read_send(struct ntvfs_request *req) (int)rd->readx.in.offset, rd->readx.in.maxcnt, rd->readx.out.nread, - get_nt_error_c_code(req->async_states->status)); + get_nt_error_c_code(req, req->async_states->status)); break; default: nbench_log(req, "Read-%d - NOT HANDLED\n", @@ -497,7 +496,7 @@ static void nbench_write_send(struct ntvfs_request *req) (int)wr->writex.in.offset, wr->writex.in.count, wr->writex.out.nwritten, - get_nt_error_c_code(req->async_states->status)); + get_nt_error_c_code(req, req->async_states->status)); break; case RAW_WRITE_WRITE: @@ -509,7 +508,7 @@ static void nbench_write_send(struct ntvfs_request *req) wr->write.in.offset, wr->write.in.count, wr->write.out.nwritten, - get_nt_error_c_code(req->async_states->status)); + get_nt_error_c_code(req, req->async_states->status)); break; default: @@ -563,12 +562,12 @@ static void nbench_flush_send(struct ntvfs_request *req) case RAW_FLUSH_FLUSH: nbench_log(req, "Flush %s %s\n", nbench_ntvfs_handle_string(req, io->flush.in.file.ntvfs), - get_nt_error_c_code(req->async_states->status)); + get_nt_error_c_code(req, req->async_states->status)); break; case RAW_FLUSH_ALL: nbench_log(req, "Flush %d %s\n", 0xFFFF, - get_nt_error_c_code(req->async_states->status)); + get_nt_error_c_code(req, req->async_states->status)); break; default: nbench_log(req, "Flush-%d - NOT HANDLED\n", @@ -601,7 +600,7 @@ static void nbench_close_send(struct ntvfs_request *req) case RAW_CLOSE_CLOSE: nbench_log(req, "Close %s %s\n", nbench_ntvfs_handle_string(req, io->close.in.file.ntvfs), - get_nt_error_c_code(req->async_states->status)); + get_nt_error_c_code(req, req->async_states->status)); break; default: @@ -718,14 +717,14 @@ static void nbench_lock_send(struct ntvfs_request *req) nbench_ntvfs_handle_string(req, lck->lockx.in.file.ntvfs), (int)lck->lockx.in.locks[0].offset, (int)lck->lockx.in.locks[0].count, - get_nt_error_c_code(req->async_states->status)); + get_nt_error_c_code(req, req->async_states->status)); } else if (lck->generic.level == RAW_LOCK_LOCKX && lck->lockx.in.ulock_cnt == 1) { nbench_log(req, "UnlockX %s %d %d %s\n", nbench_ntvfs_handle_string(req, lck->lockx.in.file.ntvfs), (int)lck->lockx.in.locks[0].offset, (int)lck->lockx.in.locks[0].count, - get_nt_error_c_code(req->async_states->status)); + get_nt_error_c_code(req, req->async_states->status)); } else { nbench_log(req, "Lock-%d - NOT HANDLED\n", lck->generic.level); } @@ -753,7 +752,7 @@ static void nbench_setfileinfo_send(struct ntvfs_request *req) nbench_log(req, "SET_FILE_INFORMATION %s %d %s\n", nbench_ntvfs_handle_string(req, info->generic.in.file.ntvfs), info->generic.level, - get_nt_error_c_code(req->async_states->status)); + get_nt_error_c_code(req, req->async_states->status)); PASS_THRU_REP_POST(req); } @@ -778,7 +777,7 @@ static void nbench_fsinfo_send(struct ntvfs_request *req) nbench_log(req, "QUERY_FS_INFORMATION %d %s\n", fs->generic.level, - get_nt_error_c_code(req->async_states->status)); + get_nt_error_c_code(req, req->async_states->status)); PASS_THRU_REP_POST(req); } @@ -832,7 +831,7 @@ static void nbench_search_first_send(struct ntvfs_request *req) io->t2ffirst.data_level, io->t2ffirst.in.max_count, io->t2ffirst.out.count, - get_nt_error_c_code(req->async_states->status)); + get_nt_error_c_code(req, req->async_states->status)); break; default: diff --git a/source4/ntvfs/ntvfs.h b/source4/ntvfs/ntvfs.h index 203b588e08..463acc3c80 100644 --- a/source4/ntvfs/ntvfs.h +++ b/source4/ntvfs/ntvfs.h @@ -24,7 +24,7 @@ #include "libcli/raw/interfaces.h" #include "param/share.h" #include "librpc/gen_ndr/security.h" -#include "librpc/gen_ndr/server_id4.h" +#include "librpc/gen_ndr/server_id.h" /* modules can use the following to determine if the interface has changed */ /* version 1 -> 0 - make module stacking easier -- metze */ @@ -201,7 +201,7 @@ struct ntvfs_context { struct server_id server_id; struct loadparm_context *lp_ctx; struct tevent_context *event_ctx; - struct messaging_context *msg_ctx; + struct imessaging_context *msg_ctx; struct { void *private_data; @@ -330,9 +330,9 @@ struct ntvfs_critical_sizes { .sizeof_ntvfs_handle_data = sizeof(struct ntvfs_handle_data), \ } -struct messaging_context; +struct imessaging_context; #include "librpc/gen_ndr/security.h" -#include "librpc/gen_ndr/s4_notify.h" +#include "librpc/gen_ndr/notify.h" #include "ntvfs/ntvfs_proto.h" #endif /* _NTVFS_H_ */ diff --git a/source4/ntvfs/ntvfs_base.c b/source4/ntvfs/ntvfs_base.c index 1b1a53361b..448d2919df 100644 --- a/source4/ntvfs/ntvfs_base.c +++ b/source4/ntvfs/ntvfs_base.c @@ -153,7 +153,7 @@ bool ntvfs_interface_differs(const struct ntvfs_critical_sizes *const iface) NTSTATUS ntvfs_init_connection(TALLOC_CTX *mem_ctx, struct share_config *scfg, enum ntvfs_type type, enum protocol_types protocol, uint64_t ntvfs_client_caps, - struct tevent_context *ev, struct messaging_context *msg, + struct tevent_context *ev, struct imessaging_context *msg, struct loadparm_context *lp_ctx, struct server_id server_id, struct ntvfs_context **_ctx) { @@ -235,7 +235,7 @@ NTSTATUS ntvfs_init(struct loadparm_context *lp_ctx) if (initialized) return NT_STATUS_OK; initialized = true; - shared_init = load_samba_modules(NULL, lp_ctx, "ntvfs"); + shared_init = load_samba_modules(NULL, "ntvfs"); run_init_functions(static_init); run_init_functions(shared_init); diff --git a/source4/ntvfs/ntvfs_generic.c b/source4/ntvfs/ntvfs_generic.c index 8e1eb0bc66..bed9c9c755 100644 --- a/source4/ntvfs/ntvfs_generic.c +++ b/source4/ntvfs/ntvfs_generic.c @@ -576,9 +576,6 @@ static NTSTATUS ntvfs_map_fsinfo_finish(struct ntvfs_module_context *ntvfs, /* and convert it to the required level */ switch (fs->generic.level) { - case RAW_QFS_GENERIC: - return NT_STATUS_INVALID_LEVEL; - case RAW_QFS_DSKATTR: { /* map from generic to DSKATTR */ unsigned int bpunit = 64; @@ -666,8 +663,11 @@ static NTSTATUS ntvfs_map_fsinfo_finish(struct ntvfs_module_context *ntvfs, fs->objectid_information.out.guid = fs2->generic.out.guid; ZERO_STRUCT(fs->objectid_information.out.unknown); return NT_STATUS_OK; - } + case RAW_QFS_GENERIC: + case RAW_QFS_UNIX_INFO: + return NT_STATUS_INVALID_LEVEL; + } return NT_STATUS_INVALID_LEVEL; } @@ -715,8 +715,6 @@ NTSTATUS ntvfs_map_fileinfo(TALLOC_CTX *mem_ctx, int i; /* and convert it to the required level using results in info2 */ switch (info->generic.level) { - case RAW_FILEINFO_GENERIC: - return NT_STATUS_INVALID_LEVEL; case RAW_FILEINFO_GETATTR: info->getattr.out.attrib = info2->generic.out.attrib & 0xff; info->getattr.out.size = info2->generic.out.size; @@ -931,6 +929,13 @@ NTSTATUS ntvfs_map_fileinfo(TALLOC_CTX *mem_ctx, info->unix_link_info.out.link_dest = info2->generic.out.link_dest; return NT_STATUS_OK; #endif + case RAW_FILEINFO_GENERIC: + case RAW_FILEINFO_SEC_DESC: + case RAW_FILEINFO_EA_LIST: + case RAW_FILEINFO_UNIX_INFO2: + case RAW_FILEINFO_SMB2_ALL_EAS: + case RAW_FILEINFO_SMB2_ALL_INFORMATION: + return NT_STATUS_INVALID_LEVEL; } return NT_STATUS_INVALID_LEVEL; diff --git a/source4/ntvfs/posix/pvfs_acl.c b/source4/ntvfs/posix/pvfs_acl.c index 67b544d4de..d7a778e1f7 100644 --- a/source4/ntvfs/posix/pvfs_acl.c +++ b/source4/ntvfs/posix/pvfs_acl.c @@ -89,7 +89,7 @@ const struct pvfs_acl_ops *pvfs_acl_backend_byname(const char *name) return NULL; } -NTSTATUS pvfs_acl_init(struct loadparm_context *lp_ctx) +NTSTATUS pvfs_acl_init(void) { static bool initialized = false; #define _MODULE_PROTO(init) extern NTSTATUS init(void); @@ -100,7 +100,7 @@ NTSTATUS pvfs_acl_init(struct loadparm_context *lp_ctx) if (initialized) return NT_STATUS_OK; initialized = true; - shared_init = load_samba_modules(NULL, lp_ctx, "pvfs_acl"); + shared_init = load_samba_modules(NULL, "pvfs_acl"); run_init_functions(static_init); run_init_functions(shared_init); diff --git a/source4/ntvfs/posix/pvfs_dirlist.c b/source4/ntvfs/posix/pvfs_dirlist.c index 77f19c3585..1bc91c1c78 100644 --- a/source4/ntvfs/posix/pvfs_dirlist.c +++ b/source4/ntvfs/posix/pvfs_dirlist.c @@ -199,7 +199,7 @@ const char *pvfs_list_next(struct pvfs_dir *dir, off_t *ofs) if (*ofs == DIR_OFFSET_DOT) { (*ofs) = DIR_OFFSET_DOTDOT; dir->offset = *ofs; - if (ms_fnmatch(dir->pattern, ".", protocol) == 0) { + if (ms_fnmatch_protocol(dir->pattern, ".", protocol) == 0) { dcache_add(dir, "."); return "."; } @@ -208,7 +208,7 @@ const char *pvfs_list_next(struct pvfs_dir *dir, off_t *ofs) if (*ofs == DIR_OFFSET_DOTDOT) { (*ofs) = DIR_OFFSET_BASE; dir->offset = *ofs; - if (ms_fnmatch(dir->pattern, "..", protocol) == 0) { + if (ms_fnmatch_protocol(dir->pattern, "..", protocol) == 0) { dcache_add(dir, ".."); return ".."; } @@ -228,10 +228,10 @@ const char *pvfs_list_next(struct pvfs_dir *dir, off_t *ofs) continue; } - if (ms_fnmatch(dir->pattern, dname, protocol) != 0) { + if (ms_fnmatch_protocol(dir->pattern, dname, protocol) != 0) { char *short_name = pvfs_short_name_component(dir->pvfs, dname); if (short_name == NULL || - ms_fnmatch(dir->pattern, short_name, protocol) != 0) { + ms_fnmatch_protocol(dir->pattern, short_name, protocol) != 0) { talloc_free(short_name); continue; } diff --git a/source4/ntvfs/posix/pvfs_lock.c b/source4/ntvfs/posix/pvfs_lock.c index 11757deea4..0d99860e59 100644 --- a/source4/ntvfs/posix/pvfs_lock.c +++ b/source4/ntvfs/posix/pvfs_lock.c @@ -39,7 +39,7 @@ NTSTATUS pvfs_check_lock(struct pvfs_state *pvfs, return NT_STATUS_OK; } - return brl_locktest(pvfs->brl_context, + return brlock_locktest(pvfs->brl_context, f->brl_handle, smbpid, offset, count, rw); @@ -70,7 +70,7 @@ static void pvfs_lock_async_failed(struct pvfs_state *pvfs, { /* undo the locks we just did */ for (i--;i>=0;i--) { - brl_unlock(pvfs->brl_context, + brlock_unlock(pvfs->brl_context, f->brl_handle, locks[i].pid, locks[i].offset, @@ -127,7 +127,7 @@ static void pvfs_pending_lock_continue(void *private_data, enum pvfs_wait_notice * because with this we'll get the correct error code * FILE_LOCK_CONFLICT in the error case */ - status = brl_lock(pvfs->brl_context, + status = brlock_lock(pvfs->brl_context, f->brl_handle, locks[pending->pending_lock].pid, locks[pending->pending_lock].offset, @@ -143,7 +143,7 @@ static void pvfs_pending_lock_continue(void *private_data, enum pvfs_wait_notice don't need the pending lock any more */ if (NT_STATUS_IS_OK(status) || timed_out) { NTSTATUS status2; - status2 = brl_remove_pending(pvfs->brl_context, + status2 = brlock_remove_pending(pvfs->brl_context, f->brl_handle, pending); if (!NT_STATUS_IS_OK(status2)) { DEBUG(0,("pvfs_lock: failed to remove pending lock - %s\n", nt_errstr(status2))); @@ -177,7 +177,7 @@ static void pvfs_pending_lock_continue(void *private_data, enum pvfs_wait_notice pending->pending_lock = i; } - status = brl_lock(pvfs->brl_context, + status = brlock_lock(pvfs->brl_context, f->brl_handle, locks[i].pid, locks[i].offset, @@ -225,7 +225,7 @@ void pvfs_lock_close(struct pvfs_state *pvfs, struct pvfs_file *f) if (f->lock_count || f->pending_list) { DEBUG(5,("pvfs_lock: removing %.0f locks on close\n", (double)f->lock_count)); - brl_close(f->pvfs->brl_context, f->brl_handle); + brlock_close(f->pvfs->brl_context, f->brl_handle); f->lock_count = 0; } @@ -324,8 +324,7 @@ NTSTATUS pvfs_lock(struct ntvfs_module_context *ntvfs, pending->req = req; pending->end_time = - timeval_current_ofs(lck->lockx.in.timeout/1000, - 1000*(lck->lockx.in.timeout%1000)); + timeval_current_ofs_msec(lck->lockx.in.timeout); } if (lck->lockx.in.mode & LOCKING_ANDX_SHARED_LOCK) { @@ -350,7 +349,7 @@ NTSTATUS pvfs_lock(struct ntvfs_module_context *ntvfs, locks = lck->lockx.in.locks; for (i=0;i<lck->lockx.in.ulock_cnt;i++) { - status = brl_unlock(pvfs->brl_context, + status = brlock_unlock(pvfs->brl_context, f->brl_handle, locks[i].pid, locks[i].offset, @@ -369,7 +368,7 @@ NTSTATUS pvfs_lock(struct ntvfs_module_context *ntvfs, pending->pending_lock = i; } - status = brl_lock(pvfs->brl_context, + status = brlock_lock(pvfs->brl_context, f->brl_handle, locks[i].pid, locks[i].offset, @@ -394,7 +393,7 @@ NTSTATUS pvfs_lock(struct ntvfs_module_context *ntvfs, /* undo the locks we just did */ for (i--;i>=0;i--) { - brl_unlock(pvfs->brl_context, + brlock_unlock(pvfs->brl_context, f->brl_handle, locks[i].pid, locks[i].offset, diff --git a/source4/ntvfs/posix/pvfs_open.c b/source4/ntvfs/posix/pvfs_open.c index 08a54f8e42..d56bce58f7 100644 --- a/source4/ntvfs/posix/pvfs_open.c +++ b/source4/ntvfs/posix/pvfs_open.c @@ -590,7 +590,7 @@ static NTSTATUS pvfs_brl_locking_handle(TALLOC_CTX *mem_ctx, data_blob_free(&odb_key); } - h = brl_create_handle(mem_ctx, ntvfs, &key); + h = brlock_create_handle(mem_ctx, ntvfs, &key); NT_STATUS_HAVE_NO_MEMORY(h); *_h = h; @@ -1174,7 +1174,7 @@ static NTSTATUS pvfs_open_setup_retry(struct ntvfs_module_context *ntvfs, *final_timeout = timeval_add(&req->statistics.request_time, pvfs->oplock_break_timeout, 0); - end_time = timeval_current_ofs(0, (pvfs->sharing_violation_delay*4)/5); + end_time = timeval_current_ofs_usec((pvfs->sharing_violation_delay*4)/5); end_time = timeval_min(final_timeout, &end_time); } else { return NT_STATUS_INTERNAL_ERROR; @@ -1569,7 +1569,7 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs, f->handle->fd = fd; - status = brl_count(f->pvfs->brl_context, f->brl_handle, &count); + status = brlock_count(f->pvfs->brl_context, f->brl_handle, &count); if (!NT_STATUS_IS_OK(status)) { talloc_free(lck); return status; diff --git a/source4/ntvfs/posix/pvfs_oplock.c b/source4/ntvfs/posix/pvfs_oplock.c index a10188f3eb..5b9f3a318c 100644 --- a/source4/ntvfs/posix/pvfs_oplock.c +++ b/source4/ntvfs/posix/pvfs_oplock.c @@ -32,7 +32,7 @@ struct pvfs_oplock { uint32_t level; struct timeval break_to_level_II; struct timeval break_to_none; - struct messaging_context *msg_ctx; + struct imessaging_context *msg_ctx; }; static NTSTATUS pvfs_oplock_release_internal(struct pvfs_file_handle *h, @@ -158,7 +158,7 @@ static void pvfs_oplock_break(struct pvfs_oplock *opl, uint8_t level) } } -static void pvfs_oplock_break_dispatch(struct messaging_context *msg, +static void pvfs_oplock_break_dispatch(struct imessaging_context *msg, void *private_data, uint32_t msg_type, struct server_id src, DATA_BLOB *data) { @@ -169,7 +169,7 @@ static void pvfs_oplock_break_dispatch(struct messaging_context *msg, ZERO_STRUCT(opb); /* we need to check that this one is for us. See - messaging_send_ptr() for the other side of this. + imessaging_send_ptr() for the other side of this. */ if (data->length == sizeof(struct opendb_oplock_break)) { struct opendb_oplock_break *p; @@ -192,7 +192,7 @@ static void pvfs_oplock_break_dispatch(struct messaging_context *msg, static int pvfs_oplock_destructor(struct pvfs_oplock *opl) { - messaging_deregister(opl->msg_ctx, MSG_NTVFS_OPLOCK_BREAK, opl); + imessaging_deregister(opl->msg_ctx, MSG_NTVFS_OPLOCK_BREAK, opl); return 0; } @@ -228,7 +228,7 @@ NTSTATUS pvfs_setup_oplock(struct pvfs_file *f, uint32_t oplock_granted) opl->level = level; opl->msg_ctx = f->pvfs->ntvfs->ctx->msg_ctx; - status = messaging_register(opl->msg_ctx, + status = imessaging_register(opl->msg_ctx, opl, MSG_NTVFS_OPLOCK_BREAK, pvfs_oplock_break_dispatch); diff --git a/source4/ntvfs/posix/pvfs_qfileinfo.c b/source4/ntvfs/posix/pvfs_qfileinfo.c index e54fc2d669..9284306753 100644 --- a/source4/ntvfs/posix/pvfs_qfileinfo.c +++ b/source4/ntvfs/posix/pvfs_qfileinfo.c @@ -149,9 +149,6 @@ static NTSTATUS pvfs_map_fileinfo(struct pvfs_state *pvfs, int fd) { switch (info->generic.level) { - case RAW_FILEINFO_GENERIC: - return NT_STATUS_INVALID_LEVEL; - case RAW_FILEINFO_GETATTR: info->getattr.out.attrib = name->dos.attrib; info->getattr.out.size = name->st.st_size; @@ -333,6 +330,12 @@ static NTSTATUS pvfs_map_fileinfo(struct pvfs_state *pvfs, name->original_name); NT_STATUS_HAVE_NO_MEMORY(info->all_info2.out.fname.s); return NT_STATUS_OK; + + case RAW_FILEINFO_GENERIC: + case RAW_FILEINFO_UNIX_BASIC: + case RAW_FILEINFO_UNIX_INFO2: + case RAW_FILEINFO_UNIX_LINK: + return NT_STATUS_INVALID_LEVEL; } return NT_STATUS_INVALID_LEVEL; diff --git a/source4/ntvfs/posix/pvfs_search.c b/source4/ntvfs/posix/pvfs_search.c index a050de1ec3..893f55c5ac 100644 --- a/source4/ntvfs/posix/pvfs_search.c +++ b/source4/ntvfs/posix/pvfs_search.c @@ -221,7 +221,9 @@ static NTSTATUS fill_search_info(struct pvfs_state *pvfs, return NT_STATUS_OK; case RAW_SEARCH_DATA_GENERIC: - break; + case RAW_SEARCH_DATA_UNIX_INFO: + case RAW_SEARCH_DATA_UNIX_INFO2: + return NT_STATUS_INVALID_LEVEL; } return NT_STATUS_INVALID_LEVEL; diff --git a/source4/ntvfs/posix/pvfs_util.c b/source4/ntvfs/posix/pvfs_util.c index 8dedf13a63..c6c6eaa13c 100644 --- a/source4/ntvfs/posix/pvfs_util.c +++ b/source4/ntvfs/posix/pvfs_util.c @@ -40,7 +40,7 @@ bool pvfs_has_wildcard(const char *str) NTSTATUS pvfs_map_errno(struct pvfs_state *pvfs, int unix_errno) { NTSTATUS status; - status = map_nt_error_from_unix(unix_errno); + status = map_nt_error_from_unix_common(unix_errno); DEBUG(10,(__location__ " mapped unix errno %d -> %s\n", unix_errno, nt_errstr(status))); return status; } diff --git a/source4/ntvfs/posix/pvfs_wait.c b/source4/ntvfs/posix/pvfs_wait.c index 876ce52797..013de69889 100644 --- a/source4/ntvfs/posix/pvfs_wait.c +++ b/source4/ntvfs/posix/pvfs_wait.c @@ -33,7 +33,7 @@ struct pvfs_wait { void (*handler)(void *, enum pvfs_wait_notice); void *private_data; int msg_type; - struct messaging_context *msg_ctx; + struct imessaging_context *msg_ctx; struct tevent_context *ev; struct ntvfs_request *req; enum pvfs_wait_notice reason; @@ -56,7 +56,7 @@ NTSTATUS pvfs_async_setup(struct ntvfs_module_context *ntvfs, /* receive a completion message for a wait */ -static void pvfs_wait_dispatch(struct messaging_context *msg, +static void pvfs_wait_dispatch(struct imessaging_context *msg, void *private_data, uint32_t msg_type, struct server_id src, DATA_BLOB *data) { @@ -66,7 +66,7 @@ static void pvfs_wait_dispatch(struct messaging_context *msg, void *p = NULL; /* we need to check that this one is for us. See - messaging_send_ptr() for the other side of this. + imessaging_send_ptr() for the other side of this. */ if (data->length == sizeof(void *)) { void **pp; @@ -116,7 +116,7 @@ static void pvfs_wait_timeout(struct tevent_context *ev, static int pvfs_wait_destructor(struct pvfs_wait *pwait) { if (pwait->msg_type != -1) { - messaging_deregister(pwait->msg_ctx, pwait->msg_type, pwait); + imessaging_deregister(pwait->msg_ctx, pwait->msg_type, pwait); } DLIST_REMOVE(pwait->pvfs->wait_list, pwait); return 0; @@ -162,7 +162,7 @@ struct pvfs_wait *pvfs_wait_message(struct pvfs_state *pvfs, /* register with the messaging subsystem for this message type */ if (msg_type != -1) { - messaging_register(pwait->msg_ctx, + imessaging_register(pwait->msg_ctx, pwait, msg_type, pvfs_wait_dispatch); diff --git a/source4/ntvfs/posix/pvfs_write.c b/source4/ntvfs/posix/pvfs_write.c index fb629a87fb..892d3dd749 100644 --- a/source4/ntvfs/posix/pvfs_write.c +++ b/source4/ntvfs/posix/pvfs_write.c @@ -64,7 +64,7 @@ static void pvfs_trigger_write_time_update(struct pvfs_file_handle *h) return; } - tv = timeval_current_ofs(0, pvfs->writetime_delay); + tv = timeval_current_ofs_usec(pvfs->writetime_delay); h->write_time.update_triggered = true; h->write_time.update_on_close = true; diff --git a/source4/ntvfs/posix/python/pyxattr_tdb.c b/source4/ntvfs/posix/python/pyxattr_tdb.c index 5e72ac9dde..2b28aca365 100644 --- a/source4/ntvfs/posix/python/pyxattr_tdb.c +++ b/source4/ntvfs/posix/python/pyxattr_tdb.c @@ -20,8 +20,8 @@ #include <Python.h> #include "includes.h" -#include <tdb.h> -#include "tdb_wrap.h" +#include "tdb_compat.h" +#include "lib/util/tdb_wrap.h" #include "librpc/ndr/libndr.h" #include "lib/util/wrap_xattr.h" #include "ntvfs/posix/vfs_posix.h" diff --git a/source4/ntvfs/posix/vfs_posix.c b/source4/ntvfs/posix/vfs_posix.c index ca1d163327..00ed146c96 100644 --- a/source4/ntvfs/posix/vfs_posix.c +++ b/source4/ntvfs/posix/vfs_posix.c @@ -26,8 +26,8 @@ #include "includes.h" #include "vfs_posix.h" #include "librpc/gen_ndr/security.h" -#include <tdb.h> -#include "tdb_wrap.h" +#include "tdb_compat.h" +#include "lib/util/tdb_wrap.h" #include "libcli/security/security.h" #include "lib/events/events.h" #include "param/param.h" @@ -212,7 +212,7 @@ static NTSTATUS pvfs_connect(struct ntvfs_module_context *ntvfs, * TODO: call this from ntvfs_posix_init() * but currently we don't have a lp_ctx there */ - status = pvfs_acl_init(ntvfs->ctx->lp_ctx); + status = pvfs_acl_init(); NT_STATUS_NOT_OK_RETURN(status); pvfs = talloc_zero(ntvfs, struct pvfs_state); @@ -249,7 +249,7 @@ static NTSTATUS pvfs_connect(struct ntvfs_module_context *ntvfs, ntvfs->private_data = pvfs; - pvfs->brl_context = brl_init(pvfs, + pvfs->brl_context = brlock_init(pvfs, pvfs->ntvfs->ctx->server_id, pvfs->ntvfs->ctx->lp_ctx, pvfs->ntvfs->ctx->msg_ctx); diff --git a/source4/ntvfs/posix/vfs_posix.h b/source4/ntvfs/posix/vfs_posix.h index d60369df50..e1593a38cf 100644 --- a/source4/ntvfs/posix/vfs_posix.h +++ b/source4/ntvfs/posix/vfs_posix.h @@ -204,7 +204,7 @@ struct pvfs_file { /* a file handle to be used for byte range locking */ struct brl_handle *brl_handle; - /* a count of active locks - used to avoid calling brl_close on + /* a count of active locks - used to avoid calling brlock_close on file close */ uint64_t lock_count; diff --git a/source4/ntvfs/posix/xattr_tdb.c b/source4/ntvfs/posix/xattr_tdb.c index de7c83677a..07b3712215 100644 --- a/source4/ntvfs/posix/xattr_tdb.c +++ b/source4/ntvfs/posix/xattr_tdb.c @@ -20,8 +20,8 @@ */ #include "includes.h" -#include "tdb_wrap.h" -#include <tdb.h> +#include "lib/util/tdb_wrap.h" +#include "tdb_compat.h" #include "vfs_posix.h" #define XATTR_LIST_ATTR ".xattr_list" @@ -129,7 +129,7 @@ NTSTATUS pull_xattr_blob_tdb_raw(struct tdb_wrap *ea_tdb, return status; } - tdata = tdb_fetch(ea_tdb->tdb, tkey); + tdata = tdb_fetch_compat(ea_tdb->tdb, tkey); if (tdata.dptr == NULL) { return NT_STATUS_NOT_FOUND; } @@ -185,7 +185,7 @@ NTSTATUS push_xattr_blob_tdb_raw(struct tdb_wrap *ea_tdb, goto done; } - if (tdb_store(ea_tdb->tdb, tkey, tdata, TDB_REPLACE) == -1) { + if (tdb_store(ea_tdb->tdb, tkey, tdata, TDB_REPLACE) != 0) { status = NT_STATUS_INTERNAL_DB_CORRUPTION; } @@ -218,7 +218,7 @@ NTSTATUS delete_xattr_tdb(struct pvfs_state *pvfs, const char *attr_name, return status; } - if (tdb_delete(pvfs->ea_db->tdb, tkey) == -1) { + if (tdb_delete(pvfs->ea_db->tdb, tkey) != 0) { talloc_free(tkey.dptr); return NT_STATUS_INTERNAL_DB_CORRUPTION; } diff --git a/source4/ntvfs/simple/svfs_util.c b/source4/ntvfs/simple/svfs_util.c index 2a01c2d5de..c4e015668c 100644 --- a/source4/ntvfs/simple/svfs_util.c +++ b/source4/ntvfs/simple/svfs_util.c @@ -38,16 +38,15 @@ char *svfs_unix_path(struct ntvfs_module_context *ntvfs, { struct svfs_private *p = ntvfs->private_data; char *ret; + char *name_lower = strlower_talloc(p, name); if (*name != '\\') { - ret = talloc_asprintf(req, "%s/%s", p->connectpath, name); + ret = talloc_asprintf(req, "%s/%s", p->connectpath, name_lower); } else { - ret = talloc_asprintf(req, "%s%s", p->connectpath, name); + ret = talloc_asprintf(req, "%s%s", p->connectpath, name_lower); } all_string_sub(ret, "\\", "/", 0); - - strlower(ret + strlen(p->connectpath)); - + talloc_free(name_lower); return ret; } @@ -82,9 +81,8 @@ struct svfs_dir *svfs_list_unix(TALLOC_CTX *mem_ctx, struct ntvfs_request *req, /* the wildcard pattern is the last part */ mask = p+1; - low_mask = talloc_strdup(mem_ctx, mask); + low_mask = strlower_talloc(mem_ctx, mask); if (!low_mask) { return NULL; } - strlower(low_mask); odir = opendir(dir->unix_dir); if (!odir) { return NULL; } @@ -99,12 +97,11 @@ struct svfs_dir *svfs_list_unix(TALLOC_CTX *mem_ctx, struct ntvfs_request *req, continue; } - low_name = talloc_strdup(mem_ctx, dent->d_name); + low_name = strlower_talloc(mem_ctx, dent->d_name); if (!low_name) { continue; } - strlower(low_name); /* check it matches the wildcard pattern */ - if (ms_fnmatch(low_mask, low_name, PROTOCOL_NT1) != 0) { + if (ms_fnmatch_protocol(low_mask, low_name, PROTOCOL_NT1) != 0) { continue; } diff --git a/source4/ntvfs/simple/vfs_simple.c b/source4/ntvfs/simple/vfs_simple.c index 03bf76634d..7ae41db521 100644 --- a/source4/ntvfs/simple/vfs_simple.c +++ b/source4/ntvfs/simple/vfs_simple.c @@ -147,7 +147,7 @@ static NTSTATUS svfs_unlink(struct ntvfs_module_context *ntvfs, /* ignoring wildcards ... */ if (unlink(unix_path) == -1) { - return map_nt_error_from_unix(errno); + return map_nt_error_from_unix_common(errno); } return NT_STATUS_OK; @@ -176,7 +176,7 @@ static NTSTATUS svfs_chkpath(struct ntvfs_module_context *ntvfs, unix_path = svfs_unix_path(ntvfs, req, cp->chkpath.in.path); if (stat(unix_path, &st) == -1) { - return map_nt_error_from_unix(errno); + return map_nt_error_from_unix_common(errno); } if (!S_ISDIR(st.st_mode)) { @@ -291,7 +291,7 @@ static NTSTATUS svfs_qpathinfo(struct ntvfs_module_context *ntvfs, DEBUG(19,("svfs_qpathinfo: file %s\n", unix_path)); if (stat(unix_path, &st) == -1) { DEBUG(19,("svfs_qpathinfo: file %s errno=%d\n", unix_path, errno)); - return map_nt_error_from_unix(errno); + return map_nt_error_from_unix_common(errno); } DEBUG(19,("svfs_qpathinfo: file %s, stat done\n", unix_path)); return svfs_map_fileinfo(ntvfs, req, info, &st, unix_path); @@ -317,7 +317,7 @@ static NTSTATUS svfs_qfileinfo(struct ntvfs_module_context *ntvfs, } if (fstat(f->fd, &st) == -1) { - return map_nt_error_from_unix(errno); + return map_nt_error_from_unix_common(errno); } return svfs_map_fileinfo(ntvfs, req,info, &st, f->name); @@ -386,13 +386,13 @@ static NTSTATUS svfs_open(struct ntvfs_module_context *ntvfs, case NTCREATEX_DISP_CREATE: if (mkdir(unix_path, 0755) == -1) { DEBUG(9,("svfs_open: mkdir %s errno=%d\n", unix_path, errno)); - return map_nt_error_from_unix(errno); + return map_nt_error_from_unix_common(errno); } break; case NTCREATEX_DISP_OPEN_IF: if (mkdir(unix_path, 0755) == -1 && errno != EEXIST) { DEBUG(9,("svfs_open: mkdir %s errno=%d\n", unix_path, errno)); - return map_nt_error_from_unix(errno); + return map_nt_error_from_unix_common(errno); } break; } @@ -401,13 +401,13 @@ static NTSTATUS svfs_open(struct ntvfs_module_context *ntvfs, do_open: fd = open(unix_path, flags, 0644); if (fd == -1) { - return map_nt_error_from_unix(errno); + return map_nt_error_from_unix_common(errno); } if (fstat(fd, &st) == -1) { DEBUG(9,("svfs_open: fstat errno=%d\n", errno)); close(fd); - return map_nt_error_from_unix(errno); + return map_nt_error_from_unix_common(errno); } status = ntvfs_handle_new(ntvfs, req, &handle); @@ -456,7 +456,7 @@ static NTSTATUS svfs_mkdir(struct ntvfs_module_context *ntvfs, unix_path = svfs_unix_path(ntvfs, req, md->mkdir.in.path); if (mkdir(unix_path, 0777) == -1) { - return map_nt_error_from_unix(errno); + return map_nt_error_from_unix_common(errno); } return NT_STATUS_OK; @@ -475,7 +475,7 @@ static NTSTATUS svfs_rmdir(struct ntvfs_module_context *ntvfs, unix_path = svfs_unix_path(ntvfs, req, rd->in.path); if (rmdir(unix_path) == -1) { - return map_nt_error_from_unix(errno); + return map_nt_error_from_unix_common(errno); } return NT_STATUS_OK; @@ -499,7 +499,7 @@ static NTSTATUS svfs_rename(struct ntvfs_module_context *ntvfs, unix_path2 = svfs_unix_path(ntvfs, req, ren->rename.in.pattern2); if (rename(unix_path1, unix_path2) == -1) { - return map_nt_error_from_unix(errno); + return map_nt_error_from_unix_common(errno); } return NT_STATUS_OK; @@ -538,7 +538,7 @@ static NTSTATUS svfs_read(struct ntvfs_module_context *ntvfs, rd->readx.in.maxcnt, rd->readx.in.offset); if (ret == -1) { - return map_nt_error_from_unix(errno); + return map_nt_error_from_unix_common(errno); } rd->readx.out.nread = ret; @@ -574,7 +574,7 @@ static NTSTATUS svfs_write(struct ntvfs_module_context *ntvfs, wr->writex.in.count, wr->writex.in.offset); if (ret == -1) { - return map_nt_error_from_unix(errno); + return map_nt_error_from_unix_common(errno); } wr->writex.out.nwritten = ret; @@ -645,7 +645,7 @@ static NTSTATUS svfs_close(struct ntvfs_module_context *ntvfs, } if (close(f->fd) == -1) { - return map_nt_error_from_unix(errno); + return map_nt_error_from_unix_common(errno); } DLIST_REMOVE(p->open_files, f); @@ -735,7 +735,7 @@ static NTSTATUS svfs_setfileinfo(struct ntvfs_module_context *ntvfs, case RAW_SFILEINFO_END_OF_FILE_INFORMATION: if (ftruncate(f->fd, info->end_of_file_info.in.size) == -1) { - return map_nt_error_from_unix(errno); + return map_nt_error_from_unix_common(errno); } break; case RAW_SFILEINFO_SETATTRE: @@ -781,7 +781,7 @@ static NTSTATUS svfs_fsinfo(struct ntvfs_module_context *ntvfs, if (sys_fsusage(p->connectpath, &fs->generic.out.blocks_free, &fs->generic.out.blocks_total) == -1) { - return map_nt_error_from_unix(errno); + return map_nt_error_from_unix_common(errno); } fs->generic.out.block_size = 512; @@ -821,7 +821,7 @@ static NTSTATUS svfs_fsattr(struct ntvfs_module_context *ntvfs, } if (stat(p->connectpath, &st) == -1) { - return map_nt_error_from_unix(errno); + return map_nt_error_from_unix_common(errno); } unix_to_nt_time(&fs->generic.out.create_time, st.st_ctime); diff --git a/source4/ntvfs/smb2/vfs_smb2.c b/source4/ntvfs/smb2/vfs_smb2.c index 6c78997686..889c534dd0 100644 --- a/source4/ntvfs/smb2/vfs_smb2.c +++ b/source4/ntvfs/smb2/vfs_smb2.c @@ -162,7 +162,6 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs, NTSTATUS status; struct cvfs_private *p; const char *host, *user, *pass, *domain, *remote_share, *sharename; - struct composite_context *creq; struct share_config *scfg = ntvfs->ctx->config; struct smb2_tree *tree; struct cli_credentials *credentials; @@ -250,17 +249,15 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs, lpcfg_smbcli_options(ntvfs->ctx->lp_ctx, &options); - creq = smb2_connect_send(p, host, + status = smb2_connect(p, host, lpcfg_parm_string_list(p, ntvfs->ctx->lp_ctx, NULL, "smb2", "ports", NULL), - remote_share, - lpcfg_resolve_context(ntvfs->ctx->lp_ctx), - credentials, - ntvfs->ctx->event_ctx, &options, - lpcfg_socket_options(ntvfs->ctx->lp_ctx), - lpcfg_gensec_settings(p, ntvfs->ctx->lp_ctx) - ); - - status = smb2_connect_recv(creq, p, &tree); + remote_share, + lpcfg_resolve_context(ntvfs->ctx->lp_ctx), + credentials, + &tree, + ntvfs->ctx->event_ctx, &options, + lpcfg_socket_options(ntvfs->ctx->lp_ctx), + lpcfg_gensec_settings(p, ntvfs->ctx->lp_ctx)); NT_STATUS_NOT_OK_RETURN(status); status = smb2_get_roothandle(tree, &p->roothandle); diff --git a/source4/ntvfs/sysdep/inotify.c b/source4/ntvfs/sysdep/inotify.c index 42aac0b097..28ea32e8a0 100644 --- a/source4/ntvfs/sysdep/inotify.c +++ b/source4/ntvfs/sysdep/inotify.c @@ -258,7 +258,7 @@ static NTSTATUS inotify_setup(struct sys_notify_context *ctx) if (in->fd == -1) { DEBUG(0,("Failed to init inotify - %s\n", strerror(errno))); talloc_free(in); - return map_nt_error_from_unix(errno); + return map_nt_error_from_unix_common(errno); } in->ctx = ctx; in->watches = NULL; @@ -274,7 +274,7 @@ static NTSTATUS inotify_setup(struct sys_notify_context *ctx) } DEBUG(0,("Failed to tevent_add_fd() - %s\n", strerror(errno))); talloc_free(in); - return map_nt_error_from_unix(errno); + return map_nt_error_from_unix_common(errno); } tevent_fd_set_auto_close(fde); @@ -373,7 +373,7 @@ static NTSTATUS inotify_watch(struct sys_notify_context *ctx, wd = inotify_add_watch(in->fd, e->path, mask); if (wd == -1) { e->filter = filter; - return map_nt_error_from_unix(errno); + return map_nt_error_from_unix_common(errno); } w = talloc(in, struct inotify_watch_context); diff --git a/source4/ntvfs/sysdep/sys_lease.c b/source4/ntvfs/sysdep/sys_lease.c index 8b0b3a5110..7865f717a4 100644 --- a/source4/ntvfs/sysdep/sys_lease.c +++ b/source4/ntvfs/sysdep/sys_lease.c @@ -40,7 +40,7 @@ static uint32_t num_backends; _PUBLIC_ struct sys_lease_context *sys_lease_context_create(struct share_config *scfg, TALLOC_CTX *mem_ctx, struct tevent_context *ev, - struct messaging_context *msg, + struct imessaging_context *msg, sys_lease_send_break_fn break_send) { struct sys_lease_context *ctx; diff --git a/source4/ntvfs/sysdep/sys_lease.h b/source4/ntvfs/sysdep/sys_lease.h index 422797b0b8..57a5e0a35f 100644 --- a/source4/ntvfs/sysdep/sys_lease.h +++ b/source4/ntvfs/sysdep/sys_lease.h @@ -21,10 +21,10 @@ struct sys_lease_context; struct opendb_entry; -struct messaging_context; +struct imessaging_context; struct tevent_context; -typedef NTSTATUS (*sys_lease_send_break_fn)(struct messaging_context *, +typedef NTSTATUS (*sys_lease_send_break_fn)(struct imessaging_context *, struct opendb_entry *, uint8_t level); @@ -41,7 +41,7 @@ struct sys_lease_ops { struct sys_lease_context { struct tevent_context *event_ctx; - struct messaging_context *msg_ctx; + struct imessaging_context *msg_ctx; sys_lease_send_break_fn break_send; void *private_data; /* for use of backend */ const struct sys_lease_ops *ops; @@ -53,7 +53,7 @@ NTSTATUS sys_lease_init(void); struct sys_lease_context *sys_lease_context_create(struct share_config *scfg, TALLOC_CTX *mem_ctx, struct tevent_context *ev, - struct messaging_context *msg_ctx, + struct imessaging_context *msg_ctx, sys_lease_send_break_fn break_send); NTSTATUS sys_lease_setup(struct sys_lease_context *ctx, diff --git a/source4/ntvfs/sysdep/sys_lease_linux.c b/source4/ntvfs/sysdep/sys_lease_linux.c index c0fb4335d9..3b0605b73b 100644 --- a/source4/ntvfs/sysdep/sys_lease_linux.c +++ b/source4/ntvfs/sysdep/sys_lease_linux.c @@ -131,13 +131,13 @@ static NTSTATUS linux_lease_setup(struct sys_lease_context *ctx, ret = fcntl(*fd, F_SETSIG, LINUX_LEASE_RT_SIGNAL); if (ret == -1) { talloc_free(p); - return map_nt_error_from_unix(errno); + return map_nt_error_from_unix_common(errno); } ret = fcntl(*fd, F_SETLEASE, F_WRLCK); if (ret == -1) { talloc_free(p); - return map_nt_error_from_unix(errno); + return map_nt_error_from_unix_common(errno); } DLIST_ADD(leases, p); diff --git a/source4/ntvfs/sysdep/sys_notify.h b/source4/ntvfs/sysdep/sys_notify.h index c474d4e6a0..d912a9bdaf 100644 --- a/source4/ntvfs/sysdep/sys_notify.h +++ b/source4/ntvfs/sysdep/sys_notify.h @@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "librpc/gen_ndr/s4_notify.h" +#include "librpc/gen_ndr/notify.h" #include "param/share.h" struct sys_notify_context; |