1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

idmap_autorid: fix status code when trying to load range for an invalid input

The "sid" input needs to be verified (it can currently be a SID or "ALLOC").
When handing in string that is valid for other kinds of records,
but not for the SID[#IDX]-->RANGE direction of mappings, like for instance
a range number, then we get "NT_STATUS_INTERNAL_DB_CORRUPTION" because
parse records finds the record, but it does not have the expected size...

This patch fixes this problem by pre-validating the input before fetching
the record from the database.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Michael Adam 2013-11-05 13:46:15 +01:00 committed by Jeremy Allison
parent 066915f29d
commit 1524dc6006

View File

@ -304,6 +304,12 @@ static NTSTATUS idmap_autorid_getrange_int(struct db_context *db,
goto done;
}
if (!idmap_autorid_validate_sid(range->domsid)) {
DEBUG(3, ("Invalid SID: '%s'\n", range->domsid));
status = NT_STATUS_INVALID_PARAMETER;
goto done;
}
idmap_autorid_build_keystr(range->domsid, range->domain_range_index,
keystr);