Displaying 1 result from an estimated 1 matches for "jail_len".
Did you mean:
fail_len
2014 Jan 01
0
Soft chroot jail for sftp-server
...; }
> /* The opposite of jail_to_actual, returns NULL if path is not in jail, This function frees path (so expects a freeable pointer) or reuses it so in any case returns a freeable pointer. */
> static char* actual_to_jail(char* path) {
> if (jail == NULL) return path;
> unsigned int jail_len = strlen(jail);
> if (strncmp(jail,path,jail_len) != 0) return NULL;
> char* actual = xstrdup(path+jail_len);
> free(path);
> if (strlen(actual) < 1) {
> free(actual);
> actual = xstrdup("/");
> }
> return actual;
> }
> /* Removes trailing slashe...