83 lines
2.9 KiB
Diff
83 lines
2.9 KiB
Diff
|
diff -up setools-3.3.7/libapol/src/policy-query.c~ setools-3.3.7/libapol/src/policy-query.c
|
||
|
diff -up setools-3.3.7/libqpol/include/qpol/type_query.h~ setools-3.3.7/libqpol/include/qpol/type_query.h
|
||
|
diff -up setools-3.3.7/libqpol/tests/iterators-tests.c~ setools-3.3.7/libqpol/tests/iterators-tests.c
|
||
|
diff -up setools-3.3.7/secmds/seinfo.c~ setools-3.3.7/secmds/seinfo.c
|
||
|
--- setools-3.3.7/secmds/seinfo.c~ 2013-03-25 11:30:23.161633059 -0400
|
||
|
+++ setools-3.3.7/secmds/seinfo.c 2013-03-28 13:08:07.281751011 -0400
|
||
|
@@ -46,6 +46,7 @@
|
||
|
#include <string.h>
|
||
|
#include <assert.h>
|
||
|
#include <getopt.h>
|
||
|
+#include <selinux/selinux.h>
|
||
|
|
||
|
#define COPYRIGHT_INFO "Copyright (C) 2003-2007 Tresys Technology, LLC"
|
||
|
|
||
|
@@ -54,6 +55,7 @@
|
||
|
|
||
|
static char *policy_file = NULL;
|
||
|
|
||
|
+static void print_type_aliases(FILE * fp, const qpol_type_t * type_datum, const apol_policy_t * policydb);
|
||
|
static void print_type_attrs(FILE * fp, const qpol_type_t * type_datum, const apol_policy_t * policydb, const int expand);
|
||
|
static void print_attr_types(FILE * fp, const qpol_type_t * type_datum, const apol_policy_t * policydb, const int expand);
|
||
|
static void print_user_roles(FILE * fp, const qpol_user_t * user_datum, const apol_policy_t * policydb, const int expand);
|
||
|
@@ -511,6 +513,7 @@ static int print_types(FILE * fp, const
|
||
|
if (qpol_policy_get_type_by_name(q, name, &type_datum))
|
||
|
goto cleanup;
|
||
|
print_type_attrs(fp, type_datum, policydb, expand);
|
||
|
+ print_type_aliases(fp, type_datum, policydb);
|
||
|
} else {
|
||
|
if (qpol_policy_get_type_iter(q, &iter))
|
||
|
goto cleanup;
|
||
|
@@ -1897,6 +1900,51 @@ int main(int argc, char **argv)
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
+ * Prints the alias of a type.
|
||
|
+ *
|
||
|
+ * @param fp Reference to a file to which to print type information
|
||
|
+ * @param type_datum Reference to sepol type_datum
|
||
|
+ * @param policydb Reference to a policy
|
||
|
+ * attributes
|
||
|
+ */
|
||
|
+static void print_type_aliases(FILE * fp, const qpol_type_t * type_datum, const apol_policy_t * policydb)
|
||
|
+{
|
||
|
+ qpol_iterator_t *iter = NULL;
|
||
|
+ size_t alias_size;
|
||
|
+ unsigned char isattr, isalias;
|
||
|
+ const char *type_name = NULL;
|
||
|
+ const char *alias_name;
|
||
|
+ qpol_policy_t *q = apol_policy_get_qpol(policydb);
|
||
|
+
|
||
|
+ if (qpol_type_get_name(q, type_datum, &type_name))
|
||
|
+ goto cleanup;
|
||
|
+ if (qpol_type_get_isattr(q, type_datum, &isattr))
|
||
|
+ goto cleanup;
|
||
|
+ if (qpol_type_get_isalias(q, type_datum, &isalias))
|
||
|
+ goto cleanup;
|
||
|
+
|
||
|
+ if (isalias) {
|
||
|
+ fprintf(fp, " TypeName %s\n", type_name);
|
||
|
+ }
|
||
|
+ if (qpol_type_get_alias_iter(q, type_datum, &iter))
|
||
|
+ goto cleanup;
|
||
|
+ if (qpol_iterator_get_size(iter, &alias_size))
|
||
|
+ goto cleanup;
|
||
|
+ if (alias_size > 0) {
|
||
|
+ fprintf(fp, " Aliases\n");
|
||
|
+ for (; !qpol_iterator_end(iter); qpol_iterator_next(iter)) {
|
||
|
+ if (qpol_iterator_get_item(iter, (void **)&alias_name))
|
||
|
+ goto cleanup;
|
||
|
+ fprintf(fp, " %s\n", alias_name);
|
||
|
+ }
|
||
|
+ }
|
||
|
+
|
||
|
+ cleanup:
|
||
|
+ qpol_iterator_destroy(&iter);
|
||
|
+ return;
|
||
|
+}
|
||
|
+
|
||
|
+/**
|
||
|
* Prints a textual representation of a type, and possibly
|
||
|
* all of that type's attributes.
|
||
|
*
|