[apparmor] [patch 04/24] make the parse_sub_mode code more generic

Steve Beattie steve at nxnw.org
Wed Mar 12 06:19:32 UTC 2014


On Fri, Mar 07, 2014 at 09:31:25AM -0800, john.johansen at canonical.com wrote:
> Make it more generic so that it can be shared with signals.
> 
> Signed-off-by: John Johansen <john.johansen at canonical.com>

So this looks good enough for Acked-by: Steve Beattie <steve at nxnw.org>,
just one question:

> +static int parse_X_sub_mode(const char *X, const char *str_mode, int *result, int fail, const char *mode_desc __unused)
> +{
> +	int mode = 0;
> +	const char *p;
> +
> +	PDEBUG("Parsing X mode: %s\n", X, str_mode);
> +
> +	if (!str_mode)
> +		return 0;
> +
> +	p = str_mode;
> +	while (*p) {
> +		char current = *p;
> +		char lower;
> +
> +reeval:
> +		switch (current) {
> +		case COD_READ_CHAR:
> +			PDEBUG("Parsing %s mode: found %s READ\n", X, mode_desc);
> +			mode |= AA_DBUS_RECEIVE;
> +			break;
> +
> +		case COD_WRITE_CHAR:
> +			PDEBUG("Parsing %s mode: found %s WRITE\n", X,
> +			       mode_desc);
> +			mode |= AA_DBUS_SEND;

If this function is to be shared between dbus and signals, should
AA_DBUS_RECEIVE and AA_DBUS SEND be morphed into something more generic?
Or does that occur in the patch that introduces signal support?

-- 
Steve Beattie
<sbeattie at ubuntu.com>
http://NxNW.org/~steve/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20140311/4b487257/attachment.pgp>


More information about the AppArmor mailing list