Skip to content

Commit 6eb75e3

Browse files
committed
[net] deprecate TSocket::CreateAuthSocket()
1 parent f06d6bb commit 6eb75e3

4 files changed

Lines changed: 21 additions & 10 deletions

File tree

net/net/inc/TSocket.h

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ struct TSocketFriend {
4242
static Bool_t IsAuthenticated(const TSocket &s);
4343
static void SetSecContext(TSocket &s, TSecContext *ctx);
4444
static TSecContext *GetSecContext(const TSocket &s);
45+
46+
static TSocket *CreateAuthSocket(const char *user, const char *host,
47+
Int_t port, Int_t size = 0,
48+
Int_t tcpwindowsize = -1, TSocket *s = nullptr, Int_t *err = nullptr);
49+
static TSocket *CreateAuthSocket(const char *url, Int_t size = 0,
50+
Int_t tcpwindowsize = -1, TSocket *s = nullptr, Int_t *err = nullptr);
4551
};
4652
} // namespace ROOT::Deprecated
4753

@@ -183,9 +189,15 @@ friend struct ROOT::Deprecated::TSocketFriend;
183189

184190
static TSocket *CreateAuthSocket(const char *user, const char *host,
185191
Int_t port, Int_t size = 0,
186-
Int_t tcpwindowsize = -1, TSocket *s = nullptr, Int_t *err = nullptr);
192+
Int_t tcpwindowsize = -1, TSocket *s = nullptr, Int_t *err = nullptr)
193+
R__DEPRECATED(6, 42, "Socket authentication is deprecated. See README.AUTH for details.")
194+
{ return ROOT::Deprecated::TSocketFriend::CreateAuthSocket(
195+
user, host, port, size, tcpwindowsize, s, err); }
187196
static TSocket *CreateAuthSocket(const char *url, Int_t size = 0,
188-
Int_t tcpwindowsize = -1, TSocket *s = nullptr, Int_t *err = nullptr);
197+
Int_t tcpwindowsize = -1, TSocket *s = nullptr, Int_t *err = nullptr)
198+
R__DEPRECATED(6, 42, "Socket authentication is deprecated. See README.AUTH for details.")
199+
{ return ROOT::Deprecated::TSocketFriend::CreateAuthSocket(url, size, tcpwindowsize, s, err); }
200+
189201
static void NetError(const char *where, Int_t error);
190202

191203
ClassDefOverride(TSocket,0) //This class implements client sockets

net/net/src/TFTP.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ void ROOT::Deprecated::TFTP::Init(const char *surl, Int_t par, Int_t wsize)
102102
}
103103
hurl += TString(Form("://%s@%s:%d",
104104
url.GetUser(), url.GetHost(), url.GetPort()));
105-
fSocket = TSocket::CreateAuthSocket(hurl, par, wsize, fSocket);
105+
fSocket = ROOT::Deprecated::TSocketFriend::CreateAuthSocket(hurl, par, wsize, fSocket);
106106
if (!fSocket || !ROOT::Deprecated::TSocketFriend::IsAuthenticated(*fSocket)) {
107107
if (par > 1)
108108
Error("TFTP", "can't open %d-stream connection to rootd on "

net/net/src/TNetFile.cxx

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

net/net/src/TSocket.cxx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1291,8 +1291,8 @@ Bool_t TSocket::Authenticate(const char *user)
12911291
/// Returns pointer to an authenticated socket or 0 if creation or
12921292
/// authentication is unsuccessful.
12931293

1294-
TSocket *TSocket::CreateAuthSocket(const char *url, Int_t size, Int_t tcpwindowsize,
1295-
TSocket *opensock, Int_t *err)
1294+
TSocket *ROOT::Deprecated::TSocketFriend::CreateAuthSocket(
1295+
const char *url, Int_t size, Int_t tcpwindowsize, TSocket *opensock, Int_t *err)
12961296
{
12971297
R__LOCKGUARD2(gSocketAuthMutex);
12981298

@@ -1428,9 +1428,8 @@ TSocket *TSocket::CreateAuthSocket(const char *url, Int_t size, Int_t tcpwindows
14281428
/// Returns pointer to an authenticated socket or 0 if creation or
14291429
/// authentication is unsuccessful.
14301430

1431-
TSocket *TSocket::CreateAuthSocket(const char *user, const char *url,
1432-
Int_t port, Int_t size, Int_t tcpwindowsize,
1433-
TSocket *opensock, Int_t *err)
1431+
TSocket *ROOT::Deprecated::TSocketFriend::CreateAuthSocket(
1432+
const char *user, const char *url, Int_t port, Int_t size, Int_t tcpwindowsize, TSocket *opensock, Int_t *err)
14341433
{
14351434
R__LOCKGUARD2(gSocketAuthMutex);
14361435

@@ -1459,7 +1458,7 @@ TSocket *TSocket::CreateAuthSocket(const char *user, const char *url,
14591458
}
14601459

14611460
// Create the socket and return it
1462-
return TSocket::CreateAuthSocket(eurl,size,tcpwindowsize,opensock,err);
1461+
return TSocketFriend::CreateAuthSocket(eurl,size,tcpwindowsize,opensock,err);
14631462
}
14641463

14651464
////////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)