From b92fcfbb75845dae31e155a2c96638417985d6a1 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 18 Oct 2013 16:26:41 +0200 Subject: [PATCH] idmap_autorid: fix traversal of ranges to correctly exclude mapping records. When listing all ranges with "net idmap get ranges", the database records of the form "S-1-5-10" --> "GID 100016" were treated here as rangee mapings, resulting in an faulty printout like this: "RANGE 541346119: S-1-5-10". This patch fixes this by adding a filter that checks the size of the value datablob. Signed-off-by: Michael Adam --- source3/winbindd/idmap_autorid_tdb.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source3/winbindd/idmap_autorid_tdb.c b/source3/winbindd/idmap_autorid_tdb.c index bbfa5b0..7d3275e 100644 --- a/source3/winbindd/idmap_autorid_tdb.c +++ b/source3/winbindd/idmap_autorid_tdb.c @@ -962,6 +962,14 @@ static int idmap_autorid_visit_domain_range(struct db_record *rec, } value = dbwrap_record_get_value(rec); + + if (value.dsize != sizeof(uint32_t)) { + /* it might be a mapping of a well known sid */ + DEBUG(10, ("value size %u != sizeof(uint32_t) for sid '%s', " + "skipping.\n", (unsigned)value.dsize, vi->domsid)); + goto done; + } + rangenum = IVAL(value.dptr, 0); db = dbwrap_record_get_db(rec); -- 1.7.9.5