Fossil SCM
Get chroot jails working correctly when a particular fossil repository is specified on the "http" command. This fixes a problem introduced by the multi-repository feature added by check-in [9cd2c42e79] on [2010-01-31].
Commit
42ba7b97aa3a479a12bc90b111bd72ce9e50fe81
Parent
a158c4e75d17df8…
2 files changed
+5
+1
+5
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -649,10 +649,14 @@ | ||
| 649 | 649 | if( stat(zRepo, &sStat)!=0 ){ |
| 650 | 650 | fossil_fatal("cannot stat() repository: %s", zRepo); |
| 651 | 651 | } |
| 652 | 652 | setgid(sStat.st_gid); |
| 653 | 653 | setuid(sStat.st_uid); |
| 654 | + if( g.db!=0 ){ | |
| 655 | + db_close(); | |
| 656 | + db_open_repository(zRepo); | |
| 657 | + } | |
| 654 | 658 | } |
| 655 | 659 | #endif |
| 656 | 660 | return zRepo; |
| 657 | 661 | } |
| 658 | 662 | |
| @@ -692,10 +696,11 @@ | ||
| 692 | 696 | ** characters other than alphanumerics, "-", and "_". |
| 693 | 697 | */ |
| 694 | 698 | for(j=strlen(g.zRepositoryName)+1, k=0; k<i-1; j++, k++){ |
| 695 | 699 | if( !isalnum(zRepo[j]) && zRepo[j]!='-' ) zRepo[j] = '_'; |
| 696 | 700 | } |
| 701 | + if( zRepo[0]=='/' && zRepo[1]=='/' ) zRepo++; | |
| 697 | 702 | |
| 698 | 703 | if( file_size(zRepo)<1024 ){ |
| 699 | 704 | if( zNotFound ){ |
| 700 | 705 | cgi_redirect(zNotFound); |
| 701 | 706 | }else{ |
| 702 | 707 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -649,10 +649,14 @@ | |
| 649 | if( stat(zRepo, &sStat)!=0 ){ |
| 650 | fossil_fatal("cannot stat() repository: %s", zRepo); |
| 651 | } |
| 652 | setgid(sStat.st_gid); |
| 653 | setuid(sStat.st_uid); |
| 654 | } |
| 655 | #endif |
| 656 | return zRepo; |
| 657 | } |
| 658 | |
| @@ -692,10 +696,11 @@ | |
| 692 | ** characters other than alphanumerics, "-", and "_". |
| 693 | */ |
| 694 | for(j=strlen(g.zRepositoryName)+1, k=0; k<i-1; j++, k++){ |
| 695 | if( !isalnum(zRepo[j]) && zRepo[j]!='-' ) zRepo[j] = '_'; |
| 696 | } |
| 697 | |
| 698 | if( file_size(zRepo)<1024 ){ |
| 699 | if( zNotFound ){ |
| 700 | cgi_redirect(zNotFound); |
| 701 | }else{ |
| 702 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -649,10 +649,14 @@ | |
| 649 | if( stat(zRepo, &sStat)!=0 ){ |
| 650 | fossil_fatal("cannot stat() repository: %s", zRepo); |
| 651 | } |
| 652 | setgid(sStat.st_gid); |
| 653 | setuid(sStat.st_uid); |
| 654 | if( g.db!=0 ){ |
| 655 | db_close(); |
| 656 | db_open_repository(zRepo); |
| 657 | } |
| 658 | } |
| 659 | #endif |
| 660 | return zRepo; |
| 661 | } |
| 662 | |
| @@ -692,10 +696,11 @@ | |
| 696 | ** characters other than alphanumerics, "-", and "_". |
| 697 | */ |
| 698 | for(j=strlen(g.zRepositoryName)+1, k=0; k<i-1; j++, k++){ |
| 699 | if( !isalnum(zRepo[j]) && zRepo[j]!='-' ) zRepo[j] = '_'; |
| 700 | } |
| 701 | if( zRepo[0]=='/' && zRepo[1]=='/' ) zRepo++; |
| 702 | |
| 703 | if( file_size(zRepo)<1024 ){ |
| 704 | if( zNotFound ){ |
| 705 | cgi_redirect(zNotFound); |
| 706 | }else{ |
| 707 |
+1
| --- src/style.c | ||
| +++ src/style.c | ||
| @@ -407,8 +407,9 @@ | ||
| 407 | 407 | #if !defined(__MINGW32__) |
| 408 | 408 | @ uid=%d(getuid()), gid=%d(getgid())<br> |
| 409 | 409 | #endif |
| 410 | 410 | @ g.zBaseURL = %h(g.zBaseURL)<br> |
| 411 | 411 | @ g.zTop = %h(g.zTop)<br> |
| 412 | + @ g.zRepositoryName = %h(g.zRepositoryName)<br> | |
| 412 | 413 | cgi_print_all(); |
| 413 | 414 | style_footer(); |
| 414 | 415 | } |
| 415 | 416 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -407,8 +407,9 @@ | |
| 407 | #if !defined(__MINGW32__) |
| 408 | @ uid=%d(getuid()), gid=%d(getgid())<br> |
| 409 | #endif |
| 410 | @ g.zBaseURL = %h(g.zBaseURL)<br> |
| 411 | @ g.zTop = %h(g.zTop)<br> |
| 412 | cgi_print_all(); |
| 413 | style_footer(); |
| 414 | } |
| 415 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -407,8 +407,9 @@ | |
| 407 | #if !defined(__MINGW32__) |
| 408 | @ uid=%d(getuid()), gid=%d(getgid())<br> |
| 409 | #endif |
| 410 | @ g.zBaseURL = %h(g.zBaseURL)<br> |
| 411 | @ g.zTop = %h(g.zTop)<br> |
| 412 | @ g.zRepositoryName = %h(g.zRepositoryName)<br> |
| 413 | cgi_print_all(); |
| 414 | style_footer(); |
| 415 | } |
| 416 |