mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1784098 - move nsITLSServerConnectionInfo from nsISocketTransport.securityInfo to securityCallbacks r=necko-reviewers,kershaw
In preparation for making nsISocketTransport.securityInfo a concrete type (nsITransportSecurityInfo), nsITLSServerConnectionInfo needs to be moved off of securityInfo. securityCallbacks seems like a reasonable place. Differential Revision: https://phabricator.services.mozilla.com/D154256
This commit is contained in:
parent
c55c1c4959
commit
e7fe86c6a0
@ -77,7 +77,7 @@ function startServer(cert) {
|
|||||||
|
|
||||||
let listener = {
|
let listener = {
|
||||||
onSocketAccepted(socket, transport) {
|
onSocketAccepted(socket, transport) {
|
||||||
let connectionInfo = transport.securityInfo.QueryInterface(
|
let connectionInfo = transport.securityCallbacks.getInterface(
|
||||||
Ci.nsITLSServerConnectionInfo
|
Ci.nsITLSServerConnectionInfo
|
||||||
);
|
);
|
||||||
connectionInfo.setSecurityObserver(listener);
|
connectionInfo.setSecurityObserver(listener);
|
||||||
|
@ -73,7 +73,7 @@ function startServer(cert) {
|
|||||||
|
|
||||||
let listener = {
|
let listener = {
|
||||||
onSocketAccepted(socket, transport) {
|
onSocketAccepted(socket, transport) {
|
||||||
let connectionInfo = transport.securityInfo.QueryInterface(
|
let connectionInfo = transport.securityCallbacks.getInterface(
|
||||||
Ci.nsITLSServerConnectionInfo
|
Ci.nsITLSServerConnectionInfo
|
||||||
);
|
);
|
||||||
connectionInfo.setSecurityObserver(listener);
|
connectionInfo.setSecurityObserver(listener);
|
||||||
|
@ -59,7 +59,7 @@ function startServer(cert) {
|
|||||||
let listener = {
|
let listener = {
|
||||||
onSocketAccepted(socket, transport) {
|
onSocketAccepted(socket, transport) {
|
||||||
info("Accepted TLS client connection");
|
info("Accepted TLS client connection");
|
||||||
let connectionInfo = transport.securityInfo.QueryInterface(
|
let connectionInfo = transport.securityCallbacks.getInterface(
|
||||||
Ci.nsITLSServerConnectionInfo
|
Ci.nsITLSServerConnectionInfo
|
||||||
);
|
);
|
||||||
connectionInfo.setSecurityObserver(listener);
|
connectionInfo.setSecurityObserver(listener);
|
||||||
|
@ -64,9 +64,9 @@ void TLSServerSocket::CreateClientTransport(PRFileDesc* aClientFD,
|
|||||||
RefPtr<TLSServerConnectionInfo> info = new TLSServerConnectionInfo();
|
RefPtr<TLSServerConnectionInfo> info = new TLSServerConnectionInfo();
|
||||||
info->mServerSocket = this;
|
info->mServerSocket = this;
|
||||||
info->mTransport = trans;
|
info->mTransport = trans;
|
||||||
nsCOMPtr<nsISupports> infoSupports =
|
nsCOMPtr<nsIInterfaceRequestor> infoInterfaceRequestor(info);
|
||||||
NS_ISUPPORTS_CAST(nsITLSServerConnectionInfo*, info);
|
rv = trans->InitWithConnectedSocket(aClientFD, &aClientAddr,
|
||||||
rv = trans->InitWithConnectedSocket(aClientFD, &aClientAddr, infoSupports);
|
infoInterfaceRequestor);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
mCondition = rv;
|
mCondition = rv;
|
||||||
return;
|
return;
|
||||||
@ -262,7 +262,7 @@ TLSServerSecurityObserverProxy::OnHandshakeDoneRunnable::Run() {
|
|||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS(TLSServerConnectionInfo, nsITLSServerConnectionInfo,
|
NS_IMPL_ISUPPORTS(TLSServerConnectionInfo, nsITLSServerConnectionInfo,
|
||||||
nsITLSClientStatus)
|
nsITLSClientStatus, nsIInterfaceRequestor)
|
||||||
|
|
||||||
TLSServerConnectionInfo::~TLSServerConnectionInfo() {
|
TLSServerConnectionInfo::~TLSServerConnectionInfo() {
|
||||||
RefPtr<nsITLSServerSecurityObserver> observer;
|
RefPtr<nsITLSServerSecurityObserver> observer;
|
||||||
@ -359,6 +359,20 @@ TLSServerConnectionInfo::GetMacLength(uint32_t* aMacLength) {
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
TLSServerConnectionInfo::GetInterface(const nsIID& aIID, void** aResult) {
|
||||||
|
NS_ENSURE_ARG_POINTER(aResult);
|
||||||
|
*aResult = nullptr;
|
||||||
|
|
||||||
|
if (aIID.Equals(NS_GET_IID(nsITLSServerConnectionInfo))) {
|
||||||
|
*aResult = static_cast<nsITLSServerConnectionInfo*>(this);
|
||||||
|
NS_ADDREF_THIS();
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NS_NOINTERFACE;
|
||||||
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
void TLSServerConnectionInfo::HandshakeCallback(PRFileDesc* aFD, void* aArg) {
|
void TLSServerConnectionInfo::HandshakeCallback(PRFileDesc* aFD, void* aArg) {
|
||||||
RefPtr<TLSServerConnectionInfo> info =
|
RefPtr<TLSServerConnectionInfo> info =
|
||||||
|
@ -39,13 +39,15 @@ class TLSServerSocket final : public nsServerSocket, public nsITLSServerSocket {
|
|||||||
};
|
};
|
||||||
|
|
||||||
class TLSServerConnectionInfo : public nsITLSServerConnectionInfo,
|
class TLSServerConnectionInfo : public nsITLSServerConnectionInfo,
|
||||||
public nsITLSClientStatus {
|
public nsITLSClientStatus,
|
||||||
|
public nsIInterfaceRequestor {
|
||||||
friend class TLSServerSocket;
|
friend class TLSServerSocket;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NS_DECL_THREADSAFE_ISUPPORTS
|
NS_DECL_THREADSAFE_ISUPPORTS
|
||||||
NS_DECL_NSITLSSERVERCONNECTIONINFO
|
NS_DECL_NSITLSSERVERCONNECTIONINFO
|
||||||
NS_DECL_NSITLSCLIENTSTATUS
|
NS_DECL_NSITLSCLIENTSTATUS
|
||||||
|
NS_DECL_NSIINTERFACEREQUESTOR
|
||||||
|
|
||||||
TLSServerConnectionInfo() = default;
|
TLSServerConnectionInfo() = default;
|
||||||
|
|
||||||
|
@ -871,10 +871,12 @@ nsresult nsSocketTransport::InitWithConnectedSocket(PRFileDesc* fd,
|
|||||||
return PostEvent(MSG_RETRY_INIT_SOCKET);
|
return PostEvent(MSG_RETRY_INIT_SOCKET);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsSocketTransport::InitWithConnectedSocket(PRFileDesc* aFD,
|
nsresult nsSocketTransport::InitWithConnectedSocket(
|
||||||
const NetAddr* aAddr,
|
PRFileDesc* aFD, const NetAddr* aAddr, nsIInterfaceRequestor* aCallbacks) {
|
||||||
nsISupports* aSecInfo) {
|
{
|
||||||
mSecInfo = aSecInfo;
|
MutexAutoLock lock(mLock);
|
||||||
|
mCallbacks = aCallbacks;
|
||||||
|
}
|
||||||
return InitWithConnectedSocket(aFD, aAddr);
|
return InitWithConnectedSocket(aFD, aAddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,9 +134,10 @@ class nsSocketTransport final : public nsASocketHandler,
|
|||||||
nsresult InitWithConnectedSocket(PRFileDesc* socketFD, const NetAddr* addr);
|
nsresult InitWithConnectedSocket(PRFileDesc* socketFD, const NetAddr* addr);
|
||||||
|
|
||||||
// this method instructs the socket transport to use an already connected
|
// this method instructs the socket transport to use an already connected
|
||||||
// socket with the given address, and additionally supplies security info.
|
// socket with the given address, and additionally supplies the security
|
||||||
|
// callbacks interface requestor.
|
||||||
nsresult InitWithConnectedSocket(PRFileDesc* aFD, const NetAddr* aAddr,
|
nsresult InitWithConnectedSocket(PRFileDesc* aFD, const NetAddr* aAddr,
|
||||||
nsISupports* aSecInfo);
|
nsIInterfaceRequestor* aCallbacks);
|
||||||
|
|
||||||
#ifdef XP_UNIX
|
#ifdef XP_UNIX
|
||||||
// This method instructs the socket transport to open a socket
|
// This method instructs the socket transport to open a socket
|
||||||
|
@ -112,7 +112,7 @@ class ServerSocketListener {
|
|||||||
|
|
||||||
onSocketAccepted(socket, transport) {
|
onSocketAccepted(socket, transport) {
|
||||||
info("accepted TLS client connection");
|
info("accepted TLS client connection");
|
||||||
let connectionInfo = transport.securityInfo.QueryInterface(
|
let connectionInfo = transport.securityCallbacks.getInterface(
|
||||||
Ci.nsITLSServerConnectionInfo
|
Ci.nsITLSServerConnectionInfo
|
||||||
);
|
);
|
||||||
let input = transport.openInputStream(0, 0, 0);
|
let input = transport.openInputStream(0, 0, 0);
|
||||||
|
@ -105,7 +105,7 @@ class ServerSocketListener {
|
|||||||
|
|
||||||
onSocketAccepted(socket, transport) {
|
onSocketAccepted(socket, transport) {
|
||||||
info("accepted TLS client connection");
|
info("accepted TLS client connection");
|
||||||
let connectionInfo = transport.securityInfo.QueryInterface(
|
let connectionInfo = transport.securityCallbacks.getInterface(
|
||||||
Ci.nsITLSServerConnectionInfo
|
Ci.nsITLSServerConnectionInfo
|
||||||
);
|
);
|
||||||
let input = transport.openInputStream(0, 0, 0);
|
let input = transport.openInputStream(0, 0, 0);
|
||||||
|
@ -107,7 +107,7 @@ class ServerSocketListener {
|
|||||||
|
|
||||||
onSocketAccepted(socket, transport) {
|
onSocketAccepted(socket, transport) {
|
||||||
info("accepted TLS client connection");
|
info("accepted TLS client connection");
|
||||||
let connectionInfo = transport.securityInfo.QueryInterface(
|
let connectionInfo = transport.securityCallbacks.getInterface(
|
||||||
Ci.nsITLSServerConnectionInfo
|
Ci.nsITLSServerConnectionInfo
|
||||||
);
|
);
|
||||||
let input = transport.openInputStream(0, 0, 0);
|
let input = transport.openInputStream(0, 0, 0);
|
||||||
|
@ -125,7 +125,7 @@ function startServer(
|
|||||||
|
|
||||||
onSocketAccepted(socket, transport) {
|
onSocketAccepted(socket, transport) {
|
||||||
info("accepted TLS client connection");
|
info("accepted TLS client connection");
|
||||||
let connectionInfo = transport.securityInfo.QueryInterface(
|
let connectionInfo = transport.securityCallbacks.getInterface(
|
||||||
Ci.nsITLSServerConnectionInfo
|
Ci.nsITLSServerConnectionInfo
|
||||||
);
|
);
|
||||||
let input = transport.openInputStream(0, 0, 0);
|
let input = transport.openInputStream(0, 0, 0);
|
||||||
|
@ -55,7 +55,7 @@ function startServer(
|
|||||||
let listener = {
|
let listener = {
|
||||||
onSocketAccepted(socket, transport) {
|
onSocketAccepted(socket, transport) {
|
||||||
info("Accept TLS client connection");
|
info("Accept TLS client connection");
|
||||||
let connectionInfo = transport.securityInfo.QueryInterface(
|
let connectionInfo = transport.securityCallbacks.getInterface(
|
||||||
Ci.nsITLSServerConnectionInfo
|
Ci.nsITLSServerConnectionInfo
|
||||||
);
|
);
|
||||||
connectionInfo.setSecurityObserver(listener);
|
connectionInfo.setSecurityObserver(listener);
|
||||||
|
@ -30,7 +30,7 @@ function startServer(cert) {
|
|||||||
let listener = {
|
let listener = {
|
||||||
onSocketAccepted(socket, transport) {
|
onSocketAccepted(socket, transport) {
|
||||||
info("Accept TLS client connection");
|
info("Accept TLS client connection");
|
||||||
let connectionInfo = transport.securityInfo.QueryInterface(
|
let connectionInfo = transport.securityCallbacks.getInterface(
|
||||||
Ci.nsITLSServerConnectionInfo
|
Ci.nsITLSServerConnectionInfo
|
||||||
);
|
);
|
||||||
connectionInfo.setSecurityObserver(listener);
|
connectionInfo.setSecurityObserver(listener);
|
||||||
|
@ -123,7 +123,7 @@ class ServerSocketListener {
|
|||||||
|
|
||||||
onSocketAccepted(socket, transport) {
|
onSocketAccepted(socket, transport) {
|
||||||
info("accepted TLS client connection");
|
info("accepted TLS client connection");
|
||||||
let connectionInfo = transport.securityInfo.QueryInterface(
|
let connectionInfo = transport.securityCallbacks.getInterface(
|
||||||
Ci.nsITLSServerConnectionInfo
|
Ci.nsITLSServerConnectionInfo
|
||||||
);
|
);
|
||||||
let input = transport.openInputStream(0, 0, 0);
|
let input = transport.openInputStream(0, 0, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user