Control: tags -1 + patch

On Sat, Aug 26, 2023 at 11:50:52PM +0200, наб wrote:
> GDB says
> │      402    if (kind == DomainInfo::All) {                                  
>                                            │
> │  >   403      ret<<parts[1]<<" zonecount:"<<count;                          
>                                            │
> │      404    }                                                               
>                                            │
> │      405    else {                                                          
>                                            │
> │      406      ret<<"All zonecount:"<<count;                                 
>                                            │
> │      407    }                                                               
>                                            │
> 
> 
> But the function starts with
> │      378  string DLListZones(const vector<string>&parts, Utility::pid_t 
> ppid)                                          │
> │      379  {                                                                 
>                                            │
> │      380    UeberBackend B;                                                 
>                                            │
> │      381    g_log<<Logger::Notice<<"Received request to list zones."<<endl; 
>                                            │
> ...
> │      386    if (parts.size() > 1) {                                         
>                                            │
> │      387      kind = DomainInfo::stringToKind(parts[1]);                    
>                                            │
> │      388    }                                                               
>                                            │
> │      389    else {                                                          
>                                            │
> │      390      kind = DomainInfo::All;                                       
>                                            │
> │      391    }                                                               
>                                            │
> 
> So... (kind == DomainInfo::All) <=> (parts.size() == 0)
"(kind == DomainInfo::All) <=> (parts.size() == 1)" of course.

Confirmed and fixed by 403s/1/0/
  # pdns_control list-zones master
  All zonecount:0
  # pdns_control list-zones slave
  All zonecount:0
  # pdns_control list-zones native
  ws.co.ls.
  All zonecount:1
  # pdns_control list-zones
  ws.co.ls.
  LIST-ZONES zonecount:1

Patch attached.

Best,
--- pdns-4.7.1.orig/pdns/dynhandler.cc
+++ pdns-4.7.1/pdns/dynhandler.cc
@@ -400,7 +400,7 @@ string DLListZones(const vector<string>&
   }
 
   if (kind == DomainInfo::All) {
-    ret<<parts[1]<<" zonecount:"<<count;
+    ret<<parts[0]<<" zonecount:"<<count;
   }
   else {
     ret<<"All zonecount:"<<count;

Attachment: signature.asc
Description: PGP signature

Reply via email to