Subject: Re: magic symlinks: uid keyword translation
To: Quentin Garnier <cube@cubidou.net>
From: Elad Efrat <elad@NetBSD.org>
List: tech-kern
Date: 10/30/2006 16:57:51
Quentin Garnier wrote:
> On Mon, Oct 30, 2006 at 02:50:14PM +0200, Elad Efrat wrote:
>> hi,
>>
>> attached diff adds a "uid" keyword translation for magic symlinks.
>>
>> any objections?
>
> s/16/LOGIN_NAME_MAX/
why?
-e.
>
>> Index: vfs_lookup.c
>> ===================================================================
>> RCS file: /cvsroot/src/sys/kern/vfs_lookup.c,v
>> retrieving revision 1.71
>> diff -u -p -r1.71 vfs_lookup.c
>> --- vfs_lookup.c 23 Jul 2006 22:06:12 -0000 1.71
>> +++ vfs_lookup.c 30 Oct 2006 01:36:19 -0000
>> @@ -163,6 +163,12 @@ symlink_magic(struct proc *p, char *cp,
>> } else if (MATCH("ostype")) {
>> SUBSTITUTE("ostype", ostype,
>> strlen(ostype));
>> + } else if (MATCH("uid")) {
>> + char uidtmp[16];
>> +
>> + (void)snprintf(uidtmp, sizeof(uidtmp) - 1, "%u",
>> + kauth_cred_getuid(p->p_cred));
>> + SUBSTITUTE("uid", uidtmp, strlen(uidtmp));
>> } else {
>> tmp[newlen++] = '@';
>> if (termchar == VC)
>
>
--
Elad Efrat