All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ivan Gyurdiev <ivg2@cornell.edu>
To: Daniel J Walsh <dwalsh@redhat.com>
Cc: Stephen Smalley <sds@tycho.nsa.gov>, SE Linux <selinux@tycho.nsa.gov>
Subject: Re: Policycoreutils latest diffs.
Date: Wed, 04 Jan 2006 11:33:10 -0500	[thread overview]
Message-ID: <43BBF8C6.1070109@cornell.edu> (raw)
In-Reply-To: <43BAB2D6.4030103@cornell.edu>


> Please use < 0 to check for error everywhere.
Another issue is that I'm rather confused by some of the current 
semanage code w' respect to local vs in-policy, so I'll try to explain 
again . All functions ending in _local (and the seusers one) act with 
respect to the local store. All functions not ending in _local act with 
respect to the final result (which includes local modifications stacked 
on top of policy). They do not act on policy alone.

Let's look at two cases of code that I don't understand:
This is from port.modify. The libsemanage meaning of modify includes 
adding things if they don't exist, but I understand this is not the case 
in the tool, so that explains all the exists checks...  However:

                (rc,exists) = semanage_port_exists_local(self.sh, k)
                if exists:
                        (rc,p) = semanage_port_query_local(self.sh, k)
                        (rc,exists) = semanage_port_exists(self.sh, k)
                        if exists:
                                (rc,p) = semanage_port_query(self.sh, k)
                        else:
                                raise ValueError("port %s/%s is not 
defined." % (proto,port))

                if rc != 0:
                        raise ValueError("Could not query port for 
%s/%s" % (proto, port))

This doesn't make sense, because of something exists locally, and your 
query succeeded, it will always exists in the final result, and the 
second query will return the exact same thing, so you already know the 
result to both of those function calls.

This is from the port add function:
                (rc,exists) = semanage_port_exists(self.sh, k)
                if exists:
                        raise ValueError("Port %s/%s already defined" % 
(proto, port))

                (rc,exists) = semanage_port_exists_local(self.sh, k)
                if exists:
                        raise ValueError("Port %s/%s already defined 
locally" % (proto, port))

Here, the second exception will never occur, because if the port exists 
locally, then it exists in-policy as well, and the first value error 
will be thrown.






--
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:[~2006-01-04 16:33 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-03 18:39 Policycoreutils latest diffs Daniel J Walsh
2006-01-03 17:22 ` Ivan Gyurdiev
2006-01-04 16:33   ` Ivan Gyurdiev [this message]
2006-01-04 16:40     ` Ivan Gyurdiev
2006-01-04 19:15       ` Daniel J Walsh
2006-01-04 17:31         ` Ivan Gyurdiev
2006-01-04 17:37           ` Ivan Gyurdiev
2006-01-04 19:35           ` Joshua Brindle
2006-01-04 17:38             ` Ivan Gyurdiev
2006-01-04 19:39           ` Daniel J Walsh
2006-01-04 19:41             ` Joshua Brindle
2006-01-04 18:02               ` Ivan Gyurdiev
2006-01-04 20:11                 ` Joshua Brindle
2006-01-04 19:03                   ` Ivan Gyurdiev
2006-01-03 18:04 ` Ivan Gyurdiev
2006-01-04 17:36 ` Stephen Smalley
  -- strict thread matches above, loose matches on Subject: below --
2006-02-22 18:23 policycoreutils " Daniel J Walsh
2006-02-23 14:02 ` Stephen Smalley
2006-03-08 17:29   ` 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=43BBF8C6.1070109@cornell.edu \
    --to=ivg2@cornell.edu \
    --cc=dwalsh@redhat.com \
    --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.