Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Improve comments on symlink logic |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | sec2020 |
| Files: | files | file ages | folders |
| SHA3-256: |
39a5df1fde741d084db2b4f900ada78a |
| User & Date: | drh 2020-08-21 10:10:49.330 |
References
|
2020-10-10
| ||
| 00:01 | Fix the fossil_stat() routine (broken by check-in [39a5df1fde741d08]) so that it responds correctly when the second argument is SymFILE. This is a fix for the problem described in [forum:/info/251ffc0584|Forum post 251ffc0584] check-in: 4d445ead4c user: drh tags: trunk | |
Context
|
2020-08-21
| ||
| 10:23 | Improved on-line help for the allow-symlinks setting. check-in: d3090e91b8 user: drh tags: sec2020 | |
| 10:10 | Improve comments on symlink logic check-in: 39a5df1fde user: drh tags: sec2020 | |
| 01:09 | Add a missing db_unprotect() to the "fossil all" command. check-in: b9ae03f6ee user: drh tags: sec2020 | |
Changes
Changes to src/file.c.
| ︙ | ︙ | |||
45 46 47 48 49 50 51 | ** ** The difference is in the handling of symbolic links. RepoFILE should be ** used for files that are under management by a Fossil repository. ExtFILE ** should be used for files that are not under management. SymFILE is for ** a few special cases such as the "fossil test-tarball" command when we never ** want to follow symlinks. ** | < < | | > < | | | > | | | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | ** ** The difference is in the handling of symbolic links. RepoFILE should be ** used for files that are under management by a Fossil repository. ExtFILE ** should be used for files that are not under management. SymFILE is for ** a few special cases such as the "fossil test-tarball" command when we never ** want to follow symlinks. ** ** ExtFILE Symbolic links always refer to the object to which the ** link points. Symlinks are never recognized as symlinks but ** instead always appear to the the target object. ** ** SymFILE Symbolic links always appear to be files whose name is ** the target pathname of the symbolic link. ** ** RepoFILE Like symfile is allow-symlinks is true, or like ** ExtFile if allow-symlinks is false. In other words, ** symbolic links are only recognized as something different ** from files or directories if allow-symlinks is true. */ #define ExtFILE 0 /* Always follow symlinks */ #define RepoFILE 1 /* Follow symlinks if and only if allow-symlinks is OFF */ #define SymFILE 2 /* Never follow symlinks */ #include <dirent.h> #if defined(_WIN32) |
| ︙ | ︙ | |||
132 133 134 135 136 137 138 |
const char *zFilename, /* name of file or directory to inspect. */
struct fossilStat *buf, /* pointer to buffer where info should go. */
int eFType /* Look at symlink itself if RepoFILE and enabled. */
){
int rc;
void *zMbcs = fossil_utf8_to_path(zFilename, 0);
#if !defined(_WIN32)
| | > > > | 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
const char *zFilename, /* name of file or directory to inspect. */
struct fossilStat *buf, /* pointer to buffer where info should go. */
int eFType /* Look at symlink itself if RepoFILE and enabled. */
){
int rc;
void *zMbcs = fossil_utf8_to_path(zFilename, 0);
#if !defined(_WIN32)
if( (eFType=RepoFILE && db_allow_symlinks())
|| eFType==SymFILE ){
/* Symlinks look like files whose content is the name of the target */
rc = lstat(zMbcs, buf);
}else{
/* Symlinks look like the object to which they point */
rc = stat(zMbcs, buf);
}
#else
rc = win32_stat(zMbcs, buf, eFType);
#endif
fossil_path_free(zMbcs);
return rc;
|
| ︙ | ︙ | |||
314 315 316 317 318 319 320 | return file_perm(zFilename, eFType)==PERM_EXE; } /* ** Return TRUE if the named file is a symlink and symlinks are allowed. ** Return false for all other cases. ** | | > | 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 |
return file_perm(zFilename, eFType)==PERM_EXE;
}
/*
** Return TRUE if the named file is a symlink and symlinks are allowed.
** Return false for all other cases.
**
** This routines assumes RepoFILE - that zFilename is always a file
** under management.
**
** On Windows, always return False.
*/
int file_islink(const char *zFilename){
return file_perm(zFilename, RepoFILE)==PERM_LNK;
}
|
| ︙ | ︙ |