Changeset View
Changeset View
Standalone View
Standalone View
smb/kio_smb.cpp
Show All 27 Lines | |||||
28 | // | 28 | // | ||
29 | ///////////////////////////////////////////////////////////////////////////// | 29 | ///////////////////////////////////////////////////////////////////////////// | ||
30 | 30 | | |||
31 | #include "kio_smb.h" | 31 | #include "kio_smb.h" | ||
32 | #include "kio_smb_internal.h" | 32 | #include "kio_smb_internal.h" | ||
33 | #include <QCoreApplication> | 33 | #include <QCoreApplication> | ||
34 | #include <QVersionNumber> | 34 | #include <QVersionNumber> | ||
35 | 35 | | |||
36 | #include "smb-logsettings.h" | | |||
37 | | ||||
38 | // Pseudo plugin class to embed meta data | 36 | // Pseudo plugin class to embed meta data | ||
39 | class KIOPluginForMetaData : public QObject | 37 | class KIOPluginForMetaData : public QObject | ||
40 | { | 38 | { | ||
41 | Q_OBJECT | 39 | Q_OBJECT | ||
42 | Q_PLUGIN_METADATA(IID "org.kde.kio.slave.smb" FILE "smb.json") | 40 | Q_PLUGIN_METADATA(IID "org.kde.kio.slave.smb" FILE "smb.json") | ||
43 | }; | 41 | }; | ||
44 | 42 | | |||
45 | bool needsEEXISTWorkaround() | 43 | bool needsEEXISTWorkaround() | ||
46 | { | 44 | { | ||
47 | /* There is an issue with some libsmbclient versions that return EEXIST | 45 | /* There is an issue with some libsmbclient versions that return EEXIST | ||
48 | * return code from smbc_opendir() instead of EPERM when the user | 46 | * return code from smbc_opendir() instead of EPERM when the user | ||
49 | * tries to access a resource that requires login authetification. | 47 | * tries to access a resource that requires login authetification. | ||
50 | * We are working around the issue by treating EEXIST as a special case | 48 | * We are working around the issue by treating EEXIST as a special case | ||
51 | * of "invalid/unavailable credentials" if we detect that we are using | 49 | * of "invalid/unavailable credentials" if we detect that we are using | ||
52 | * the affected versions of libsmbclient | 50 | * the affected versions of libsmbclient | ||
53 | * | 51 | * | ||
54 | * Upstream bug report: https://bugzilla.samba.org/show_bug.cgi?id=13050 | 52 | * Upstream bug report: https://bugzilla.samba.org/show_bug.cgi?id=13050 | ||
55 | */ | 53 | */ | ||
56 | static const QVersionNumber firstBrokenVer{4, 7, 0}; | 54 | static const QVersionNumber firstBrokenVer{4, 7, 0}; | ||
57 | static const QVersionNumber lastBrokenVer{4, 7, 6}; | 55 | static const QVersionNumber lastBrokenVer{4, 7, 6}; | ||
58 | 56 | | |||
59 | const QVersionNumber currentVer = QVersionNumber::fromString(smbc_version()); | 57 | const QVersionNumber currentVer = QVersionNumber::fromString(smbc_version()); | ||
60 | qCDebug(KIO_SMB) << "Using libsmbclient library version" << currentVer; | 58 | qCDebug(KIO_SMB_LOG) << "Using libsmbclient library version" << currentVer; | ||
61 | 59 | | |||
62 | if (currentVer >= firstBrokenVer && currentVer <= lastBrokenVer) { | 60 | if (currentVer >= firstBrokenVer && currentVer <= lastBrokenVer) { | ||
63 | qCDebug(KIO_SMB) << "Detected broken libsmbclient version" << currentVer; | 61 | qCDebug(KIO_SMB_LOG) << "Detected broken libsmbclient version" << currentVer; | ||
64 | return true; | 62 | return true; | ||
65 | } | 63 | } | ||
66 | 64 | | |||
67 | return false; | 65 | return false; | ||
68 | } | 66 | } | ||
69 | 67 | | |||
70 | //=========================================================================== | 68 | //=========================================================================== | ||
71 | SMBSlave::SMBSlave(const QByteArray& pool, const QByteArray& app) | 69 | SMBSlave::SMBSlave(const QByteArray& pool, const QByteArray& app) | ||
Show All 29 Lines | |||||
101 | } | 99 | } | ||
102 | 100 | | |||
103 | //=========================================================================== | 101 | //=========================================================================== | ||
104 | int Q_DECL_EXPORT kdemain( int argc, char **argv ) | 102 | int Q_DECL_EXPORT kdemain( int argc, char **argv ) | ||
105 | { | 103 | { | ||
106 | QCoreApplication app(argc, argv); | 104 | QCoreApplication app(argc, argv); | ||
107 | if( argc != 4 ) | 105 | if( argc != 4 ) | ||
108 | { | 106 | { | ||
109 | qCDebug(KIO_SMB) << "Usage: kio_smb protocol domain-socket1 domain-socket2"; | 107 | qCDebug(KIO_SMB_LOG) << "Usage: kio_smb protocol domain-socket1 domain-socket2"; | ||
110 | return -1; | 108 | return -1; | ||
111 | } | 109 | } | ||
112 | 110 | | |||
113 | SMBSlave slave( argv[2], argv[3] ); | 111 | SMBSlave slave( argv[2], argv[3] ); | ||
114 | 112 | | |||
115 | slave.dispatchLoop(); | 113 | slave.dispatchLoop(); | ||
116 | 114 | | |||
117 | return 0; | 115 | return 0; | ||
118 | } | 116 | } | ||
119 | 117 | | |||
120 | #include "kio_smb.moc" | 118 | #include "kio_smb.moc" |