From: Daniel J Walsh <dwalsh@redhat.com>
To: Steve Lawrence <slawrence@tresys.com>
Cc: selinux@tycho.nsa.gov
Subject: Re: [PATCH] Add chcon method to libselinux python bindings
Date: Tue, 08 Jun 2010 07:58:43 -0400 [thread overview]
Message-ID: <4C0E3073.7010803@redhat.com> (raw)
In-Reply-To: <1275946805-9194-1-git-send-email-slawrence@tresys.com>
I like it, I have basically the same code in sandbox. and would move to
this implementation if it is added to libselinux.
On 06/07/2010 05:40 PM, Steve Lawrence wrote:
> Adds a chcon method to the libselinux python bindings to change the
> context of a file/directory tree.
> ---
> libselinux/src/selinuxswig_python.i | 8 ++++++++
> 1 files changed, 8 insertions(+), 0 deletions(-)
>
> diff --git a/libselinux/src/selinuxswig_python.i b/libselinux/src/selinuxswig_python.i
> index 8b34c99..dea0e80 100644
> --- a/libselinux/src/selinuxswig_python.i
> +++ b/libselinux/src/selinuxswig_python.i
> @@ -21,6 +21,14 @@ def restorecon(path, recursive=False):
> map(restorecon, [os.path.join(dirname, fname)
> for fname in fnames]), None)
>
> +def chcon(path, context, recursive=False):
> + """ Set the SELinux context on a given path """
> + lsetfilecon(path, context)
> + if recursive:
> + for root, dirs, files in os.walk(path):
> + for name in files + dirs:
> + lsetfilecon(os.path.join(root,name), context)
> +
> def copytree(src, dest):
> """ An SELinux-friendly shutil.copytree method """
> shutil.copytree(src, dest)
--
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.
next prev parent reply other threads:[~2010-06-08 11:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-07 21:40 [PATCH] Add chcon method to libselinux python bindings Steve Lawrence
2010-06-08 11:58 ` Daniel J Walsh [this message]
2010-06-10 21:04 ` Chad Sellers
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=4C0E3073.7010803@redhat.com \
--to=dwalsh@redhat.com \
--cc=selinux@tycho.nsa.gov \
--cc=slawrence@tresys.com \
/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.