From c04d809ba001ebca17b68eae3a9f7d37454a290c Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 26 Apr 2010 13:40:15 +0200 Subject: s4:ntvfs: add tsocket based addresses to ntvfs_context metze --- source4/ntvfs/ntvfs.h | 2 ++ source4/ntvfs/ntvfs_interface.c | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+) (limited to 'source4/ntvfs') diff --git a/source4/ntvfs/ntvfs.h b/source4/ntvfs/ntvfs.h index 5e9c657737..5b551cd345 100644 --- a/source4/ntvfs/ntvfs.h +++ b/source4/ntvfs/ntvfs.h @@ -212,6 +212,8 @@ struct ntvfs_context { void *private_data; struct socket_address *(*get_my_addr)(void *private_data, TALLOC_CTX *mem_ctx); struct socket_address *(*get_peer_addr)(void *private_data, TALLOC_CTX *mem_ctx); + const struct tsocket_address *local_address; + const struct tsocket_address *remote_address; } client; struct { diff --git a/source4/ntvfs/ntvfs_interface.c b/source4/ntvfs/ntvfs_interface.c index 808bd97e61..c743126d24 100644 --- a/source4/ntvfs/ntvfs_interface.c +++ b/source4/ntvfs/ntvfs_interface.c @@ -20,6 +20,7 @@ #include "includes.h" #include "ntvfs/ntvfs.h" +#include "lib/tsocket/tsocket.h" /* connect/disconnect */ NTSTATUS ntvfs_connect(struct ntvfs_request *req, union smb_tcon *tcon) @@ -666,6 +667,30 @@ NTSTATUS ntvfs_next_exit(struct ntvfs_module_context *ntvfs, return ntvfs->next->ops->exit(ntvfs->next, req); } +/* client connection callback */ +NTSTATUS ntvfs_set_addresses(struct ntvfs_context *ntvfs, + const struct tsocket_address *local_address, + const struct tsocket_address *remote_address) +{ + ntvfs->client.local_address = tsocket_address_copy(local_address, ntvfs); + NT_STATUS_HAVE_NO_MEMORY(ntvfs->client.local_address); + + ntvfs->client.remote_address = tsocket_address_copy(remote_address, ntvfs); + NT_STATUS_HAVE_NO_MEMORY(ntvfs->client.remote_address); + + return NT_STATUS_OK; +} + +const struct tsocket_address *ntvfs_get_local_address(struct ntvfs_module_context *ntvfs) +{ + return ntvfs->ctx->client.local_address; +} + +const struct tsocket_address *ntvfs_get_remote_address(struct ntvfs_module_context *ntvfs) +{ + return ntvfs->ctx->client.remote_address; +} + /* oplock helpers */ NTSTATUS ntvfs_set_oplock_handler(struct ntvfs_context *ntvfs, NTSTATUS (*handler)(void *private_data, struct ntvfs_handle *handle, uint8_t level), -- cgit