summaryrefslogtreecommitdiff
path: root/src/safe.h
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruen@gnu.org>2016-07-27 15:40:38 +0200
committerAndreas Gruenbacher <agruen@gnu.org>2016-07-27 15:47:47 +0200
commit83a3ed012c677df484a892af69dbca8963867cb3 (patch)
tree6f01604efaa0525a1a3b1bb11ad417c18a918a77 /src/safe.h
parent70532e21a8e1a849d934334b51fff780babc0386 (diff)
downloadpatch-83a3ed012c677df484a892af69dbca8963867cb3.tar.gz
Fix inname test case
* src/safe.h (unsafe): New flag to allow turning off safe file operations. * src/safe.c (safe_xstat, safe_open, safe_rename, safe_mkdir, safe_rmdir, safe_unlink, safe_symlink, safe_chmod, safe_lchown, safe_lutimens, safe_readlink, safe_access): When safe file operations are turned off, skip safe path traversal. Any symlink checks of the last path component are still done though. * src/patch.c (main): When the file to patch is specified on the command line, turn off safe file operations. * tests/inname: Fix typo in test.
Diffstat (limited to 'src/safe.h')
-rw-r--r--src/safe.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/safe.h b/src/safe.h
index 1a0ff70..8b2a5a1 100644
--- a/src/safe.h
+++ b/src/safe.h
@@ -18,6 +18,10 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+#include <stdbool.h>
+
+extern bool unsafe;
+
int safe_stat (const char *pathname, struct stat *buf);
int safe_lstat (const char *pathname, struct stat *buf);
int safe_open (const char *pathname, int flags, mode_t mode);