mirror of
https://github.com/samba-team/samba.git
synced 2025-08-09 17:49:29 +03:00
s3:smbd: pass smbXsrv_connection to smbd_[un]lock_socket()
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org> Autobuild-User(master): Michael Adam <obnox@samba.org> Autobuild-Date(master): Wed Aug 6 12:15:57 CEST 2014 on sn-devel-104
This commit is contained in:
committed by
Michael Adam
parent
3805249deb
commit
bb8e6d458a
@ -113,8 +113,8 @@ struct smbd_smb2_request;
|
||||
|
||||
DATA_BLOB negprot_spnego(TALLOC_CTX *ctx, struct smbXsrv_connection *xconn);
|
||||
|
||||
void smbd_lock_socket(struct smbd_server_connection *sconn);
|
||||
void smbd_unlock_socket(struct smbd_server_connection *sconn);
|
||||
void smbd_lock_socket(struct smbXsrv_connection *xconn);
|
||||
void smbd_unlock_socket(struct smbXsrv_connection *xconn);
|
||||
|
||||
NTSTATUS smbd_do_locking(struct smb_request *req,
|
||||
files_struct *fsp,
|
||||
|
@ -140,10 +140,8 @@ static bool smbd_lock_socket_internal(struct smbXsrv_connection *xconn)
|
||||
return true;
|
||||
}
|
||||
|
||||
void smbd_lock_socket(struct smbd_server_connection *sconn)
|
||||
void smbd_lock_socket(struct smbXsrv_connection *xconn)
|
||||
{
|
||||
struct smbXsrv_connection *xconn = sconn->conn;
|
||||
|
||||
if (!smbd_lock_socket_internal(xconn)) {
|
||||
exit_server_cleanly("failed to lock socket");
|
||||
}
|
||||
@ -200,10 +198,8 @@ static bool smbd_unlock_socket_internal(struct smbXsrv_connection *xconn)
|
||||
return true;
|
||||
}
|
||||
|
||||
void smbd_unlock_socket(struct smbd_server_connection *sconn)
|
||||
void smbd_unlock_socket(struct smbXsrv_connection *xconn)
|
||||
{
|
||||
struct smbXsrv_connection *xconn = sconn->conn;
|
||||
|
||||
if (!smbd_unlock_socket_internal(xconn)) {
|
||||
exit_server_cleanly("failed to unlock socket");
|
||||
}
|
||||
@ -232,7 +228,7 @@ bool srv_send_smb(struct smbd_server_connection *sconn, char *buffer,
|
||||
return true;
|
||||
}
|
||||
|
||||
smbd_lock_socket(sconn);
|
||||
smbd_lock_socket(xconn);
|
||||
|
||||
if (do_signing) {
|
||||
/* Sign the outgoing packet if required. */
|
||||
@ -274,7 +270,7 @@ bool srv_send_smb(struct smbd_server_connection *sconn, char *buffer,
|
||||
out:
|
||||
SMB_PERFCOUNT_END(pcd);
|
||||
|
||||
smbd_unlock_socket(sconn);
|
||||
smbd_unlock_socket(xconn);
|
||||
return (ret > 0);
|
||||
}
|
||||
|
||||
@ -2477,11 +2473,11 @@ static void smbd_server_connection_read_handler(
|
||||
from_client = (xconn->transport.sock == fd);
|
||||
|
||||
if (async_echo && from_client) {
|
||||
smbd_lock_socket(sconn);
|
||||
smbd_lock_socket(xconn);
|
||||
|
||||
if (!fd_is_readable(fd)) {
|
||||
DEBUG(10,("the echo listener was faster\n"));
|
||||
smbd_unlock_socket(sconn);
|
||||
smbd_unlock_socket(xconn);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -2496,7 +2492,7 @@ static void smbd_server_connection_read_handler(
|
||||
!from_client /* trusted channel */);
|
||||
|
||||
if (async_echo && from_client) {
|
||||
smbd_unlock_socket(sconn);
|
||||
smbd_unlock_socket(xconn);
|
||||
}
|
||||
|
||||
if (NT_STATUS_EQUAL(status, NT_STATUS_RETRY)) {
|
||||
@ -2726,9 +2722,9 @@ static bool keepalive_fn(const struct timeval *now, void *private_data)
|
||||
return false;
|
||||
}
|
||||
|
||||
smbd_lock_socket(sconn);
|
||||
smbd_lock_socket(xconn);
|
||||
ret = send_keepalive(xconn->transport.sock);
|
||||
smbd_unlock_socket(sconn);
|
||||
smbd_unlock_socket(xconn);
|
||||
|
||||
if (!ret) {
|
||||
int saved_errno = errno;
|
||||
|
@ -3166,12 +3166,11 @@ ssize_t sendfile_short_send(struct smbXsrv_connection *xconn,
|
||||
|
||||
static void reply_readbraw_error(struct smbXsrv_connection *xconn)
|
||||
{
|
||||
struct smbd_server_connection *sconn = xconn->sconn;
|
||||
char header[4];
|
||||
|
||||
SIVAL(header,0,0);
|
||||
|
||||
smbd_lock_socket(sconn);
|
||||
smbd_lock_socket(xconn);
|
||||
if (write_data(xconn->transport.sock,header,4) != 4) {
|
||||
int saved_errno = errno;
|
||||
/*
|
||||
@ -3186,7 +3185,7 @@ static void reply_readbraw_error(struct smbXsrv_connection *xconn)
|
||||
|
||||
fail_readraw();
|
||||
}
|
||||
smbd_unlock_socket(sconn);
|
||||
smbd_unlock_socket(xconn);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -4073,9 +4072,9 @@ void reply_read_and_X(struct smb_request *req)
|
||||
/* NT_STATUS_RETRY - fall back to sync read. */
|
||||
}
|
||||
|
||||
smbd_lock_socket(req->sconn);
|
||||
smbd_lock_socket(req->xconn);
|
||||
send_file_readX(conn, req, fsp, startpos, smb_maxcnt);
|
||||
smbd_unlock_socket(req->sconn);
|
||||
smbd_unlock_socket(req->xconn);
|
||||
|
||||
out:
|
||||
END_PROFILE(SMBreadX);
|
||||
|
Reference in New Issue
Block a user