From 2bb637d1cfa5147000d9c2cbbbafcbbb20df26da Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 27 Apr 2011 09:05:50 +0200 Subject: s4:ntvfs/smb2: use sync version of smb2_connect() We don't use it in an async fashion anyway. metze --- source4/ntvfs/smb2/vfs_smb2.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'source4/ntvfs') diff --git a/source4/ntvfs/smb2/vfs_smb2.c b/source4/ntvfs/smb2/vfs_smb2.c index 6c78997686..24f0c33b1d 100644 --- a/source4/ntvfs/smb2/vfs_smb2.c +++ b/source4/ntvfs/smb2/vfs_smb2.c @@ -250,17 +250,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); -- cgit From cdd802af8319e0b0744d8e727cef75526269ece2 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 3 May 2011 10:40:33 +1000 Subject: s4-messaging Rename messaging -> imessaging This avoid symbol and structure conflicts between Samba3 and Samba4, and chooses a less generic name. Andrew Bartlett --- source4/ntvfs/common/brlock.c | 6 +++--- source4/ntvfs/common/brlock.h | 2 +- source4/ntvfs/common/brlock_tdb.c | 10 +++++----- source4/ntvfs/common/notify.c | 18 +++++++++--------- source4/ntvfs/common/opendb.c | 2 +- source4/ntvfs/common/opendb_tdb.c | 12 ++++++------ source4/ntvfs/ntvfs.h | 4 ++-- source4/ntvfs/ntvfs_base.c | 2 +- source4/ntvfs/posix/pvfs_oplock.c | 10 +++++----- source4/ntvfs/posix/pvfs_wait.c | 10 +++++----- source4/ntvfs/sysdep/sys_lease.c | 2 +- source4/ntvfs/sysdep/sys_lease.h | 8 ++++---- 12 files changed, 43 insertions(+), 43 deletions(-) (limited to 'source4/ntvfs') diff --git a/source4/ntvfs/common/brlock.c b/source4/ntvfs/common/brlock.c index 94041d2014..efb70226e6 100644 --- a/source4/ntvfs/common/brlock.c +++ b/source4/ntvfs/common/brlock.c @@ -45,16 +45,16 @@ void brl_set_ops(const struct brlock_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 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) diff --git a/source4/ntvfs/common/brlock.h b/source4/ntvfs/common/brlock.h index e5e618d045..7ae3111cc4 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 *, diff --git a/source4/ntvfs/common/brlock_tdb.c b/source4/ntvfs/common/brlock_tdb.c index 35d4c27d0f..630b4072db 100644 --- a/source4/ntvfs/common/brlock_tdb.c +++ b/source4/ntvfs/common/brlock_tdb.c @@ -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; } @@ -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); } } diff --git a/source4/ntvfs/common/notify.c b/source4/ntvfs/common/notify.c index 0b5f91bfe1..d05f04707a 100644 --- a/source4/ntvfs/common/notify.c +++ b/source4/ntvfs/common/notify.c @@ -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..536d17f9c0 100644 --- a/source4/ntvfs/common/opendb_tdb.c +++ b/source4/ntvfs/common/opendb_tdb.c @@ -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, @@ -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;ifile.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;ifile.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/ntvfs.h b/source4/ntvfs/ntvfs.h index 203b588e08..a31e302dfc 100644 --- a/source4/ntvfs/ntvfs.h +++ b/source4/ntvfs/ntvfs.h @@ -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,7 +330,7 @@ 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 "ntvfs/ntvfs_proto.h" diff --git a/source4/ntvfs/ntvfs_base.c b/source4/ntvfs/ntvfs_base.c index 1b1a53361b..1a83d27843 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) { 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_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/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, -- cgit From 2742ec0e34c06ded2885aa2607f1c1729a57b034 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 3 May 2011 12:16:16 +1000 Subject: Remove strlower_m() and strupper_m() from source4 and common code. This function is problematic because a string may expand in size when changed into upper or lower case. This will then push characters off the end of the string in the s3 implementation, or panic in the former s4 implementation. Andrew Bartlett --- source4/ntvfs/cifs_posix_cli/svfs_util.c | 15 ++++++--------- source4/ntvfs/simple/svfs_util.c | 15 ++++++--------- 2 files changed, 12 insertions(+), 18 deletions(-) (limited to 'source4/ntvfs') diff --git a/source4/ntvfs/cifs_posix_cli/svfs_util.c b/source4/ntvfs/cifs_posix_cli/svfs_util.c index d8a7909390..128440c1ea 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,9 +100,8 @@ 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) { diff --git a/source4/ntvfs/simple/svfs_util.c b/source4/ntvfs/simple/svfs_util.c index 2a01c2d5de..75261f7277 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,9 +97,8 @@ 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) { -- cgit From 14750139639b3531e57a3ca3f9e481d6e458dc06 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 4 May 2011 10:28:15 +1000 Subject: lib/util Move source3 tdb_wrap_open() into the common code. This #if _SAMBA_BUILD == 3 is very unfortunate, as it means that in the top level build, these options are not available for these databases. However, having two different tdb_wrap lists is a worse fate, so this will do for now. Andrew Bartlett --- source4/ntvfs/common/brlock_tdb.c | 2 +- source4/ntvfs/common/notify.c | 2 +- source4/ntvfs/common/opendb_tdb.c | 2 +- source4/ntvfs/posix/python/pyxattr_tdb.c | 2 +- source4/ntvfs/posix/vfs_posix.c | 2 +- source4/ntvfs/posix/xattr_tdb.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) (limited to 'source4/ntvfs') diff --git a/source4/ntvfs/common/brlock_tdb.c b/source4/ntvfs/common/brlock_tdb.c index 630b4072db..ab4d91c4db 100644 --- a/source4/ntvfs/common/brlock_tdb.c +++ b/source4/ntvfs/common/brlock_tdb.c @@ -28,7 +28,7 @@ #include "system/filesys.h" #include #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" diff --git a/source4/ntvfs/common/notify.c b/source4/ntvfs/common/notify.c index d05f04707a..7260759341 100644 --- a/source4/ntvfs/common/notify.c +++ b/source4/ntvfs/common/notify.c @@ -28,7 +28,7 @@ #include #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 "../lib/util/dlinklist.h" diff --git a/source4/ntvfs/common/opendb_tdb.c b/source4/ntvfs/common/opendb_tdb.c index 536d17f9c0..7c2707f7c6 100644 --- a/source4/ntvfs/common/opendb_tdb.c +++ b/source4/ntvfs/common/opendb_tdb.c @@ -42,7 +42,7 @@ #include "system/filesys.h" #include #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" diff --git a/source4/ntvfs/posix/python/pyxattr_tdb.c b/source4/ntvfs/posix/python/pyxattr_tdb.c index 5e72ac9dde..34b449f70f 100644 --- a/source4/ntvfs/posix/python/pyxattr_tdb.c +++ b/source4/ntvfs/posix/python/pyxattr_tdb.c @@ -21,7 +21,7 @@ #include #include "includes.h" #include -#include "tdb_wrap.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..b79ae957f3 100644 --- a/source4/ntvfs/posix/vfs_posix.c +++ b/source4/ntvfs/posix/vfs_posix.c @@ -27,7 +27,7 @@ #include "vfs_posix.h" #include "librpc/gen_ndr/security.h" #include -#include "tdb_wrap.h" +#include "lib/util/tdb_wrap.h" #include "libcli/security/security.h" #include "lib/events/events.h" #include "param/param.h" diff --git a/source4/ntvfs/posix/xattr_tdb.c b/source4/ntvfs/posix/xattr_tdb.c index de7c83677a..2d6f1d94d0 100644 --- a/source4/ntvfs/posix/xattr_tdb.c +++ b/source4/ntvfs/posix/xattr_tdb.c @@ -20,7 +20,7 @@ */ #include "includes.h" -#include "tdb_wrap.h" +#include "lib/util/tdb_wrap.h" #include #include "vfs_posix.h" -- cgit From 344eb08ee4e444c1fc1beac26e50c6a85b942885 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 4 May 2011 15:30:01 +1000 Subject: nterr: Add mem_ctx for return string from get_nt_error_c_code() It is clearer to avoid the implicit return on talloc_tos() Andrew Bartlett --- source4/ntvfs/nbench/vfs_nbench.c | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) (limited to 'source4/ntvfs') 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: -- cgit From 3892112e7b3143f808932771a7b71f4fd335f8cb Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 4 May 2011 20:53:33 +1000 Subject: lib/util Rename ms_fnmatch() to ms_fnmatch_protocol() to avoid dup symbol This verison of the function takes a protcol as argument to determine matching rules. Andrew Bartlett --- source4/ntvfs/cifs_posix_cli/svfs_util.c | 2 +- source4/ntvfs/posix/pvfs_dirlist.c | 8 ++++---- source4/ntvfs/simple/svfs_util.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'source4/ntvfs') diff --git a/source4/ntvfs/cifs_posix_cli/svfs_util.c b/source4/ntvfs/cifs_posix_cli/svfs_util.c index 128440c1ea..f351c5840e 100644 --- a/source4/ntvfs/cifs_posix_cli/svfs_util.c +++ b/source4/ntvfs/cifs_posix_cli/svfs_util.c @@ -104,7 +104,7 @@ struct cifspsx_dir *cifspsx_list_unix(TALLOC_CTX *mem_ctx, struct ntvfs_request if (!low_name) { continue; } /* 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/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/simple/svfs_util.c b/source4/ntvfs/simple/svfs_util.c index 75261f7277..c4e015668c 100644 --- a/source4/ntvfs/simple/svfs_util.c +++ b/source4/ntvfs/simple/svfs_util.c @@ -101,7 +101,7 @@ struct svfs_dir *svfs_list_unix(TALLOC_CTX *mem_ctx, struct ntvfs_request *req, if (!low_name) { continue; } /* 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; } -- cgit From 1969aa8eacd257951cdc8d13110302c3b9388013 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sat, 7 May 2011 08:12:54 +0200 Subject: s4-ntvfs: Rename brl_*() -> brlock_*() to avoid conflict with brlock_init in s3 --- source4/ntvfs/common/brlock.c | 18 +++++++++--------- source4/ntvfs/common/brlock.h | 2 +- source4/ntvfs/common/brlock_tdb.c | 2 +- source4/ntvfs/posix/pvfs_lock.c | 18 +++++++++--------- source4/ntvfs/posix/pvfs_open.c | 4 ++-- source4/ntvfs/posix/vfs_posix.c | 2 +- source4/ntvfs/posix/vfs_posix.h | 2 +- 7 files changed, 24 insertions(+), 24 deletions(-) (limited to 'source4/ntvfs') diff --git a/source4/ntvfs/common/brlock.c b/source4/ntvfs/common/brlock.c index efb70226e6..142b4ff799 100644 --- a/source4/ntvfs/common/brlock.c +++ b/source4/ntvfs/common/brlock.c @@ -38,7 +38,7 @@ 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; } @@ -47,7 +47,7 @@ void brl_set_ops(const struct brlock_ops *new_ops) Open up the brlock database. Close it down using talloc_free(). We 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 imessaging_context *imessaging_ctx) { @@ -57,7 +57,7 @@ struct brl_context *brl_init(TALLOC_CTX *mem_ctx, struct server_id server, 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 7ae3111cc4..703538f073 100644 --- a/source4/ntvfs/common/brlock.h +++ b/source4/ntvfs/common/brlock.h @@ -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 ab4d91c4db..3fd0edcc69 100644 --- a/source4/ntvfs/common/brlock_tdb.c +++ b/source4/ntvfs/common/brlock_tdb.c @@ -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/posix/pvfs_lock.c b/source4/ntvfs/posix/pvfs_lock.c index 11757deea4..76bc73dad8 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; } @@ -350,7 +350,7 @@ NTSTATUS pvfs_lock(struct ntvfs_module_context *ntvfs, locks = lck->lockx.in.locks; for (i=0;ilockx.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 +369,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 +394,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..dfe2f2aa62 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; @@ -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/vfs_posix.c b/source4/ntvfs/posix/vfs_posix.c index b79ae957f3..4c1404eec5 100644 --- a/source4/ntvfs/posix/vfs_posix.c +++ b/source4/ntvfs/posix/vfs_posix.c @@ -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; -- cgit From 902b1d9a19ca8bbc32c3cf1f67efd9cf6627d711 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 2 May 2011 12:51:58 +0200 Subject: s4:ntvfs/cifs: return NT_STATUS_INTERNAL_ERROR if no credentials are available This is a configuration problem on the server, no invalid parameter from the client. metze Autobuild-User: Stefan Metzmacher Autobuild-Date: Wed May 18 08:49:00 CEST 2011 on sn-devel-104 --- source4/ntvfs/cifs/vfs_cifs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/ntvfs') diff --git a/source4/ntvfs/cifs/vfs_cifs.c b/source4/ntvfs/cifs/vfs_cifs.c index 27bf1ead24..24dee76e46 100644 --- a/source4/ntvfs/cifs/vfs_cifs.c +++ b/source4/ntvfs/cifs/vfs_cifs.c @@ -228,7 +228,7 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs, credentials = req->session_info->credentials; } 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 */ -- cgit From 56e72337b01216dc7cba418f040a5cc928e5fc6f Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 1 Jun 2011 11:21:15 +0930 Subject: lib/util/time.c: timeval_current_ofs_msec Several places want "milliseconds from current time", and several were simply doing "msec * 1000" which can (and does in one place) result in a usec value over 1 a million. Using a helper to do this is safer and more readable. Signed-off-by: Rusty Russell --- source4/ntvfs/posix/pvfs_lock.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source4/ntvfs') diff --git a/source4/ntvfs/posix/pvfs_lock.c b/source4/ntvfs/posix/pvfs_lock.c index 76bc73dad8..0d99860e59 100644 --- a/source4/ntvfs/posix/pvfs_lock.c +++ b/source4/ntvfs/posix/pvfs_lock.c @@ -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) { -- cgit From 0204ae6229bae3573b3194c3f657c8f385c0b940 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 1 Jun 2011 11:24:51 +0930 Subject: lib/util/time.c: timeval_current_ofs_usec Several places want "microseconds from current time", and several were simply handing "usecs" values which could be over a million. Using a helper to do this is safer and more readable. I didn't replace any obviously correct callers (ie. constants). I also renamed wait_nsec in source3/lib/util_sock.c; it's actually microseconds not nanoseconds (introduced with this code in Volker's 19b783cc Async wrapper for open_socket_out_send/recv). Signed-off-by: Rusty Russell --- source4/ntvfs/posix/pvfs_open.c | 2 +- source4/ntvfs/posix/pvfs_write.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/ntvfs') diff --git a/source4/ntvfs/posix/pvfs_open.c b/source4/ntvfs/posix/pvfs_open.c index dfe2f2aa62..d56bce58f7 100644 --- a/source4/ntvfs/posix/pvfs_open.c +++ b/source4/ntvfs/posix/pvfs_open.c @@ -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; 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; -- cgit From 907cdb5de7f16a2540299aeba211bf2a5ae6fafe Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 6 Jun 2011 14:58:28 +1000 Subject: s4-modules Remove lp_ctx from init functions that no longer need it Now that we don't allow the smb.conf to change the modules dir, many functions that simply load modules or initialise a subsytem that may load modules no longer need an lp_ctx. Andrew Bartlett --- source4/ntvfs/ntvfs_base.c | 2 +- source4/ntvfs/posix/pvfs_acl.c | 4 ++-- source4/ntvfs/posix/vfs_posix.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'source4/ntvfs') diff --git a/source4/ntvfs/ntvfs_base.c b/source4/ntvfs/ntvfs_base.c index 1a83d27843..448d2919df 100644 --- a/source4/ntvfs/ntvfs_base.c +++ b/source4/ntvfs/ntvfs_base.c @@ -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/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/vfs_posix.c b/source4/ntvfs/posix/vfs_posix.c index 4c1404eec5..5b89f1e608 100644 --- a/source4/ntvfs/posix/vfs_posix.c +++ b/source4/ntvfs/posix/vfs_posix.c @@ -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); -- cgit From 260bc987b00b3fff6c9b99211627b14e9bd0789a Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Wed, 8 Jun 2011 19:00:18 +0200 Subject: s4:ntvfs subsystem - quiet enum warnings Simply return "NT_STATUS_INVALID_LEVEL" for unknown types of requests. Reviewed-by: Tridge --- source4/ntvfs/ntvfs_generic.c | 15 +++++---------- source4/ntvfs/posix/pvfs_qfileinfo.c | 7 +++---- source4/ntvfs/posix/pvfs_search.c | 6 ++---- 3 files changed, 10 insertions(+), 18 deletions(-) (limited to 'source4/ntvfs') diff --git a/source4/ntvfs/ntvfs_generic.c b/source4/ntvfs/ntvfs_generic.c index 8e1eb0bc66..9aa8e04787 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,10 +663,10 @@ 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; - } - - return NT_STATUS_INVALID_LEVEL; + default: + return NT_STATUS_INVALID_LEVEL; + } } /* @@ -715,8 +712,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,9 +926,9 @@ 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 + default: + return NT_STATUS_INVALID_LEVEL; } - - return NT_STATUS_INVALID_LEVEL; } /* diff --git a/source4/ntvfs/posix/pvfs_qfileinfo.c b/source4/ntvfs/posix/pvfs_qfileinfo.c index e54fc2d669..515819b6ee 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,9 +330,11 @@ 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; + + default: + 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..668f8d741e 100644 --- a/source4/ntvfs/posix/pvfs_search.c +++ b/source4/ntvfs/posix/pvfs_search.c @@ -220,11 +220,9 @@ static NTSTATUS fill_search_info(struct pvfs_state *pvfs, file->id_both_directory_info.name.s = fname; return NT_STATUS_OK; - case RAW_SEARCH_DATA_GENERIC: - break; + default: + return NT_STATUS_INVALID_LEVEL; } - - return NT_STATUS_INVALID_LEVEL; } -- cgit From d057116cc2e454ba097d0dcb22e16108a05a4a1b Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 2 May 2011 10:55:20 +1000 Subject: server_id.idl: Bring server_id.idl in common Andrew Bartlett Signed-off-by: Andrew Tridgell --- source4/ntvfs/ntvfs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/ntvfs') diff --git a/source4/ntvfs/ntvfs.h b/source4/ntvfs/ntvfs.h index a31e302dfc..1716687e5f 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 */ -- cgit From a772797a384a1142c5af95bd06c14a141dea38d7 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 2 May 2011 11:10:12 +1000 Subject: librpc/idr Use the Samba3 notify.idl in common. The extra fields in the structure that Samba4 does not use should not bother it. Andrew Bartlett Signed-off-by: Andrew Tridgell --- source4/ntvfs/common/notify.c | 2 +- source4/ntvfs/ntvfs.h | 2 +- source4/ntvfs/sysdep/sys_notify.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'source4/ntvfs') diff --git a/source4/ntvfs/common/notify.c b/source4/ntvfs/common/notify.c index 7260759341..e3335feb91 100644 --- a/source4/ntvfs/common/notify.c +++ b/source4/ntvfs/common/notify.c @@ -30,7 +30,7 @@ #include "messaging/messaging.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" diff --git a/source4/ntvfs/ntvfs.h b/source4/ntvfs/ntvfs.h index 1716687e5f..463acc3c80 100644 --- a/source4/ntvfs/ntvfs.h +++ b/source4/ntvfs/ntvfs.h @@ -332,7 +332,7 @@ struct ntvfs_critical_sizes { 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/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 . */ -#include "librpc/gen_ndr/s4_notify.h" +#include "librpc/gen_ndr/notify.h" #include "param/share.h" struct sys_notify_context; -- cgit From 62a1e13b294d26f44d764810344ead5b58b8eb53 Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Sat, 11 Jun 2011 15:22:34 +0200 Subject: s4:ntvfs/smb2/vfs_smb2.c - remove unused variable Reviewed-by: Jelmer --- source4/ntvfs/smb2/vfs_smb2.c | 1 - 1 file changed, 1 deletion(-) (limited to 'source4/ntvfs') diff --git a/source4/ntvfs/smb2/vfs_smb2.c b/source4/ntvfs/smb2/vfs_smb2.c index 24f0c33b1d..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; -- cgit From 75e77f9fa023d81a57e7913bcbd712eae7a677b1 Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Thu, 16 Jun 2011 08:39:03 +0200 Subject: s4:ntvfs subsystems - rework it using concrete enum values This changes commit 260bc987b00b3fff6c9b99211627b14e9bd0789a to comply with metze's plans. --- source4/ntvfs/ntvfs_generic.c | 14 ++++++++++++-- source4/ntvfs/posix/pvfs_qfileinfo.c | 6 +++++- source4/ntvfs/posix/pvfs_search.c | 6 +++++- 3 files changed, 22 insertions(+), 4 deletions(-) (limited to 'source4/ntvfs') diff --git a/source4/ntvfs/ntvfs_generic.c b/source4/ntvfs/ntvfs_generic.c index 9aa8e04787..bed9c9c755 100644 --- a/source4/ntvfs/ntvfs_generic.c +++ b/source4/ntvfs/ntvfs_generic.c @@ -664,9 +664,12 @@ static NTSTATUS ntvfs_map_fsinfo_finish(struct ntvfs_module_context *ntvfs, ZERO_STRUCT(fs->objectid_information.out.unknown); return NT_STATUS_OK; - default: + case RAW_QFS_GENERIC: + case RAW_QFS_UNIX_INFO: return NT_STATUS_INVALID_LEVEL; } + + return NT_STATUS_INVALID_LEVEL; } /* @@ -926,9 +929,16 @@ 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 - default: + 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_qfileinfo.c b/source4/ntvfs/posix/pvfs_qfileinfo.c index 515819b6ee..9284306753 100644 --- a/source4/ntvfs/posix/pvfs_qfileinfo.c +++ b/source4/ntvfs/posix/pvfs_qfileinfo.c @@ -331,10 +331,14 @@ static NTSTATUS pvfs_map_fileinfo(struct pvfs_state *pvfs, NT_STATUS_HAVE_NO_MEMORY(info->all_info2.out.fname.s); return NT_STATUS_OK; - default: + 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 668f8d741e..893f55c5ac 100644 --- a/source4/ntvfs/posix/pvfs_search.c +++ b/source4/ntvfs/posix/pvfs_search.c @@ -220,9 +220,13 @@ static NTSTATUS fill_search_info(struct pvfs_state *pvfs, file->id_both_directory_info.name.s = fname; return NT_STATUS_OK; - default: + case RAW_SEARCH_DATA_GENERIC: + case RAW_SEARCH_DATA_UNIX_INFO: + case RAW_SEARCH_DATA_UNIX_INFO2: return NT_STATUS_INVALID_LEVEL; } + + return NT_STATUS_INVALID_LEVEL; } -- cgit From a1f04e8abc761ef1ba211420ff1dbda50fcf527d Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 20 Jun 2011 14:55:32 +1000 Subject: libcli/util Rename common map_nt_error_from_unix to avoid duplicate symbol The two error tables need to be combined, but for now seperate the names. (As the common parts of the tree now use the _common function, errmap_unix.c must be included in the s3 autoconf build). Andrew Bartlett Autobuild-User: Andrew Bartlett Autobuild-Date: Mon Jun 20 08:12:03 CEST 2011 on sn-devel-104 --- source4/ntvfs/cifs_posix_cli/vfs_cifs_posix.c | 34 +++++++++++++-------------- source4/ntvfs/ipc/vfs_ipc.c | 14 +++++------ source4/ntvfs/posix/pvfs_util.c | 2 +- source4/ntvfs/simple/vfs_simple.c | 34 +++++++++++++-------------- source4/ntvfs/sysdep/inotify.c | 6 ++--- source4/ntvfs/sysdep/sys_lease_linux.c | 4 ++-- 6 files changed, 47 insertions(+), 47 deletions(-) (limited to 'source4/ntvfs') 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/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/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/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/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_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); -- cgit From 0e4c358e2710580d5aeb439d767c87aaf4c0f2f3 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 20 Jun 2011 18:40:25 +0930 Subject: tdb_compat.h: divert every tdb build and includes to tdb_compat We change all the headers and wscript files to use tdb_compat; this means we have one place to decide whether to use TDB1 or TDB2. Signed-off-by: Rusty Russell --- source4/ntvfs/common/brlock.c | 2 +- source4/ntvfs/common/brlock_tdb.c | 2 +- source4/ntvfs/common/notify.c | 2 +- source4/ntvfs/common/opendb_tdb.c | 2 +- source4/ntvfs/posix/python/pyxattr_tdb.c | 2 +- source4/ntvfs/posix/vfs_posix.c | 2 +- source4/ntvfs/posix/xattr_tdb.c | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) (limited to 'source4/ntvfs') diff --git a/source4/ntvfs/common/brlock.c b/source4/ntvfs/common/brlock.c index 142b4ff799..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 +#include "tdb_compat.h" #include "messaging/messaging.h" #include "lib/messaging/irpc.h" #include "libcli/libcli.h" diff --git a/source4/ntvfs/common/brlock_tdb.c b/source4/ntvfs/common/brlock_tdb.c index 3fd0edcc69..885eda98cd 100644 --- a/source4/ntvfs/common/brlock_tdb.c +++ b/source4/ntvfs/common/brlock_tdb.c @@ -26,7 +26,7 @@ #include "includes.h" #include "system/filesys.h" -#include +#include "tdb_compat.h" #include "messaging/messaging.h" #include "lib/util/tdb_wrap.h" #include "lib/messaging/irpc.h" diff --git a/source4/ntvfs/common/notify.c b/source4/ntvfs/common/notify.c index e3335feb91..98f17a6565 100644 --- a/source4/ntvfs/common/notify.c +++ b/source4/ntvfs/common/notify.c @@ -25,7 +25,7 @@ #include "includes.h" #include "system/filesys.h" -#include +#include "../lib/tdb_compat/tdb_compat.h" #include "../lib/util/util_tdb.h" #include "messaging/messaging.h" #include "lib/util/tdb_wrap.h" diff --git a/source4/ntvfs/common/opendb_tdb.c b/source4/ntvfs/common/opendb_tdb.c index 7c2707f7c6..851d838203 100644 --- a/source4/ntvfs/common/opendb_tdb.c +++ b/source4/ntvfs/common/opendb_tdb.c @@ -40,7 +40,7 @@ #include "includes.h" #include "system/filesys.h" -#include +#include "../lib/tdb_compat/tdb_compat.h" #include "messaging/messaging.h" #include "lib/util/tdb_wrap.h" #include "lib/messaging/irpc.h" diff --git a/source4/ntvfs/posix/python/pyxattr_tdb.c b/source4/ntvfs/posix/python/pyxattr_tdb.c index 34b449f70f..2b28aca365 100644 --- a/source4/ntvfs/posix/python/pyxattr_tdb.c +++ b/source4/ntvfs/posix/python/pyxattr_tdb.c @@ -20,7 +20,7 @@ #include #include "includes.h" -#include +#include "tdb_compat.h" #include "lib/util/tdb_wrap.h" #include "librpc/ndr/libndr.h" #include "lib/util/wrap_xattr.h" diff --git a/source4/ntvfs/posix/vfs_posix.c b/source4/ntvfs/posix/vfs_posix.c index 5b89f1e608..00ed146c96 100644 --- a/source4/ntvfs/posix/vfs_posix.c +++ b/source4/ntvfs/posix/vfs_posix.c @@ -26,7 +26,7 @@ #include "includes.h" #include "vfs_posix.h" #include "librpc/gen_ndr/security.h" -#include +#include "tdb_compat.h" #include "lib/util/tdb_wrap.h" #include "libcli/security/security.h" #include "lib/events/events.h" diff --git a/source4/ntvfs/posix/xattr_tdb.c b/source4/ntvfs/posix/xattr_tdb.c index 2d6f1d94d0..a2e8111ded 100644 --- a/source4/ntvfs/posix/xattr_tdb.c +++ b/source4/ntvfs/posix/xattr_tdb.c @@ -21,7 +21,7 @@ #include "includes.h" #include "lib/util/tdb_wrap.h" -#include +#include "tdb_compat.h" #include "vfs_posix.h" #define XATTR_LIST_ATTR ".xattr_list" -- cgit From 058c4f84924c07b88ccaf3d617f3abff797a7cc8 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 20 Jun 2011 18:40:31 +0930 Subject: tdb_fetch_compat: use instead of tdb_fetch. This is a noop for tdb1. Signed-off-by: Rusty Russell --- source4/ntvfs/common/brlock_tdb.c | 12 ++++++------ source4/ntvfs/common/opendb_tdb.c | 2 +- source4/ntvfs/posix/xattr_tdb.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'source4/ntvfs') diff --git a/source4/ntvfs/common/brlock_tdb.c b/source4/ntvfs/common/brlock_tdb.c index 885eda98cd..817448377c 100644 --- a/source4/ntvfs/common/brlock_tdb.c +++ b/source4/ntvfs/common/brlock_tdb.c @@ -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; @@ -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; diff --git a/source4/ntvfs/common/opendb_tdb.c b/source4/ntvfs/common/opendb_tdb.c index 851d838203..9884e1f8b0 100644 --- a/source4/ntvfs/common/opendb_tdb.c +++ b/source4/ntvfs/common/opendb_tdb.c @@ -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; } diff --git a/source4/ntvfs/posix/xattr_tdb.c b/source4/ntvfs/posix/xattr_tdb.c index a2e8111ded..c325561562 100644 --- a/source4/ntvfs/posix/xattr_tdb.c +++ b/source4/ntvfs/posix/xattr_tdb.c @@ -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; } -- cgit From 1078eb21c49d707ddeef2257353f35c10d131b9f Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 20 Jun 2011 18:40:31 +0930 Subject: tdb_delete: check returns for 0, not -1. TDB2 returns a negative error number on failure. This is compatible if we always check for != 0 instead of == -1. Signed-off-by: Rusty Russell --- source4/ntvfs/posix/xattr_tdb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/ntvfs') diff --git a/source4/ntvfs/posix/xattr_tdb.c b/source4/ntvfs/posix/xattr_tdb.c index c325561562..44aced9bee 100644 --- a/source4/ntvfs/posix/xattr_tdb.c +++ b/source4/ntvfs/posix/xattr_tdb.c @@ -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; } -- cgit From 6bc59d77b64d1ecbe5c906ed2fa80a7b8ca5d420 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 20 Jun 2011 18:40:31 +0930 Subject: tdb_store: check returns for 0, not -1. TDB2 returns a negative error number on failure. This is compatible if we always check for != 0 instead of == -1. Signed-off-by: Rusty Russell --- source4/ntvfs/posix/xattr_tdb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/ntvfs') diff --git a/source4/ntvfs/posix/xattr_tdb.c b/source4/ntvfs/posix/xattr_tdb.c index 44aced9bee..07b3712215 100644 --- a/source4/ntvfs/posix/xattr_tdb.c +++ b/source4/ntvfs/posix/xattr_tdb.c @@ -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; } -- cgit From 5a8ac842701b65c0abd9731545792c2a0fd2aa79 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 11 Mar 2011 08:32:22 +0100 Subject: s4:ntvfs/cifs: add option to use S4U2Proxy Note: this doesn't work against a Samba4 KDC yet. metze Autobuild-User: Stefan Metzmacher Autobuild-Date: Wed Jun 22 18:17:43 CEST 2011 on sn-devel-104 --- source4/ntvfs/cifs/vfs_cifs.c | 49 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'source4/ntvfs') diff --git a/source4/ntvfs/cifs/vfs_cifs.c b/source4/ntvfs/cifs/vfs_cifs.c index 24dee76e46..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,6 +230,51 @@ 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_INTERNAL_ERROR; -- cgit