647
648
649
650
651
652
653
654
655
656
657
658
659
660
|
zRepo = &zDir[i];
}
if( stat(zRepo, &sStat)!=0 ){
fossil_fatal("cannot stat() repository: %s", zRepo);
}
setgid(sStat.st_gid);
setuid(sStat.st_uid);
}
#endif
return zRepo;
}
/*
** Preconditions:
|
>
>
>
>
|
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
|
zRepo = &zDir[i];
}
if( stat(zRepo, &sStat)!=0 ){
fossil_fatal("cannot stat() repository: %s", zRepo);
}
setgid(sStat.st_gid);
setuid(sStat.st_uid);
if( g.db!=0 ){
db_close();
db_open_repository(zRepo);
}
}
#endif
return zRepo;
}
/*
** Preconditions:
|
690
691
692
693
694
695
696
697
698
699
700
701
702
703
|
/* To avoid mischief, make sure the repository basename contains no
** characters other than alphanumerics, "-", and "_".
*/
for(j=strlen(g.zRepositoryName)+1, k=0; k<i-1; j++, k++){
if( !isalnum(zRepo[j]) && zRepo[j]!='-' ) zRepo[j] = '_';
}
if( file_size(zRepo)<1024 ){
if( zNotFound ){
cgi_redirect(zNotFound);
}else{
@ <h1>Not Found</h1>
cgi_set_status(404, "not found");
|
>
|
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
|
/* To avoid mischief, make sure the repository basename contains no
** characters other than alphanumerics, "-", and "_".
*/
for(j=strlen(g.zRepositoryName)+1, k=0; k<i-1; j++, k++){
if( !isalnum(zRepo[j]) && zRepo[j]!='-' ) zRepo[j] = '_';
}
if( zRepo[0]=='/' && zRepo[1]=='/' ) zRepo++;
if( file_size(zRepo)<1024 ){
if( zNotFound ){
cgi_redirect(zNotFound);
}else{
@ <h1>Not Found</h1>
cgi_set_status(404, "not found");
|