On Tue, 2012-05-08 at 07:59 +0200, Stef Walter wrote:
Integrated subdomain support into the patch.
Along the lines of what Simo said, all subdomains use the regular expression of the parent domain and we only match the regular expression once for those cases.
Thanks for the other reviews too. Updated patch attached.
I'd appreciate help testing this. I don't know how to reach all the code paths involved.
Thanks for the patch, you're making great progress here.
A few issues remain:
sss_parse_name_for_domains(): Please create a tmp_ctx and use that for allocating dmatch and nmatch, instead of allocating them on memctx. You're effectively leaking memory in a way that valgrind cannot detect (they're allocated and attached to memctx, but unreachable). Please use the tmp_ctx and steal the results onto memctx just prior to returning from the function. Also make sure that all exit points free tmp_ctx.
Please prefer to use the 'bool' type for only_name_seen and only_name_mismatch and 'true' or 'false' as values, instead of zero and one. It just reads easier.
I think only_name_seen is probably unnecessary. You should be able to just check whether only_name is NULL. You have a guarantee that nmatch will never be NULL if code == EOK after sss_parse_name. Well, assuming no bugs in sss_parse_name, but it's not your responsibility in sss_parse_name_for_domains() to work around such bugs. You can simplify the mismatch testing considerably with this in mind.
Actually, thinking more on this, you should have a guarantee that if dmatch is NULL and code is EOK, nmatch will always be the same as orig. Again, if it is not, that would be a bug in sss_parse_name().
So I think we can pretty handily simplify this down.