"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "core/smb4kclient_p.cpp" between
smb4k-3.0.70.tar.xz and smb4k-3.0.71.tar.xz

About: Smb4K is an advanced SMB/CIFS share (network neighborhood) browser for KDE and a frontend to the programs of the Samba software suite. Beta version.

smb4kclient_p.cpp  (smb4k-3.0.70.tar.xz):smb4kclient_p.cpp  (smb4k-3.0.71.tar.xz)
skipping to change at line 153 skipping to change at line 153
// //
// Clear the list of files and directories // Clear the list of files and directories
// //
while (!m_files.isEmpty()) while (!m_files.isEmpty())
{ {
m_files.takeFirst().clear(); m_files.takeFirst().clear();
} }
// //
// Delete the context // Free the SMB context
// //
if (!m_context) smbc_free_context(m_context, 1);
{
qDebug() << "Delete the context";
delete m_context;
}
} }
void Smb4KClientJob::start() void Smb4KClientJob::start()
{ {
QTimer::singleShot(50, this, SLOT(slotStartJob())); QTimer::singleShot(50, this, SLOT(slotStartJob()));
} }
void Smb4KClientJob::setNetworkItem(NetworkItemPtr item) void Smb4KClientJob::setNetworkItem(NetworkItemPtr item)
{ {
m_item = item; m_item = item;
skipping to change at line 393 skipping to change at line 389
break; break;
} }
} }
return workgroup; return workgroup;
} }
void Smb4KClientJob::initClientLibrary() void Smb4KClientJob::initClientLibrary()
{ {
// //
// Allocate new context // Get new context
//
m_context= smbc_new_context();
if (!m_context)
{
int errorCode = errno;
setError(ClientError);
setErrorText(strerror(errorCode));
emitResult();
return;
}
//
// Init the context
// //
m_context = smbc_new_context(); m_context = smbc_init_context(m_context);
if (!m_context) if (!m_context)
{ {
int errorCode = errno; int errorCode = errno;
setError(ClientError); setError(ClientError);
setErrorText(strerror(errorCode)); setErrorText(strerror(errorCode));
smbc_free_context(m_context, 1);
emitResult(); emitResult();
return; return;
} }
// //
// Get the custom options // Get the custom options
// //
OptionsPtr options = Smb4KCustomOptionsManager::self()->findOptions(m_item); OptionsPtr options = Smb4KCustomOptionsManager::self()->findOptions(m_item);
// //
skipping to change at line 470 skipping to change at line 484
// neighborhood. Thus, only set the workgroup if no DNS-SD discovery was u sed. // neighborhood. Thus, only set the workgroup if no DNS-SD discovery was u sed.
// //
HostPtr host = m_item.staticCast<Smb4KHost>(); HostPtr host = m_item.staticCast<Smb4KHost>();
WorkgroupPtr workgroup = findWorkgroup(host->workgroupName()); WorkgroupPtr workgroup = findWorkgroup(host->workgroupName());
if (!workgroup->dnsDiscovered()) if (!workgroup->dnsDiscovered())
{ {
smbc_setWorkgroup(m_context, host->workgroupName().toUtf8().data()); smbc_setWorkgroup(m_context, host->workgroupName().toUtf8().data());
} }
//
// Set the NetBIOS name
//
smbc_setNetbiosName(m_context, host->hostName().toUtf8().data()); smbc_setNetbiosName(m_context, host->hostName().toUtf8().data());
break; break;
} }
case Share: case Share:
{ {
// //
// In case the domain/workgroup was discovered by the DNS-SD service, the // In case the domain/workgroup was discovered by the DNS-SD service, the
// workgroup/domain might not be identical with the one defined in the net work // workgroup/domain might not be identical with the one defined in the net work
// neighborhood. Thus, only set the workgroup if no DNS-SD discovery was u sed. // neighborhood. Thus, only set the workgroup if no DNS-SD discovery was u sed.
// //
SharePtr share = m_item.staticCast<Smb4KShare>(); SharePtr share = m_item.staticCast<Smb4KShare>();
WorkgroupPtr workgroup = findWorkgroup(share->workgroupName()); WorkgroupPtr workgroup = findWorkgroup(share->workgroupName());
if (!workgroup->dnsDiscovered()) if (!workgroup->dnsDiscovered())
{ {
smbc_setWorkgroup(m_context, share->workgroupName().toUtf8().data()); smbc_setWorkgroup(m_context, share->workgroupName().toUtf8().data());
} }
//
// Set the NetBIOS name
//
smbc_setNetbiosName(m_context, share->hostName().toUtf8().data()); smbc_setNetbiosName(m_context, share->hostName().toUtf8().data());
break; break;
} }
case Directory: case Directory:
{ {
// //
// In case the domain/workgroup was discovered by the DNS-SD service, the // In case the domain/workgroup was discovered by the DNS-SD service, the
// workgroup/domain might not be identical with the one defined in the net work // workgroup/domain might not be identical with the one defined in the net work
// neighborhood. Thus, only set the workgroup if no DNS-SD discovery was u sed. // neighborhood. Thus, only set the workgroup if no DNS-SD discovery was u sed.
// //
FilePtr file = m_item.staticCast<Smb4KFile>(); FilePtr file = m_item.staticCast<Smb4KFile>();
WorkgroupPtr workgroup = findWorkgroup(file->workgroupName()); WorkgroupPtr workgroup = findWorkgroup(file->workgroupName());
if (!workgroup->dnsDiscovered()) if (!workgroup->dnsDiscovered())
{ {
smbc_setWorkgroup(m_context, file->workgroupName().toUtf8().data()); smbc_setWorkgroup(m_context, file->workgroupName().toUtf8().data());
} }
//
// Set the NetBIOS name
//
smbc_setNetbiosName(m_context, file->hostName().toUtf8().data()); smbc_setNetbiosName(m_context, file->hostName().toUtf8().data());
break; break;
} }
default: default:
{ {
break; break;
} }
} }
skipping to change at line 577 skipping to change at line 600
} }
// //
// Set the protocol to SMB1 ("NT1") if desired so that the workgroups // Set the protocol to SMB1 ("NT1") if desired so that the workgroups
// and domains can be discovered. // and domains can be discovered.
// //
if (Smb4KSettings::forceSmb1Protocol() && m_item->type() == Network) if (Smb4KSettings::forceSmb1Protocol() && m_item->type() == Network)
{ {
smbc_setOptionProtocols(m_context, "NT1", "NT1"); smbc_setOptionProtocols(m_context, "NT1", "NT1");
} }
else
{
smbc_setOptionProtocols(m_context, NULL, NULL);
}
// //
// Set the encryption level // Set the encryption level
// //
if (Smb4KSettings::useEncryptionLevel()) if (Smb4KSettings::useEncryptionLevel())
{ {
switch (Smb4KSettings::encryptionLevel()) switch (Smb4KSettings::encryptionLevel())
{ {
case Smb4KSettings::EnumEncryptionLevel::None: case Smb4KSettings::EnumEncryptionLevel::None:
{ {
skipping to change at line 640 skipping to change at line 667
// //
// Set the channel for debug output // Set the channel for debug output
// //
smbc_setOptionDebugToStderr(m_context, 1); smbc_setOptionDebugToStderr(m_context, 1);
// //
// Set auth callback function // Set auth callback function
// //
smbc_setFunctionAuthDataWithContext(m_context, get_auth_data_with_context_fn); smbc_setFunctionAuthDataWithContext(m_context, get_auth_data_with_context_fn);
//
// Initialize context with the previously defined options
//
if (!smbc_init_context(m_context))
{
int errorCode = errno;
setError(ClientError);
setErrorText(strerror(errorCode));
smbc_free_context(m_context, 1);
emitResult();
return;
}
} }
void Smb4KClientJob::doLookups() void Smb4KClientJob::doLookups()
{ {
// //
// Set the new context // Set the new context
// //
(void)smbc_set_context(m_context); (void)smbc_set_context(m_context);
// //
skipping to change at line 1147 skipping to change at line 1158
{ {
int errorCode = errno; int errorCode = errno;
setError(ClientError); setError(ClientError);
setErrorText(strerror(errorCode)); setErrorText(strerror(errorCode));
return; return;
} }
(void)closeDirectory(m_context, directory); (void)closeDirectory(m_context, directory);
//
// Free the context
//
smbc_free_context(m_context, 1);
} }
#ifdef USE_WS_DISCOVERY #ifdef USE_WS_DISCOVERY
void Smb4KClientJob::doWsDiscovery() void Smb4KClientJob::doWsDiscovery()
{ {
// //
// The KDSoap WS-Discovery client // The KDSoap WS-Discovery client
// //
WSDiscoveryClient client(this); WSDiscoveryClient client(this);
skipping to change at line 1789 skipping to change at line 1795
smbc_free_context(m_context, 1); smbc_free_context(m_context, 1);
} }
QHostAddress Smb4KClientJob::lookupIpAddress(const QString& name) QHostAddress Smb4KClientJob::lookupIpAddress(const QString& name)
{ {
// //
// The IP address object // The IP address object
// //
QHostAddress ipAddress; QHostAddress ipAddress;
//
// Get the IP address
//
// If the IP address is not to be determined for the local machine, we can use QHostInfo to // If the IP address is not to be determined for the local machine, we can use QHostInfo to
// determine it. Otherwise we need to use QNetworkInterface for it. // determine it. Otherwise we need to use QNetworkInterface for it.
//
if (name.toUpper() == QHostInfo::localHostName().toUpper() || if (name.toUpper() == QHostInfo::localHostName().toUpper() ||
name.toUpper() == globalSambaOptions()["netbios name"].toUpper() || name.toUpper() == machineNetbiosName().toUpper() ||
name.toUpper() == Smb4KSettings::netBIOSName().toUpper()) name.toUpper() == Smb4KSettings::netBIOSName().toUpper())
{ {
// FIXME: Do we need to honor 'interfaces' here? // FIXME: Do we need to honor 'interfaces' here?
QList<QHostAddress> addresses = QNetworkInterface::allAddresses(); QList<QHostAddress> addresses = QNetworkInterface::allAddresses();
// Get the IP address for the host. For the time being, prefer the // Get the IP address for the host. For the time being, prefer the
// IPv4 address over the IPv6 address. // IPv4 address over the IPv6 address.
for (const QHostAddress &addr : addresses) for (const QHostAddress &addr : addresses)
{ {
// We only use global addresses. // We only use global addresses.
 End of changes. 14 change blocks. 
30 lines changed or deleted 40 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)