All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joshua Brindle <jbrindle@tresys.com>
To: Karl MacMillan <kmacmillan@mentalrootkit.com>
Cc: SELinux Mail List <selinux@tycho.nsa.gov>,
	Daniel J Walsh <dwalsh@redhat.com>
Subject: Re: [PATCH] correct return value handling in libsemanage
Date: Wed, 03 Jan 2007 07:28:29 -0500	[thread overview]
Message-ID: <459BA16D.8090300@tresys.com> (raw)
In-Reply-To: <458B10CE.6000201@mentalrootkit.com>

Karl MacMillan wrote:
> The function semanage_direct_commit in libsemanage:direct_api.c does 
> not correctly propagate error codes. This patch fixes that.
>
> Signed-off-by: Karl MacMillan <kmacmillan@mentalrootkit.com>
>
Acked-By: Joshua Brindle <jbrindle@tresys.com>
>
> diff -r 1ecfd5befe3f src/direct_api.c
> --- a/src/direct_api.c    Thu Dec 21 17:09:45 2006 -0500
> +++ b/src/direct_api.c    Thu Dec 21 17:47:06 2006 -0500
> @@ -603,7 +603,8 @@ static int semanage_direct_commit(semana
>
>          /* Create new policy object, then attach to policy databases
>           * that work with a policydb */
> -        if (semanage_expand_sandbox(sh, base, &out) < 0)
> +        retval = semanage_expand_sandbox(sh, base, &out);
> +        if (retval < 0)
>              goto cleanup;
>
>          dbase_policydb_attach((dbase_policydb_t *) pusers_base->dbase,
> @@ -615,13 +616,16 @@ static int semanage_direct_commit(semana
>
>          /* ============= Apply changes, and verify  =============== */
>
> -        if (semanage_base_merge_components(sh) < 0)
> -            goto cleanup;
> -
> -        if (semanage_write_policydb(sh, out) < 0)
> -            goto cleanup;
> -
> -        if (semanage_verify_kernel(sh) != 0)
> +        retval = semanage_base_merge_components(sh);
> +        if (retval < 0)
> +            goto cleanup;
> +
> +        retval = semanage_write_policydb(sh, out);
> +        if (retval < 0)
> +            goto cleanup;
> +
> +        retval = semanage_verify_kernel(sh);
> +        if (retval < 0)
>              goto cleanup;
>      }
>
> @@ -635,26 +639,30 @@ static int semanage_direct_commit(semana
>       * merged into the main file_contexts. We won't check the
>       * large file_contexts - checked at compile time */
>      if (sh->do_rebuild || modified || fcontexts_modified) {
> -        if (semanage_fcontext_validate_local(sh, out) < 0)
> +        retval = semanage_fcontext_validate_local(sh, out);
> +        if (retval < 0)
>              goto cleanup;
>      }
>
>      /* Validate local seusers against policy */
>      if (sh->do_rebuild || modified || seusers_modified) {
> -        if (semanage_seuser_validate_local(sh, out) < 0)
> +        retval = semanage_seuser_validate_local(sh, out);
> +        if (retval < 0)
>              goto cleanup;
>      }
>
>      /* Validate local ports for overlap */
>      if (sh->do_rebuild || ports_modified) {
> -        if (semanage_port_validate_local(sh) < 0)
> +        retval = semanage_port_validate_local(sh);
> +        if (retval < 0)
>              goto cleanup;
>      }
>
>      /* ================== Write non-policydb components ========= */
>
>      /* Commit changes to components */
> -    if (semanage_commit_components(sh) < 0)
> +    retval = semanage_commit_components(sh);
> +    if (retval < 0)
>          goto cleanup;
>
>      retval = semanage_install_sandbox(sh);
>
>
> -- 
> 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.
>



--
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:[~2007-01-03 12:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-21 22:55 [PATCH] correct return value handling in libsemanage Karl MacMillan
2007-01-03 12:28 ` Joshua Brindle [this message]
2007-01-03 16:01   ` Karl MacMillan
2007-01-04 21:58     ` Joshua Brindle
2007-01-05 15:13       ` Stephen Smalley

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=459BA16D.8090300@tresys.com \
    --to=jbrindle@tresys.com \
    --cc=dwalsh@redhat.com \
    --cc=kmacmillan@mentalrootkit.com \
    --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.