diff --git a/source3/auth/pampass.c b/source3/auth/pampass.c index e08670f4817..6c7294dd8b6 100644 --- a/source3/auth/pampass.c +++ b/source3/auth/pampass.c @@ -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; } diff --git a/source3/include/proto.h b/source3/include/proto.h index 850710b2c76..80d23e54316 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -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); diff --git a/source3/lib/dummysmbd.c b/source3/lib/dummysmbd.c index ee88a78e7c4..eb6bfe94740 100644 --- a/source3/lib/dummysmbd.c +++ b/source3/lib/dummysmbd.c @@ -23,7 +23,7 @@ #include "includes.h" -int get_client_fd(void) +int smbd_server_fd(void) { return -1; } diff --git a/source3/lib/substitute.c b/source3/lib/substitute.c index dbb5f7d08ad..e5f1b2dbdf9 100644 --- a/source3/lib/substitute.c +++ b/source3/lib/substitute.c @@ -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); diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c index ced76ebca98..bf04af10bd4 100644 --- a/source3/lib/util_sock.c +++ b/source3/lib/util_sock.c @@ -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. diff --git a/source3/modules/vfs_expand_msdfs.c b/source3/modules/vfs_expand_msdfs.c index 3d5ea9630c3..2d9bd4fd90e 100644 --- a/source3/modules/vfs_expand_msdfs.c +++ b/source3/modules/vfs_expand_msdfs.c @@ -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; diff --git a/source3/printing/print_cups.c b/source3/printing/print_cups.c index f96e8e17268..2441cfc275f 100644 --- a/source3/printing/print_cups.c +++ b/source3/printing/print_cups.c @@ -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, diff --git a/source3/printing/print_iprint.c b/source3/printing/print_iprint.c index 2f6e5b26675..75324960ef0 100644 --- a/source3/printing/print_iprint.c +++ b/source3/printing/print_iprint.c @@ -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, diff --git a/source3/rpc_server/srv_netlog_nt.c b/source3/rpc_server/srv_netlog_nt.c index b3e54050d47..4433a707adb 100644 --- a/source3/rpc_server/srv_netlog_nt.c +++ b/source3/rpc_server/srv_netlog_nt.c @@ -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; } diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index cec0b7138e5..1c04ef167af 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -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; diff --git a/source3/smbd/process.c b/source3/smbd/process.c index f40b7dda4b0..9ce4bbb6f53 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -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; diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 1c614dad0b0..3c79dc46f93 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -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(); diff --git a/source3/smbd/service.c b/source3/smbd/service.c index 9a345476dcb..d32e53a5685 100644 --- a/source3/smbd/service.c +++ b/source3/smbd/service.c @@ -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; diff --git a/source3/smbd/session.c b/source3/smbd/session.c index 64274b771e2..92742384bfc 100644 --- a/source3/smbd/session.c +++ b/source3/smbd/session.c @@ -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, diff --git a/source3/smbd/sesssetup.c b/source3/smbd/sesssetup.c index cca3a1abf69..1d8fe16203f 100644 --- a/source3/smbd/sesssetup.c +++ b/source3/smbd/sesssetup.c @@ -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); } diff --git a/source3/torture/vfstest.c b/source3/torture/vfstest.c index 99358de29b4..cac4621dd5a 100644 --- a/source3/torture/vfstest.c +++ b/source3/torture/vfstest.c @@ -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 ****************************************************************************/