]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: use ceph_memzero_s instead of explicit_bzero
authorLucian Petrut <lpetrut@cloudbasesolutions.com>
Wed, 20 Jan 2021 11:42:03 +0000 (11:42 +0000)
committerJason Dillaman <dillaman@redhat.com>
Tue, 26 Jan 2021 14:52:51 +0000 (09:52 -0500)
explicit_bzero isn't available on Windows. We'll use the portable
ceph_memzero_s function instead.

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
(cherry picked from commit 4b94acad0c41d20cdae48e01fbbc1ae26229c75b)

src/tools/rbd/action/Encryption.cc

index 7796eee267d3c328593f0bfc774d01eea1db3994..a997fe7017eeadf85ece872618f1cc459bfa227c 100644 (file)
@@ -1,6 +1,7 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
 // vim: ts=8 sw=2 smarttab
 
+#include "include/compat.h"
 #include "include/scope_guard.h"
 #include "tools/rbd/ArgumentTypes.h"
 #include "tools/rbd/Shell.h"
@@ -66,7 +67,7 @@ int execute(const po::variables_map &vm,
   std::string passphrase((std::istreambuf_iterator<char>(file)),
                          (std::istreambuf_iterator<char>()));
   auto sg = make_scope_guard([&] {
-      explicit_bzero(&passphrase[0], passphrase.size()); });
+      ceph_memzero_s(&passphrase[0], passphrase.size(), passphrase.size()); });
   file.close();
   if (!passphrase.empty() && passphrase[passphrase.length() - 1] == '\n') {
     passphrase.erase(passphrase.length() - 1);