s3: Remove smbd_server_fd()
authorVolker Lendecke <vl@samba.org>
Sat, 28 Aug 2010 15:25:22 +0000 (17:25 +0200)
committerVolker Lendecke <vl@samba.org>
Sun, 29 Aug 2010 19:55:25 +0000 (21:55 +0200)
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
source3/lib/dummysmbd.c
source3/modules/perfcount_onefs.c
source3/smbd/globals.h
source3/smbd/server.c
source3/torture/vfstest.c

index 37f4d19232ddef3eb6746805d44b5e4eebb4f35e..5b9414f61c96a312d592cf0f5be8e34acdf5911c 100644 (file)
@@ -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);
index eb6bfe9474042fb09c76e3af73b6cef67b4f16ce..2ab0ed559d570682a271c0b6672956e0150097da 100644 (file)
 
 #include "includes.h"
 
-int smbd_server_fd(void)
-{
-       return -1;
-}
-
 int find_service(fstring service)
 {
        return -1;
index 75dc14555cd97b64d47790851ca3ab61d6d0abd2..d693376bfe290453b029329f70dbe7ad3da5ac0f 100644 (file)
@@ -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;
+               }
        }
 
        /*
index 759fead1c3a0ecbb843f8b2d39a90a485ca08266..c4d65aa565953c5dfeebb8aae905ab2c6a360361 100644 (file)
@@ -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;
 
index 36b081a3fe7bd0db6f13bf75fcdf56c2f1938523..aa0f7e85abe40be38644dc8311ff0165c7d0426d 100644 (file)
@@ -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;
 
        /*
index 4d537dadcf53834edbcab289aedea5103e72fe5d..923b5479abad0f52fb2322129854204a994114cb 100644 (file)
@@ -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 */