All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: Also libsemanage does not seem to work when adding.
       [not found]   ` <43BC3BFA.4020606@redhat.com>
@ 2006-01-04 19:59     ` Ivan Gyurdiev
  0 siblings, 0 replies; only message in thread
From: Ivan Gyurdiev @ 2006-01-04 19:59 UTC (permalink / raw)
  To: Daniel J Walsh; +Cc: SELinux List, Stephen Smalley

[-- 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) {

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-01-04 19:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <43BC37D9.5010201@redhat.com>
     [not found] ` <43BC1DFA.5020106@cornell.edu>
     [not found]   ` <43BC3BFA.4020606@redhat.com>
2006-01-04 19:59     ` Also libsemanage does not seem to work when adding Ivan Gyurdiev

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.