From 570a18b0d0a9a00b240504ac949214d6cc96949b Mon Sep 17 00:00:00 2001 From: geronimo Date: Sun, 29 Jul 2012 18:22:58 +0200 Subject: fixed bug on directory reading, if it contains an entry without access rights (reported by seahawk1986) --- libs/IO/IO.layout | 21 +++++++++++++-------- libs/IO/include/FileRepresentation.h | 12 ++++++------ libs/IO/src/File.cc | 24 ++++++++++-------------- libs/IO/src/FileRepresentation.cc | 12 ++++++------ libs/fsScan/fsScan.layout | 18 +++++++++--------- libs/networking/networking.layout | 28 ++++++++++++++-------------- libs/util/util.layout | 32 ++++++++++++++++---------------- libs/vdr/vdr.layout | 28 ++++++++++++++-------------- 8 files changed, 88 insertions(+), 87 deletions(-) (limited to 'libs') 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 @@ - + - + - + - + + + + + + @@ -21,14 +26,14 @@ - + - + - + - + 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: Geronimo * 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: Geronimo * 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 @@ -30,10 +30,6 @@ #include 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: Geronimo * 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 diff --git a/libs/fsScan/fsScan.layout b/libs/fsScan/fsScan.layout index 2db2bda..066b040 100644 --- a/libs/fsScan/fsScan.layout +++ b/libs/fsScan/fsScan.layout @@ -1,6 +1,11 @@ + + + + + @@ -16,19 +21,14 @@ - - - - - - + - + - + - + diff --git a/libs/networking/networking.layout b/libs/networking/networking.layout index d908ef8..8ed81c4 100644 --- a/libs/networking/networking.layout +++ b/libs/networking/networking.layout @@ -1,54 +1,54 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/libs/util/util.layout b/libs/util/util.layout index ef999ec..7fa0f25 100644 --- a/libs/util/util.layout +++ b/libs/util/util.layout @@ -1,14 +1,9 @@ - - - - - - + - + @@ -16,11 +11,6 @@ - - - - - @@ -36,19 +26,29 @@ + + + + + + + + + + - + - + - + - + diff --git a/libs/vdr/vdr.layout b/libs/vdr/vdr.layout index a8d4974..1c3d5a2 100644 --- a/libs/vdr/vdr.layout +++ b/libs/vdr/vdr.layout @@ -1,9 +1,9 @@ - + - + @@ -11,34 +11,34 @@ - + - + - + - + - + - + - + - + - + - + - + - + -- cgit v1.2.3