[Opendnssec-user] Error converting from 1.4.14 to 2.1.8

Havard Eidnes he at uninett.no
Fri Mar 5 17:14:03 UTC 2021


Hi,

more follow-up, this one is a minor buglet.  The sqlite3
conversion script contains

-- We need the following mapping 1.4 -> 2.0 for denialType
-- 0 -> 1
-- 3 -> 0

UPDATE policy
SET denialType = (
        SELECT (CASE value WHEN 0 THEN 0 WHEN 1 THEN 0 WHEN 3 THEN 1 ELSE 1 END)
        FROM  REMOTE.parameters_policies
        INNER JOIN REMOTE.parameters
        ON REMOTE.parameters_policies.parameter_id = REMOTE.parameters.id 
        WHERE REMOTE.parameters_policies.policy_id = policy.id 
                AND REMOTE.parameters.category_id = 2
                AND REMOTE.parameters.name = 'version');

First, we didn't manage to make the "WHEN" statements match up
with the comment.

Second, we looked in enforcer/src/db/policy.h and found:

typedef enum policy_denial_type {
    POLICY_DENIAL_TYPE_INVALID = -1,
    POLICY_DENIAL_TYPE_NSEC = 0,
    POLICY_DENIAL_TYPE_NSEC3 = 1
} policy_denial_type_t;
extern const db_enum_t policy_enum_set_denial_type[];

So...  The code in the conversion script is correct, but the
comment is dead wrong.  It should say:

-- We need the following mapping 1.4 -> 2.0 for denialType
-- 0 -> 0
-- 3 -> 1

The "WHEN" statements also implement these additional mappings by
the looks of it:

-- 1 -> 0
-- else -> 1

So as to not needlessly confuse anyone who follows in this track,
the comment in the conversion script should be updated to reflect
actual reality.

Regards,

- Håvard


More information about the Opendnssec-user mailing list