diff options
author | Pierre Ossman <ossman@cendio.se> | 2023-01-13 11:14:21 +0100 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2023-02-04 14:03:13 +0100 |
commit | 5c1ac16776cd9f2a75e31086755e72186b3b3d41 (patch) | |
tree | 234a54c7f11c25ba59f8487118d13eb550c1cc64 /common/rfb/VNCServerST.cxx | |
parent | 1af2a56f7583b301890f8ea213f262782cc3c9f1 (diff) | |
download | tigervnc-5c1ac16776cd9f2a75e31086755e72186b3b3d41.tar.gz tigervnc-5c1ac16776cd9f2a75e31086755e72186b3b3d41.zip |
Return static char buffer from some methods
This mimics how some system functions (like inet_ntop()) work, and
avoids complexity around ownership of the returned string buffer.
The downside is that the string must be consumed directly as it will be
overwritten on the next call, but that is not an issue with the current
usage.
Diffstat (limited to 'common/rfb/VNCServerST.cxx')
-rw-r--r-- | common/rfb/VNCServerST.cxx | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/common/rfb/VNCServerST.cxx b/common/rfb/VNCServerST.cxx index a02366e1..aaa59eaa 100644 --- a/common/rfb/VNCServerST.cxx +++ b/common/rfb/VNCServerST.cxx @@ -131,9 +131,9 @@ void VNCServerST::addSocket(network::Socket* sock, bool outgoing) { // - Check the connection isn't black-marked // *** do this in getSecurity instead? - CharArray address(sock->getPeerAddress()); - if (blHosts->isBlackmarked(address.buf)) { - connectionsLog.error("blacklisted: %s", address.buf); + const char *address = sock->getPeerAddress(); + if (blHosts->isBlackmarked(address)) { + connectionsLog.error("blacklisted: %s", address); try { rdr::OutStream& os = sock->outStream(); @@ -151,9 +151,7 @@ void VNCServerST::addSocket(network::Socket* sock, bool outgoing) return; } - CharArray name; - name.buf = sock->getPeerEndpoint(); - connectionsLog.status("accepted: %s", name.buf); + connectionsLog.status("accepted: %s", sock->getPeerEndpoint()); // Adjust the exit timers if (rfb::Server::maxConnectionTime && clients.empty()) @@ -651,9 +649,7 @@ void VNCServerST::queryConnection(VNCSConnectionST* client, const char* userName) { // - Authentication succeeded - clear from blacklist - CharArray name; - name.buf = client->getSock()->getPeerAddress(); - blHosts->clearBlackmark(name.buf); + blHosts->clearBlackmark(client->getSock()->getPeerAddress()); // - Prepare the desktop for that the client will start requiring // resources after this |