diff options
author | geronimo <geronimo013@gmx.de> | 2012-07-29 18:22:58 +0200 |
---|---|---|
committer | geronimo <geronimo013@gmx.de> | 2012-07-29 18:22:58 +0200 |
commit | 570a18b0d0a9a00b240504ac949214d6cc96949b (patch) | |
tree | cdbcb38d64de20587c886609b4c6ced61dc9414e /libs/IO | |
parent | aa714b0076c06d7133c625ab22c86114d4f17e23 (diff) | |
download | cmp-570a18b0d0a9a00b240504ac949214d6cc96949b.tar.gz cmp-570a18b0d0a9a00b240504ac949214d6cc96949b.tar.bz2 |
fixed bug on directory reading, if it contains an entry without access rights (reported by seahawk1986)
Diffstat (limited to 'libs/IO')
-rw-r--r-- | libs/IO/IO.layout | 21 | ||||
-rw-r--r-- | libs/IO/include/FileRepresentation.h | 12 | ||||
-rw-r--r-- | libs/IO/src/File.cc | 24 | ||||
-rw-r--r-- | libs/IO/src/FileRepresentation.cc | 12 |
4 files changed, 35 insertions, 34 deletions
diff --git a/libs/IO/IO.layout b/libs/IO/IO.layout index f0b6b2a..0e6cd97 100644 --- a/libs/IO/IO.layout +++ b/libs/IO/IO.layout @@ -1,14 +1,19 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <CodeBlocks_layout_file> <ActiveTarget name="Debug" /> - <File name="src/ConfigReader.cc" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> + <File name="src/File.cc" open="1" top="1" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> <Cursor> - <Cursor1 position="459" topLine="0" /> + <Cursor1 position="1130" topLine="0" /> </Cursor> </File> - <File name="src/File.cc" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> + <File name="include/File.h" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> <Cursor> - <Cursor1 position="1638" topLine="30" /> + <Cursor1 position="0" topLine="0" /> + </Cursor> + </File> + <File name="include/ConfigReader.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> + <Cursor> + <Cursor1 position="475" topLine="0" /> </Cursor> </File> <File name="src/FileReader.cc" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> @@ -21,14 +26,14 @@ <Cursor1 position="1846" topLine="0" /> </Cursor> </File> - <File name="include/ConfigReader.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> + <File name="src/LineReader.cc" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> <Cursor> - <Cursor1 position="475" topLine="0" /> + <Cursor1 position="854" topLine="0" /> </Cursor> </File> - <File name="src/LineReader.cc" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> + <File name="src/ConfigReader.cc" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> <Cursor> - <Cursor1 position="854" topLine="0" /> + <Cursor1 position="459" topLine="0" /> </Cursor> </File> </CodeBlocks_layout_file> diff --git a/libs/IO/include/FileRepresentation.h b/libs/IO/include/FileRepresentation.h index 2c2db5a..8bc9d9b 100644 --- a/libs/IO/include/FileRepresentation.h +++ b/libs/IO/include/FileRepresentation.h @@ -1,25 +1,25 @@ /** * ======================== legal notice ====================== - * + * * File: FileRepresentation.h * Created: 21. Juli 2012, 12 * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a> * Project: libIO: classes for files, filesystem and input/output - * + * * CMP - compound media player - * + * * is a client/server mediaplayer intended to play any media from any workstation * without the need to export or mount shares. cmps is an easy to use backend * with a (ready to use) HTML-interface. Additionally the backend supports * authentication via HTTP-digest authorization. * cmpc is a client with vdr-like osd-menues. - * + * * Copyright (c) 2012 Reinhard Mantey, some rights reserved! * published under Creative Commons by-sa * For details see http://creativecommons.org/licenses/by-sa/3.0/ - * + * * The cmp project's homepage is at http://projects.vdr-developer.org/projects/cmp - * + * * -------------------------------------------------------------- */ #ifndef FILEREPRESENTATION_H diff --git a/libs/IO/src/File.cc b/libs/IO/src/File.cc index 6770ec8..9b92b55 100644 --- a/libs/IO/src/File.cc +++ b/libs/IO/src/File.cc @@ -1,25 +1,25 @@ /** * ======================== legal notice ====================== - * + * * File: File.cc * Created: 21. Juli 2012, 12 * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a> * Project: libIO: classes for files, filesystem and input/output - * + * * CMP - compound media player - * + * * is a client/server mediaplayer intended to play any media from any workstation * without the need to export or mount shares. cmps is an easy to use backend * with a (ready to use) HTML-interface. Additionally the backend supports * authentication via HTTP-digest authorization. * cmpc is a client with vdr-like osd-menues. - * + * * Copyright (c) 2012 Reinhard Mantey, some rights reserved! * published under Creative Commons by-sa * For details see http://creativecommons.org/licenses/by-sa/3.0/ - * + * * The cmp project's homepage is at http://projects.vdr-developer.org/projects/cmp - * + * * -------------------------------------------------------------- */ #include <File.h> @@ -30,10 +30,6 @@ #include <sys/dir.h> cFileSystem *cFile::fs = NULL; -static mode_t ReadMask = S_IRUSR | S_IRGRP | S_IROTH; -static mode_t WriteMask = S_IWUSR | S_IWGRP | S_IWOTH; -static mode_t ExecMask = S_IXUSR | S_IXGRP | S_IXOTH; - cFile::cFile(const char *Path) : rep(NULL) @@ -109,19 +105,19 @@ bool cFile::IsSymbolic(void) const bool cFile::CanRead(void) const { - if (rep) return rep->mode & ReadMask; + if (rep) return access(rep->Path(), R_OK) == 0; return false; } bool cFile::CanWrite(void) const { - if (rep) return rep->mode & WriteMask; + if (rep) return access(rep->Path(), W_OK) == 0; return false; } bool cFile::CanExecute(void) const { - if (rep) return rep->mode & ExecMask; + if (rep) return access(rep->Path(), X_OK) == 0; return false; } @@ -159,7 +155,7 @@ void cFile::Cleanup(void) void cFile::VisitFiles(int (*cb)(void *, cFile *, const char *), void *opaque) { - if (!Exists() || !IsDirectory()) return; + if (!Exists() || !IsDirectory() || !CanExecute()) return; const char *path = AbsolutePath(); if (!path) return; diff --git a/libs/IO/src/FileRepresentation.cc b/libs/IO/src/FileRepresentation.cc index f74d2c8..3366157 100644 --- a/libs/IO/src/FileRepresentation.cc +++ b/libs/IO/src/FileRepresentation.cc @@ -1,25 +1,25 @@ /** * ======================== legal notice ====================== - * + * * File: FileRepresentation.cc * Created: 21. Juli 2012, 12 * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a> * Project: libIO: classes for files, filesystem and input/output - * + * * CMP - compound media player - * + * * is a client/server mediaplayer intended to play any media from any workstation * without the need to export or mount shares. cmps is an easy to use backend * with a (ready to use) HTML-interface. Additionally the backend supports * authentication via HTTP-digest authorization. * cmpc is a client with vdr-like osd-menues. - * + * * Copyright (c) 2012 Reinhard Mantey, some rights reserved! * published under Creative Commons by-sa * For details see http://creativecommons.org/licenses/by-sa/3.0/ - * + * * The cmp project's homepage is at http://projects.vdr-developer.org/projects/cmp - * + * * -------------------------------------------------------------- */ #include <FileRepresentation.h> |