1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

s3: Remove get_client_fd()

This commit is contained in:
Volker Lendecke 2010-08-14 10:22:12 +02:00
parent a482b3e14e
commit 96ae457023
16 changed files with 32 additions and 38 deletions

View File

@ -479,9 +479,10 @@ static bool smb_pam_start(pam_handle_t **pamh, const char *user, const char *rho
#ifdef PAM_RHOST #ifdef PAM_RHOST
if (rhost == NULL) { if (rhost == NULL) {
our_rhost = client_name(get_client_fd()); our_rhost = client_name(smbd_server_fd());
if (strequal(our_rhost,"UNKNOWN")) 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 { } else {
our_rhost = rhost; our_rhost = rhost;
} }

View File

@ -5792,7 +5792,6 @@ void server_messaging_context_free(void);
/* The following definitions come from smbd/server.c */ /* The following definitions come from smbd/server.c */
int smbd_server_fd(void); int smbd_server_fd(void);
int get_client_fd(void);
struct event_context *smbd_event_context(void); struct event_context *smbd_event_context(void);
struct messaging_context *smbd_messaging_context(void); struct messaging_context *smbd_messaging_context(void);
struct memcache *smbd_memcache(void); struct memcache *smbd_memcache(void);

View File

@ -23,7 +23,7 @@
#include "includes.h" #include "includes.h"
int get_client_fd(void) int smbd_server_fd(void)
{ {
return -1; return -1;
} }

View File

@ -62,7 +62,7 @@ bool set_local_machine_name(const char *local_name, bool perm)
if (strequal(tmp_local_machine, "*SMBSERVER") || if (strequal(tmp_local_machine, "*SMBSERVER") ||
strequal(tmp_local_machine, "*SMBSERV") ) { strequal(tmp_local_machine, "*SMBSERV") ) {
SAFE_FREE(local_machine); 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)) ); addr, sizeof(addr)) );
SAFE_FREE(tmp_local_machine); SAFE_FREE(tmp_local_machine);
return local_machine ? true : false; return local_machine ? true : false;
@ -609,7 +609,7 @@ static char *alloc_sub_basic(const char *smb_name, const char *domain_name,
break; break;
case 'I' : { case 'I' : {
int offset = 0; int offset = 0;
client_addr(get_client_fd(), addr, sizeof(addr)); client_addr(smbd_server_fd(), addr, sizeof(addr));
if (strnequal(addr,"::ffff:",7)) { if (strnequal(addr,"::ffff:",7)) {
offset = 7; offset = 7;
} }
@ -618,8 +618,10 @@ static char *alloc_sub_basic(const char *smb_name, const char *domain_name,
break; break;
} }
case 'i': case 'i':
a_string = realloc_string_sub( a_string, "%i", a_string = realloc_string_sub(
client_socket_addr(get_client_fd(), addr, sizeof(addr)) ); a_string, "%i",
client_socket_addr(smbd_server_fd(),
addr, sizeof(addr)));
break; break;
case 'L' : case 'L' :
if ( StrnCaseCmp(p, "%LOGONSERVER%", strlen("%LOGONSERVER%")) == 0 ) { 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)); a_string = realloc_string_sub(a_string, "%N", automount_server(smb_name));
break; break;
case 'M' : 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; break;
case 'R' : case 'R' :
a_string = realloc_string_sub(a_string, "%R", remote_proto); a_string = realloc_string_sub(a_string, "%R", remote_proto);

View File

@ -466,7 +466,7 @@ NTSTATUS read_fd_with_timeout(int fd, char *buf,
if (readret == -1) { if (readret == -1) {
save_errno = errno; save_errno = errno;
if (fd == get_client_fd()) { if (fd == smbd_server_fd()) {
/* Try and give an error message /* Try and give an error message
* saying what client failed. */ * saying what client failed. */
DEBUG(0,("read_fd_with_timeout: " DEBUG(0,("read_fd_with_timeout: "
@ -505,7 +505,7 @@ NTSTATUS read_fd_with_timeout(int fd, char *buf,
if (selrtn == -1) { if (selrtn == -1) {
save_errno = errno; save_errno = errno;
/* something is wrong. Maybe the socket is dead? */ /* 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 /* Try and give an error message saying
* what client failed. */ * what client failed. */
DEBUG(0,("read_fd_with_timeout: timeout " DEBUG(0,("read_fd_with_timeout: timeout "
@ -539,7 +539,7 @@ NTSTATUS read_fd_with_timeout(int fd, char *buf,
if (readret == -1) { if (readret == -1) {
save_errno = errno; save_errno = errno;
/* the descriptor is probably dead */ /* the descriptor is probably dead */
if (fd == get_client_fd()) { if (fd == smbd_server_fd()) {
/* Try and give an error message /* Try and give an error message
* saying what client failed. */ * saying what client failed. */
DEBUG(0,("read_fd_with_timeout: timeout " 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; return ret;
} }
if (fd == get_client_fd()) { if (fd == smbd_server_fd()) {
char addr[INET6_ADDRSTRLEN]; char addr[INET6_ADDRSTRLEN];
/* /*
* Try and give an error message saying what client failed. * Try and give an error message saying what client failed.

View File

@ -70,7 +70,7 @@ static char *read_target_host(TALLOC_CTX *ctx, const char *mapfile)
*space = '\0'; *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) { buf, strlen(buf)) == 0) {
found = true; found = true;
break; break;

View 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", ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
NULL, user); NULL, user);
clientname = client_name(get_client_fd()); clientname = client_name(smbd_server_fd());
if (strcmp(clientname, "UNKNOWN") == 0) { 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, ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,

View 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", ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
NULL, pjob->user); NULL, pjob->user);
clientname = client_name(get_client_fd()); clientname = client_name(smbd_server_fd());
if (strcmp(clientname, "UNKNOWN") == 0) { 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, ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,

View 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(), if (!allow_access(lp_domain_hostsdeny(), lp_domain_hostsallow(),
client_name(get_client_fd()), client_name(smbd_server_fd()),
client_addr(get_client_fd(),addr,sizeof(addr)))) { client_addr(smbd_server_fd(),addr,sizeof(addr)))) {
DEBUG(0,("get_md4pw: Workstation %s denied access to domain\n", mach_acct)); DEBUG(0,("get_md4pw: Workstation %s denied access to domain\n", mach_acct));
return False; return False;
} }

View File

@ -1642,7 +1642,8 @@ WERROR _spoolss_OpenPrinterEx(struct pipes_struct *p,
/* check smb.conf parameters and the the sec_desc */ /* 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")); DEBUG(3, ("access DENIED (hosts allow/deny) for printer open\n"));
ZERO_STRUCTP(r->out.handle); ZERO_STRUCTP(r->out.handle);
return WERR_ACCESS_DENIED; return WERR_ACCESS_DENIED;

View File

@ -2352,7 +2352,7 @@ static void release_ip(const char *ip, void *priv)
char addr[INET6_ADDRSTRLEN]; char addr[INET6_ADDRSTRLEN];
char *p = addr; 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) { if (strncmp("::ffff:", addr, 7) == 0) {
p = addr + 7; p = addr + 7;

View File

@ -62,11 +62,6 @@ static void smbd_set_server_fd(int fd)
server_fd = fd; server_fd = fd;
} }
int get_client_fd(void)
{
return server_fd;
}
struct event_context *smbd_event_context(void) struct event_context *smbd_event_context(void)
{ {
return server_event_context(); return server_event_context();

View File

@ -690,7 +690,7 @@ connection_struct *make_connection_snum(struct smbd_server_connection *sconn,
add_session_user(sconn, conn->server_info->unix_name); add_session_user(sconn, conn->server_info->unix_name);
safe_strcpy(conn->client_address, 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); sizeof(conn->client_address)-1);
conn->num_files_open = 0; conn->num_files_open = 0;
conn->lastused = conn->lastused_count = time(NULL); 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", DEBUG(3,("%s (%s) couldn't find service %s\n",
get_remote_machine_name(), get_remote_machine_name(),
client_addr(get_client_fd(),addr,sizeof(addr)), client_addr(smbd_server_fd(),addr,sizeof(addr)),
service)); service));
*status = NT_STATUS_BAD_NETWORK_NAME; *status = NT_STATUS_BAD_NETWORK_NAME;
return NULL; return NULL;

View File

@ -131,9 +131,9 @@ bool session_claim(struct server_id pid, user_struct *vuser)
client_name() handles this case internally. client_name() handles this case internally.
*/ */
hostname = client_name(get_client_fd()); hostname = client_name(smbd_server_fd());
if (strcmp(hostname, "UNKNOWN") == 0) { 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); 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; sessionid.gid = vuser->server_info->utok.gid;
fstrcpy(sessionid.remote_machine, get_remote_machine_name()); fstrcpy(sessionid.remote_machine, get_remote_machine_name());
fstrcpy(sessionid.ip_addr_str, 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); sessionid.connect_start = time(NULL);
if (!smb_pam_claim_session(sessionid.username, sessionid.id_str, if (!smb_pam_claim_session(sessionid.username, sessionid.id_str,

View File

@ -1420,7 +1420,7 @@ static void setup_new_vc_session(struct messaging_context *msg_ctx)
char addr[INET6_ADDRSTRLEN]; char addr[INET6_ADDRSTRLEN];
struct shutdown_state state; 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; state.msg_ctx = msg_ctx;
connections_forall_read(shutdown_other_smbds, &state); connections_forall_read(shutdown_other_smbds, &state);
} }

View File

@ -33,11 +33,6 @@ static struct cmd_list {
struct cmd_set *cmd_set; struct cmd_set *cmd_set;
} *cmd_list; } *cmd_list;
int get_client_fd(void)
{
return -1;
}
/**************************************************************************** /****************************************************************************
handle completion of commands for readline handle completion of commands for readline
****************************************************************************/ ****************************************************************************/