From: Alexey Dobriyan <adobriyan@gmail.com>
To: Kentaro Takeda <takedakn@nttdata.co.jp>
Cc: jmorris@namei.org, linux-security-module@vger.kernel.org,
linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
haradats@nttdata.co.jp,
Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Subject: Re: [TOMOYO #15 6/8] LSM adapter functions.
Date: Thu, 5 Feb 2009 20:10:55 +0300 [thread overview]
Message-ID: <20090205171055.GA2809@x200.localdomain> (raw)
In-Reply-To: <20090205082232.562805442@nttdata.co.jp>
On Thu, Feb 05, 2009 at 05:18:16PM +0900, Kentaro Takeda wrote:
> +/**
> + * tomoyo_sysctl_path - return the realpath of a ctl_table.
> + * @table: pointer to "struct ctl_table".
> + *
> + * Returns realpath(3) of the @table on success.
> + * Returns NULL on failure.
> + *
> + * This function uses tomoyo_alloc(), so the caller must call tomoyo_free()
> + * if this function didn't return NULL.
> + */
> +static char *tomoyo_sysctl_path(struct ctl_table *table)
> +{
> + int buflen = TOMOYO_MAX_PATHNAME_LEN;
> + char *buf = tomoyo_alloc(buflen);
> + char *end = buf + buflen;
> + int error = -ENOMEM;
> +
> + if (!buf)
> + return NULL;
> +
> + *--end = '\0';
> + buflen--;
> + while (table) {
> + char buf[32];
> + const char *sp = table->procname;
> +
> + if (!sp) {
> + memset(buf, 0, sizeof(buf));
> + snprintf(buf, sizeof(buf) - 1, "=%d=", table->ctl_name);
> + sp = buf;
> + }
> + if (tomoyo_prepend(&end, &buflen, sp) ||
> + tomoyo_prepend(&end, &buflen, "/"))
> + goto out;
> + table = table->parent;
> + }
> + if (tomoyo_prepend(&end, &buflen, "/proc/sys"))
Hardcoded path?
> + goto out;
> + error = tomoyo_encode(buf, end - buf, end);
> + out:
> + if (!error)
> + return buf;
> + tomoyo_free(buf);
> + return NULL;
> +}
next prev parent reply other threads:[~2009-02-05 17:05 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-05 8:18 [TOMOYO #15 0/8] TOMOYO Linux Kentaro Takeda
2009-02-05 8:18 ` [TOMOYO #15 1/8] Add in_execve flag into task_struct Kentaro Takeda
2009-02-05 8:18 ` [TOMOYO #15 2/8] Memory and pathname management functions Kentaro Takeda
2009-02-05 8:18 ` [TOMOYO #15 3/8] Common functions for TOMOYO Linux Kentaro Takeda
2009-02-05 8:18 ` [TOMOYO #15 4/8] File operation restriction part Kentaro Takeda
2009-02-05 8:18 ` [TOMOYO #15 5/8] Domain transition handler Kentaro Takeda
2009-02-05 8:18 ` [TOMOYO #15 6/8] LSM adapter functions Kentaro Takeda
2009-02-05 17:10 ` Alexey Dobriyan [this message]
2009-02-06 1:41 ` Tetsuo Handa
2009-02-05 8:18 ` [TOMOYO #15 7/8] Kconfig and Makefile Kentaro Takeda
2009-02-05 8:18 ` [TOMOYO #15 8/8] MAINTAINERS info Kentaro Takeda
2009-02-12 5:34 ` [TOMOYO #15 0/8] TOMOYO Linux James Morris
2009-02-12 6:53 ` Tetsuo Handa
2009-02-12 9:25 ` James Morris
2009-02-13 7:00 ` Tetsuo Handa
2009-02-14 1:33 ` James Morris
2009-02-22 14:23 ` Pavel Machek
2009-02-22 14:27 ` Tetsuo Handa
2009-02-22 14:48 ` Pavel Machek
2009-02-23 7:37 ` Toshiharu Harada
2009-02-25 19:46 ` Pavel Machek
2009-02-27 1:27 ` KOSAKI Motohiro
2009-03-01 22:45 ` Pavel Machek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090205171055.GA2809@x200.localdomain \
--to=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=haradats@nttdata.co.jp \
--cc=jmorris@namei.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
--cc=takedakn@nttdata.co.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox