Browse Source

[2522] add SSHFP::operator=

Paul Selkirk 12 years ago
parent
commit
c39edd26a6
2 changed files with 16 additions and 1 deletions
  1. 15 1
      src/lib/dns/rdata/generic/sshfp_44.cc
  2. 1 0
      src/lib/dns/rdata/generic/sshfp_44.h

+ 15 - 1
src/lib/dns/rdata/generic/sshfp_44.cc

@@ -82,7 +82,7 @@ SSHFP::constructFromLexer(MasterLexer& lexer) {
 /// will make the construction fail with an exception.
 /// will make the construction fail with an exception.
 ///
 ///
 /// The Algorithm and Fingerprint Type fields must be within their valid
 /// The Algorithm and Fingerprint Type fields must be within their valid
-/// ranges, but are not contrained to the values defined in RFC4255.
+/// ranges, but are not constrained to the values defined in RFC4255.
 ///
 ///
 /// The Fingerprint field may be absent, but if present it must contain a
 /// The Fingerprint field may be absent, but if present it must contain a
 /// valid hex encoding of the fingerprint.
 /// valid hex encoding of the fingerprint.
@@ -182,6 +182,20 @@ SSHFP::SSHFP(const SSHFP& other) :
         Rdata(), impl_(new SSHFPImpl(*other.impl_))
         Rdata(), impl_(new SSHFPImpl(*other.impl_))
 {}
 {}
 
 
+SSHFP&
+SSHFP::operator=(const SSHFP& source)
+{
+    if (impl_ == source.impl_) {
+        return (*this);
+    }
+
+    SSHFPImpl* newimpl = new SSHFPImpl(*source.impl_);
+    delete impl_;
+    impl_ = newimpl;
+
+    return (*this);
+}
+
 SSHFP::~SSHFP() {
 SSHFP::~SSHFP() {
     delete impl_;
     delete impl_;
 }
 }

+ 1 - 0
src/lib/dns/rdata/generic/sshfp_44.h

@@ -37,6 +37,7 @@ public:
 
 
     SSHFP(uint8_t algorithm, uint8_t fingerprint_type,
     SSHFP(uint8_t algorithm, uint8_t fingerprint_type,
           const std::string& fingerprint);
           const std::string& fingerprint);
+    SSHFP& operator=(const SSHFP& source);
     ~SSHFP();
     ~SSHFP();
 
 
     ///
     ///