From: Ivan Gyurdiev <ivg2@cornell.edu>
To: SELinux List <SELinux@tycho.nsa.gov>
Cc: Stephen Smalley <sds@tycho.nsa.gov>, Daniel J Walsh <dwalsh@redhat.com>
Subject: [SEMANAGE(tool)] Do not attempt to delete in-policy users
Date: Sat, 24 Dec 2005 14:53:49 -0500 [thread overview]
Message-ID: <43ADA74D.50405@cornell.edu> (raw)
[-- Attachment #1: Type: text/plain, Size: 737 bytes --]
Hi, this patch shows how to properly use the exists function on delete.
The libsemanage delete operation will succeed if you try to delete an
object that does not exist (no action is taken), so the user is left
wondering why the object wasn't deleted, but no error was displayed. The
del_local function checks if the user exists "locally" - not in-policy.
The same is true for all functions that end in _local. You can't delete
in-policy objects at this time (you can only modify them). To support
deletion of in-policy objects we have to track the user deletion
requests in a file, and then apply those on every policy upgrade. This
is possible, but it's not currently implemented - didn't think it was a
wanted feature.
[-- Attachment #2: semanage.exists_test.diff --]
[-- Type: text/x-patch, Size: 795 bytes --]
diff -Naurp --exclude-from excludes old/policycoreutils/semanage/semanage new/policycoreutils/semanage/semanage
--- old/policycoreutils/semanage/semanage 2005-11-29 10:55:01.000000000 -0500
+++ new/policycoreutils/semanage/semanage 2005-12-24 14:32:50.000000000 -0500
@@ -137,9 +137,12 @@ class seluserRecords:
def delete(self, name):
(rc,k)=semanage_user_key_create(self.sh, name)
+ (rc,exists_local)= semanage_user_exists_local(self.sh, k)
(rc,exists)= semanage_user_exists(self.sh, k)
if not exists:
raise ValueError("user %s is not defined" % name)
+ if not exists_local:
+ raise ValueError("user %s is built into policy, and cannot be deleted" % name)
semanage_begin_transaction(self.sh)
semanage_user_del_local(self.sh, k)
if semanage_commit(self.sh) != 0:
reply other threads:[~2005-12-24 19:53 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=43ADA74D.50405@cornell.edu \
--to=ivg2@cornell.edu \
--cc=SELinux@tycho.nsa.gov \
--cc=dwalsh@redhat.com \
--cc=sds@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.