s3-smbd: expose smbd_set_server_fd()
authorAndrew Tridgell <tridge@samba.org>
Mon, 2 May 2011 23:32:01 +0000 (09:32 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Sun, 8 May 2011 10:01:13 +0000 (12:01 +0200)
this allows the fd to be setup by subsystems that want to use the s3
server core code

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Sun May  8 12:01:13 CEST 2011 on sn-devel-104

source3/include/proto.h
source3/smbd/globals.c
source3/smbd/server.c

index e0bdabc7804cf057ae8194178cbb47b8773a847c..7e25f8e3adba59401381bfb642c7dd28f7030b24 100644 (file)
@@ -1856,6 +1856,7 @@ void send_stat_cache_delete_message(struct messaging_context *msg_ctx,
 NTSTATUS can_delete_directory(struct connection_struct *conn,
                                const char *dirname);
 bool change_to_root_user(void);
 NTSTATUS can_delete_directory(struct connection_struct *conn,
                                const char *dirname);
 bool change_to_root_user(void);
+void smbd_set_server_fd(int fd);
 struct event_context *smbd_event_context(void);
 void contend_level2_oplocks_begin(files_struct *fsp,
                                  enum level2_contention_type type);
 struct event_context *smbd_event_context(void);
 void contend_level2_oplocks_begin(files_struct *fsp,
                                  enum level2_contention_type type);
index 8e6f46fe5cddfa60a654abaae0137f591e0ec032..6f7f200b01cf4e210898ad6c49dd491e990499f5 100644 (file)
@@ -160,3 +160,32 @@ void smbd_init_globals(void)
        smbd_server_conn->smb1.echo_handler.trusted_fd = -1;
        smbd_server_conn->smb1.echo_handler.socket_lock_fd = -1;
 }
        smbd_server_conn->smb1.echo_handler.trusted_fd = -1;
        smbd_server_conn->smb1.echo_handler.socket_lock_fd = -1;
 }
+
+void smbd_set_server_fd(int fd)
+{
+       struct smbd_server_connection *sconn = smbd_server_conn;
+       char addr[INET6_ADDRSTRLEN];
+       const char *name;
+
+       sconn->sock = fd;
+
+       /*
+        * Initialize sconn->client_id: If we can't find the client's
+        * name, default to its address.
+        */
+
+       client_addr(fd, sconn->client_id.addr, sizeof(sconn->client_id.addr));
+
+       name = client_name(sconn->sock);
+       if (strcmp(name, "UNKNOWN") != 0) {
+               name = talloc_strdup(sconn, name);
+       } else {
+               name = NULL;
+       }
+       sconn->client_id.name =
+               (name != NULL) ? name : sconn->client_id.addr;
+
+       sub_set_socket_ids(sconn->client_id.addr, sconn->client_id.name,
+                          client_socket_addr(sconn->sock, addr,
+                                             sizeof(addr)));
+}
index a4857756a16c23b0919c4d6d3eb5874325604367..29acf8d2219790e203fb4554bfbd45f68b308958 100644 (file)
@@ -51,35 +51,6 @@ extern void start_spoolssd(struct event_context *ev_ctx,
 extern int dcelogin_atmost_once;
 #endif /* WITH_DFS */
 
 extern int dcelogin_atmost_once;
 #endif /* WITH_DFS */
 
-static void smbd_set_server_fd(int fd)
-{
-       struct smbd_server_connection *sconn = smbd_server_conn;
-       char addr[INET6_ADDRSTRLEN];
-       const char *name;
-
-       sconn->sock = fd;
-
-       /*
-        * Initialize sconn->client_id: If we can't find the client's
-        * name, default to its address.
-        */
-
-       client_addr(fd, sconn->client_id.addr, sizeof(sconn->client_id.addr));
-
-       name = client_name(sconn->sock);
-       if (strcmp(name, "UNKNOWN") != 0) {
-               name = talloc_strdup(sconn, name);
-       } else {
-               name = NULL;
-       }
-       sconn->client_id.name =
-               (name != NULL) ? name : sconn->client_id.addr;
-
-       sub_set_socket_ids(sconn->client_id.addr, sconn->client_id.name,
-                          client_socket_addr(sconn->sock, addr,
-                                             sizeof(addr)));
-}
-
 struct event_context *smbd_event_context(void)
 {
        return server_event_context();
 struct event_context *smbd_event_context(void)
 {
        return server_event_context();