From baab67ca52eafaf58ccf70cee577e97db37e391f Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Wed, 11 Aug 2021 12:02:08 +0800 Subject: [PATCH] auth: build without "using namespace std" * add "std::" prefix in headers * add "using" declarations in .cc files. so we don't rely on "using namespace std" in one or more included headers. Signed-off-by: Kefu Chai --- src/auth/Crypto.cc | 12 ++++++------ src/auth/cephx/CephxKeyServer.cc | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/auth/Crypto.cc b/src/auth/Crypto.cc index 2dda80e2b04b5..c96222feafcb8 100644 --- a/src/auth/Crypto.cc +++ b/src/auth/Crypto.cc @@ -33,12 +33,6 @@ #include "common/debug.h" #include -// use getentropy() if available. it uses the same source of randomness -// as /dev/urandom without the filesystem overhead -#ifdef HAVE_GETENTROPY - -#include - using std::ostringstream; using std::string; @@ -46,6 +40,12 @@ using ceph::bufferlist; using ceph::bufferptr; using ceph::Formatter; +// use getentropy() if available. it uses the same source of randomness +// as /dev/urandom without the filesystem overhead +#ifdef HAVE_GETENTROPY + +#include + static bool getentropy_works() { char buf; diff --git a/src/auth/cephx/CephxKeyServer.cc b/src/auth/cephx/CephxKeyServer.cc index adfe74d2baba6..89e0c415c8a75 100644 --- a/src/auth/cephx/CephxKeyServer.cc +++ b/src/auth/cephx/CephxKeyServer.cc @@ -58,7 +58,7 @@ bool KeyServerData::get_service_secret(CephContext *cct, uint32_t service_id, // with a bogus, possibly way into the future, validity ttl = service_id == CEPH_ENTITY_TYPE_AUTH ? cct->_conf->auth_mon_ticket_ttl : cct->_conf->auth_service_ticket_ttl; - ttl = min(ttl, static_cast( + ttl = std::min(ttl, static_cast( secrets.secrets.rbegin()->second.expiration - now)); ldout(cct, 30) << __func__ << " service " -- 2.39.5