busybox -- SELinux option support for coreutils
PATCH 1/6 busybox -- SELinux option support for coreutils
[1/6] busybox-coreutils-common-01.patch
- usage.h for SELinux options
usage.h +21 -9
@@ -388,13 +388,15 @@"Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY" \"\n\nOptions:\n" \" -a Same as -dpR\n" \ + USAGE_SELINUX(" -c Preserves security context\n") \" -d,-P Preserve links\n" \" -H,-L Dereference all symlinks (implied by default)\n" \" -p Preserve file attributes if possible\n" \" -f Force, overwrite\n" \" -i Interactive, prompt before overwrite\n" \" -R,-r Copy directories recursively\n" \ -" -l,-s Create (sym)links" +" -l,-s Create (sym)links\n" \ + USAGE_SELINUX(" -Z CONTEXT\tset security context of copy to CONTEXT")#define cpio_trivial_usage \ "-[dimtuv][F cpiofile]"
@@ -1299,9 +1301,8 @@#define id_full_usage \ "Print information for USERNAME or the current user" \ "\n\nOptions:\n" \ - USE_SELINUX( \ - " -c Prints only the security context\n") \ - " -g Prints only the group ID\n" \ + USAGE_SELINUX(" -Z prints only the security context\n") \ + " -g Prints only the group ID\n" \ " -u Prints only the user ID\n" \ " -n Print a name instead of a number\n" \ " -r Prints the real user ID instead of the effective ID"
@@ -1519,7 +1520,9 @@" -m Set permission modes\n" \" -o Set ownership\n" \" -p Preserve date\n" \ -" -s Strip symbol tables" +" -s Strip symbol tables\n" \ + USAGE_SELINUX(" -P preserve security context\n") \ + USAGE_SELINUX(" Z CONTEXT set security context of copy to CONTEXT")#define ip_trivial_usage \ "[OPTIONS] {address | link | route | tunnel | rule} {COMMAND}"
@@ -1829,7 +1832,9 @@USE_SELINUX ( \ "\n -k Print security context") \USE_SELINUX ( \ - "\n -K Print security context in long format") + "\n -K Print security context in long format") \ +USE_SELINUX ( \ + "\n -Z Print security context and permission")#define lsattr_trivial_usage \ "[-Radlv] [files...]"
@@ -1974,7 +1979,9 @@"Create the DIRECTORY(ies) if they do not already exist" \"\n\nOptions:\n" \" -m Set permission mode (as in chmod), not rwxrwxrwx - umask\n" \ -" -p No error if existing, make parent directories as needed" +" -p No error if existing, make parent directories as needed\n" \ + USAGE_SELINUX(" -Z set security context") +#define mkdir_example_usage \ "$ mkdir /tmp/foo\n" \ "$ mkdir /tmp/foo\n" \
@@ -2019,7 +2026,8 @@#define mkfifo_full_usage \ "Create a named pipe (identical to 'mknod name p')" \ "\n\nOptions:\n" \ - " -m Create the pipe using the specified mode (default a=rw)" + " -m Create the pipe using the specified mode (default a=rw)\n" \ + USAGE_SELINUX(" -Z set security context")#define mkfs_minix_trivial_usage \ "[-c | -l filename] [-nXX] [-iXX] /dev/name [blocks]"
@@ -2041,7 +2049,9 @@"\n\nTYPEs include:\n" \" b: Make a block (buffered) device\n" \" c or u: Make a character (un-buffered) device\n" \ -" p: Make a named pipe. MAJOR and MINOR are ignored for named pipes" +" p: Make a named pipe. MAJOR and MINOR are ignored for named pipes\n" \ + USAGE_SELINUX(" -Z set security context") +#define mknod_example_usage \ "$ mknod /dev/fd0 b 2 0\n" \ "$ mknod -m 644 /tmp/pipe p\n"
@@ -2901,6 +2911,7 @@" -f Display filesystem status\n" \" -L,-l Dereference links\n" \" -t Display info in terse form" \ + USAGE_SELINUX(" -Z print security context\n") \USE_FEATURE_STAT_FORMAT ( \"\n\nValid format sequences for files:\n" \ " %a Access rights in octal\n" \
@@ -2935,6 +2946,7 @@" %c Total file nodes in file system\n" \" %d Free file nodes in file system\n" \" %f Free blocks in file system\n" \ + USAGE_SELINUX(" %C Security context in SELinux\n") \" %i File System ID in hex\n" \" %l Maximum length of filenames\n" \" %n File name\n" \
A message that is not in the archive (sent off-list or not yet received): [email protected]
Thank you for comments.
Quoted 21 lines · On Thu, 8 Feb 2007 23:32:43 +0100 Denis Vlasenko wrote:
Quoted 5 lines · Yuichi Nakamura
[1/6] busybox-coreutils-common-01.patch
-usage.hfor SELinux optionsSigned-off-by Yuichi Nakamura <[email protected]>(quoted diff) +2
-3@@ -1299,9 +1301,8 @@ #define id_full_usage \ "Print information for USERNAME or the current user" \ "\n\nOptions:\n" \ - USE_SELINUX( \ - " -c Prints only the security context\n") \ - " -g Prints only the group ID\n" \ + USAGE_SELINUX(" -Z prints only the security context\n") \ + " -g Prints only the group ID\n" \Well I can fix occasional problems but this is a bitt too much. I would prefer more careful formatting, like
Quoted 8 lines
USAGE_SELINUX( \ " -Z prints only the security context\n" \ ) \ " -g Prints only the group ID\n" \This helps to avoid misformatting in help texts.
The rest of this patch needs similar reformatting.
Fixed.
Quoted 3 lines
--
vda
We were porting SELinux option based on coreutils in Fedora Core6,
but Stephen recommended to check upstream coreutils.
So I have checked upstream coreutils and found some SELinux option has been changed. I have changed following:
* Removed -Z option from cp
* Added -Z and --preserve-context option to install
About cp, -c option is dropped in upstream and "--preserve=context" is used instead. However, cp in BusyBox does not have long options, so our patch still has -c option.
Yuichi Nakamura
usage.h +35 -9
@@ -388,13 +388,16 @@"Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY" \"\n\nOptions:\n" \" -a Same as -dpR\n" \ +USAGE_SELINUX ( \ +" -c Preserves security context\n" \ + ) \" -d,-P Preserve links\n" \" -H,-L Dereference all symlinks (implied by default)\n" \" -p Preserve file attributes if possible\n" \" -f Force, overwrite\n" \" -i Interactive, prompt before overwrite\n" \" -R,-r Copy directories recursively\n" \ -" -l,-s Create (sym)links" +" -l,-s Create (sym)links\n" #define cpio_trivial_usage \"-[dimtuv][F cpiofile]"
@@ -1299,9 +1302,10 @@#define id_full_usage \ "Print information for USERNAME or the current user" \ "\n\nOptions:\n" \ - USE_SELINUX( \ - " -c Prints only the security context\n") \ - " -g Prints only the group ID\n" \ + USAGE_SELINUX( \ + " -Z prints only the security context\n" \ + ) \ + " -g Prints only the group ID\n" \ " -u Prints only the user ID\n" \ " -n Print a name instead of a number\n" \ " -r Prints the real user ID instead of the effective ID"
@@ -1519,7 +1523,10 @@" -m Set permission modes\n" \" -o Set ownership\n" \" -p Preserve date\n" \ -" -s Strip symbol tables" +" -s Strip symbol tables\n" \ +USAGE_SELINUX ( \ +" Z Set security context of copy" \ + )#define ip_trivial_usage \ "[OPTIONS] {address | link | route | tunnel | rule} {COMMAND}"
@@ -1829,7 +1836,9 @@USE_SELINUX ( \ "\n -k Print security context") \USE_SELINUX ( \ - "\n -K Print security context in long format") + "\n -K Print security context in long format") \ +USE_SELINUX ( \ + "\n -Z Print security context and permission")#define lsattr_trivial_usage \ "[-Radlv] [files...]"
@@ -1974,7 +1983,11 @@"Create the DIRECTORY(ies) if they do not already exist" \"\n\nOptions:\n" \" -m Set permission mode (as in chmod), not rwxrwxrwx - umask\n" \ -" -p No error if existing, make parent directories as needed" +" -p No error if existing, make parent directories as needed\n" \ +USAGE_SELINUX ( \ +" -Z set security context" \ + ) +#define mkdir_example_usage \ "$ mkdir /tmp/foo\n" \ "$ mkdir /tmp/foo\n" \
@@ -2019,7 +2032,10 @@#define mkfifo_full_usage \ "Create a named pipe (identical to 'mknod name p')" \ "\n\nOptions:\n" \ - " -m Create the pipe using the specified mode (default a=rw)" + " -m Create the pipe using the specified mode (default a=rw)\n" \ + USAGE_SELINUX( \ + " -Z set security context" \ + )#define mkfs_minix_trivial_usage \ "[-c | -l filename] [-nXX] [-iXX] /dev/name [blocks]"
@@ -2041,7 +2057,11 @@"\n\nTYPEs include:\n" \" b: Make a block (buffered) device\n" \" c or u: Make a character (un-buffered) device\n" \ -" p: Make a named pipe. MAJOR and MINOR are ignored for named pipes" +" p: Make a named pipe. MAJOR and MINOR are ignored for named pipes\n" \ +USAGE_SELINUX ( \ +" -Z set security context" \ + ) +#define mknod_example_usage \ "$ mknod /dev/fd0 b 2 0\n" \ "$ mknod -m 644 /tmp/pipe p\n"
@@ -2901,6 +2921,9 @@" -f Display filesystem status\n" \" -L,-l Dereference links\n" \" -t Display info in terse form" \ +USAGE_SELINUX ( \ +" -Z print security context\n" \ + ) \USE_FEATURE_STAT_FORMAT ( \"\n\nValid format sequences for files:\n" \ " %a Access rights in octal\n" \
@@ -2935,6 +2958,9 @@" %c Total file nodes in file system\n" \" %d Free file nodes in file system\n" \" %f Free blocks in file system\n" \ +USAGE_SELINUX ( \ +" %C Security context in SELinux\n" \ + ) \" %i File System ID in hex\n" \" %l Maximum length of filenames\n" \" %n File name\n" \