Skip to content

Commit

Permalink
Version 0.10.4, 17.04.2016:
Browse files Browse the repository at this point in the history
- Fixed another bug with read-only files, fixes error reports like "...RawFileIO.cpp:257 -- true == canWrite"
- Properly implemented Access method, should fix ticket #55 (and maybe other problems on OS X)
- Updated OpenSSL to 1.0.2g
- Updated PFM to 1.0.0.181 (should fix ticket #50 and #53)
  • Loading branch information
rhiestan committed Apr 17, 2016
1 parent e2b5c73 commit 2c58f0b
Show file tree
Hide file tree
Showing 9 changed files with 471 additions and 342 deletions.
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ IF(APPLE)
COMMAND osacompile -o "${CMAKE_BINARY_DIR}/Uninstall PFM.app" "${CMAKE_SOURCE_DIR}/install/Uninstall PFM.scpt")
ADD_CUSTOM_TARGET(Uninstall_PFM ALL DEPENDS "${CMAKE_BINARY_DIR}/Uninstall PFM.app")

INSTALL(PROGRAMS ${CMAKE_SOURCE_DIR}/install/res/pfm-180-encfsmp-mac.run DESTINATION pfm)
INSTALL(PROGRAMS ${CMAKE_SOURCE_DIR}/install/res/pfm-181-encfsmp-mac.run DESTINATION pfm)
INSTALL(DIRECTORY "${CMAKE_BINARY_DIR}/Install PFM.app" DESTINATION "." USE_SOURCE_PERMISSIONS)
INSTALL(DIRECTORY "${CMAKE_BINARY_DIR}/Uninstall PFM.app" DESTINATION "." USE_SOURCE_PERMISSIONS)
ENDIF(APPLE)
Expand Down
42 changes: 36 additions & 6 deletions src/EncFSMPMainFrameBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,23 +109,53 @@ EncFSMPMainFrameBase::EncFSMPMainFrameBase( wxWindow* parent, wxWindowID id, con
wxGridSizer* gSizer1;
gSizer1 = new wxGridSizer( 2, 3, 0, 0 );

wxBoxSizer* bSizer17;
bSizer17 = new wxBoxSizer( wxVERTICAL );

pMountButton_ = new wxButton( pMainPanel_, ID_MOUNTBUTTON, wxT("Mount"), wxDefaultPosition, wxDefaultSize, 0 );
gSizer1->Add( pMountButton_, 0, wxALIGN_CENTER|wxALL|wxEXPAND, 3 );
bSizer17->Add( pMountButton_, 1, wxALIGN_CENTER|wxALL|wxEXPAND, 3 );

gSizer1->Add( bSizer17, 1, wxEXPAND, 5 );

wxBoxSizer* bSizer18;
bSizer18 = new wxBoxSizer( wxVERTICAL );

pRemoveButton_ = new wxButton( pMainPanel_, ID_REMOVEBUTTON, wxT("Remove"), wxDefaultPosition, wxDefaultSize, 0 );
gSizer1->Add( pRemoveButton_, 1, wxALIGN_CENTER|wxALL|wxEXPAND, 3 );
bSizer18->Add( pRemoveButton_, 1, wxALIGN_CENTER|wxALL|wxEXPAND, 3 );

gSizer1->Add( bSizer18, 1, wxEXPAND, 5 );

wxBoxSizer* bSizer19;
bSizer19 = new wxBoxSizer( wxVERTICAL );

pEditButton_ = new wxButton( pMainPanel_, ID_EDITBUTTON, wxT("Edit"), wxDefaultPosition, wxDefaultSize, 0 );
gSizer1->Add( pEditButton_, 1, wxALIGN_CENTER|wxALL|wxEXPAND, 3 );
bSizer19->Add( pEditButton_, 1, wxALIGN_CENTER|wxALL|wxEXPAND, 3 );

gSizer1->Add( bSizer19, 1, wxEXPAND, 5 );

wxBoxSizer* bSizer20;
bSizer20 = new wxBoxSizer( wxVERTICAL );

pBrowseButton_ = new wxButton( pMainPanel_, ID_BROWSEBUTTON, wxT("Browse"), wxDefaultPosition, wxDefaultSize, 0 );
gSizer1->Add( pBrowseButton_, 1, wxALIGN_CENTER|wxALL|wxEXPAND, 3 );
bSizer20->Add( pBrowseButton_, 1, wxALIGN_CENTER|wxALL|wxEXPAND, 3 );

gSizer1->Add( bSizer20, 1, wxEXPAND, 5 );

wxBoxSizer* bSizer21;
bSizer21 = new wxBoxSizer( wxVERTICAL );

pInfoButton_ = new wxButton( pMainPanel_, ID_INFOBUTTON, wxT("Show Info"), wxDefaultPosition, wxDefaultSize, 0 );
gSizer1->Add( pInfoButton_, 1, wxALIGN_CENTER|wxALL|wxEXPAND, 3 );
bSizer21->Add( pInfoButton_, 1, wxALIGN_CENTER|wxALL|wxEXPAND, 3 );

gSizer1->Add( bSizer21, 1, wxEXPAND, 5 );

wxBoxSizer* bSizer22;
bSizer22 = new wxBoxSizer( wxVERTICAL );

pChangePasswordButton_ = new wxButton( pMainPanel_, ID_CHANGEPASSWORDBUTTON, wxT("Change password"), wxDefaultPosition, wxDefaultSize, 0 );
gSizer1->Add( pChangePasswordButton_, 1, wxALIGN_CENTER|wxALL|wxEXPAND, 3 );
bSizer22->Add( pChangePasswordButton_, 1, wxALIGN_CENTER|wxALL|wxEXPAND, 3 );

gSizer1->Add( bSizer22, 1, wxEXPAND, 5 );

sbSizer1->Add( gSizer1, 0, wxEXPAND, 3 );

Expand Down
8 changes: 4 additions & 4 deletions src/install/EncFSMP_MinGW_32_64.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,11 @@ Section "Pismo File Mount" Section_PFM

SetOutPath $TEMP

IfFileExists "$TEMP\pfm-180-encfsmp-win.exe" ErrorPFMFileExists
IfFileExists "$TEMP\pfm-181-encfsmp-win.exe" ErrorPFMFileExists
DetailPrint "Installing Pismo File Mount"
File "res\pfm-180-encfsmp-win.exe"
nsExec::ExecToLog '"$TEMP\pfm-180-encfsmp-win.exe" install'
Delete "$TEMP\pfm-180-encfsmp-win.exe"
File "res\pfm-181-encfsmp-win.exe"
nsExec::ExecToLog '"$TEMP\pfm-181-encfsmp-win.exe" install'
Delete "$TEMP\pfm-181-encfsmp-win.exe"

Return

Expand Down
Binary file modified src/install/Install PFM.scpt
Binary file not shown.
44 changes: 34 additions & 10 deletions src/pfm_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1143,16 +1143,36 @@ int/*error*/ CCALL PFMLayer::Access(int64_t openId,int8_t accessLevel,PfmOpenAtt

#if !defined(PFM_ACCESS_LEVEL_WORKAROUND)
// Check for access level and fail if source file is not writable
if(accessLevel >= pfmAccessLevelWriteData
&& pOpenFile->isReadOnly_)
return pfmErrorAccessDenied;
if(accessLevel >= pfmAccessLevelWriteData)
{
if(pOpenFile->isReadOnly_)
return pfmErrorAccessDenied;

if(pOpenFile->isOpenedReadOnly_)
{
// Try to reopen file with write access
pOpenFile->fileNode_.reset();

int res = 0;
pOpenFile->fileNode_ =
rootFS_->root->openNode(pOpenFile->pathName_.c_str(), "open", makeOpenFileFlags(accessLevel), &res);
if(!pOpenFile->fileNode_)
{
// Failed, try to open again for reading
pOpenFile->fileNode_ =
rootFS_->root->openNode(pOpenFile->pathName_.c_str(), "open", makeOpenFileFlags(openAttribs->accessLevel), &res);
return pfmErrorAccessDenied;
}
pOpenFile->isOpenedReadOnly_ = false;
}
}
#endif

pOpenFile->sequenceId_++;

openAttribs->openId = pOpenFile->openId_;
openAttribs->openSequence = pOpenFile->sequenceId_;
openAttribs->accessLevel = (pOpenFile->isReadOnly_ ? pfmAccessLevelWriteInfo : pfmAccessLevelWriteData);
openAttribs->accessLevel = ((pOpenFile->isReadOnly_ || pOpenFile->isOpenedReadOnly_) ? pfmAccessLevelDelete : pfmAccessLevelWriteData);

if(pOpenFile->isFile_)
openAttribs->attribs.fileType = pfmFileTypeFile;
Expand Down Expand Up @@ -1361,7 +1381,8 @@ int PFMLayer::createOp(const std::string &path, int8_t createFileType, uint8_t c
of.sequenceId_ = 1;
of.fd_ = res;
of.pathName_ = path;
of.isReadOnly_ = (accessLevel == pfmAccessLevelWriteInfo);
of.isOpenedReadOnly_ = (accessLevel < pfmAccessLevelWriteData);
of.isReadOnly_ = false;
of.fileId_ = createFileId(path);

openAttribs->openId = newCreateOpenId;
Expand Down Expand Up @@ -1423,7 +1444,8 @@ int PFMLayer::createOp(const std::string &path, int8_t createFileType, uint8_t c
of.openId_ = newCreateOpenId;
of.sequenceId_ = 1;
of.pathName_ = path;
of.isReadOnly_ = (accessLevel == pfmAccessLevelWriteInfo);
of.isOpenedReadOnly_ = (accessLevel < pfmAccessLevelWriteData);
of.isReadOnly_ = false;
of.fileId_ = createFileId(path);

openAttribs->openId = newCreateOpenId;
Expand Down Expand Up @@ -1470,7 +1492,7 @@ int PFMLayer::createOp(const std::string &path, int8_t createFileType, uint8_t c

int PFMLayer::renameOp(PFMLayer::OpenFile *pOpenFile, const std::string &newPath)
{
int openFlags = makeOpenFileFlags(pOpenFile->isReadOnly_);
int openFlags = makeOpenFileFlags(pOpenFile->isReadOnly_ || pOpenFile->isOpenedReadOnly_);

try
{
Expand Down Expand Up @@ -1593,7 +1615,7 @@ int PFMLayer::deleteOp(PFMLayer::OpenFile *pOpenFile)
void PFMLayer::openExisting(PFMLayer::OpenFile *pOpenFile, PfmOpenAttribs *openAttribs,
PT_UINT8 accessLevel)
{
accessLevel = determineAccessLevel(pOpenFile->isReadOnly_, accessLevel);
accessLevel = determineAccessLevel(pOpenFile->isReadOnly_ || pOpenFile->isOpenedReadOnly_, accessLevel);

pOpenFile->sequenceId_++;

Expand Down Expand Up @@ -1641,9 +1663,10 @@ int PFMLayer::openFileOp(boost::shared_ptr<FileNode> fileNode, int fd, PfmOpenAt
of.fd_ = fd;
of.pathName_ = path;
of.isReadOnly_ = ((buf.st_mode & S_IWUSR) == 0);
of.isOpenedReadOnly_ = (accessLevel < pfmAccessLevelWriteData);
of.fileId_ = createFileId(path);

accessLevel = determineAccessLevel(of.isReadOnly_, accessLevel);
accessLevel = determineAccessLevel(of.isReadOnly_ || of.isOpenedReadOnly_, accessLevel);

openAttribs->openId = newExistingOpenId;
openAttribs->openSequence = 1;
Expand Down Expand Up @@ -1701,9 +1724,10 @@ int PFMLayer::openDirOp(PfmOpenAttribs *openAttribs, int64_t newExistingOpenId,
of.sequenceId_ = 1;
of.pathName_ = path;
of.isReadOnly_ = ((buf.st_mode & S_IWUSR) == 0);
of.isOpenedReadOnly_ = (accessLevel < pfmAccessLevelWriteData);
of.fileId_ = createFileId(path);

accessLevel = determineAccessLevel(of.isReadOnly_, accessLevel);
accessLevel = determineAccessLevel(of.isReadOnly_ || of.isOpenedReadOnly_, accessLevel);

openAttribs->openId = newExistingOpenId;
openAttribs->openSequence = 1;
Expand Down
8 changes: 5 additions & 3 deletions src/pfm_layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ class PFMLayer: public PfmFormatterOps
{
public:
OpenFile() : openId_(0), sequenceId_(0), fd_(-1), isFile_(true), fileId_(0),
isDeleted_(false), isReadOnly_(false), fileFlags_(0), fileSize_(0), createTime_(0),
accessTime_(0), writeTime_(0), changeTime_(0)
isDeleted_(false), isReadOnly_(false), isOpenedReadOnly_(false), fileFlags_(0),
fileSize_(0), createTime_(0), accessTime_(0), writeTime_(0), changeTime_(0)
{ }
OpenFile(const OpenFile &o) { copy(o); }
virtual ~OpenFile() { }
Expand All @@ -140,6 +140,7 @@ class PFMLayer: public PfmFormatterOps
fileId_ = o.fileId_;
pathName_ = o.pathName_;
isReadOnly_ = o.isReadOnly_;
isOpenedReadOnly_ = o.isOpenedReadOnly_;
fileFlags_ = o.fileFlags_;
fileSize_ = o.fileSize_;
createTime_ = o.createTime_;
Expand All @@ -159,7 +160,8 @@ class PFMLayer: public PfmFormatterOps
bool isDeleted_;
int64_t fileId_;
boost::shared_ptr<FileNode> fileNode_; // For files
bool isReadOnly_;
bool isReadOnly_; // File has Read-only bit set
bool isOpenedReadOnly_; // File was opened read-only
PT_UINT8 fileFlags_;
PT_UINT64 fileSize_;
PT_INT64 createTime_;
Expand Down
Loading

0 comments on commit 2c58f0b

Please sign in to comment.