]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Fix coverity time_t related warnings 12938/head
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Thu, 22 Jun 2023 07:12:10 +0000 (09:12 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Thu, 22 Jun 2023 07:12:10 +0000 (09:12 +0200)
Most are not *really* bad, as we convert tmioe_t or unsigned int, which is good
for quite some time. One case of converting time_t to *signed* int spotted.

modules/bindbackend/bindbackend2.cc
pdns/auth-zonecache.hh
pdns/dbdnsseckeeper.cc
pdns/ixplore.cc
pdns/saxfr.cc
pdns/serialtweaker.cc
pdns/tkey.cc
pdns/ws-auth.cc

index 931952d4e881c0987aa619203b1c3cbbde93f132..1a0b01a57886e219c5c6cdff19841992f670b4b8 100644 (file)
@@ -430,6 +430,7 @@ void Bind2Backend::getUnfreshSlaveInfos(vector<DomainInfo>* unfreshDomains)
     catch (...) {
     }
     sd.serial = soadata.serial;
+    // coverity[store_truncates_time_t]
     if (sd.last_check + soadata.refresh < (unsigned int)time(nullptr))
       unfreshDomains->push_back(std::move(sd));
   }
index c1b91d2b580a35c214b16c4dbb6b3677fd0d0f00..c5b052a5378fd1a038319bb03049db6b1fd86478 100644 (file)
@@ -43,6 +43,7 @@ public:
 
   uint32_t getRefreshInterval() const
   {
+    // coverity[store_truncates_time_t]
     return d_refreshinterval;
   }
 
index 9d7b85a332f95c06d78b6bdf93eed3627b83a53b..514025292961af0acc2b4cd4f91a85d3db63f178 100644 (file)
@@ -533,6 +533,7 @@ DNSSECKeeper::keyset_t DNSSECKeeper::getEntryPoints(const DNSName& zname)
 DNSSECKeeper::keyset_t DNSSECKeeper::getKeys(const DNSName& zone, bool useCache)
 {
   static int ttl = ::arg().asNum("dnssec-key-cache-ttl");
+  // coverity[store_truncates_time_t]
   unsigned int now = time(nullptr);
 
   if(!((++s_ops) % 100000)) {
index e6eedf42ce2a849485856d8afb88df4b1a9f701a..620402ab0e568a7c78f90c426990f12690af7ccd 100644 (file)
@@ -180,7 +180,7 @@ int main(int argc, char** argv) {
       shared_ptr<const SOARecordContent> sr;
       uint32_t serial = getSerialFromMaster(master, zone, sr, tt);
       if(ourSerial == serial) {
-        time_t sleepTime = sr ? sr->d_st.refresh : 60;
+        unsigned int sleepTime = sr ? sr->d_st.refresh : 60;
         cout<<"still up to date, their serial is "<<serial<<", sleeping "<<sleepTime<<" seconds"<<endl;
         sleep(sleepTime);
         continue;
index fa2335e54094aa0086e9042ce0db26fe5b84366f..f6d25cfbc66015f75c259da5c782f66318fecbcf 100644 (file)
@@ -105,6 +105,7 @@ try
       DNSPacketWriter pwtkey(packet, gssctx.getLabel(), QType::TKEY, QClass::ANY);
       TKEYRecordContent tkrc;
       tkrc.d_algo = DNSName("gss-tsig.");
+      // coverity[store_truncates_time_t]
       tkrc.d_inception = time((time_t*)NULL);
       tkrc.d_expiration = tkrc.d_inception+15;
       tkrc.d_mode = 3;
index 72f31a7d58096d06f8fef0f8be0530709a8a537f..771c3088951e7427c8be85213d301ae28978eaf1 100644 (file)
@@ -59,6 +59,7 @@ uint32_t calculateEditSOA(uint32_t old_serial, const string& kind, const DNSName
     return (old_serial + (inception / (7*86400)));
   }
   else if(pdns_iequals(kind,"EPOCH")) {
+    // coverity[store_truncates_time_t]
     return time(nullptr);
   }
   else if(pdns_iequals(kind,"INCEPTION-EPOCH")) {
@@ -107,6 +108,7 @@ static uint32_t calculateIncreaseSOA(uint32_t old_serial, const string& increase
     return old_serial + 1;
   }
   else if (pdns_iequals(increaseKind, "EPOCH")) {
+    // coverity[store_truncates_time_t]
     return time(nullptr);
   }
   else if (pdns_iequals(increaseKind, "DEFAULT")) {
index a057b196d59c16dd2a66a85df8469557a8b74779..0fabcd2f9a82ce8499e91d9935d565c43f365469 100644 (file)
@@ -31,6 +31,7 @@ void PacketHandler::tkeyHandler(const DNSPacket& p, std::unique_ptr<DNSPacket>&
   tkey_out->d_error = 0;
   tkey_out->d_mode = tkey_in.d_mode;
   tkey_out->d_algo = tkey_in.d_algo;
+  // coverity[store_truncates_time_t]
   tkey_out->d_inception = inception;
   tkey_out->d_expiration = tkey_out->d_inception+15;
 
index 20d79875f68204d10d4cafb5218447114dcae7a9..fe7fb50b0c33363f7a5a806355be485dda8a0208 100644 (file)
@@ -583,6 +583,7 @@ static void gatherComments(const Json& container, const DNSName& qname, const QT
 
   time_t now = time(nullptr);
   for (const auto& comment : container["comments"].array_items()) {
+    // FIXME this is converting to a *signed* int, 2036 issue
     c.modified_at = intFromJson(comment, "modified_at", now);
     c.content = stringFromJson(comment, "content");
     c.account = stringFromJson(comment, "account");