All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ivan Gyurdiev <ivg2@cornell.edu>
To: Daniel J Walsh <dwalsh@redhat.com>
Cc: SELinux List <SELinux@tycho.nsa.gov>,
	Stephen Smalley <sds@tycho.nsa.gov>
Subject: Re: Also libsemanage does not seem to work when adding.
Date: Wed, 04 Jan 2006 14:59:18 -0500	[thread overview]
Message-ID: <43BC2916.4000909@cornell.edu> (raw)
In-Reply-To: <43BC3BFA.4020606@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 590 bytes --]


> libsemanage.parse_assert_space: missing whitespace 
> (/etc/selinux/targeted/modules/active/ports.local: 1):
> portcon tcp 123456 system_u:object_r:http_port_t:s0
> libsemanage.port_parse: could not parse port record
> libsemanage.dbase_file_cache: could not cache file database
> libsemanage.enter_ro: could not enter read-only section
> Segmentation fault
Fix for single ports parser attached - I had only tried ranges.
Not sure what's going on with this segfault - try to reproduce again, 
and make sure
that all rc values are checked before proceeding to the next semanage call.





[-- Attachment #2: libsemanage.fix_ports_parser.diff --]
[-- Type: text/x-patch, Size: 1294 bytes --]

diff -Naurp --exclude man --exclude-from excludes old/libsemanage/src/ports_file.c new/libsemanage/src/ports_file.c
--- old/libsemanage/src/ports_file.c	2006-01-04 10:47:45.000000000 -0500
+++ new/libsemanage/src/ports_file.c	2006-01-04 14:49:19.000000000 -0500
@@ -99,22 +99,29 @@ static int port_parse(
 	if (parse_fetch_int(handle, info, &low, '-') < 0)
 		goto err;
 
-	if (parse_skip_space(handle, info) < 0)
-		goto err;
+	/* If range (-) does not follow immediately, require a space 
+	 * In other words, the space here is optional, but only
+	 * in the ranged case, not in the single port case,
+	 * so do a custom test */
+	if (*(info->ptr) && *(info->ptr) != '-') {
+		if (parse_assert_space(handle, info) < 0)
+			goto err;
+	}
+
 	if (parse_optional_ch(info, '-') != STATUS_NODATA) {
 
 		if (parse_skip_space(handle, info) < 0)
 			goto err;	
 		if (parse_fetch_int(handle, info, &high, ' ') < 0)
 			goto err;
+		if (parse_assert_space(handle, info) < 0)
+			goto err;
 		semanage_port_set_range(port, low, high);
 	}
 	else 
 		semanage_port_set_port(port, low);
 
         /* Port context */
-	if (parse_assert_space(handle, info) < 0)
-		goto err;
 	if (parse_fetch_string(handle, info, &str, ' ') < 0)
 		goto err;
 	if (semanage_context_from_string(handle, str, &con) < 0) {

           reply	other threads:[~2006-01-04 19:59 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <43BC3BFA.4020606@redhat.com>]

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=43BC2916.4000909@cornell.edu \
    --to=ivg2@cornell.edu \
    --cc=SELinux@tycho.nsa.gov \
    --cc=dwalsh@redhat.com \
    --cc=sds@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.