]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Credentials: Add move assignement operator
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 20 Sep 2021 08:03:02 +0000 (10:03 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 20 Sep 2021 09:43:01 +0000 (11:43 +0200)
pdns/credentials.cc
pdns/credentials.hh

index f2f882db2c054adada5cbeb68f97e6a5155dc498..460df05edfc15de6c7450c2100760bf0b68d17c4 100644 (file)
@@ -66,6 +66,12 @@ SensitiveData::SensitiveData(std::string&& data) :
 #endif
 }
 
+SensitiveData& SensitiveData::operator=(SensitiveData&& rhs)
+{
+  d_data = std::move(rhs.d_data);
+  return *this;
+}
+
 SensitiveData::SensitiveData(size_t bytes)
 {
   d_data.resize(bytes);
index 83b55264caff698ad52b4b28867a2a3f82e8d65f..6e59c6b40e40effa9b23e8003596a5d5e24e91c4 100644 (file)
@@ -29,6 +29,8 @@ class SensitiveData
 public:
   SensitiveData(size_t bytes);
   SensitiveData(std::string&& data);
+  SensitiveData& operator=(SensitiveData&&);
+
   ~SensitiveData();
   void clear();
   const std::string& getString() const
@@ -92,7 +94,7 @@ private:
   uint64_t d_parallelFactor{0};
   uint64_t d_blockSize{0};
   /* seed our hash so it's not predictable */
-  uint32_t d_fallbackHashPerturb;
+  uint32_t d_fallbackHashPerturb{0};
   uint32_t d_fallbackHash{0};
   /* whether it was constructed from a hashed and salted string */
   bool d_wasHashed{false};