All of lore.kernel.org
 help / color / mirror / Atom feed
* matchpathcon regcomp return code
@ 2005-10-05  6:14 Johan Fischer
  2005-10-05 13:19 ` Stephen Smalley
  0 siblings, 1 reply; 11+ messages in thread
From: Johan Fischer @ 2005-10-05  6:14 UTC (permalink / raw)
  To: SELinux

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

Hi list,

Well, first message here (yeah).

I have a double problem with restorecon crashing with a segfault.

Some background of the situation:
using centos4 with a cutsomized (not much) targeted selinux policy.
Trying to make the httpd server access /var/lib/svn (svn repositories)
which is a separate ext3 fs.

so basically, I changed the src/policy/file_contexts/types.fc and added
'/var/lib/svn/lost\+found(/.*)?  system_u:object_r:lost_found_t'
to keep my lost+found dir secured.

and changed my apache.fc file to add /var/lib/svn(/.*) to another type
accessible by apache (let's say system_u:object_r:httpd_sys_content_t
but could be anything else...)

Anyway, This configuration will not work as expected since the apache.fc
file is concatened after the types.fc, the lost+found will get the
httpd_sys_content_t type....

So I tried to use a bit of regex and set up a look ahead assertion to
avoid the lost+found and use the following regex (tested with perl happily):

/var/lib/svn(?!(/.*)?/lost\\+found)(/.*)?

Now the problem is restorecon is crashing (segfault in matchpathcon)

About the crashing, it seems that the error code check of regcomp in
matchpathcon.c is wrong (see attached patch from CVS HEAD).

The second question is actually, is lookaround supported at all in posix
regex ?

Cheers.
J.

-- 
Johan Fischer
Capital Markets CRC Limited
Level 2, 9 Castlereagh Street, Sydney NSW 2000
Tel: +61 2 9233 7999   Direct: +61 2 9236 9150
Fax: +61 2 9236 9177   http://www.cmcrc.com

Capital Markets CRC Ltd (CMCRC) - Confidential Communication
The information contained in this e-mail is confidential.  It is intended solely for the addressee. If you receive this e-mail by mistake please promptly inform us by reply e-mail and then delete the e-mail and destroy any printed copy. You must not disclose or use in any way the information in the e-mail. There is no warranty that this e-mail is error or virus free. It may be a private communication, and if so, does not represent the views of the CMCRC and its associates. If it is a private communication, care should be taken in opening it to ensure that undue offence is not given.


[-- Attachment #2: matchpathcon.c.diff --]
[-- Type: text/plain, Size: 390 bytes --]

--- matchpathcon.c	2005-10-05 15:33:38.000000000 +1000
+++ matchpathcon.c.new	2005-10-05 15:33:26.000000000 +1000
@@ -501,7 +501,7 @@
 			regcomp(&spec_arr[nspec].regex,
 				anchored_regex,
 				REG_EXTENDED | REG_NOSUB);
-		if (regerr < 0) {
+		if (regerr != 0) {
 			myprintf("%s:  line %d has invalid regex %s\n", path, lineno, anchored_regex); 
 			free(anchored_regex);
 			return 0;

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2005-10-11 12:07 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-05  6:14 matchpathcon regcomp return code Johan Fischer
2005-10-05 13:19 ` Stephen Smalley
2005-10-05 14:29   ` Christopher J. PeBenito
2005-10-05 14:34     ` Stephen Smalley
2005-10-06 17:38       ` Christopher J. PeBenito
2005-10-06 18:42         ` Stephen Smalley
2005-10-06 21:28           ` Christopher J. PeBenito
2005-10-07  2:01         ` Johan Fischer
2005-10-05 16:17   ` Stephen Smalley
2005-10-10 14:03   ` Christopher J. PeBenito
2005-10-11 12:07     ` Stephen Smalley

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.