Skip to content

Commit 9bdbc51

Browse files
committed
[net] deprecate TSocket::IsAuthenticated()
1 parent 0476216 commit 9bdbc51

5 files changed

Lines changed: 21 additions & 6 deletions

File tree

net/net/inc/TSocket.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,18 @@
3535
#include "TVirtualMutex.h"
3636

3737
class TMessage;
38+
class TSocket;
39+
40+
namespace ROOT::Deprecated {
41+
struct TSocketFriend {
42+
static Bool_t IsAuthenticated(const TSocket &s);
43+
};
44+
} // namespace ROOT::Deprecated
3845

3946
class TSocket : public TNamed {
4047

4148
friend class TServerSocket;
49+
friend class ROOT::Deprecated::TSocketFriend;
4250

4351
public:
4452
enum EStatusBits { kIsUnix = BIT(16), // set if unix socket
@@ -132,7 +140,9 @@ friend class TServerSocket;
132140
Int_t GetTcpWindowSize() const { return fTcpWindowSize; }
133141
TTimeStamp GetLastUsage() { R__LOCKGUARD2(fLastUsageMtx); return fLastUsage; }
134142
const char *GetUrl() const { return fUrl.Data(); }
135-
virtual Bool_t IsAuthenticated() const { return fSecContext ? kTRUE : kFALSE; }
143+
virtual Bool_t IsAuthenticated() const
144+
R__DEPRECATED(6, 42, "TSocket::IsAuthenticated is deprecated")
145+
{ return ROOT::Deprecated::TSocketFriend::IsAuthenticated(*this); }
136146
virtual Bool_t IsValid() const { return fSocket < 0 ? kFALSE : kTRUE; }
137147
virtual Int_t Recv(TMessage *&mess);
138148
virtual Int_t Recv(Int_t &status, Int_t &kind);

net/net/src/TFTP.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ void TFTP::Init(const char *surl, Int_t par, Int_t wsize)
103103
hurl += TString(Form("://%s@%s:%d",
104104
url.GetUser(), url.GetHost(), url.GetPort()));
105105
fSocket = TSocket::CreateAuthSocket(hurl, par, wsize, fSocket);
106-
if (!fSocket || !fSocket->IsAuthenticated()) {
106+
if (!fSocket || !ROOT::Deprecated::TSocketFriend::IsAuthenticated(*fSocket)) {
107107
if (par > 1)
108108
Error("TFTP", "can't open %d-stream connection to rootd on "
109109
"host %s at port %d", par, url.GetHost(), url.GetPort());
@@ -160,7 +160,7 @@ void TFTP::Print(Option_t *) const
160160
Printf("Local host: %s", gSystem->HostName());
161161
Printf("Remote host: %s [%d]", fHost.Data(), fPort);
162162
Printf("Remote user: %s", fUser.Data());
163-
if (fSocket->IsAuthenticated())
163+
if (ROOT::Deprecated::TSocketFriend::IsAuthenticated(*fSocket))
164164
Printf("Security context: %s",
165165
fSocket->GetSecContext()->AsString(secCont));
166166
Printf("Rootd protocol vers.: %d", fSocket->GetRemoteProtocol());

net/net/src/TNetFile.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ void TNetFile::ConnectServer(Int_t *stat, EMessageTypes *kind, Int_t netopt,
582582
url += TString(Form("://%s@%s:%d",
583583
fUrl.GetUser(), fUrl.GetHost(), fUrl.GetPort()));
584584
fSocket = TSocket::CreateAuthSocket(url, sSize, tcpwindowsize, fSocket, stat);
585-
if (!fSocket || (fSocket && !fSocket->IsAuthenticated())) {
585+
if (!fSocket || (fSocket && !ROOT::Deprecated::TSocketFriend::IsAuthenticated(*fSocket))) {
586586
if (sSize > 1)
587587
Error("TNetFile", "can't open %d-stream connection to rootd on "
588588
"host %s at port %d", sSize, fUrl.GetHost(), fUrl.GetPort());

net/net/src/TPServerSocket.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ TPSocket *TPServerSocket::Accept(UChar_t Opt)
136136
}
137137

138138
// Transmit authentication information, if any
139-
if (setupSocket->IsAuthenticated())
139+
if (ROOT::Deprecated::TSocketFriend::IsAuthenticated(*setupSocket))
140140
newPSocket->SetSecContext(setupSocket->GetSecContext());
141141

142142
// clean up, if needed

net/net/src/TSocket.cxx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@
3636
#include "TStreamerInfo.h"
3737
#include "TProcessID.h"
3838

39+
Bool_t ROOT::Deprecated::TSocketFriend::IsAuthenticated(const TSocket &s)
40+
{
41+
return s.fSecContext;
42+
}
43+
3944

4045
ULong64_t TSocket::fgBytesSent = 0;
4146
ULong64_t TSocket::fgBytesRecv = 0;
@@ -1354,7 +1359,7 @@ TSocket *TSocket::CreateAuthSocket(const char *url, Int_t size, Int_t tcpwindows
13541359
sock = new TPSocket(eurl, TUrl(url).GetPort(), size, tcpwindowsize);
13551360

13561361
// Cleanup if failure ...
1357-
if (sock && !sock->IsAuthenticated()) {
1362+
if (sock && !ROOT::Deprecated::TSocketFriend::IsAuthenticated(*sock)) {
13581363
// Nothing to do except setting the error code (if required) and sock to NULL
13591364
if (err) {
13601365
*err = (Int_t)kErrAuthNotOK;

0 commit comments

Comments
 (0)