]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
auth: build without "using namespace std"
authorKefu Chai <kchai@redhat.com>
Wed, 11 Aug 2021 04:02:08 +0000 (12:02 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 13 Aug 2021 04:23:38 +0000 (12:23 +0800)
* 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 <kchai@redhat.com>
src/auth/Crypto.cc
src/auth/cephx/CephxKeyServer.cc

index 2dda80e2b04b54f58e80ab9bfe6d4586ec3a5fd2..c96222feafcb864ca44ca8fc215417cdac302514 100644 (file)
 #include "common/debug.h"
 #include <errno.h>
 
-// use getentropy() if available. it uses the same source of randomness
-// as /dev/urandom without the filesystem overhead
-#ifdef HAVE_GETENTROPY
-
-#include <unistd.h>
-
 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 <unistd.h>
+
 static bool getentropy_works()
 {
   char buf;
index adfe74d2baba681b5fcdb88a67bbe16e76d81c2f..89e0c415c8a757452086081e8480b431d4e52d68 100644 (file)
@@ -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<double>(
+  ttl = std::min(ttl, static_cast<double>(
                     secrets.secrets.rbegin()->second.expiration - now));
 
   ldout(cct, 30) << __func__ << " service "