Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Add experimental --chroot option to the 'http' and 'server' commands. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | chrootOpt |
| Files: | files | file ages | folders |
| SHA3-256: |
acd75ce64ce8d79e3c2d03aedd60b1f0 |
| User & Date: | mistachkin 2021-12-17 23:04:53.700 |
Context
|
2021-12-17
| ||
| 23:53 | Fix several compiler warnings, etc. ... (Closed-Leaf check-in: 6397ece589 user: mistachkin tags: chrootOpt) | |
| 23:04 | Add experimental --chroot option to the 'http' and 'server' commands. ... (check-in: acd75ce64c user: mistachkin tags: chrootOpt) | |
|
2021-12-16
| ||
| 09:43 | Added missing help text reference to the -o/--options help flag, per [forum:9b3a25eb2b | forum post 9b3a25eb2b]. ... (check-in: 784f147dc4 user: stephan tags: trunk) | |
Changes
Changes to src/main.c.
| ︙ | ︙ | |||
2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 | ** ** If the --localauth option is given, then automatic login is performed ** for requests coming from localhost, if the "localauth" setting is not ** enabled. ** ** Options: ** --baseurl URL base URL (useful with reverse proxies) ** --ckout-alias N Treat URIs of the form /doc/N/... as if they were ** /doc/ckout/... ** --extroot DIR document root for the /ext extension mechanism ** --files GLOB comma-separate glob patterns for static file to serve ** --host NAME specify hostname of the server ** --https signal a request coming in via https ** --in FILE Take input from FILE instead of standard input | > | 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 | ** ** If the --localauth option is given, then automatic login is performed ** for requests coming from localhost, if the "localauth" setting is not ** enabled. ** ** Options: ** --baseurl URL base URL (useful with reverse proxies) ** --chroot DIR Use directory for chroot instead of repository path. ** --ckout-alias N Treat URIs of the form /doc/N/... as if they were ** /doc/ckout/... ** --extroot DIR document root for the /ext extension mechanism ** --files GLOB comma-separate glob patterns for static file to serve ** --host NAME specify hostname of the server ** --https signal a request coming in via https ** --in FILE Take input from FILE instead of standard input |
| ︙ | ︙ | |||
2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 |
const char *zIpAddr = 0;
const char *zNotFound;
const char *zHost;
const char *zAltBase;
const char *zFileGlob;
const char *zInFile;
const char *zOutFile;
int useSCGI;
int noJail;
int allowRepoList;
Th_InitTraceLog();
builtin_set_js_delivery_mode(find_option("jsmode",0,1),0);
| > | 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 |
const char *zIpAddr = 0;
const char *zNotFound;
const char *zHost;
const char *zAltBase;
const char *zFileGlob;
const char *zInFile;
const char *zOutFile;
const char *zChRoot;
int useSCGI;
int noJail;
int allowRepoList;
Th_InitTraceLog();
builtin_set_js_delivery_mode(find_option("jsmode",0,1),0);
|
| ︙ | ︙ | |||
2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 |
dehttpize(z);
zFileGlob = z;
}else{
zFileGlob = find_option("files",0,1);
}
skin_override();
zNotFound = find_option("notfound", 0, 1);
noJail = find_option("nojail",0,0)!=0;
allowRepoList = find_option("repolist",0,0)!=0;
g.useLocalauth = find_option("localauth", 0, 0)!=0;
g.sslNotAvailable = find_option("nossl", 0, 0)!=0;
g.fNoHttpCompress = find_option("nocompress",0,0)!=0;
g.zExtRoot = find_option("extroot",0,1);
g.zCkoutAlias = find_option("ckout-alias",0,1);
| > | 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 |
dehttpize(z);
zFileGlob = z;
}else{
zFileGlob = find_option("files",0,1);
}
skin_override();
zNotFound = find_option("notfound", 0, 1);
zChRoot = find_option("chroot",0,1);
noJail = find_option("nojail",0,0)!=0;
allowRepoList = find_option("repolist",0,0)!=0;
g.useLocalauth = find_option("localauth", 0, 0)!=0;
g.sslNotAvailable = find_option("nossl", 0, 0)!=0;
g.fNoHttpCompress = find_option("nocompress",0,0)!=0;
g.zExtRoot = find_option("extroot",0,1);
g.zCkoutAlias = find_option("ckout-alias",0,1);
|
| ︙ | ︙ | |||
2714 2715 2716 2717 2718 2719 2720 |
find_server_repository(2, 0);
if( zIpAddr==0 ){
zIpAddr = cgi_ssh_remote_addr(0);
if( zIpAddr && zIpAddr[0] ){
g.fSshClient |= CGI_SSH_CLIENT;
}
}
| > > > | > | 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 |
find_server_repository(2, 0);
if( zIpAddr==0 ){
zIpAddr = cgi_ssh_remote_addr(0);
if( zIpAddr && zIpAddr[0] ){
g.fSshClient |= CGI_SSH_CLIENT;
}
}
if( zChRoot ){
enter_chroot_jail(zChRoot, noJail);
}else{
g.zRepositoryName = enter_chroot_jail(g.zRepositoryName, noJail);
}
if( useSCGI ){
cgi_handle_scgi_request();
}else if( g.fSshClient & CGI_SSH_CLIENT ){
ssh_request_loop(zIpAddr, glob_create(zFileGlob));
}else{
cgi_handle_http_request(zIpAddr);
}
|
| ︙ | ︙ | |||
2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 | ** setting. Automatic login for the "server" command is available if the ** --localauth option is present and the "localauth" setting is off and the ** connection is from localhost. The "ui" command also enables --repolist ** by default. ** ** Options: ** --baseurl URL Use URL as the base (useful for reverse proxies) ** --ckout-alias NAME Treat URIs of the form /doc/NAME/... as if they were ** /doc/ckout/... ** --create Create a new REPOSITORY if it does not already exist ** --extroot DIR Document root for the /ext extension mechanism ** --files GLOBLIST Comma-separated list of glob patterns for static files ** --fossilcmd PATH Full pathname of the "fossil" executable on the remote ** system when REPOSITORY is remote. Default: "fossil" | > | 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 | ** setting. Automatic login for the "server" command is available if the ** --localauth option is present and the "localauth" setting is off and the ** connection is from localhost. The "ui" command also enables --repolist ** by default. ** ** Options: ** --baseurl URL Use URL as the base (useful for reverse proxies) ** --chroot DIR Use directory for chroot instead of repository path. ** --ckout-alias NAME Treat URIs of the form /doc/NAME/... as if they were ** /doc/ckout/... ** --create Create a new REPOSITORY if it does not already exist ** --extroot DIR Document root for the /ext extension mechanism ** --files GLOBLIST Comma-separated list of glob patterns for static files ** --fossilcmd PATH Full pathname of the "fossil" executable on the remote ** system when REPOSITORY is remote. Default: "fossil" |
| ︙ | ︙ | |||
2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 |
dehttpize(z);
zFileGlob = z;
}else{
zFileGlob = find_option("files",0,1);
}
skin_override();
#if !defined(_WIN32)
noJail = find_option("nojail",0,0)!=0;
zTimeout = find_option("max-latency",0,1);
#endif
g.useLocalauth = find_option("localauth", 0, 0)!=0;
Th_InitTraceLog();
zPort = find_option("port", "P", 1);
isUiCmd = g.argv[1][0]=='u';
| > | 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 |
dehttpize(z);
zFileGlob = z;
}else{
zFileGlob = find_option("files",0,1);
}
skin_override();
#if !defined(_WIN32)
zChRoot = find_option("chroot",0,1);
noJail = find_option("nojail",0,0)!=0;
zTimeout = find_option("max-latency",0,1);
#endif
g.useLocalauth = find_option("localauth", 0, 0)!=0;
Th_InitTraceLog();
zPort = find_option("port", "P", 1);
isUiCmd = g.argv[1][0]=='u';
|
| ︙ | ︙ | |||
3174 3175 3176 3177 3178 3179 3180 |
fprintf(stderr, "/***** Subprocess %d *****/\n", getpid());
}
g.cgiOutput = 1;
find_server_repository(2, 0);
if( fossil_strcmp(g.zRepositoryName,"/")==0 ){
allowRepoList = 1;
}else{
| > > > | > | 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 |
fprintf(stderr, "/***** Subprocess %d *****/\n", getpid());
}
g.cgiOutput = 1;
find_server_repository(2, 0);
if( fossil_strcmp(g.zRepositoryName,"/")==0 ){
allowRepoList = 1;
}else{
if( zChRoot ){
enter_chroot_jail(zChRoot, noJail);
}else{
g.zRepositoryName = enter_chroot_jail(g.zRepositoryName, noJail);
}
}
if( flags & HTTP_SERVER_SCGI ){
cgi_handle_scgi_request();
}else{
cgi_handle_http_request(0);
}
process_one_web_page(zNotFound, glob_create(zFileGlob), allowRepoList);
|
| ︙ | ︙ |