public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Z. Cliffe Schreuders" <c.schreuders@murdoch.edu.au>
To: Jan Engelhardt <jengelh@computergmbh.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Including STRTOK_R in a LSM
Date: Mon, 16 Jul 2007 20:19:57 +0800	[thread overview]
Message-ID: <469B626D.4060700@murdoch.edu.au> (raw)
In-Reply-To: <Pine.LNX.4.64.0707161214140.686@fbirervta.pbzchgretzou.qr>

What I need is to ignore double delimiters such as (::). This can be 
done trivially with a string comparison to check for "\0". What I want 
to know is if it is ok to include the strtok_r code in my security 
module, or if strtok was removed for a very good reason. I am porting a 
lot of existing code which already uses strtok_r to a kernel security 
module.

Thanks,

Cliffe.

Jan Engelhardt wrote:
> On Jul 16 2007 16:52, Z. Cliffe Schreuders wrote:
>   
>> I am aware strtok was removed from the kernel in 2002. However strtok_r is more
>> desirable than strsep as I do not want to know about 'blank fields' (2
>> consecutive delimiters). Is it acceptable to simply include the strtok_r code
>> in my security module? or should I create a wrapper for strsep to ignore
>> blanks?
>>     
> 12:16 ichi:/dev/shm > cat test.c 
> #include <stdio.h>
> #include <string.h>
> int main(void)
> {
>         char x[] = "foo::bar";
>         char *w = x;
>         char *p;
>         while ((p = strsep(&w, ":")) != NULL)
>                 printf("\"%s\"\n", p);
> }
> 12:16 ichi:/dev/shm > ./a.out 
> "foo"
> ""
> "bar"
>
>
> q.e.d.
>
>
> 	Jan
>   


  reply	other threads:[~2007-07-16 12:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-16  8:52 Including STRTOK_R in a LSM Z. Cliffe Schreuders
2007-07-16 10:16 ` Jan Engelhardt
2007-07-16 12:19   ` Z. Cliffe Schreuders [this message]
2007-07-16 13:34     ` Casey Schaufler
2007-07-16 14:43       ` Z. Cliffe Schreuders
2009-03-16 14:03 ` Getting the port numbers and IP address from struct socket Cliffe
2009-03-16 13:58   ` Matthias Kaehlcke

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=469B626D.4060700@murdoch.edu.au \
    --to=c.schreuders@murdoch.edu.au \
    --cc=jengelh@computergmbh.de \
    --cc=linux-kernel@vger.kernel.org \
    /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