From e466bb4af45175a3fe1d6dff54c10d81c4e68257 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 28 Aug 2010 17:25:22 +0200 Subject: s3: Remove smbd_server_fd() This breaks the perfcol_onefs() build. Tim, Steve, this use of smbd_server_fd is replacable by calls into substitute.c. I don't have a onefs environment around to build a fix, so I've decided to insert an #error, making it not compile. The fix should be pretty obvious, you can get the socket data via "%I" and "%i" substitutions. --- source3/include/proto.h | 1 - source3/lib/dummysmbd.c | 5 ----- source3/modules/perfcount_onefs.c | 31 +++++++++++++++++-------------- source3/smbd/globals.h | 2 +- source3/smbd/server.c | 7 ------- source3/torture/vfstest.c | 8 +------- 6 files changed, 19 insertions(+), 35 deletions(-) (limited to 'source3') diff --git a/source3/include/proto.h b/source3/include/proto.h index 37f4d19232..5b9414f61c 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -5391,7 +5391,6 @@ void server_messaging_context_free(void); /* The following definitions come from smbd/server.c */ -int smbd_server_fd(void); struct event_context *smbd_event_context(void); struct messaging_context *smbd_messaging_context(void); struct memcache *smbd_memcache(void); diff --git a/source3/lib/dummysmbd.c b/source3/lib/dummysmbd.c index eb6bfe9474..2ab0ed559d 100644 --- a/source3/lib/dummysmbd.c +++ b/source3/lib/dummysmbd.c @@ -23,11 +23,6 @@ #include "includes.h" -int smbd_server_fd(void) -{ - return -1; -} - int find_service(fstring service) { return -1; diff --git a/source3/modules/perfcount_onefs.c b/source3/modules/perfcount_onefs.c index 75dc14555c..d693376bfe 100644 --- a/source3/modules/perfcount_onefs.c +++ b/source3/modules/perfcount_onefs.c @@ -302,23 +302,26 @@ static void onefs_smb_statistics_end(struct smb_perfcount_data *pcd) /* get address info once, doesn't change for process */ if (rem_addr == 0) { - struct sockaddr_storage sa; - socklen_t sa_len; - int fd = smbd_server_fd(); - - sa_len = sizeof sa; - if (getpeername(fd, (struct sockaddr *)&sa, &sa_len) == 0 && - sa.ss_family == AF_INET) - rem_addr = ((struct sockaddr_in *)&sa)->sin_addr.s_addr; - else + +#error Isilon, please remove this after testing the code below + + char *addr; + + addr = talloc_sub_basic(talloc_tos(), "", "", "%I"); + if (addr != NULL) { + rem_addr = interpret_addr(addr); + TALLOC_FREE(addr); + } else { rem_addr = ISC_MASKED_ADDR; + } - sa_len = sizeof sa; - if (getsockname(fd, (struct sockaddr *)&sa, &sa_len) == 0 && - sa.ss_family == AF_INET) - loc_addr = ((struct sockaddr_in *)&sa)->sin_addr.s_addr; - else + addr = talloc_sub_basic(talloc_tos(), "", "", "%i"); + if (addr != NULL) { + loc_addr = interpret_addr(addr); + TALLOC_FREE(addr); + } else { loc_addr = ISC_MASKED_ADDR; + } } /* diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h index 759fead1c3..c4d65aa565 100644 --- a/source3/smbd/globals.h +++ b/source3/smbd/globals.h @@ -469,7 +469,7 @@ struct smbd_server_connection { struct { /* - * fd for the fcntl lock mutexing access to smbd_server_fd + * fd for the fcntl lock mutexing access to our sock */ int socket_lock_fd; diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 36b081a3fe..aa0f7e85ab 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -53,19 +53,12 @@ static_decl_rpc; extern int dcelogin_atmost_once; #endif /* WITH_DFS */ -int smbd_server_fd(void) -{ - return server_fd; -} - static void smbd_set_server_fd(int fd) { struct smbd_server_connection *sconn = smbd_server_conn; char addr[INET6_ADDRSTRLEN]; const char *name; - server_fd = fd; - sconn->sock = fd; /* diff --git a/source3/torture/vfstest.c b/source3/torture/vfstest.c index 4d537dadcf..923b5479ab 100644 --- a/source3/torture/vfstest.c +++ b/source3/torture/vfstest.c @@ -410,14 +410,8 @@ void exit_server_cleanly(const char *const reason) exit_server("normal exit"); } -static int server_fd = -1; int last_message = -1; -int smbd_server_fd(void) -{ - return server_fd; -} - struct event_context *smbd_event_context(void) { static struct event_context *ctx; @@ -463,7 +457,7 @@ int main(int argc, char *argv[]) poptFreeContext(pc); /* TODO: check output */ - reload_services(smbd_messaging_context(), smbd_server_fd(), False); + reload_services(smbd_messaging_context(), -1, False); /* the following functions are part of the Samba debugging facilities. See lib/debug.c */ -- cgit