Commit b2ad7517 authored by Méven Car's avatar Méven Car
Browse files

smb ioslave: fix build regression

Summary: Regression was introduced in D26420

Test Plan: builds

Reviewers: #frameworks, mlaurent, ngraham

Reviewed By: ngraham

Subscribers: kde-frameworks-devel, kfm-devel

Tags: #dolphin, #frameworks

Differential Revision: https://phabricator.kde.org/D26488
parent 1360c1f0
......@@ -33,8 +33,6 @@
#include <QCoreApplication>
#include <QVersionNumber>
#include "smb-logsettings.h"
// Pseudo plugin class to embed meta data
class KIOPluginForMetaData : public QObject
{
......@@ -57,10 +55,10 @@ bool needsEEXISTWorkaround()
static const QVersionNumber lastBrokenVer{4, 7, 6};
const QVersionNumber currentVer = QVersionNumber::fromString(smbc_version());
qCDebug(KIO_SMB) << "Using libsmbclient library version" << currentVer;
qCDebug(KIO_SMB_LOG) << "Using libsmbclient library version" << currentVer;
if (currentVer >= firstBrokenVer && currentVer <= lastBrokenVer) {
qCDebug(KIO_SMB) << "Detected broken libsmbclient version" << currentVer;
qCDebug(KIO_SMB_LOG) << "Detected broken libsmbclient version" << currentVer;
return true;
}
......@@ -106,7 +104,7 @@ int Q_DECL_EXPORT kdemain( int argc, char **argv )
QCoreApplication app(argc, argv);
if( argc != 4 )
{
qCDebug(KIO_SMB) << "Usage: kio_smb protocol domain-socket1 domain-socket2";
qCDebug(KIO_SMB_LOG) << "Usage: kio_smb protocol domain-socket1 domain-socket2";
return -1;
}
......
......@@ -38,6 +38,8 @@
#include <config-smb.h>
#include "smb-logsettings.h"
//--------------
// KDE includes
//--------------
......@@ -81,9 +83,6 @@ extern "C"
#define MAX_XFER_BUF_SIZE 65534
// Categorized logger
Q_DECLARE_LOGGING_CATEGORY(KIO_SMB)
using namespace KIO;
//===========================================================================
......
......@@ -71,10 +71,10 @@ void SMBSlave::auth_smbc_get_data(const char *server,const char *share,
SMBUrlType t = m_current_url.getType();
if( t == SMBURLTYPE_ENTIRE_NETWORK )
{
qCDebug(KIO_SMB) << "we don't really need to authenticate for this top level url, returning";
qCDebug(KIO_SMB_LOG) << "we don't really need to authenticate for this top level url, returning";
return;
}
qCDebug(KIO_SMB) << "auth_smbc_get_dat: set user=" << username << ", workgroup=" << workgroup
qCDebug(KIO_SMB_LOG) << "auth_smbc_get_dat: set user=" << username << ", workgroup=" << workgroup
<< " server=" << server << ", share=" << share;
QString s_server = QString::fromUtf8(server);
......@@ -95,7 +95,7 @@ void SMBSlave::auth_smbc_get_data(const char *server,const char *share,
info.password = s_password;
info.verifyPath = true;
qCDebug(KIO_SMB) << "libsmb-auth-callback URL:" << info.url;
qCDebug(KIO_SMB_LOG) << "libsmb-auth-callback URL:" << info.url;
if ( !checkCachedAuthentication( info ) )
{
......@@ -113,7 +113,7 @@ void SMBSlave::auth_smbc_get_data(const char *server,const char *share,
}
} else
qCDebug(KIO_SMB) << "got password through cache";
qCDebug(KIO_SMB_LOG) << "got password through cache";
strncpy(username, info.username.toUtf8(), unmaxlen - 1);
strncpy(password, info.password.toUtf8(), pwmaxlen - 1);
......@@ -121,7 +121,7 @@ void SMBSlave::auth_smbc_get_data(const char *server,const char *share,
int SMBSlave::checkPassword(SMBUrl &url)
{
qCDebug(KIO_SMB) << "checkPassword for " << url;
qCDebug(KIO_SMB_LOG) << "checkPassword for " << url;
KIO::AuthInfo info;
info.url = QUrl("smb:///");
......@@ -150,22 +150,22 @@ int SMBSlave::checkPassword(SMBUrl &url)
share );
info.username = url.userName();
qCDebug(KIO_SMB) << "call openPasswordDialog for " << info.url;
qCDebug(KIO_SMB_LOG) << "call openPasswordDialog for " << info.url;
const int passwordDialogErrorCode = openPasswordDialogV2(info);
if (passwordDialogErrorCode == KJob::NoError) {
qCDebug(KIO_SMB) << "openPasswordDialog returned " << info.username;
qCDebug(KIO_SMB_LOG) << "openPasswordDialog returned " << info.username;
url.setUser(info.username);
if (info.keepPassword) {
qCDebug(KIO_SMB) << "Caching info.username = " << info.username
qCDebug(KIO_SMB_LOG) << "Caching info.username = " << info.username
<< ", info.url = " << info.url.toDisplayString();
cacheAuthentication(info);
}
return KJob::NoError;
}
qCDebug(KIO_SMB) << "no value from openPasswordDialog; error:" << passwordDialogErrorCode;
qCDebug(KIO_SMB_LOG) << "no value from openPasswordDialog; error:" << passwordDialogErrorCode;
return passwordDialogErrorCode;
}
......@@ -177,10 +177,10 @@ bool SMBSlave::auth_initialize_smbc()
{
SMBCCTX *smb_context = nullptr;
qCDebug(KIO_SMB) << "auth_initialize_smbc ";
qCDebug(KIO_SMB_LOG) << "auth_initialize_smbc ";
if(m_initialized_smbc == false)
{
qCDebug(KIO_SMB) << "smbc_init call";
qCDebug(KIO_SMB_LOG) << "smbc_init call";
KConfig cfg( "kioslaverc", KConfig::SimpleConfig);
int debug_level = cfg.group( "SMB" ).readEntry( "DebugLevel", 0 );
......
......@@ -57,7 +57,7 @@ int SMBSlave::cache_stat(const SMBUrl &url, struct stat* st )
} else {
cacheStatErr = errno;
}
qCDebug(KIO_SMB) << "size " << (KIO::filesize_t)st->st_size;
qCDebug(KIO_SMB_LOG) << "size " << (KIO::filesize_t)st->st_size;
return cacheStatErr;
}
......@@ -71,7 +71,7 @@ int SMBSlave::browse_stat_path(const SMBUrl& _url, UDSEntry& udsentry)
{
if(!S_ISDIR(st.st_mode) && !S_ISREG(st.st_mode))
{
qCDebug(KIO_SMB) << "mode: "<< st.st_mode;
qCDebug(KIO_SMB_LOG) << "mode: "<< st.st_mode;
warning(i18n("%1:\n"
"Unknown file type, neither directory or file.", url.toDisplayString()));
return EINVAL;
......@@ -109,14 +109,14 @@ int SMBSlave::browse_stat_path(const SMBUrl& _url, UDSEntry& udsentry)
//===========================================================================
void SMBSlave::stat( const QUrl& kurl )
{
qCDebug(KIO_SMB) << kurl;
qCDebug(KIO_SMB_LOG) << kurl;
// make a valid URL
QUrl url = checkURL(kurl);
// if URL is not valid we have to redirect to correct URL
if (url != kurl)
{
qCDebug(KIO_SMB) << "redirection " << url;
qCDebug(KIO_SMB_LOG) << "redirection " << url;
redirection(url);
finished();
return;
......@@ -166,14 +166,14 @@ void SMBSlave::stat( const QUrl& kurl )
}
else if (ret != 0)
{
qCDebug(KIO_SMB) << "stat() error" << ret << url;
qCDebug(KIO_SMB_LOG) << "stat() error" << ret << url;
reportError(url, ret);
return;
}
break;
}
default:
qCDebug(KIO_SMB) << "UNKNOWN " << url;
qCDebug(KIO_SMB_LOG) << "UNKNOWN " << url;
finished();
return;
}
......@@ -186,7 +186,7 @@ void SMBSlave::stat( const QUrl& kurl )
// TODO: complete checking
QUrl SMBSlave::checkURL(const QUrl& kurl) const
{
qCDebug(KIO_SMB) << "checkURL " << kurl;
qCDebug(KIO_SMB_LOG) << "checkURL " << kurl;
QString surl = kurl.url();
//transform any links in the form smb:/ into smb://
if (surl.startsWith(QLatin1String("smb:/"))) {
......@@ -195,7 +195,7 @@ QUrl SMBSlave::checkURL(const QUrl& kurl) const
}
if (surl.at(5) != '/') {
surl = "smb://" + surl.mid(5);
qCDebug(KIO_SMB) << "checkURL return1 " << surl << " " << QUrl(surl);
qCDebug(KIO_SMB_LOG) << "checkURL return1 " << surl << " " << QUrl(surl);
return QUrl(surl);
}
}
......@@ -215,7 +215,7 @@ QUrl SMBSlave::checkURL(const QUrl& kurl) const
} else {
url.setUserName(userinfo);
}
qCDebug(KIO_SMB) << "checkURL return2 " << url;
qCDebug(KIO_SMB_LOG) << "checkURL return2 " << url;
return url;
}
......@@ -225,13 +225,13 @@ QUrl SMBSlave::checkURL(const QUrl& kurl) const
if (url.path().isEmpty())
url.setPath("/");
qCDebug(KIO_SMB) << "checkURL return3 " << url;
qCDebug(KIO_SMB_LOG) << "checkURL return3 " << url;
return url;
}
SMBSlave::SMBError SMBSlave::errnumToKioError(const SMBUrl &url, const int errNum)
{
qCDebug(KIO_SMB) << "errNum" << errNum;
qCDebug(KIO_SMB_LOG) << "errNum" << errNum;
switch(errNum)
{
......@@ -313,7 +313,7 @@ void SMBSlave::reportWarning(const SMBUrl& url, const int errNum)
//===========================================================================
void SMBSlave::listDir( const QUrl& kurl )
{
qCDebug(KIO_SMB) << kurl;
qCDebug(KIO_SMB_LOG) << kurl;
int errNum = 0;
// check (correct) URL
......@@ -340,12 +340,12 @@ void SMBSlave::listDir( const QUrl& kurl )
errNum = errno;
}
qCDebug(KIO_SMB) << "open " << m_current_url.toSmbcUrl() << " " << m_current_url.getType() << " " << dirfd;
qCDebug(KIO_SMB_LOG) << "open " << m_current_url.toSmbcUrl() << " " << m_current_url.getType() << " " << dirfd;
if(dirfd >= 0)
{
uint direntCount = 0;
do {
qCDebug(KIO_SMB) << "smbc_readdir ";
qCDebug(KIO_SMB_LOG) << "smbc_readdir ";
dirp = smbc_readdir(dirfd);
if(dirp == nullptr)
break;
......@@ -366,13 +366,13 @@ void SMBSlave::listDir( const QUrl& kurl )
} else
udsName = dirpName;
qCDebug(KIO_SMB) << "dirp->name " << dirp->name << " " << dirpName << " '" << comment << "'" << " " << dirp->smbc_type;
qCDebug(KIO_SMB_LOG) << "dirp->name " << dirp->name << " " << dirpName << " '" << comment << "'" << " " << dirp->smbc_type;
udsentry.fastInsert( KIO::UDSEntry::UDS_NAME, udsName );
// Mark all administrative shares, e.g ADMIN$, as hidden. #197903
if (dirpName.endsWith(QLatin1Char('$'))) {
//qCDebug(KIO_SMB) << dirpName << "marked as hidden";
//qCDebug(KIO_SMB_LOG) << dirpName << "marked as hidden";
udsentry.fastInsert(KIO::UDSEntry::UDS_HIDDEN, 1);
}
......@@ -423,7 +423,7 @@ void SMBSlave::listDir( const QUrl& kurl )
// when libsmbclient knows
// u = QString("smb://%1?WORKGROUP=%2").arg(dirpName).arg(workgroup.toUpper());
qCDebug(KIO_SMB) << "list item " << u;
qCDebug(KIO_SMB_LOG) << "list item " << u;
udsentry.fastInsert(KIO::UDSEntry::UDS_URL, u.url());
udsentry.fastInsert(KIO::UDSEntry::UDS_MIME_TYPE, QString::fromLatin1("application/x-smb-server"));
......@@ -454,7 +454,7 @@ void SMBSlave::listDir( const QUrl& kurl )
}
else
{
qCDebug(KIO_SMB) << "SMBC_UNKNOWN :" << dirpName;
qCDebug(KIO_SMB_LOG) << "SMBC_UNKNOWN :" << dirpName;
// TODO: we don't handle SMBC_IPC_SHARE, SMBC_PRINTER_SHARE
// SMBC_LINK, SMBC_COMMS_SHARE
//SlaveBase::error(ERR_INTERNAL, TEXT_UNSUPPORTED_FILE_TYPE);
......@@ -540,7 +540,7 @@ void SMBSlave::listDNSSD(UDSEntry &udsentry, const QUrl &url, const uint direntC
KDNSSD::ServiceBrowser browser(QStringLiteral("_smb._tcp"));
connect(&browser, &KDNSSD::ServiceBrowser::serviceAdded,
this, [&services](KDNSSD::RemoteService::Ptr service){
qCDebug(KIO_SMB) << "DNSSD added:"
qCDebug(KIO_SMB_LOG) << "DNSSD added:"
<< service->serviceName()
<< service->type()
<< service->domain()
......@@ -563,7 +563,7 @@ void SMBSlave::listDNSSD(UDSEntry &udsentry, const QUrl &url, const uint direntC
});
connect(&browser, &KDNSSD::ServiceBrowser::serviceRemoved,
this, [&services](KDNSSD::RemoteService::Ptr service){
qCDebug(KIO_SMB) << "DNSSD removed:"
qCDebug(KIO_SMB_LOG) << "DNSSD removed:"
<< service->serviceName()
<< service->type()
<< service->domain()
......@@ -580,7 +580,7 @@ void SMBSlave::listDNSSD(UDSEntry &udsentry, const QUrl &url, const uint direntC
for (auto it = services.begin(); it != services.end(); ++it) {
auto service = *it;
if (!service->resolve()) {
qCWarning(KIO_SMB) << "Failed to resolve DNSSD service"
qCWarning(KIO_SMB_LOG) << "Failed to resolve DNSSD service"
<< service->serviceName();
it = services.erase(it);
}
......@@ -626,7 +626,7 @@ void SMBSlave::listDNSSD(UDSEntry &udsentry, const QUrl &url, const uint direntC
void SMBSlave::fileSystemFreeSpace(const QUrl& url)
{
qCDebug(KIO_SMB) << url;
qCDebug(KIO_SMB_LOG) << url;
// Avoid crashing in smbc_fstatvfs below when
// requesting free space for smb:// which doesn't
......
......@@ -68,7 +68,7 @@ void SMBSlave::smbCopy(const QUrl& ksrc, const QUrl& kdst, int permissions, KIO:
KIO::filesize_t processed_size = 0;
unsigned char buf[MAX_XFER_BUF_SIZE];
qCDebug(KIO_SMB) << "SMBSlave::copy with src = " << ksrc << "and dest = " << kdst;
qCDebug(KIO_SMB_LOG) << "SMBSlave::copy with src = " << ksrc << "and dest = " << kdst;
// setup urls
src = ksrc;
......@@ -184,7 +184,7 @@ void SMBSlave::smbCopy(const QUrl& ksrc, const QUrl& kdst, int permissions, KIO:
n = smbc_write(dstfd, buf, n);
if(n == -1)
{
qCDebug(KIO_SMB) << "SMBSlave::copy copy now KIO::ERR_CANNOT_WRITE";
qCDebug(KIO_SMB_LOG) << "SMBSlave::copy copy now KIO::ERR_CANNOT_WRITE";
error( KIO::ERR_CANNOT_WRITE, dst.toDisplayString());
break;
}
......@@ -230,7 +230,7 @@ void SMBSlave::smbCopy(const QUrl& ksrc, const QUrl& kdst, int permissions, KIO:
void SMBSlave::smbCopyGet(const QUrl& ksrc, const QUrl& kdst, int permissions, KIO::JobFlags flags)
{
qCDebug(KIO_SMB) << "src = " << ksrc << ", dest = " << kdst;
qCDebug(KIO_SMB_LOG) << "src = " << ksrc << ", dest = " << kdst;
// check if destination is ok ...
const QString dstFile = kdst.toLocalFile();
......@@ -288,7 +288,7 @@ void SMBSlave::smbCopyGet(const QUrl& ksrc, const QUrl& kdst, int permissions, K
}
if (!file.open(mode)) {
qCDebug(KIO_SMB) << "could not write to" << dstFile;
qCDebug(KIO_SMB_LOG) << "could not write to" << dstFile;
switch (file.error()) {
case QFile::OpenError:
if (bResume) {
......@@ -335,7 +335,7 @@ void SMBSlave::smbCopyGet(const QUrl& ksrc, const QUrl& kdst, int permissions, K
} else {
errNum = 0;
if (bResume) {
qCDebug(KIO_SMB) << "seeking to size" << partInfo.size();
qCDebug(KIO_SMB_LOG) << "seeking to size" << partInfo.size();
off_t offset = smbc_lseek(srcfd, partInfo.size(), SEEK_SET);
if (offset == -1) {
error(KIO::ERR_CANNOT_SEEK, src.toDisplayString());
......@@ -372,7 +372,7 @@ void SMBSlave::smbCopyGet(const QUrl& ksrc, const QUrl& kdst, int permissions, K
const qint64 bytesWritten = file.write(buf, bytesRead);
if (bytesWritten == -1) {
qCDebug(KIO_SMB) << "copy now KIO::ERR_CANNOT_WRITE";
qCDebug(KIO_SMB_LOG) << "copy now KIO::ERR_CANNOT_WRITE";
error( KIO::ERR_CANNOT_WRITE, kdst.toDisplayString());
isErr = true;
break;
......@@ -405,7 +405,7 @@ void SMBSlave::smbCopyGet(const QUrl& ksrc, const QUrl& kdst, int permissions, K
QFile::remove(dstFile);
}
if (!QFile::rename(sPart, dstFile)) {
qCDebug(KIO_SMB) << "failed to rename" << sPart << "to" << dstFile;
qCDebug(KIO_SMB_LOG) << "failed to rename" << sPart << "to" << dstFile;
error(ERR_CANNOT_RENAME_PARTIAL, sPart);
return;
}
......@@ -413,7 +413,7 @@ void SMBSlave::smbCopyGet(const QUrl& ksrc, const QUrl& kdst, int permissions, K
// Restore the mtime on the file.
const QString mtimeStr = metaData("modified");
qCDebug(KIO_SMB) << "modified:" << mtimeStr;
qCDebug(KIO_SMB_LOG) << "modified:" << mtimeStr;
if (!mtimeStr.isEmpty()) {
QDateTime dt = QDateTime::fromString(mtimeStr, Qt::ISODate);
if (dt.isValid()) {
......@@ -429,7 +429,7 @@ void SMBSlave::smbCopyGet(const QUrl& ksrc, const QUrl& kdst, int permissions, K
void SMBSlave::smbCopyPut(const QUrl& ksrc, const QUrl& kdst, int permissions, KIO::JobFlags flags)
{
qCDebug(KIO_SMB) << "src = " << ksrc << ", dest = " << kdst;
qCDebug(KIO_SMB_LOG) << "src = " << ksrc << ", dest = " << kdst;
QFile srcFile (ksrc.toLocalFile());
const QFileInfo srcInfo (srcFile);
......@@ -445,7 +445,7 @@ void SMBSlave::smbCopyPut(const QUrl& ksrc, const QUrl& kdst, int permissions, K
}
if (!srcFile.open(QFile::ReadOnly)) {
qCDebug(KIO_SMB) << "could not read from" << ksrc;
qCDebug(KIO_SMB_LOG) << "could not read from" << ksrc;
switch (srcFile.error()) {
case QFile::PermissionsError:
error(KIO::ERR_WRITE_ACCESS_DENIED, ksrc.toDisplayString());
......@@ -494,7 +494,7 @@ void SMBSlave::smbCopyPut(const QUrl& ksrc, const QUrl& kdst, int permissions, K
if (bResume) {
// append if resuming
qCDebug(KIO_SMB) << "resume" << dstUrl;
qCDebug(KIO_SMB_LOG) << "resume" << dstUrl;
dstfd = smbc_open(dstUrl.toSmbcUrl(), O_RDWR, 0 );
if (dstfd < 0) {
errNum = errno;
......@@ -516,7 +516,7 @@ void SMBSlave::smbCopyPut(const QUrl& ksrc, const QUrl& kdst, int permissions, K
mode = permissions | S_IRUSR | S_IWUSR;
}
qCDebug(KIO_SMB) << "NO resume" << dstUrl;
qCDebug(KIO_SMB_LOG) << "NO resume" << dstUrl;
dstfd = smbc_open(dstUrl.toSmbcUrl(), O_CREAT | O_TRUNC | O_WRONLY, mode);
if (dstfd < 0) {
errNum = errno;
......@@ -525,11 +525,11 @@ void SMBSlave::smbCopyPut(const QUrl& ksrc, const QUrl& kdst, int permissions, K
if (dstfd < 0) {
if (errNum == EACCES) {
qCDebug(KIO_SMB) << "access denied";
qCDebug(KIO_SMB_LOG) << "access denied";
error( KIO::ERR_WRITE_ACCESS_DENIED, dstUrl.toDisplayString());
}
else {
qCDebug(KIO_SMB) << "can not open for writing";
qCDebug(KIO_SMB_LOG) << "can not open for writing";
error( KIO::ERR_CANNOT_OPEN_FOR_WRITING, dstUrl.toDisplayString());
}
return;
......@@ -568,7 +568,7 @@ void SMBSlave::smbCopyPut(const QUrl& ksrc, const QUrl& kdst, int permissions, K
// FINISHED
if (smbc_close(dstfd) < 0) {
qCDebug(KIO_SMB) << dstUrl << "could not write";
qCDebug(KIO_SMB_LOG) << dstUrl << "could not write";
error( KIO::ERR_CANNOT_WRITE, dstUrl.toDisplayString());
return;
}
......@@ -589,7 +589,7 @@ void SMBSlave::smbCopyPut(const QUrl& ksrc, const QUrl& kdst, int permissions, K
if (bMarkPartial) {
smbc_unlink(dstOrigUrl.toSmbcUrl());
if (smbc_rename(dstUrl.toSmbcUrl(), dstOrigUrl.toSmbcUrl()) < 0) {
qCDebug(KIO_SMB) << "failed to rename" << dstUrl << "to" << dstOrigUrl << "->" << strerror(errno);
qCDebug(KIO_SMB_LOG) << "failed to rename" << dstUrl << "to" << dstOrigUrl << "->" << strerror(errno);
error(ERR_CANNOT_RENAME_PARTIAL, dstUrl.toDisplayString());
return;
}
......@@ -616,7 +616,7 @@ void SMBSlave::smbCopyPut(const QUrl& ksrc, const QUrl& kdst, int permissions, K
//===========================================================================
void SMBSlave::del( const QUrl &kurl, bool isfile)
{
qCDebug(KIO_SMB) << kurl;
qCDebug(KIO_SMB_LOG) << kurl;
m_current_url = kurl;
int errNum = 0;
int retVal = 0;
......@@ -624,7 +624,7 @@ void SMBSlave::del( const QUrl &kurl, bool isfile)
if(isfile)
{
// Delete file
qCDebug(KIO_SMB) << "Deleting file" << kurl;
qCDebug(KIO_SMB_LOG) << "Deleting file" << kurl;
retVal = smbc_unlink(m_current_url.toSmbcUrl());
if ( retVal < 0 ){
errNum = errno;
......@@ -634,7 +634,7 @@ void SMBSlave::del( const QUrl &kurl, bool isfile)
}
else
{
qCDebug(KIO_SMB) << "Deleting directory" << kurl;
qCDebug(KIO_SMB_LOG) << "Deleting directory" << kurl;
// Delete directory
retVal = smbc_rmdir(m_current_url.toSmbcUrl());
if( retVal < 0 ) {
......@@ -657,7 +657,7 @@ void SMBSlave::del( const QUrl &kurl, bool isfile)
//===========================================================================
void SMBSlave::mkdir( const QUrl &kurl, int permissions )
{
qCDebug(KIO_SMB) << kurl;
qCDebug(KIO_SMB_LOG) << kurl;
int errNum = 0;
int retVal = 0;
m_current_url = kurl;
......@@ -686,7 +686,7 @@ void SMBSlave::mkdir( const QUrl &kurl, int permissions )
{
reportError(kurl, errNum);
}
qCDebug(KIO_SMB) << "exit with error " << kurl;
qCDebug(KIO_SMB_LOG) << "exit with error " << kurl;
}
else // success
{
......@@ -709,31 +709,31 @@ void SMBSlave::rename( const QUrl& ksrc, const QUrl& kdest, KIO::JobFlags flags
int errNum = 0;
int retVal = 0;
qCDebug(KIO_SMB) << "old name = " << ksrc << ", new name = " << kdest;
qCDebug(KIO_SMB_LOG) << "old name = " << ksrc << ", new name = " << kdest;
src = ksrc;
dst = kdest;
// Check to se if the destination exists
qCDebug(KIO_SMB) << "stat dst";
qCDebug(KIO_SMB_LOG) << "stat dst";
errNum = cache_stat(dst, &st);
if( errNum == 0 )
{
if(S_ISDIR(st.st_mode))
{
qCDebug(KIO_SMB) << "KIO::ERR_DIR_ALREADY_EXIST";
qCDebug(KIO_SMB_LOG) << "KIO::ERR_DIR_ALREADY_EXIST";
error( KIO::ERR_DIR_ALREADY_EXIST, dst.toDisplayString());
return;
}
if(!(flags & KIO::Overwrite))
{
qCDebug(KIO_SMB) << "KIO::ERR_FILE_ALREADY_EXIST";
qCDebug(KIO_SMB_LOG) << "KIO::ERR_FILE_ALREADY_EXIST";
error( KIO::ERR_FILE_ALREADY_EXIST, dst.toDisplayString());
return;
}
}
qCDebug(KIO_SMB ) << "smbc_rename " << src.toSmbcUrl() << " " << dst.toSmbcUrl();
qCDebug(KIO_SMB_LOG) << "smbc_rename " << src.toSmbcUrl() << " " << dst.toSmbcUrl();
retVal = smbc_rename(src.toSmbcUrl(), dst.toSmbcUrl());
if( retVal < 0 ){
errNum = errno;
......@@ -743,7 +743,7 @@ void SMBSlave::rename( const QUrl& ksrc, const QUrl& kdest, KIO::JobFlags flags
if( retVal < 0 )
{
qCDebug(KIO_SMB ) << "failed ";
qCDebug(KIO_SMB_LOG) << "failed ";
switch(errNum)
{
case ENOENT:
......@@ -752,12 +752,12 @@ void SMBSlave::rename( const QUrl& ksrc, const QUrl& kdest, KIO::JobFlags flags
{
if(errNum == EACCES)
{
qCDebug(KIO_SMB) << "KIO::ERR_ACCESS_DENIED";
qCDebug(KIO_SMB_LOG) << "KIO::ERR_ACCESS_DENIED";
error(KIO::ERR_ACCESS_DENIED, src.toDisplayString());
}
else
{
qCDebug(KIO_SMB) << "KIO::ERR_DOES_NOT_EXIST";
qCDebug(KIO_SMB_LOG) << "KIO::ERR_DOES_NOT_EXIST";
error(KIO::ERR_DOES_NOT_EXIST, src.toDisplayString());
}
}
......@@ -765,20 +765,20 @@ void SMBSlave::rename( const QUrl& ksrc, const QUrl& kdest, KIO::JobFlags flags
case EACCES:
case EPERM:
qCDebug(KIO_SMB) << "KIO::ERR_ACCESS_DENIED";
qCDebug(KIO_SMB_LOG) << "KIO::ERR_ACCESS_DENIED";
error( KIO::ERR_ACCESS_DENIED, dst.toDisplayString() );
break;
default:
qCDebug(KIO_SMB) << "KIO::ERR_CANNOT_RENAME";
qCDebug(KIO_SMB_LOG) << "KIO::ERR_CANNOT_RENAME";
error( KIO::ERR_CANNOT_RENAME, src.toDisplayString() );
}
qCDebug(KIO_SMB) << "exit with error";
qCDebug(KIO_SMB_LOG) << "exit with error";
return;
}
qCDebug(KIO_SMB ) << "everything fine\n";
qCDebug(KIO_SMB_LOG) << "everything fine\n";
finished();
}
......@@ -52,7 +52,7 @@ void SMBSlave::get( const QUrl& kurl )
QByteArray filedata;
SMBUrl url;
qCDebug(KIO_SMB) << kurl;
qCDebug(KIO_SMB_LOG) << kurl;
// check (correct) URL
QUrl kvurl = checkURL(kurl);
......@@ -141,7 +141,7 @@ void SMBSlave::get( const QUrl& kurl )
void SMBSlave::open( const QUrl& kurl, QIODevice::OpenMode mode)
{
int errNum = 0;
qCDebug(KIO_SMB) << kurl;
qCDebug(KIO_SMB_LOG) << kurl;
// check (correct) URL
QUrl kvurl = checkURL(kurl);
......@@ -256,7 +256,7 @@ void SMBSlave::read( KIO::filesize_t bytesRequested )
if(bytesRead < 0)
{
qCDebug(KIO_SMB) << "Could not read " << m_openUrl;
qCDebug(KIO_SMB_LOG) << "Could not read " << m_openUrl;
error( KIO::ERR_CANNOT_READ, m_openUrl.toDisplayString());
closeWithoutFinish();
return;
......@@ -276,7 +276,7 @@ void SMBSlave::write(const QByteArray &fileData)
ssize_t size = smbc_write(m_openFd, buf.data(), buf.size());
if (size < 0)
{
qCDebug(KIO_SMB) << "Could not write to " << m_openUrl;
qCDebug(KIO_SMB_LOG) << "Could not write to " << m_openUrl;
error( KIO::ERR_CANNOT_WRITE, m_openUrl.toDisplayString());
closeWithoutFinish();
return;
......@@ -292,7 +292,7 @@ void SMBSlave::seek(KIO::filesize_t offset)
error(KIO::ERR_CANNOT_SEEK, m_openUrl.path());
closeWithoutFinish();
} else {
qCDebug( KIO_SMB ) << "res" << res;
qCDebug(KIO_SMB_LOG) << "res" << res;
position( res );
}
}
......@@ -326,7 +326,7 @@ void SMBSlave::put( const QUrl& kurl,
mode_t mode;
QByteArray filedata;
qCDebug(KIO_SMB) << kurl;
qCDebug(KIO_SMB_LOG) << kurl;
errNum = cache_stat(m_current_url, &st);
exists = (errNum == 0);
......@@ -334,12 +334,12 @@ void SMBSlave::put( const QUrl& kurl,
{
if (S_ISDIR(st.st_mode))
{