All of lore.kernel.org
 help / color / mirror / Atom feed
* infelicity in context_user_set; new syscalls: setfileconat, etc.?
@ 2006-07-29 14:50 Jim Meyering
  2006-07-31  4:58 ` Valdis.Kletnieks
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Jim Meyering @ 2006-07-29 14:50 UTC (permalink / raw)
  To: SELinux

Hello,

I've just discovered what may be a documentation error
for context_user_set, context_role_set, etc.

Those functions are documented as setting errno upon failure,
yet the following program prints "failed with errno=0":

  #include <stdio.h>
  #include <errno.h>
  #include <selinux/context.h>

  int
  main ()
  {
    context_t c = context_new ("a:b:c");
    if (!c)
      return 1;
    errno = 0;
    if (context_user_set (c, ":") != 0)
      printf ("failed with errno=%d\n", errno);
    return 0;
  }

FYI, as part of merging the coreutils SE Linux changes "upstream",
I've just rewritten chcon to use fts (and new openat-style functions,
getfileconat, lgetfileconat, setfileconat, lsetfileconat[*]).  Now,
chcon -R can operate on an arbitrarily deep hierarchy.
One test was to process a 100K-level hierarchy -- finished in just 19sec.
The old version chokes on PATH_MAX at a depth of 2k.

Can any of you point me to a test suite for chcon.
That might save me the trouble of writing my own.

Jim

[*] With linux and /proc, I can emulate functions like openat and
setfileconat, but not everyone has linux, and some linux environments
lack access to /proc, so...

Has anyone considered adding these system calls?
  getfileconat
  lgetfileconat
  setfileconat
  lsetfileconat

They'd be useful for the same reasons openat, lstatat, etc.
are useful (and are now in the Linux kernel).

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2006-08-01 20:17 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-29 14:50 infelicity in context_user_set; new syscalls: setfileconat, etc.? Jim Meyering
2006-07-31  4:58 ` Valdis.Kletnieks
2006-07-31  8:39   ` Jim Meyering
2006-07-31 12:35     ` Russell Coker
2006-07-31 13:27       ` Jim Meyering
2006-07-31 13:26 ` Karl MacMillan
2006-07-31 13:48   ` Jim Meyering
2006-07-31 14:01     ` Stephen Smalley
2006-07-31 14:21       ` Jim Meyering
2006-07-31 14:02     ` Karl MacMillan
2006-07-31 16:37   ` Jim Meyering
2006-08-01 20:17     ` Stephen Smalley
2006-07-31 13:44 ` Stephen Smalley

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.