Displaying 1 result from an estimated 1 matches for "actual_to_jail".
2014 Jan 01
0
Soft chroot jail for sftp-server
...ed = concat_path(jail,shortened);
> free(shortened);
> return translated;
> }
> /* 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(&quo...