View Full Version : What does user_path_walk() ?
felix
01-14-2004, 09:27 PM
Hi!!
I was looking for a source code and i saw this line:
user_path_walk("/etc/passwd", &memNd);
I searched at google and can't find a man page for it...
ps.: The program that have this routine run in kernel space (LKM).
What it does ??
Thkz a lot.
Regards.
RobSeace
01-15-2004, 01:02 PM
In "/usr/src/linux*/include/linux/fs.h", it's defined as a macro cover
__user_walk(), which I find defined in "/usr/src/linux*/fs/namei.c"...
felix
01-15-2004, 03:07 PM
Hi,
I saw this source in kernel:
int __user_walk(const char *name, unsigned flags, struct nameidata *nd)
{
char *tmp;
int err;
tmp = getname(name);
err = PTR_ERR(tmp);
if (!IS_ERR(tmp)) {
err = 0;
if (path_init(tmp, flags, nd))
err = path_walk(tmp, nd);
putname(tmp);
}
return err;
}
But i don't understand exactily what it does.. first because documentation about getname() say the it get the user-name from password file (/etc/passwd i belive), then have a PTR_ERR that i don't know what do, then check to see if the tmp returne a negative value, then call path_init() and path_walk() that i don't understood exactily what does.. in sequence putname()...
I foud this archive:
http://lists.jammed.com/linux-security-module/2003/05/0101.html
It's appear return the value of the inode that it use.. or something similar... but why use a function like getname() to do it (if it relly, extracet the name field from password file) ?
Regards
RobSeace
01-15-2004, 08:49 PM
What documentation are you reading that says getname() has
anything to do with "/etc/passwd" or usernames?? I think that's
most definitely wrong... As near as I can tell, getname() (which
is also defined in that same "namei.c" file; using macros
__getname() and putname() from that same "fs.h" header) does
something having to do with caching filenames...
felix
01-16-2004, 07:58 PM
Hi,
What documentation are you reading that says getname() has
anything to do with "/etc/passwd" or usernames??
https://www.netmar.com/cgi-bin/sec/man2html?cgi_command=getname&cgi_section=2
I done several tests and discover what user_walk_path does, it get the filename passed as argument and retrive the inode informations.. :)
Thkz a lot.
Regards.
[ ]'s
RobSeace
01-17-2004, 08:07 PM
The blurb at the top of that page says it's refering to SunOS 5.7...
And, it's obviously a man page for some user-space library
function, not an internal kernel function... Just because 2 functions
have the same name, doesn't imply they do anything similar... ;-)
ramchandar
12-13-2005, 06:04 AM
guys
those who want to know about namei(namei.c) algorithm can go through the book "Design of Unix Operating System" by Jacob .Its basically used for file path identification
hope u find it useful
Thanx
vBulletin® v3.7.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.