From: "Joshua Brindle" <method@manicmethod.com>
To: selinux@tycho.nsa.gov
Cc: sds@tycho.nsa.gov, paul.moore@hp.com
Subject: [patch 2/2] Peersid capability support
Date: Wed, 07 Nov 2007 15:50:49 -0500 [thread overview]
Message-ID: <20071107205333.697495852@manicmethod.com> (raw)
In-Reply-To: 20071107205047.102519666@manicmethod.com
Peersid capability support, keys the peersid capability on the peer object class.
---
libsepol/src/polcaps.c | 26 ++++++++++++++++++++++++++
libsepol/src/polcaps.h | 8 ++++++++
libsepol/src/write.c | 3 +++
3 files changed, 37 insertions(+)
--- /dev/null
+++ trunk/libsepol/src/polcaps.c
@@ -0,0 +1,26 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+
+#include <sepol/policydb/policydb.h>
+#include "polcaps.h"
+
+int sepol_setup_capabilities(policydb_t *pol)
+{
+
+ if (!pol)
+ return POLICYDB_ERROR;
+
+ /* Each capability should be keyed in some way,
+ * such as the existance of an object class */
+
+ /* POLICYDB_CAPABILITY_NETPEER */
+ if (hashtab_search(pol->symtab[SYM_CLASSES].table, "peer")) {
+ if (ebitmap_set_bit(&pol->policycaps,
+ POLICY_CAPABILITY_NETPEER, 1))
+ return POLICYDB_ERROR;
+ }
+
+ return POLICYDB_SUCCESS;
+
+}
--- /dev/null
+++ trunk/libsepol/src/polcaps.h
@@ -0,0 +1,8 @@
+#ifndef _SEPOL_INTERNAL_POLCAP_H_
+#define _SEPOL_INTERNAL_POLCAP_H_
+
+extern int sepol_setup_capabilities(policydb_t *pol);
+
+#define POLICY_CAPABILITY_NETPEER 1
+
+#endif
--- trunk.orig/libsepol/src/write.c
+++ trunk/libsepol/src/write.c
@@ -44,6 +44,7 @@
#include "debug.h"
#include "private.h"
#include "mls.h"
+#include "polcaps.h"
struct policy_data {
struct policy_file *fp;
@@ -1577,6 +1578,8 @@ int policydb_write(policydb_t * p, struc
return POLICYDB_ERROR;
if (p->policyvers >= POLICYDB_VERSION_POLCAP) {
+ if (sepol_setup_capabilities(p))
+ return POLICYDB_ERROR;
if (ebitmap_write(&p->policycaps, fp) == -1)
return POLICYDB_ERROR;
}
--
--
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.
next prev parent reply other threads:[~2007-11-07 20:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-07 20:50 [patch 0/2] policy capabilities and netpeer support Joshua Brindle
2007-11-07 20:50 ` [patch 1/2] Version 22/Policy capability support Joshua Brindle
2007-11-07 20:50 ` Joshua Brindle [this message]
2007-11-07 21:07 ` [patch 2/2] Peersid " Stephen Smalley
2007-11-07 21:23 ` Joshua Brindle
2007-11-07 21:54 ` Paul Moore
2007-11-07 22:12 ` Joshua Brindle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071107205333.697495852@manicmethod.com \
--to=method@manicmethod.com \
--cc=paul.moore@hp.com \
--cc=sds@tycho.nsa.gov \
--cc=selinux@tycho.nsa.gov \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.