| 1 |
Description: support symlinks as device names |
| 2 |
This patch adds support for symlinks as device store in the backend. |
| 3 |
. |
| 4 |
This patch was rejected upstream. Upstream was worried about security |
| 5 |
implications when following symlinks to logical devices. This is an opinion I |
| 6 |
do not share, as I consider existing file permission layers as sufficient. |
| 7 |
. |
| 8 |
Neither do several people asked for advise. |
| 9 |
. |
| 10 |
-- Arno Töll <[email protected]> |
| 11 |
|
| 12 |
Author: Michal Suchanek <[email protected]> |
| 13 |
Forwarded: yes |
| 14 |
|
| 15 |
Index: istgt-0.4~20111008/src/istgt_lu.c |
| 16 |
=================================================================== |
| 17 |
--- istgt-0.4~20111008.orig/src/istgt_lu.c 2011-11-27 21:48:45.000000000 +0100 |
| 18 |
+++ istgt-0.4~20111008/src/istgt_lu.c 2011-11-27 22:14:12.000000000 +0100 |
| 19 |
@@ -606,7 +606,7 @@ |
| 20 |
int rc; |
| 21 |
|
| 22 |
val = 0ULL; |
| 23 |
- rc = lstat(file, &st); |
| 24 |
+ rc = stat(file, &st); |
| 25 |
if (rc != 0) |
| 26 |
return val; |
| 27 |
if (!S_ISCHR(st.st_mode) && !S_ISBLK(st.st_mode)) |
| 28 |
@@ -689,11 +689,9 @@ |
| 29 |
int rc; |
| 30 |
|
| 31 |
val = 0ULL; |
| 32 |
- rc = lstat(file, &st); |
| 33 |
+ rc = stat(file, &st); |
| 34 |
if (rc < 0) |
| 35 |
return val; |
| 36 |
- if (S_ISLNK(st.st_mode)) |
| 37 |
- return val; |
| 38 |
|
| 39 |
if (S_ISCHR(st.st_mode)) { |
| 40 |
val = istgt_lu_get_devsize(file); |
| 41 |
@@ -702,7 +700,7 @@ |
| 42 |
} else if (S_ISREG(st.st_mode)) { |
| 43 |
val = st.st_size; |
| 44 |
} else { |
| 45 |
- ISTGT_ERRLOG("lstat is neither REG, CHR nor BLK\n"); |
| 46 |
+ ISTGT_ERRLOG("stat is neither REG, CHR nor BLK\n"); |
| 47 |
val = 0ULL; |
| 48 |
} |
| 49 |
return val; |