From: <ssm...@us...> - 2008-04-21 17:58:41
|
Revision: 2871 http://selinux.svn.sourceforge.net/selinux/?rev=2871&view=rev Author: ssmalley Date: 2008-04-21 09:55:37 -0700 (Mon, 21 Apr 2008) Log Message: ----------- Author: Stephen Smalley Email: sd...@ty... Subject: libsemanage: don't call genhomedircon if policy was not rebuilt Date: Mon, 21 Apr 2008 09:41:15 -0400 See: https://bugzilla.redhat.com/show_bug.cgi?id=441379 It appears to me that what is happening here is we have a case where nothing is being rebuilt (semanage boolean -D is being applied but there are no local boolean definitions and thus no change), and thus semanage_direct_commit() does not rebuild the policy (conditional on sh->do_rebuild || modified), leaving the out policydb == NULL. Then when it calls semanage_genhomedircon(sh, out, 1) the NULL policydb pointer ultimately gets passed down to libsepol and that then triggers a seg fault upon the attempted dereference. This patch ensures that we do not call genhomedircon if the policy was not rebuilt, as there is no need to regenerate home directory contexts in that situation. This avoids the bug for semanage boolean -D while still properly handling semodule -Bn aka genhomedircon or other operations. Signed-off-by: Stephen Smalley <sd...@ty...> Acked-by: Joshua Brindle <me...@ma...> Modified Paths: -------------- trunk/libsemanage/src/direct_api.c Modified: trunk/libsemanage/src/direct_api.c =================================================================== --- trunk/libsemanage/src/direct_api.c 2008-04-18 14:23:06 UTC (rev 2870) +++ trunk/libsemanage/src/direct_api.c 2008-04-21 16:55:37 UTC (rev 2871) @@ -708,7 +708,7 @@ /* run genhomedircon if its enabled, this should be the last operation * which requires the out policydb */ if (!sh->conf->disable_genhomedircon) { - if ((retval = + if (out && (retval = semanage_genhomedircon(sh, out, 1)) != 0) { ERR(sh, "semanage_genhomedircon returned error code %d.", retval); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |