jailkit-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Jailkit-users] error in jailkit code: jk_lib.c


From: Olivier Sessink
Subject: Re: [Jailkit-users] error in jailkit code: jk_lib.c
Date: Tue, 25 Jun 2013 12:07:43 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130308 Thunderbird/17.0.4

thanks, fixed in cvs!

Olivier

On 06/06/2013 05:06 AM, Marcus Eting wrote:
> shouldn't the next to last line of jk_lib.c be "return 0;" instead of "return 
> 1" ?
>
>
> /* if it returns 1 it will allocate new memory for jaildir and newhomedir
>  * else it will return 0
>  */
> int getjaildir(const char *oldhomedir, char **jaildir, char **newhomedir) {
>
>       int i=strlen(oldhomedir);
>       /* we will not accept /./ as jail, so we continue looking while i > 4 
> (minimum then is /a/./ )
>        * we start at the end so if there are multiple /path/./path2/./path3 
> the user will be jailed in the most minimized path
>        */
>       while (i > 4) {
> /*            DEBUG_MSG("oldhomedir[%d]=%c\n",i,oldhomedir[i]);*/
>               if (oldhomedir[i] == '/' && oldhomedir[i-1] == '.' && 
> oldhomedir[i-2] == '/') {
>                       DEBUG_MSG("&oldhomedir[%d]=%s\n",i,&oldhomedir[i]);
>                       *jaildir = strndup(oldhomedir, i-2);
>                       *newhomedir = strdup(&oldhomedir[i]);
>                       return 1;
>               }
>               i--;
>       }
>       return 1;
> }
> _______________________________________________
> Jailkit-users mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/jailkit-users


-- 
Bluefish website http://bluefish.openoffice.nl/
Blog http://oli4444.wordpress.com/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]