All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luke Kenneth Casson Leighton <lkcl@lkcl.net>
To: Stephen Smalley <sds@epoch.ncsc.mil>
Cc: Daniel J Walsh <dwalsh@redhat.com>,
	SELinux <SELinux@tycho.nsa.gov>,
	Colin Walters <walters@redhat.com>
Subject: Re: Proposed patch for libselinux
Date: Fri, 22 Oct 2004 16:56:40 +0100	[thread overview]
Message-ID: <20041022155639.GA4986@lkcl.net> (raw)
In-Reply-To: <1098449318.7614.13.camel@moss-spartans.epoch.ncsc.mil>

or if it's a boolean (1 or 0) then store a char instead:

	char val;
	int err = getxattr(path, ..., &val, sizeof(val);
	*perm = val;
	return err;

On Fri, Oct 22, 2004 at 08:48:39AM -0400, Stephen Smalley wrote:

> On Thu, 2004-10-21 at 17:35, Daniel J Walsh wrote:
> > diff --exclude-from=exclude -N -u -r nsalibselinux/src/getfilecon.c libselinux-1.17.15/src/getfilecon.c
> > --- nsalibselinux/src/getfilecon.c	2004-10-20 16:31:36.000000000 -0400
> > +++ libselinux-1.17.15/src/getfilecon.c	2004-10-20 16:35:52.000000000 -0400
> > @@ -4,7 +4,7 @@
> >  #include <selinux/selinux.h>
> >  #include <stdlib.h>
> >  #include <errno.h>
> > -#include <sys/xattr.h>
> > +#include <attr/xattr.h>
> >  #include "policy.h"
> 
> This is wrong; glibc directly provides [gs]etxattr for all modern glibc
> versions built against modern kernel headers; you don't need to use
> libattr.  We originally used attr/xattr.h and then migrated a long time
> ago.
> 
> > +int getfileconperm(const char *path, int *perm)
> > +{
> > +	*perm=0;
> > +	return getxattr(path, XATTR_NAME_SELINUX_PERM, perm, sizeof(*perm));
> > +}
> 
> Directly storing an integer in the xattr?  Endianness issues; you need
> to convert to a particular ordering before setting and convert back when
> getting.
> 
> -- 
> Stephen Smalley <sds@epoch.ncsc.mil>
> National Security Agency
> 
> 
> --
> 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.

-- 
--
you don't have to BE MAD   | this space    | my brother wanted to join mensa,
  to work, but   IT HELPS  |   for rent    | for an ego trip - and get kicked 
 you feel better!  I AM    | can pay cash  | out for a even bigger one.
--

--
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.

  parent reply	other threads:[~2004-10-22 15:45 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-21 21:35 Proposed patch for libselinux Daniel J Walsh
2004-10-22 12:48 ` Stephen Smalley
2004-10-22 13:22   ` Daniel J Walsh
2004-10-22 13:44     ` Stephen Smalley
2004-10-22 14:22       ` Daniel J Walsh
2004-10-22 15:56   ` Luke Kenneth Casson Leighton [this message]
2004-10-22 19:55     ` Daniel J Walsh
2004-10-22 20:22     ` Daniel J Walsh
2004-10-25 14:52       ` Stephen Smalley
2004-10-25 15:31         ` Colin Walters
2004-10-25 18:00         ` Daniel J Walsh
2004-10-26 14:21         ` Luke Kenneth Casson Leighton
2004-10-26 14:13           ` Stephen Smalley
2004-10-26 15:21             ` Luke Kenneth Casson Leighton
2004-10-26 18:05           ` Luke Kenneth Casson Leighton
2004-10-29 23:28   ` Proposed patch for libselinux -- xdr ??? Nifty Hat Mitch
2004-10-22 13:23 ` Proposed patch for libselinux Stephen Smalley
2004-10-22 13:45   ` Daniel J Walsh
2004-10-22 14:15     ` Stephen Smalley
2004-10-22 14:24       ` Daniel J Walsh
2004-10-22 14:30         ` Stephen Smalley
2004-10-22 18:01           ` Daniel J Walsh

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=20041022155639.GA4986@lkcl.net \
    --to=lkcl@lkcl.net \
    --cc=SELinux@tycho.nsa.gov \
    --cc=dwalsh@redhat.com \
    --cc=sds@epoch.ncsc.mil \
    --cc=walters@redhat.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.