Also libsemanage does not seem to work when adding.
Quoted 7 lines
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.
libsemanage/src/ports_file.c +11 -4
@@ -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 ) {