Add support for -R (recurse) to init chown builtin.

This is helpful for setting ownerships on entire directory trees,
such as sysfs and selinuxfs, particularly when the precise set of
files is dynamically generated at runtime.

Change-Id: I81070ea36fd7ffcab4ee8b3ef1bb0028d4b7839c
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
Allow system UID to setenforce and set booleans for SELinux.

Allow system UID to setenforce and set booleans for SELinux.
Boolean ownerships must also be reset upon policy reload as
the boolean files in selinuxfs are regenerated to match the new policy.
run-as:  set the SELinux security context.

Before invoking the specified command or a shell, set the
SELinux security context.

Change-Id: Ifc7f91aed9d298290b95d771484b322ed7a4c594
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
run-as:  Get seinfo from packages.list and pass to libselinux.
Document the SELinux extensions to the Android init language.

Change-Id: I9b066e0789c93e5147c28a60baeed91c44dd9359
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
Add persist.mac_enforcing_mode property

Conflicts:
	init/property_service.c
Label sockets consistently with the seclabel value if specified.

This is necessary to ensure that the adbd socket is created in the
adbd domain rather than the init domain.

Change-Id: Id4997d7f074aeefea62b41c87b46a6609e03f527
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
Change setsebool syntax to be consistent with other init built-ins.

Change setsebool syntax from name=value to name value.
This is to make it consistent with setprop and similar commands.
Update both the init built-in command and the toolbox command
for consistency.

Change-Id: I2c8e016ba26731c4a2ad4a49ae3b89362bf8f8a8
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>

Conflicts:
	init/builtins.c
toolbox: silence some compiler warnings

Comparison of signed and unsigned integers. Use parenthesis around a
group of bitwise OR operations.

Change-Id: Ia404380593ce2c2a291133c07c0fc7a016a3ad3f
Create a new location for /data policy files

Updating the location of policy files from
/data/system to /data/securtiy. Requires a
new directory to be created by init and an
update to the location of the
property_contexts file for property service.

Change-Id: Ibac2a84dfb403339bd169787cb5b7f24655be429
Fix mode on /data/security.
Reserve AID_AUDIT

AID_AUDIT will be used for an audit daemon for gathering
and controlling the Linux audit subsystem.

Change-Id: I95d597524b5547a60f3a59f692b4b0a6df0a9645

Conflicts:

	include/private/android_filesystem_config.h
Auditd initial commit

Initial commit for an audit daemon that
writes kernel audit messages to a log
file. The daemon runs in uid "audit" or
AID_AUDIT.

The log files are located at /data/misc/audit/
The daemon maintains two files at this location:
audit.log and optionally audit.old. On boot (
if the file is non-zero in size), or
when a fixed threshold is hit, the daemon rotates
audit.log to audit.old.

Optionally, if passed the -k option, the daemon polls
dmesg for all lines that contain "audit" and writes
them into the log. After that it continues to operate
as normal, receiving the messages from the netlink
socket.

Change-Id: I5b5037a5a8b39a054213848249afb7808f8b0ffa
Correct run-as with seinfo parsing capability.

Change-Id: I874ccf70bf4d113e294eeb3b7fa5ca7324ad52b3
Sync with master auditd.
sys/capability.h does not exist in the 4.2 bionic.
Fix perms on /data/security

installd and zygote need to be able
to search the directory to access
the policy files.

Change-Id: I0679fd2084d2664dfb5a594f493317eff058415d
Add support for socket security context specification.

Add an optional argument to the socket option for specifying
a SELinux security context for the socket.  Normally the socket
security context is automatically computed from the service security
context or set using the seclabel option, but this facility allows
dealing with two scenarios that cannot be addressed using the existing
mechanisms:
1) Use of logwrapper to wrap a service.
In this case, init cannot determine the service security context
as it does not directly execute it and we do not want logwrapper
to run in the same domain as the service.

2) Situations where a service has multiple sockets and we want to
label them distinctly.

Change-Id: I7ae9088c326a2140e56a8044bfb21a91505aea11
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>

Conflicts:
	init/init.c
	init/util.c
Explicitly add the theme manager's AID to fs config

SELinux failed to set the theme manager's context since the
app has a fixed non-user ID, and it didn't map to a pseudo-username.

Change-Id: I287dc0dd02abc164fe22e14c9f3f505c3dcb938d
Fix building without SELINUX

since the scon is now a mandatory arg, it needs to exist even if
NULL

Change-Id: I8ba31a7a8cf357e9b0c43cee81ab49d3eb192819