lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 15 May 2007 09:12:35 +0000
From:	Pavel Machek <pavel@....cz>
To:	jjohansen@...e.de
Cc:	linux-kernel@...r.kernel.org,
	linux-security-module@...r.kernel.org,
	linux-fsdevel@...r.kernel.org, Andreas Gruenbacher <agruen@...e.de>
Subject: Re: [AppArmor 37/45] AppArmor: Main Part

Hi!

> The underlying functions by which the AppArmor LSM hooks are implemented.
> 
> Signed-off-by: John Johansen <jjohansen@...e.de>
> Signed-off-by: Andreas Gruenbacher <agruen@...e.de>

> +#include "inline.h"

Select a better name for include?

> +static inline void aa_permerror2result(int perm_result, struct aa_audit *sa)

Betternameoffunction?

> +/**
> + * mangle -- escape special characters in str
> + * @str: string to escape
> + * @buffer: buffer containing str
> + *
> + * Escape special characters in @str, which is contained in @buffer. @str must
> + * be aligned to the end of the buffer, and the space between @buffer and @str
> + * may be used for escaping.
> + *
> + * Returns @str if no escaping was necessary, a pointer to the beginning of the
> + * escaped string, or NULL if there was not enough space in @buffer.  When
> + * called with a NULL buffer, the return value tells whether any escaping is
> + * necessary.
> + */
> +static const char *mangle(const char *str, char *buffer)
> +{
> +	static const char c_escape[] = {
> +		['\a'] = 'a',	['\b'] = 'b',
> +		['\f'] = 'f',	['\n'] = 'n',
> +		['\r'] = 'r',	['\t'] = 't',
> +		['\v'] = 'v',
> +		[' '] = ' ',	['\\'] = '\\',
> +	};
> +	const char *s;
> +	char *t, c;
> +
> +#define mangle_escape(c)						\
> +	unlikely((unsigned char)(c) < ARRAY_SIZE(c_escape) &&		\
> +		 c_escape[(unsigned char)c])
> +
> +	for (s = (char *)str; (c = *s) != '\0'; s++)
> +		if (mangle_escape(c))
> +			goto escape;
> +	return str;
> +
> +escape:
> +	if (!buffer)
> +		return NULL;
> +	for (s = str, t = buffer; (c = *s) != '\0'; s++) {
> +		if (mangle_escape(c)) {
> +			if (t == s)
> +				return NULL;
> +			*t++ = '\\';
> +			*t++ = c_escape[(unsigned char)c];
> +		} else
> +			*t++ = c;
> +	}
> +	*t++ = '\0';
> +
> +#undef mangle_escape
> +
> +	return buffer;
> +}

I do not think we want this in kernel.

							Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ