Skip to content

ESE multivalue record is always returned as a list #46

Description

@hypn0s

Hello,

After updating ntdissector to use dissect.database instead of dissect.esedb, we found a bug where record.get returns a list of values even when there is only one value.

The Problem

The issue is caused by a recent change in https://github.com/fox-it/dissect.database/blob/542289301b3f754c40dceddaed26d4bd33043f6f/dissect/database/ese/record.py (lines 303–304):

            if column.is_multivalue and not isinstance(value, list):
                value = [value]

The code currently treats all "multivalue" columns as lists. However, a column typed as "multivalue" might still only contain a single value (or none). In these cases, it should return the value directly rather than wrapping it in a list. This is why the tag flags are compared to TAGFLD_HEADER.MultiValues in which case, indicate that multiple values are in the field.

This condition was recently added in 64ae6d8 .

Proposed Fix

Remove lines 303 and 304. I have tested this change locally, and it restores the expected behavior for ntdissector.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions