Get rid of security_context_t and fix const declarations.

In attempting to enable building various part of Android with -Wall -Werror,
we found that the const security_context_t declarations in libselinux
are incorrect; const char * was intended, but const security_context_t
translates to char * const and triggers warnings on passing
const char * from the caller.   Easiest fix is to replace them all with
const char *.  And while we are at it, just get rid of all usage of
security_context_t itself as it adds no value - there is no true
encapsulation of the security context strings and callers already
directly use string functions on them.  typedef left to permit
building legacy users until such a time as all are updated.

This is a port of Change-Id I2f9df7bb9f575f76024c3e5f5b660345da2931a7
from Android, augmented to deal with all of the other code in upstream
libselinux and updating the man pages too.

Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
Acked-by: Eric Paris <eparis@redhat.com>
diff --git a/libselinux/src/avc_sidtab.c b/libselinux/src/avc_sidtab.c
index 0b696bb..52f21df 100644
--- a/libselinux/src/avc_sidtab.c
+++ b/libselinux/src/avc_sidtab.c
@@ -13,7 +13,7 @@
 #include "avc_sidtab.h"
 #include "avc_internal.h"
 
-static inline unsigned sidtab_hash(security_context_t key)
+static inline unsigned sidtab_hash(const char * key)
 {
 	char *p, *keyp;
 	unsigned int size;
@@ -46,18 +46,18 @@
 	return rc;
 }
 
-int sidtab_insert(struct sidtab *s, const security_context_t ctx)
+int sidtab_insert(struct sidtab *s, const char * ctx)
 {
 	int hvalue, rc = 0;
 	struct sidtab_node *newnode;
-	security_context_t newctx;
+	char * newctx;
 
 	newnode = (struct sidtab_node *)avc_malloc(sizeof(*newnode));
 	if (!newnode) {
 		rc = -1;
 		goto out;
 	}
-	newctx = (security_context_t) strdup(ctx);
+	newctx = (char *) strdup(ctx);
 	if (!newctx) {
 		rc = -1;
 		avc_free(newnode);
@@ -76,7 +76,7 @@
 
 int
 sidtab_context_to_sid(struct sidtab *s,
-		      const security_context_t ctx, security_id_t * sid)
+		      const char * ctx, security_id_t * sid)
 {
 	int hvalue, rc = 0;
 	struct sidtab_node *cur;