| Summary: | If the downloading user haven't the needed rights to write in the target directory, kftpgrabber will download into nirvana (the files arn't there) and don't inform the user about this! | ||
|---|---|---|---|
| Product: | [Unmaintained] kftpgrabber | Reporter: | Karl Glatz <karl.glatz> |
| Component: | general | Assignee: | Jernej Kos <kostko> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | ||
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | unspecified | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
Karl Glatz
2007-02-20 17:18:53 UTC
SVN commit 648973 by kostko:
Abort file transfer when local open operation fails.
BUG: 141989
M +25 -3 ftpsocket.cpp
--- trunk/extragear/network/kftpgrabber/src/engine/ftpsocket.cpp #648972:648973
@@ -682,13 +682,21 @@
case SentRest: {
if (!socket()->isResponse("2") && !socket()->isResponse("3")) {
socket()->setConfig("feat.rest", 0);
-
socket()->getTransferFile()->close();
+ bool ok;
+
if (socket()->getPreviousCommand() == Commands::CmdGet)
- socket()->getTransferFile()->open(IO_WriteOnly | IO_Truncate);
+ ok = socket()->getTransferFile()->open(IO_WriteOnly | IO_Truncate);
else
- socket()->getTransferFile()->open(IO_ReadOnly);
+ ok = socket()->getTransferFile()->open(IO_ReadOnly);
+
+ // Check if there was a problem opening the file
+ if (!ok) {
+ socket()->emitError(FileOpenFailed);
+ socket()->resetCommandClass(Failed);
+ return;
+ }
}
// We have sent REST, now send the data command
@@ -1503,6 +1511,13 @@
socket()->getTransferFile()->open(IO_WriteOnly | IO_Truncate);
}
+ // Check if there was a problem opening the file
+ if (!socket()->getTransferFile()->isOpen()) {
+ socket()->emitError(FileOpenFailed);
+ socket()->resetCommandClass(Failed);
+ return;
+ }
+
// First we have to initialize the data connection, another class will
// do this for us, so we just add it to the command chain
socket()->setConfig("params.data_type", KFTPCore::Config::self()->ftpMode(sourceFile.path()));
@@ -1755,6 +1770,13 @@
socket()->getTransferFile()->open(IO_ReadOnly);
}
+ // Check if there was a problem opening the file
+ if (!socket()->getTransferFile()->isOpen()) {
+ socket()->emitError(FileOpenFailed);
+ socket()->resetCommandClass(Failed);
+ return;
+ }
+
// First we have to initialize the data connection, another class will
// do this for us, so we just add it to the command chain
socket()->setConfig("params.data_type", KFTPCore::Config::self()->ftpMode(destinationFile.path()));
|