From: Daniel J Walsh <dwalsh@redhat.com>
To: Stephen Smalley <sds@tycho.nsa.gov>
Cc: Darrel Goeddel <dgoeddel@TrustedCS.com>,
SE Linux <selinux@tycho.nsa.gov>
Subject: Re: libselinux category patch
Date: Wed, 24 Aug 2005 09:27:16 -0400 [thread overview]
Message-ID: <430C75B4.3020008@redhat.com> (raw)
In-Reply-To: <1124820200.7874.163.camel@moss-spartans.epoch.ncsc.mil>
[-- Attachment #1: Type: text/plain, Size: 108 bytes --]
I still want at least the set_comp diff to allow me to set level to
NULL, so it does not show up.
--
[-- Attachment #2: diff --]
[-- Type: text/plain, Size: 6518 bytes --]
diff --exclude-from=exclude -N -u -r nsalibselinux/src/compute_relabel.c libselinux-1.25.3/src/compute_relabel.c
--- nsalibselinux/src/compute_relabel.c 2005-08-24 09:07:11.000000000 -0400
+++ libselinux-1.25.3/src/compute_relabel.c 2005-08-24 09:13:57.000000000 -0400
@@ -20,6 +20,7 @@
size_t size;
int fd, ret;
+ *newcon=NULL;
snprintf(path, sizeof path, "%s/relabel", selinux_mnt);
fd = open(path, O_RDWR);
if (fd < 0)
diff --exclude-from=exclude -N -u -r nsalibselinux/src/compute_user.c libselinux-1.25.3/src/compute_user.c
--- nsalibselinux/src/compute_user.c 2005-08-24 09:07:11.000000000 -0400
+++ libselinux-1.25.3/src/compute_user.c 2005-08-24 09:13:57.000000000 -0400
@@ -21,6 +21,7 @@
int fd, ret;
unsigned int i, nel;
+ *con = NULL;
snprintf(path, sizeof path, "%s/user", selinux_mnt);
fd = open(path, O_RDWR);
if (fd < 0)
diff --exclude-from=exclude -N -u -r nsalibselinux/src/context.c libselinux-1.25.3/src/context.c
--- nsalibselinux/src/context.c 2005-08-22 16:37:00.000000000 -0400
+++ libselinux-1.25.3/src/context.c 2005-08-24 09:13:57.000000000 -0400
@@ -137,19 +137,23 @@
static int set_comp(context_private_t* n,int index, const char *str)
{
- char *t = (char*) malloc(strlen(str)+1);
+ char *t = NULL;
const char *p;
- if ( !t ) { return 1; }
- for ( p = str; *p; p++ ) {
- if ( *p == '\t' || *p == ' ' || *p == '\n' || *p == '\r' ||
- (*p == ':' && index != COMP_RANGE) ) {
- free(t);
- return 1;
- }
- }
- conditional_free(&n->component[index]);
+ if (str) {
+ t=(char*) malloc(strlen(str)+1);
+ if ( !t ) { return 1; }
+ for ( p = str; *p; p++ ) {
+ if ( *p == '\t' || *p == '\n' || *p == '\r' ||
+ ((*p == ':' || *p == ' ') && index != COMP_RANGE) ) {
+ free(t);
+ return 1;
+ }
+ }
+ }
+ conditional_free(&n->component[index]);
+ if (str)
+ strcpy(t,str);
n->component[index] = t;
- strcpy(t,str);
return 0;
}
diff --exclude-from=exclude -N -u -r nsalibselinux/src/fgetfilecon.c libselinux-1.25.3/src/fgetfilecon.c
--- nsalibselinux/src/fgetfilecon.c 2005-08-24 09:07:11.000000000 -0400
+++ libselinux-1.25.3/src/fgetfilecon.c 2005-08-24 09:13:57.000000000 -0400
@@ -13,6 +13,7 @@
ssize_t size;
ssize_t ret;
+ *context = NULL;
size = INITCONTEXTLEN+1;
buf = malloc(size);
if (!buf)
diff --exclude-from=exclude -N -u -r nsalibselinux/src/getcon.c libselinux-1.25.3/src/getcon.c
--- nsalibselinux/src/getcon.c 2005-08-24 09:07:11.000000000 -0400
+++ libselinux-1.25.3/src/getcon.c 2005-08-24 09:13:57.000000000 -0400
@@ -14,6 +14,7 @@
int fd;
ssize_t ret;
+ *context=NULL;
fd = open("/proc/self/attr/current", O_RDONLY);
if (fd < 0)
return -1;
diff --exclude-from=exclude -N -u -r nsalibselinux/src/getexeccon.c libselinux-1.25.3/src/getexeccon.c
--- nsalibselinux/src/getexeccon.c 2005-08-24 09:07:11.000000000 -0400
+++ libselinux-1.25.3/src/getexeccon.c 2005-08-24 09:13:57.000000000 -0400
@@ -14,6 +14,7 @@
int fd;
ssize_t ret;
+ *context = NULL;
fd = open("/proc/self/attr/exec", O_RDONLY);
if (fd < 0)
return -1;
diff --exclude-from=exclude -N -u -r nsalibselinux/src/getfilecon.c libselinux-1.25.3/src/getfilecon.c
--- nsalibselinux/src/getfilecon.c 2005-08-24 09:07:11.000000000 -0400
+++ libselinux-1.25.3/src/getfilecon.c 2005-08-24 09:15:03.000000000 -0400
@@ -13,6 +13,7 @@
ssize_t size;
ssize_t ret;
+ *context = NULL;
size = INITCONTEXTLEN+1;
buf = malloc(size);
if (!buf)
diff --exclude-from=exclude -N -u -r nsalibselinux/src/getfscreatecon.c libselinux-1.25.3/src/getfscreatecon.c
--- nsalibselinux/src/getfscreatecon.c 2005-08-24 09:07:11.000000000 -0400
+++ libselinux-1.25.3/src/getfscreatecon.c 2005-08-24 09:13:57.000000000 -0400
@@ -14,6 +14,7 @@
int fd;
ssize_t ret;
+ *context = NULL;
fd = open("/proc/self/attr/fscreate", O_RDONLY);
if (fd < 0)
return -1;
diff --exclude-from=exclude -N -u -r nsalibselinux/src/getpeercon.c libselinux-1.25.3/src/getpeercon.c
--- nsalibselinux/src/getpeercon.c 2005-08-24 09:07:11.000000000 -0400
+++ libselinux-1.25.3/src/getpeercon.c 2005-08-24 09:13:57.000000000 -0400
@@ -17,6 +17,7 @@
socklen_t size;
ssize_t ret;
+ *context = NULL;
size = INITCONTEXTLEN+1;
buf = malloc(size);
if (!buf)
diff --exclude-from=exclude -N -u -r nsalibselinux/src/getpidcon.c libselinux-1.25.3/src/getpidcon.c
--- nsalibselinux/src/getpidcon.c 2005-08-24 09:07:11.000000000 -0400
+++ libselinux-1.25.3/src/getpidcon.c 2005-08-24 09:13:57.000000000 -0400
@@ -16,6 +16,7 @@
int fd;
ssize_t ret;
+ *context = NULL;
snprintf(path, sizeof path, "/proc/%d/attr/current", pid);
fd = open(path, O_RDONLY);
diff --exclude-from=exclude -N -u -r nsalibselinux/src/getprevcon.c libselinux-1.25.3/src/getprevcon.c
--- nsalibselinux/src/getprevcon.c 2005-08-24 09:07:11.000000000 -0400
+++ libselinux-1.25.3/src/getprevcon.c 2005-08-24 09:13:57.000000000 -0400
@@ -14,6 +14,7 @@
int fd;
ssize_t ret;
+ *context = NULL;
fd = open("/proc/self/attr/prev", O_RDONLY);
if (fd < 0)
return -1;
diff --exclude-from=exclude -N -u -r nsalibselinux/src/lgetfilecon.c libselinux-1.25.3/src/lgetfilecon.c
--- nsalibselinux/src/lgetfilecon.c 2005-08-24 09:07:11.000000000 -0400
+++ libselinux-1.25.3/src/lgetfilecon.c 2005-08-24 09:13:57.000000000 -0400
@@ -13,6 +13,7 @@
ssize_t size;
ssize_t ret;
+ *context = NULL;
size = INITCONTEXTLEN+1;
buf = malloc(size);
if (!buf)
diff --exclude-from=exclude -N -u -r nsalibselinux/src/trans.c libselinux-1.25.3/src/trans.c
--- nsalibselinux/src/trans.c 2005-08-23 13:34:34.000000000 -0400
+++ libselinux-1.25.3/src/trans.c 2005-08-24 09:13:57.000000000 -0400
@@ -6,8 +6,8 @@
int trans_to_raw_context(char *raw, char **transp)
{
+ *transp = NULL;
if (!raw) {
- *transp = NULL;
return 0;
}
@@ -19,8 +19,8 @@
int raw_to_trans_context(char *trans, char **rawp)
{
+ *rawp = NULL;
if (!trans) {
- *rawp = NULL;
return 0;
}
diff --exclude-from=exclude -N -u -r nsalibselinux/utils/getfilecon.c libselinux-1.25.3/utils/getfilecon.c
--- nsalibselinux/utils/getfilecon.c 2005-01-20 16:05:24.000000000 -0500
+++ libselinux-1.25.3/utils/getfilecon.c 2005-08-24 09:13:57.000000000 -0400
@@ -21,6 +21,9 @@
}
printf("%s\t%s\n", argv[i], buf);
freecon(buf);
+ rc = getfilecon_raw(argv[i], &buf);
+ printf("%s\t%s\n", argv[i], buf);
+ freecon(buf);
}
exit(0);
}
next prev parent reply other threads:[~2005-08-24 13:27 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-22 20:21 libselinux category patch Daniel J Walsh
2005-08-23 13:45 ` Stephen Smalley
2005-08-24 14:19 ` Darrel Goeddel
2005-08-24 14:34 ` Stephen Smalley
2005-08-23 14:06 ` Joshua Brindle
2005-08-23 14:18 ` Daniel J Walsh
2005-08-23 14:50 ` Stephen Smalley
2005-08-23 15:11 ` Daniel J Walsh
2005-08-23 16:15 ` Stephen Smalley
2005-08-24 14:34 ` Darrel Goeddel
2005-08-24 14:39 ` Joshua Brindle
2005-08-23 14:27 ` Stephen Smalley
2005-08-23 15:02 ` Daniel J Walsh
2005-08-23 15:04 ` Stephen Smalley
2005-08-24 14:48 ` Darrel Goeddel
2005-08-24 14:49 ` Stephen Smalley
2005-08-23 16:52 ` Stephen Smalley
2005-08-23 17:21 ` Stephen Smalley
2005-08-23 18:03 ` Stephen Smalley
2005-08-23 18:10 ` Stephen Smalley
2005-08-24 13:27 ` Daniel J Walsh [this message]
2005-08-24 14:13 ` Stephen Smalley
2005-08-24 14:24 ` Daniel J Walsh
2005-08-24 14:50 ` Ok I plead ignorance to the way MLS works Daniel J Walsh
2005-08-24 16:44 ` Darrel Goeddel
2005-08-24 16:56 ` Stephen Smalley
2005-08-24 17:27 ` Daniel J Walsh
2005-08-24 17:40 ` Stephen Smalley
2005-08-24 19:14 ` James Morris
2005-08-24 19:36 ` libselinux category patch Stephen Smalley
2005-08-23 17:54 ` Daniel J Walsh
2005-08-25 14:19 ` Stephen Smalley
-- strict thread matches above, loose matches on Subject: below --
2005-08-24 20:18 Chad Hanson
2005-08-25 14:56 ` Stephen Smalley
2005-08-25 20:43 Chad Hanson
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=430C75B4.3020008@redhat.com \
--to=dwalsh@redhat.com \
--cc=dgoeddel@TrustedCS.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.