s3: Remove get_client_fd()
authorVolker Lendecke <vl@samba.org>
Sat, 14 Aug 2010 08:22:12 +0000 (10:22 +0200)
committerVolker Lendecke <vl@samba.org>
Mon, 16 Aug 2010 11:13:10 +0000 (13:13 +0200)
16 files changed:
source3/auth/pampass.c
source3/include/proto.h
source3/lib/dummysmbd.c
source3/lib/substitute.c
source3/lib/util_sock.c
source3/modules/vfs_expand_msdfs.c
source3/printing/print_cups.c
source3/printing/print_iprint.c
source3/rpc_server/srv_netlog_nt.c
source3/rpc_server/srv_spoolss_nt.c
source3/smbd/process.c
source3/smbd/server.c
source3/smbd/service.c
source3/smbd/session.c
source3/smbd/sesssetup.c
source3/torture/vfstest.c

index e08670f481751add0301463e3dd77afc325f9bb5..6c7294dd8b600149fa29d7cfcd5bf67200d238c5 100644 (file)
@@ -479,9 +479,10 @@ static bool smb_pam_start(pam_handle_t **pamh, const char *user, const char *rho
 
 #ifdef PAM_RHOST
        if (rhost == NULL) {
-               our_rhost = client_name(get_client_fd());
+               our_rhost = client_name(smbd_server_fd());
                if (strequal(our_rhost,"UNKNOWN"))
-                       our_rhost = client_addr(get_client_fd(),addr,sizeof(addr));
+                       our_rhost = client_addr(smbd_server_fd(), addr,
+                                               sizeof(addr));
        } else {
                our_rhost = rhost;
        }
index 850710b2c76ae158273584b9a7f9ae9bf36917c9..80d23e54316cb4ca081c8ea2a3dccd0f1dae544b 100644 (file)
@@ -5792,7 +5792,6 @@ void server_messaging_context_free(void);
 /* The following definitions come from smbd/server.c  */
 
 int smbd_server_fd(void);
-int get_client_fd(void);
 struct event_context *smbd_event_context(void);
 struct messaging_context *smbd_messaging_context(void);
 struct memcache *smbd_memcache(void);
index ee88a78e7c462f2c25dc3dcae5ae3058b2140119..eb6bfe9474042fb09c76e3af73b6cef67b4f16ce 100644 (file)
@@ -23,7 +23,7 @@
 
 #include "includes.h"
 
-int get_client_fd(void)
+int smbd_server_fd(void)
 {
        return -1;
 }
index dbb5f7d08adc15b785253d2ca8d028317387768f..e5f1b2dbdf999324b2a4933ef627073cfd34ba51 100644 (file)
@@ -62,7 +62,7 @@ bool set_local_machine_name(const char *local_name, bool perm)
        if (strequal(tmp_local_machine, "*SMBSERVER") ||
                        strequal(tmp_local_machine, "*SMBSERV") )  {
                SAFE_FREE(local_machine);
-               local_machine = SMB_STRDUP(client_socket_addr(get_client_fd(),
+               local_machine = SMB_STRDUP(client_socket_addr(smbd_server_fd(),
                                        addr, sizeof(addr)) );
                SAFE_FREE(tmp_local_machine);
                return local_machine ? true : false;
@@ -609,7 +609,7 @@ static char *alloc_sub_basic(const char *smb_name, const char *domain_name,
                        break;
                case 'I' : {
                        int offset = 0;
-                       client_addr(get_client_fd(), addr, sizeof(addr));
+                       client_addr(smbd_server_fd(), addr, sizeof(addr));
                        if (strnequal(addr,"::ffff:",7)) {
                                offset = 7;
                        }
@@ -618,8 +618,10 @@ static char *alloc_sub_basic(const char *smb_name, const char *domain_name,
                        break;
                }
                case 'i': 
-                       a_string = realloc_string_sub( a_string, "%i",
-                                       client_socket_addr(get_client_fd(), addr, sizeof(addr)) );
+                       a_string = realloc_string_sub(
+                               a_string, "%i",
+                               client_socket_addr(smbd_server_fd(),
+                                                  addr, sizeof(addr)));
                        break;
                case 'L' : 
                        if ( StrnCaseCmp(p, "%LOGONSERVER%", strlen("%LOGONSERVER%")) == 0 ) {
@@ -635,7 +637,8 @@ static char *alloc_sub_basic(const char *smb_name, const char *domain_name,
                        a_string = realloc_string_sub(a_string, "%N", automount_server(smb_name));
                        break;
                case 'M' :
-                       a_string = realloc_string_sub(a_string, "%M", client_name(get_client_fd()));
+                       a_string = realloc_string_sub(
+                               a_string, "%M", client_name(smbd_server_fd()));
                        break;
                case 'R' :
                        a_string = realloc_string_sub(a_string, "%R", remote_proto);
index ced76ebca986923c179e041fc36238e7622bd339..bf04af10bd4e47c2d122bd10f28a1a89dfb536df 100644 (file)
@@ -466,7 +466,7 @@ NTSTATUS read_fd_with_timeout(int fd, char *buf,
 
                        if (readret == -1) {
                                save_errno = errno;
-                               if (fd == get_client_fd()) {
+                               if (fd == smbd_server_fd()) {
                                        /* Try and give an error message
                                         * saying what client failed. */
                                        DEBUG(0,("read_fd_with_timeout: "
@@ -505,7 +505,7 @@ NTSTATUS read_fd_with_timeout(int fd, char *buf,
                if (selrtn == -1) {
                        save_errno = errno;
                        /* something is wrong. Maybe the socket is dead? */
-                       if (fd == get_client_fd()) {
+                       if (fd == smbd_server_fd()) {
                                /* Try and give an error message saying
                                 * what client failed. */
                                DEBUG(0,("read_fd_with_timeout: timeout "
@@ -539,7 +539,7 @@ NTSTATUS read_fd_with_timeout(int fd, char *buf,
                if (readret == -1) {
                        save_errno = errno;
                        /* the descriptor is probably dead */
-                       if (fd == get_client_fd()) {
+                       if (fd == smbd_server_fd()) {
                                /* Try and give an error message
                                 * saying what client failed. */
                                DEBUG(0,("read_fd_with_timeout: timeout "
@@ -666,7 +666,7 @@ ssize_t write_data(int fd, const char *buffer, size_t N)
                return ret;
        }
 
-       if (fd == get_client_fd()) {
+       if (fd == smbd_server_fd()) {
                char addr[INET6_ADDRSTRLEN];
                /*
                 * Try and give an error message saying what client failed.
index 3d5ea9630c35ed40b33625660f9738203aa51c95..2d9bd4fd90e1f5d6892709536977184383fb861a 100644 (file)
@@ -70,7 +70,7 @@ static char *read_target_host(TALLOC_CTX *ctx, const char *mapfile)
 
                *space = '\0';
 
-               if (strncmp(client_addr(get_client_fd(),addr,sizeof(addr)),
+               if (strncmp(client_addr(smbd_server_fd(),addr,sizeof(addr)),
                                buf, strlen(buf)) == 0) {
                        found = true;
                        break;
index f96e8e17268c000dac4aee5e03fe43b721eea7c9..2441cfc275fcf144d312eb8e001e18ecfab1f201 100644 (file)
@@ -981,9 +981,9 @@ static int cups_job_submit(int snum, struct printjob *pjob)
        ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
                     NULL, user);
 
-       clientname = client_name(get_client_fd());
+       clientname = client_name(smbd_server_fd());
        if (strcmp(clientname, "UNKNOWN") == 0) {
-               clientname = client_addr(get_client_fd(),addr,sizeof(addr));
+               clientname = client_addr(smbd_server_fd(),addr,sizeof(addr));
        }
 
        ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
index 2f6e5b2667549ec90995cc418e59e929d6943ce4..75324960ef0f47abb1db326675dec5afc92c68cc 100644 (file)
@@ -785,9 +785,9 @@ static int iprint_job_submit(int snum, struct printjob *pjob)
        ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
                     NULL, pjob->user);
 
-       clientname = client_name(get_client_fd());
+       clientname = client_name(smbd_server_fd());
        if (strcmp(clientname, "UNKNOWN") == 0) {
-               clientname = client_addr(get_client_fd(),addr,sizeof(addr));
+               clientname = client_addr(smbd_server_fd(),addr,sizeof(addr));
        }
        
        ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
index b3e54050d47cd57476c6b9529a5768a64c2471e8..4433a707adb1be62a11ca9a23961f10b340b72a5 100644 (file)
@@ -610,8 +610,8 @@ static NTSTATUS get_md4pw(struct samr_Password *md4pw, const char *mach_acct,
      */
 
        if (!allow_access(lp_domain_hostsdeny(), lp_domain_hostsallow(),
-                       client_name(get_client_fd()),
-                       client_addr(get_client_fd(),addr,sizeof(addr)))) {
+                         client_name(smbd_server_fd()),
+                         client_addr(smbd_server_fd(),addr,sizeof(addr)))) {
                DEBUG(0,("get_md4pw: Workstation %s denied access to domain\n", mach_acct));
                return False;
        }
index cec0b7138e55f2fa912e40ceb5007cb1b83abaad..1c04ef167aff455e2f190a88df579868d1285859 100644 (file)
@@ -1642,7 +1642,8 @@ WERROR _spoolss_OpenPrinterEx(struct pipes_struct *p,
 
                /* check smb.conf parameters and the the sec_desc */
 
-               if ( !check_access(get_client_fd(), lp_hostsallow(snum), lp_hostsdeny(snum)) ) {
+               if ( !check_access(smbd_server_fd(), lp_hostsallow(snum),
+                                  lp_hostsdeny(snum)) ) {
                        DEBUG(3, ("access DENIED (hosts allow/deny) for printer open\n"));
                        ZERO_STRUCTP(r->out.handle);
                        return WERR_ACCESS_DENIED;
index f40b7dda4b02eaad4454cdd26e7db79d6e89ed76..9ce4bbb6f53a310a45448f32dc131e0859cd7584 100644 (file)
@@ -2352,7 +2352,7 @@ static void release_ip(const char *ip, void *priv)
        char addr[INET6_ADDRSTRLEN];
        char *p = addr;
 
-       client_socket_addr(get_client_fd(),addr,sizeof(addr));
+       client_socket_addr(smbd_server_fd(),addr,sizeof(addr));
 
        if (strncmp("::ffff:", addr, 7) == 0) {
                p = addr + 7;
index 1c614dad0b0985b2d0ece9af90a36a04a1934334..3c79dc46f93a3d94f397eadb8b739a0e641a032c 100644 (file)
@@ -62,11 +62,6 @@ static void smbd_set_server_fd(int fd)
        server_fd = fd;
 }
 
-int get_client_fd(void)
-{
-       return server_fd;
-}
-
 struct event_context *smbd_event_context(void)
 {
        return server_event_context();
index 9a345476dcbfd1864144d8f0730d26d2a84af24a..d32e53a56851526c0d1583c668a2869e6299604c 100644 (file)
@@ -690,7 +690,7 @@ connection_struct *make_connection_snum(struct smbd_server_connection *sconn,
        add_session_user(sconn, conn->server_info->unix_name);
 
        safe_strcpy(conn->client_address,
-                       client_addr(get_client_fd(),addr,sizeof(addr)), 
+                       client_addr(smbd_server_fd(),addr,sizeof(addr)),
                        sizeof(conn->client_address)-1);
        conn->num_files_open = 0;
        conn->lastused = conn->lastused_count = time(NULL);
@@ -1199,7 +1199,7 @@ connection_struct *make_connection(struct smbd_server_connection *sconn,
 
                DEBUG(3,("%s (%s) couldn't find service %s\n",
                        get_remote_machine_name(),
-                       client_addr(get_client_fd(),addr,sizeof(addr)),
+                       client_addr(smbd_server_fd(),addr,sizeof(addr)),
                        service));
                *status = NT_STATUS_BAD_NETWORK_NAME;
                return NULL;
index 64274b771e2c590113e8915820341ebca60df992..92742384bfc0e00ddd8ded51ae815701094e6ede 100644 (file)
@@ -131,9 +131,9 @@ bool session_claim(struct server_id pid, user_struct *vuser)
           client_name() handles this case internally.
        */
 
-       hostname = client_name(get_client_fd());
+       hostname = client_name(smbd_server_fd());
        if (strcmp(hostname, "UNKNOWN") == 0) {
-               hostname = client_addr(get_client_fd(),addr,sizeof(addr));
+               hostname = client_addr(smbd_server_fd(),addr,sizeof(addr));
        }
 
        fstrcpy(sessionid.username, vuser->server_info->unix_name);
@@ -144,7 +144,7 @@ bool session_claim(struct server_id pid, user_struct *vuser)
        sessionid.gid = vuser->server_info->utok.gid;
        fstrcpy(sessionid.remote_machine, get_remote_machine_name());
        fstrcpy(sessionid.ip_addr_str,
-               client_addr(get_client_fd(),addr,sizeof(addr)));
+               client_addr(smbd_server_fd(),addr,sizeof(addr)));
        sessionid.connect_start = time(NULL);
 
        if (!smb_pam_claim_session(sessionid.username, sessionid.id_str,
index cca3a1abf69b12a48a917ee8ddff3362003a9d25..1d8fe16203fda6373b9f20e82fa917ab9b08bbad 100644 (file)
@@ -1420,7 +1420,7 @@ static void setup_new_vc_session(struct messaging_context *msg_ctx)
                char addr[INET6_ADDRSTRLEN];
                struct shutdown_state state;
 
-               state.ip = client_addr(get_client_fd(),addr,sizeof(addr));
+               state.ip = client_addr(smbd_server_fd(),addr,sizeof(addr));
                state.msg_ctx = msg_ctx;
                connections_forall_read(shutdown_other_smbds, &state);
        }
index 99358de29b4853f40727a70a432ffe9404dcebaa..cac4621dd5a9e2283a2945a44a68cf9647be156a 100644 (file)
@@ -33,11 +33,6 @@ static struct cmd_list {
        struct cmd_set *cmd_set;
 } *cmd_list;
 
-int get_client_fd(void)
-{
-       return -1;
-}
-
 /****************************************************************************
 handle completion of commands for readline
 ****************************************************************************/