Commit 45b1327a authored by Harald Sitter's avatar Harald Sitter 🌹
Browse files

fix password error condition handling of smb mount

Summary:
this was previously wrong in two ways:

1. errors from the password check would previously be ignored but
   still end in early termination of the mount command despite that command
   not having finished (successfully)
2. since the password check is always run we may not actually require
   auth data in which case it is perfectly reasonable for the user to
   cancel the auth request (the user experience sucks, but there's not
   much we can do within the special command I think)

to solve both issues special now exists in error when there was an error
forwarded out of checkpassword (e.g. kiod is broken) BUT NOT when that
error is that the user canceled the auth query.

no auth info being provided is already supported later on in the actual
mount code.

testing code for posterity
```
#define KIO_ARGS QByteArray packedArgs; QDataStream stream( &packedArgs, QIODevice::WriteOnly ); stream

    KIO_ARGS << int(1)
             << QString("\\\\HOST/PATH/") // remotepath
             << QString("/LOCAL/MNT") // mountpoint
                ;
    auto job = KIO::special(QUrl("smb://HOST/PATH/"), packedArgs);
```

Test Plan:
# broken kiod

- run job
- get error about broken kiod

# cancel with working kiod

- run job
- get error about smbmount not being installed (bc it hasn't been a thing since the 2000's ;))

Reviewers: dfaure

Reviewed By: dfaure

Subscribers: kde-frameworks-devel, kfm-devel

Tags: #dolphin, #frameworks

Differential Revision: https://phabricator.kde.org/D24487
parent 5a870554
......@@ -67,9 +67,9 @@ void SMBSlave::special( const QByteArray & data)
smburl.setHost(host);
smburl.setPath('/' + share);
if ( checkPassword(smburl) != KJob::NoError )
{
finished();
const int passwordError = checkPassword(smburl);
if (passwordError != KJob::NoError && passwordError != KIO::ERR_USER_CANCELED) {
error(passwordError, smburl.toString());
return;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment