Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:grahami:openssh
openssh
openssh-sftp-server.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File openssh-sftp-server.patch of Package openssh
--- sftp-server.c 2007-01-05 05:31:03.000000000 +0000 +++ sftp-server.c 2008-02-29 15:54:33.000000000 +0000 @@ -45,6 +45,10 @@ #include "sftp.h" #include "sftp-common.h" +/* Following single line added by Minstrel */ + +#define CHROOT + /* helper */ #define get_int64() buffer_get_int64(&iqueue); #define get_int() buffer_get_int(&iqueue); @@ -1204,6 +1208,40 @@ exit(1); } +/* Start additions by Minstrel */ + +#ifdef CHROOT +void +chroot_init(void) +{ + char *user_dir, *new_root; + + user_dir = getenv("HOME"); + if (!user_dir) + fatal("HOME isn't in environment"); + + new_root = user_dir + 1; + + while ((new_root = strchr(new_root, '.')) != NULL) { + new_root--; + if (strncmp(new_root, "/./", 3) == 0) { + *new_root = '\0'; + new_root += 2; + + if (chroot(user_dir) != 0) + fatal("Couldn't chroot to user directory %s: %s", user_dir, strerror(errno)); + + setenv("HOME", new_root, 1); + break; + } + new_root += 2; + } +} +#endif /* CHROOT */ + +/* End additions by Minstrel */ + + int main(int argc, char **argv) { @@ -1270,6 +1308,17 @@ handle_init(); +/* Start additions by Minstrel */ + +#ifdef CHROOT + chroot_init(); +#endif + if (setuid(getuid()) != 0 || setgid(getgid()) != 0) + fatal("Couldn't drop privileges: %s", strerror(errno)); + +/* End additions by Minstrel */ + + in = dup(STDIN_FILENO); out = dup(STDOUT_FILENO);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor