All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joshua Brindle <jbrindle@tresys.com>
To: Stephen Smalley <sds@tycho.nsa.gov>
Cc: Ivan Gyurdiev <ivg2@cornell.edu>,
	SELinux-dev@tresys.com, dwalsh@redhat.com, selinux@tycho.nsa.gov
Subject: Re: [ SEMANAGE ] [ SEPOL ] More database work
Date: Fri, 07 Oct 2005 15:36:44 -0400	[thread overview]
Message-ID: <4346CE4C.1030201@tresys.com> (raw)
In-Reply-To: <1128709856.1450.75.camel@moss-spartans.epoch.ncsc.mil>

Stephen Smalley wrote:
> On Fri, 2005-10-07 at 11:52 -0400, Stephen Smalley wrote:
> 
>>On Fri, 2005-10-07 at 10:30 -0400, Stephen Smalley wrote:
>>
>>>Ok, I've made a first cut at the changes to libsepol and updated it and
>>>checkpolicy to build again, and am starting to work through libsemanage.
>>>As an example of what to expect, the diff below to database_direct.[ch]
>>>was needed to get it to compile again.
>>
>>A more interesting example - conversion of direct_api.c.
> 
> 
> Still more interesting example - conversion of semanage_store.c.
> This brings in the expand/link interfaces.  A few things to note,
> primarily directed at the Tresys folks since this was their code:
> - AFAICS the calls to policydb_index* were unneeded; they are already
> called as appropriate by the libsepol functions to update the indices.
> Possibly legacy of earlier versions of the libsepol code?

Yes, this is probably legacy from before everything was always indexed.

> - Enabling of the global branch moved into sepol_expand_module based on
> a new parameter, so that libsemanage and other callers don't need access
> to the policydb definition.  Not sure how you plan to selectively enable
> in the future.

I don't know of any reason to selectively enable the global branch, it 
should always be enabled or else there won't be any rules in the 
expanded policy.

> - expand_module already set the output type, so we only need to adjust
> the version here (and I changed it to use the kernel's policyvers if
> available instead of the config, as that is what will be loaded by
> load_policy now).

Hrm... Would it be better to always expand it to the latest format we 
know about and handle downgrading at write time? What if the kernel 
policyvery is lower than the requested write version? There is a 
possibility of lost information.

> - AFAICS the calls to load_isids were bogus/unneeded, unless you were
> trying to use their error checking as a side effect, in which case we
> should do that as part of expand_module.

yes, expand_module is probably a better place to do it (for error 
checking)..

<snip>
> @@ -1165,7 +1157,7 @@ int semanage_link_sandbox(semanage_handl
>  	}
>  	free(module_filenames);
>  	for (i = 0; mods != NULL && i < num_modules; i++) {
> -		sepol_module_package_destroy(mods[i]);
> +		sepol_module_package_free(mods[i]);
>  	}
>  	free(mods);
>  	return retval;

What is this?

> @@ -1176,31 +1168,24 @@ int semanage_link_sandbox(semanage_handl
>   * error.
>   */
>  int semanage_expand_sandbox(semanage_handle_t *sh, sepol_module_package_t *base) {
> -	policydb_t out;
> +	struct sepol_policydb *out;
>  	int retval = -1;
>  	const char *kernel_filename = NULL;
> -	sidtab_t sidtab;
> -	struct policy_file pf;
> +	struct sepol_policy_file *pf;
> +	int policyvers = security_policyvers();
>  	FILE *outfile = NULL;
>  
> -	memset(&out, 0, sizeof(out));
> +	if (policyvers < 0)
> +		policyvers = sh->conf->policyvers;
>  

Only if the kernel policyvers lookup fails we use the config file?

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

  reply	other threads:[~2005-10-07 19:36 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-06 16:01 [ SEMANAGE ] [ SEPOL ] More database work Ivan Gyurdiev
2005-10-06 16:05 ` Ivan Gyurdiev
2005-10-06 19:27 ` Stephen Smalley
2005-10-07 14:30   ` Stephen Smalley
2005-10-07 15:52     ` Stephen Smalley
2005-10-07 18:30       ` Stephen Smalley
2005-10-07 19:36         ` Joshua Brindle [this message]
2005-10-07 19:54           ` Stephen Smalley
2005-10-07 20:15             ` Joshua Brindle
2005-10-07 20:23               ` Stephen Smalley
2005-10-07 20:41                 ` Joshua Brindle
2005-10-11 19:15                   ` Stephen Smalley
2005-10-11 20:05                     ` Stephen Smalley
2005-10-11 20:17                       ` Stephen Smalley
2005-10-11 22:45                         ` Joshua Brindle
2005-10-11 22:51                     ` Joshua Brindle
2005-10-12 14:58                       ` Stephen Smalley
2005-10-12 15:34                         ` Joshua Brindle
2005-10-12 15:44                           ` Stephen Smalley
2005-10-12 16:19                             ` Joshua Brindle
2005-10-12 16:26                               ` Stephen Smalley
2005-10-12 18:06                                 ` Joshua Brindle
2005-10-12 19:52                                   ` Stephen Smalley
2005-10-12 20:11                                     ` Stephen Smalley
2005-10-13 16:43                                       ` Stephen Smalley
2005-10-13 18:43                                         ` Stephen Smalley
2005-10-13 18:54                                           ` Stephen Smalley
2005-10-12 20:16                                     ` Joshua Brindle
2005-10-12 20:43                                       ` Stephen Smalley
2005-10-07 21:17             ` Stephen Smalley
2005-10-07 22:48               ` Ivan Gyurdiev
2005-10-11 12:32                 ` Stephen Smalley
2005-10-11 12:51               ` Stephen Smalley
2005-10-13 19:29                 ` Stephen Smalley
2005-10-13 22:35                   ` Joshua Brindle
2005-10-14 12:02                     ` Stephen Smalley
2005-10-14 13:33                       ` Joshua Brindle
2005-10-14 13:49                         ` Stephen Smalley
2005-10-07 19:37         ` Stephen Smalley
2005-10-07 15:52     ` Ivan Gyurdiev
2005-10-07 16:01       ` Stephen Smalley
2005-10-07 16:05         ` Stephen Smalley
2005-10-07 16:46           ` Ivan Gyurdiev
2005-10-07 17:04         ` Stephen Smalley
2005-10-07 16:06       ` Joshua Brindle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4346CE4C.1030201@tresys.com \
    --to=jbrindle@tresys.com \
    --cc=SELinux-dev@tresys.com \
    --cc=dwalsh@redhat.com \
    --cc=ivg2@cornell.edu \
    --cc=sds@tycho.nsa.gov \
    --cc=selinux@tycho.nsa.gov \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.