rpms/smb4k/devel smb4k-0.6.8-mount.patch, NONE, 1.1 smb4k.spec, 1.4, 1.5 smb4k-0.6.5-buff.patch, 1.1, NONE
Marcin Garski (mgarski)
fedora-extras-commits at redhat.com
Fri Feb 17 11:17:05 UTC 2006
Author: mgarski
Update of /cvs/extras/rpms/smb4k/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv26192
Modified Files:
smb4k.spec
Added Files:
smb4k-0.6.8-mount.patch
Removed Files:
smb4k-0.6.5-buff.patch
Log Message:
- Add support of mount.cifs/umount.cifs (bug #181638)
- Remove smb4k-0.6.5-buff.patch
smb4k-0.6.8-mount.patch:
--- NEW FILE smb4k-0.6.8-mount.patch ---
diff -urN smb4k-0.6.7/ChangeLog smb4k-0.6.8rc/ChangeLog
--- smb4k-0.6.7/ChangeLog 2006-02-05 14:27:06.000000000 +0100
+++ smb4k-0.6.8rc/ChangeLog 2006-02-17 07:59:51.000000000 +0100
@@ -1,3 +1,16 @@
+Smb4K 0.6.8:
+- Fixed another bug in the bookmark menu widget. It will again be updated
+ during run time, when bookmarks are added or removed.
+- Fixed enabling of "Authentication" action in browser widget.
+- Fixed a crash (NULL pointer access) in Smb4KShareWidget::slotMountedShares(),
+ that was found by Glen Masgai, who also sent the patch.
+- Added support of mount.cifs and umount.cifs. This should enable users to
+ mount CIFS shares as normal users depending on the configuration of the
+ system and on the presence of these two utilities. NOTE: You have to set the
+ setuid root bit for both binaries.
+- Fixed start-up if either only smbmount/smbumount or mount.cifs/umount.cifs
+ are present.
+
Smb4K 0.6.7:
- Fixed a crash in Smb4KBookmarkMenuWidget::insertBookmarks(), that was
introduced by the "fix" in 0.6.6.
diff -urN smb4k-0.6.7/configure smb4k-0.6.8rc/configure
--- smb4k-0.6.7/configure 2006-02-05 14:28:24.000000000 +0100
+++ smb4k-0.6.8rc/configure 2006-02-17 09:02:07.000000000 +0100
@@ -1953,7 +1953,7 @@
# Define the identity of the package.
PACKAGE=smb4k
- VERSION=0.6.7
+ VERSION=0.6.8rc
cat >>confdefs.h <<_ACEOF
diff -urN smb4k-0.6.7/configure.in smb4k-0.6.8rc/configure.in
--- smb4k-0.6.7/configure.in 2006-02-05 14:28:04.000000000 +0100
+++ smb4k-0.6.8rc/configure.in 2006-02-17 09:01:50.000000000 +0100
@@ -40,7 +40,7 @@
AC_ARG_PROGRAM
dnl Automake doc recommends to do this only here. (Janos)
-AM_INIT_AUTOMAKE(smb4k, 0.6.7) dnl searches for some needed programs
+AM_INIT_AUTOMAKE(smb4k, 0.6.8rc) dnl searches for some needed programs
KDE_SET_PREFIX
diff -urN smb4k-0.6.7/configure.in.in smb4k-0.6.8rc/configure.in.in
--- smb4k-0.6.7/configure.in.in 2006-02-05 13:52:33.000000000 +0100
+++ smb4k-0.6.8rc/configure.in.in 2006-02-17 08:08:01.000000000 +0100
@@ -1,6 +1,6 @@
#MIN_CONFIG(3.2.0)
-AM_INIT_AUTOMAKE(smb4k,0.6.7)
+AM_INIT_AUTOMAKE(smb4k,0.6.8rc)
dnl CXXFLAGS="$NOOPT_CXXFLAGS" dnl __kdevelop[noopt]__
dnl CFLAGS="$NOOPT_CFLAGS" dnl __kdevelop[noopt]__
diff -urN smb4k-0.6.7/smb4k/core/smb4kcore.cpp smb4k-0.6.8rc/smb4k/core/smb4kcore.cpp
--- smb4k-0.6.7/smb4k/core/smb4kcore.cpp 2005-11-21 08:13:13.000000000 +0100
+++ smb4k-0.6.8rc/smb4k/core/smb4kcore.cpp 2006-02-17 09:02:04.000000000 +0100
@@ -235,7 +235,10 @@
fileList << "ls";
fileList << "nmblookup";
fileList << "smbclient";
+ fileList << "net";
#ifndef __FreeBSD__
+ fileList << "mount.cifs";
+ fileList << "umount.cifs";
fileList << "smbmount";
fileList << "smbumount";
fileList << "mount";
@@ -246,6 +249,8 @@
fileList << "smb4k_mount";
fileList << "smb4k_umount";
fileList << "smb4k_kill";
+ fileList << "smb4k_cat";
+ fileList << "smb4k_mv";
fileList << "smbspool";
// optional programs
@@ -254,10 +259,7 @@
optional << "sudo";
optional << "dvips";
optional << "enscript";
- optional << "net";
-#ifndef __FreeBSD__
- optional << "mount.cifs";
-#endif
+ optional << "rsync";
fileList += optional;
@@ -276,7 +278,9 @@
continue;
}
else
+ {
continue;
+ }
}
}
@@ -300,13 +304,6 @@
optional.remove( QString::null );
- if ( fileList.count() != 0 )
- {
- fileList.sort();
- slotShowErrorMessage( ERROR_MISSING_PROGRAMS, fileList.join( ", " ) );
- exit( EXIT_SUCCESS );
- }
-
if ( optional.count() != 0 )
{
config()->setGroup( "Mount Options" );
@@ -335,6 +332,95 @@
config()->writeEntry( "Force Unmount", false );
}
}
+
+ if ( fileList.count() != 0 )
+ {
+#ifndef __FreeBSD__
+
+ // If either smbmount/smbumount or mount.cifs/umount.cifs
+ // are present, we want to allow Smb4K to start up.
+ // We also need to change the filesystem, if necessary. But
+ // only modify, if the user does *not* use super or sudo.
+
+ config()->setGroup( "Samba" );
+ QString filesystem = config()->readEntry( "Mount Filesystem", "smbfs" );
+
+ config()->setGroup( "Super User Privileges" );
+ bool run_suid = config()->readBoolEntry( "Run SUID", false );
+
+ if ( fileList.find( "smbmount" ) != fileList.end() &&
+ fileList.find( "mount.cifs" ) == fileList.end() )
+ {
+ *(fileList.find( "smbmount" )) = QString::null;
+
+ if ( QString::compare( filesystem, "cifs" ) != 0 && !run_suid )
+ {
+ filesystem = "cifs";
+
+ config()->setGroup( "Samba" );
+ config()->writeEntry( "Mount Filesystem", filesystem );
+ }
+ }
+
+ if ( fileList.find( "mount.cifs" ) != fileList.end() &&
+ fileList.find( "smbmount" ) == fileList.end() )
+ {
+ *(fileList.find( "mount.cifs" )) = QString::null;
+
+ if ( QString::compare( filesystem, "smbfs" ) != 0 && !run_suid )
+ {
+ filesystem = "smbfs";
+
+ config()->setGroup( "Samba" );
+ config()->writeEntry( "Mount Filesystem", filesystem );
+ }
+ }
+
+ if ( fileList.find( "smbumount" ) != fileList.end() &&
+ fileList.find( "umount.cifs" ) == fileList.end() )
+ {
+ *(fileList.find( "smbumount" )) = QString::null;
+
+ if ( QString::compare( filesystem, "cifs" ) != 0 && !run_suid )
+ {
+ filesystem = "cifs";
+
+ config()->setGroup( "Samba" );
+ config()->writeEntry( "Mount Filesystem", filesystem );
+ }
+ }
+
+ if ( fileList.find( "umount.cifs" ) != fileList.end() &&
+ fileList.find( "smbumount" ) == fileList.end() )
+ {
+ *(fileList.find( "umount.cifs" )) = QString::null;
+
+ if ( QString::compare( filesystem, "smbfs" ) != 0 && !run_suid )
+ {
+ filesystem = "smbfs";
+
+ config()->setGroup( "Samba" );
+ config()->writeEntry( "Mount Filesystem", filesystem );
+ }
+ }
+
+ fileList.remove( QString::null );
+
+ if ( fileList.count() != 0 )
+ {
+ fileList.sort();
+ slotShowErrorMessage( ERROR_MISSING_PROGRAMS, fileList.join( ", " ) );
+ exit( EXIT_SUCCESS );
+ }
+
+#else
+
+ fileList.sort();
+ slotShowErrorMessage( ERROR_MISSING_PROGRAMS, fileList.join( ", " ) );
+ exit( EXIT_SUCCESS );
+
+#endif
+ }
}
}
diff -urN smb4k-0.6.7/smb4k/core/smb4kmounter.cpp smb4k-0.6.8rc/smb4k/core/smb4kmounter.cpp
--- smb4k-0.6.7/smb4k/core/smb4kmounter.cpp 2006-01-07 08:38:54.000000000 +0100
+++ smb4k-0.6.8rc/smb4k/core/smb4kmounter.cpp 2006-02-17 07:38:03.000000000 +0100
@@ -672,14 +672,7 @@
if ( !run_suid || suid_program.isEmpty() )
{
- if ( QString::compare( m_filesystem, "cifs" ) != 0 )
- {
- command = "smb4k_mount --no-suid ";
- }
- else
- {
- command = QString( "smb4k_mount --suid -t %1 " ).arg( m_filesystem );
- }
+ command = QString( "smb4k_mount --no-suid -t %1 " ).arg( m_filesystem );
}
else if ( run_suid && !suid_program.isEmpty() )
{
@@ -719,26 +712,24 @@
// is explicitly wanted:
if ( command.contains( "uid=", true ) == 0 && command.contains( "gid=", true ) == 0 && run_suid )
{
- command.append( QString( "uid=%1,gid=%2," ).arg( QString( "%1" ).arg( (int)getuid() ) ).arg( QString( "%1" ).arg( (int)getgid() ) ) );
+ command.append( QString( "uid=%1,gid=%2," ).arg( QString( "%1" ).arg( (int)getuid() ), QString( "%1" ).arg( (int)getgid() ) ) );
}
- // (4) The authentication data:
+ // Setting the USER environment won't give you the right
+ // user when using super/sudo.
if ( !auth->user().isEmpty() )
{
command.append( QString( "username=%1" ).arg( KProcess::quote( auth->user() ) ) );
m_cifs_login = auth->user();
-
- // We want to allow empty passwords:
- if ( !auth->password().isEmpty() )
- {
- m_proc->setEnvironment( "PASSWD", auth->password() );
- }
}
else
{
command.append( "guest" );
+ m_cifs_login = "guest";
}
+ m_proc->setEnvironment( "PASSWD", !auth->password().isEmpty() ? auth->password() : "" );
+
#else
if ( !run_suid || suid_program.isEmpty() )
@@ -811,6 +802,11 @@
void Smb4KMounter::unmount( const QString &mountpoint, const QString &uid, const QString &gid, bool noMessage )
{
+ // Scrap uid and gid here. (They are not needed anymore
+ // due to the following backport from HEAD.)
+ QString d_uid = uid;
+ QString d_gid = gid;
+
config()->setGroup( "Super User Privileges" );
bool run_suid = config()->readBoolEntry( "Run SUID", false );
QString suid_program = config()->readEntry( "SUID Program", QString::null );
@@ -819,39 +815,36 @@
bool allow_unmount_foreign = config()->readBoolEntry( "Unmount Foreign", false );
QString mount_prefix = config()->readEntry( "Default Path", QDir::homeDirPath().append( "/smb4k/" ) );
- config()->setGroup( "Samba" );
- QString filesystem = config()->readEntry( "Mount Filesystem", "smbfs" );
-
if ( !mountpoint.isEmpty() )
{
QString command;
- m_path = mountpoint;
- m_path.replace( '\044', "\044" );
+ QString path = mountpoint;
+ m_path = path.replace( '\044', "\044" );
+
+ Smb4KShare *share = findShareByPath( mountpoint );
- if ( (uid.toInt() == (int)getuid() && gid.toInt() == (int)getgid()) ||
- mountpoint.startsWith( QDir( mount_prefix ).canonicalPath() ) ||
- mountpoint.startsWith( QDir::home().canonicalPath() ) )
+ if ( share && !share->isForeign() )
{
if ( !run_suid || suid_program.isEmpty() )
{
- command = QString( "smb4k_umount --no-suid --%1 " ).arg( filesystem.lower() );
+ command = "smb4k_umount --no-suid ";
}
else if ( run_suid && !suid_program.isEmpty() )
{
- command = QString( "%1 smb4k_umount --suid --%2 " ).arg( suid_program, filesystem.lower() );
+ command = QString( "%1 smb4k_umount --suid " ).arg( suid_program );
}
}
- else
+ else if ( share && share->isForeign() )
{
if ( allow_unmount_foreign )
{
if ( !run_suid || suid_program.isEmpty() )
{
- command = QString( "smb4k_umount --no-suid --%1 " ).arg( filesystem.lower() );
+ command = "smb4k_umount --no-suid ";
}
else if ( run_suid && !suid_program.isEmpty() )
{
- command = QString( "%1 smb4k_umount --suid --%2 " ).arg( suid_program, filesystem.lower() );
+ command = QString( "%1 smb4k_umount --suid " ).arg( suid_program );
}
}
else
@@ -861,8 +854,8 @@
emit error( ERROR_UNMOUNTING_NOT_ALLOWED, QString::null );
}
- emit running( MOUNTER_STOP, false );
m_working = false;
+ emit running( MOUNTER_STOP, m_working );
return;
}
@@ -899,6 +892,11 @@
void Smb4KMounter::forceUnmount( const QString &mountpoint, const QString &uid, const QString &gid )
{
+ // Scrap uid and gid here. (They are not needed anymore
+ // due to the following backport from HEAD.)
+ QString d_uid = uid;
+ QString d_gid = gid;
+
config()->setGroup( "Super User Privileges" );
bool force_unmount = config()->readBoolEntry( "Force Unmount", false );
QString suid_program = config()->readEntry( "SUID Program", QString::null );
@@ -907,9 +905,6 @@
bool allow_unmount_foreign = config()->readBoolEntry( "Unmount Foreign", false );
QString mount_prefix = config()->readEntry( "Default Path", QDir::homeDirPath().append( "/smb4k/" ) );
- config()->setGroup( "Samba" );
- QString filesystem = config()->readEntry( "Mount Filesystem", "smbfs" );
-
QString kernel = getKernelVersion();
if ( !force_unmount )
@@ -947,18 +942,18 @@
if ( !mountpoint.isEmpty() )
{
QString command;
- m_path = mountpoint;
- m_path.replace( '\044', "\044" );
+ QString path = mountpoint;
+ m_path = path.replace( '\044', "\044" );
+
+ Smb4KShare *share = findShareByPath( mountpoint );
bool execute = false;
- if ( uid.toInt() == (int)getuid() && gid.toInt() == (int)getgid() ||
- mountpoint.startsWith( QDir( mount_prefix ).canonicalPath() ) ||
- mountpoint.startsWith( QDir::home().canonicalPath() ) )
+ if ( share && !share->isForeign() )
{
- if ( KMessageBox::questionYesNo( (QWidget *)this, i18n( "Do you really want to force the unmounting of this share?" ), QString::null, KStdGuiItem::yes(), KStdGuiItem::no(), "Dont Ask Forced", KMessageBox::Notify ) == KMessageBox::Yes )
+ if ( KMessageBox::questionYesNo( 0, i18n( "Do you really want to force the unmounting of this share?" ), QString::null, KStdGuiItem::yes(), KStdGuiItem::no(), "Dont Ask Forced", KMessageBox::Notify ) == KMessageBox::Yes )
{
- command = QString( "%1 smb4k_umount --suid --%2 -l " ).arg( suid_program, filesystem.lower() );
+ command = QString( "%1 smb4k_umount --suid -l " ).arg( suid_program );
execute = true;
}
else
@@ -968,13 +963,13 @@
return;
}
}
- else
+ else if ( share && share->isForeign() )
{
if ( allow_unmount_foreign )
{
- if ( KMessageBox::questionYesNo( (QWidget *)this, i18n( "Do you really want to force the unmounting of this share?" ), QString::null, KStdGuiItem::yes(), KStdGuiItem::no(), "Dont Ask Forced", KMessageBox::Notify ) == KMessageBox::Yes )
+ if ( KMessageBox::questionYesNo( 0, i18n( "Do you really want to force the unmounting of this share?" ), QString::null, KStdGuiItem::yes(), KStdGuiItem::no(), "Dont Ask Forced", KMessageBox::Notify ) == KMessageBox::Yes )
{
- command = QString( "%1 smb4k_umount --suid --%2 -l " ).arg( suid_program, filesystem.lower() );
+ command = QString( "%1 smb4k_umount --suid -l " ).arg( suid_program );
execute = true;
}
else
@@ -1052,11 +1047,11 @@
{
if ( run_suid )
{
- command.append( QString( "%1 smb4k_umount --suid --%2 " ).arg( suid_program, (*it)->getFilesystem().lower() ) ).append( KProcess::quote( (*it)->getPath().replace( '\044', "\044" ) ) ).append( " ; " );
+ command.append( QString( "%1 smb4k_umount --suid " ).arg( suid_program ) ).append( KProcess::quote( (*it)->getPath().replace( '\044', "\044" ) ) ).append( " ; " );
}
else
{
- command.append( QString( "smb4k_umount --no-suid --%1 " ).arg( (*it)->getFilesystem().lower() ) ).append( KProcess::quote( (*it)->getPath().replace( '\044', "\044" ) ) ).append( " ; " );
+ command.append( "smb4k_umount --no-suid " ).append( KProcess::quote( (*it)->getPath().replace( '\044', "\044" ) ) ).append( " ; " );
}
#ifndef __FreeBSD__
diff -urN smb4k-0.6.7/smb4k/widgets/smb4kbookmarkmenuwidget.cpp smb4k-0.6.8rc/smb4k/widgets/smb4kbookmarkmenuwidget.cpp
--- smb4k-0.6.7/smb4k/widgets/smb4kbookmarkmenuwidget.cpp 2006-02-05 13:25:51.000000000 +0100
+++ smb4k-0.6.8rc/smb4k/widgets/smb4kbookmarkmenuwidget.cpp 2006-02-11 10:24:07.000000000 +0100
@@ -146,6 +146,9 @@
}
}
+ list.clear();
+ list = m_collection->actions( "Bookmarks" );
+
uint index = 0;
while ( index < list.count() )
diff -urN smb4k-0.6.7/smb4k/widgets/smb4kbrowserwidget.cpp smb4k-0.6.8rc/smb4k/widgets/smb4kbrowserwidget.cpp
--- smb4k-0.6.7/smb4k/widgets/smb4kbrowserwidget.cpp 2006-01-19 22:44:21.000000000 +0100
+++ smb4k-0.6.8rc/smb4k/widgets/smb4kbrowserwidget.cpp 2006-02-11 10:27:50.000000000 +0100
@@ -402,6 +402,7 @@
if ( item && item->depth() == 2 )
{
m_preview_action->setEnabled( true );
+ m_askpass_action->setEnabled( true );
if ( item->text( Type ).contains( "Printer" ) == 0 )
{
diff -urN smb4k-0.6.7/smb4k/widgets/smb4ksharewidget.cpp smb4k-0.6.8rc/smb4k/widgets/smb4ksharewidget.cpp
--- smb4k-0.6.7/smb4k/widgets/smb4ksharewidget.cpp 2005-11-26 13:35:50.000000000 +0100
+++ smb4k-0.6.8rc/smb4k/widgets/smb4ksharewidget.cpp 2006-02-15 08:46:02.000000000 +0100
@@ -268,20 +268,29 @@
if ( !shares.isEmpty() )
{
+ Smb4KShareWidgetItem *test_item = (Smb4KShareWidgetItem *)firstItem();
+ Smb4KShareWidgetItem *next_item = NULL;
+
// First remove those, that are not mounted anymore:
- for ( Smb4KShareWidgetItem *item = (Smb4KShareWidgetItem *)this->firstItem(); item; item = (Smb4KShareWidgetItem *)item->nextItem() )
+ while ( test_item )
{
- if( !smb4k_core->mounter()->findShareByPath( item->mountpoint() ) ||
- ( item->shareObject()->isForeign() && !m_showExternal ) )
+ next_item = (Smb4KShareWidgetItem *)test_item->nextItem();
+
+ if( !smb4k_core->mounter()->findShareByPath( test_item->mountpoint() ) ||
+ ( test_item->shareObject()->isForeign() && !m_showExternal ) )
{
- if ( current == item )
+ if ( current == test_item )
{
smb4k_core->setShareForUsageInfo( NULL );
}
- delete item;
+ delete test_item;
+ test_item = NULL;
+
this->sort( this->sortDirection() );
}
+
+ test_item = next_item;
}
// Now process the entries in the list:
Pliki binarne smb4k-0.6.7/smb4k.kdevelop.pcs i smb4k-0.6.8rc/smb4k.kdevelop.pcs siÄ różniÄ
diff -urN smb4k-0.6.7/smb4k.kdevses smb4k-0.6.8rc/smb4k.kdevses
--- smb4k-0.6.7/smb4k.kdevses 2006-02-05 08:40:30.000000000 +0100
+++ smb4k-0.6.8rc/smb4k.kdevses 2006-02-17 08:46:12.000000000 +0100
@@ -1,9 +1,9 @@
<?xml version = '1.0' encoding = 'UTF-8'?>
<!DOCTYPE KDevPrjSession>
<KDevPrjSession>
- <DocsAndViews NumberOfDocuments="10" >
+ <DocsAndViews NumberOfDocuments="4" >
<Doc0 NumberOfViews="1" URL="file:///home/alex/Entwicklung/smb4k_06/ChangeLog" >
- <View0 Type="Source" />
+ <View0 line="10" Type="Source" />
</Doc0>
<Doc1 NumberOfViews="1" URL="file:///home/alex/Entwicklung/smb4k_06/smb4k/core/smb4kglobal.h" >
<View0 Type="Source" />
@@ -11,27 +11,9 @@
<Doc2 NumberOfViews="1" URL="file:///home/alex/Entwicklung/smb4k_06/smb4k/core/smb4kglobal.cpp" >
<View0 Type="Source" />
</Doc2>
- <Doc3 NumberOfViews="1" URL="file:///home/alex/Entwicklung/smb4k_06/smb4k/core/smb4kuser.cpp" >
- <View0 Type="Source" />
+ <Doc3 NumberOfViews="1" URL="file:///home/alex/Entwicklung/smb4k_06/smb4k/core/smb4kcore.cpp" >
+ <View0 line="380" Type="Source" />
</Doc3>
- <Doc4 NumberOfViews="1" URL="file:///home/alex/Entwicklung/smb4k_06/smb4k/widgets/smb4kbrowserwidget.cpp" >
- <View0 Type="Source" />
- </Doc4>
- <Doc5 NumberOfViews="1" URL="file:///home/alex/Entwicklung/smb4k_06/smb4k/main.cpp" >
- <View0 Type="Source" />
- </Doc5>
- <Doc6 NumberOfViews="1" URL="file:///home/alex/Entwicklung/smb4k_06/smb4k/core/smb4kfileio.cpp" >
- <View0 Type="Source" />
- </Doc6>
- <Doc7 NumberOfViews="1" URL="file:///home/alex/Entwicklung/smb4k_06/smb4k/core/smb4kfileio.h" >
- <View0 Type="Source" />
- </Doc7>
- <Doc8 NumberOfViews="1" URL="file:///home/alex/Entwicklung/smb4k_06/smb4k/widgets/smb4kbookmarkmenuwidget.cpp" >
- <View0 Type="Source" />
- </Doc8>
- <Doc9 NumberOfViews="1" URL="file:///home/alex/Entwicklung/smb4k_06/smb4k/core/smb4kbookmarkhandler.cpp" >
- <View0 line="76" Type="Source" />
- </Doc9>
</DocsAndViews>
<pluginList>
<kdevdebugger>
diff -urN smb4k-0.6.7/utilities/smb4k_mount.cpp smb4k-0.6.8rc/utilities/smb4k_mount.cpp
--- smb4k-0.6.7/utilities/smb4k_mount.cpp 2005-06-09 16:12:55.000000000 +0200
+++ smb4k-0.6.8rc/utilities/smb4k_mount.cpp 2006-02-17 07:38:08.000000000 +0100
@@ -34,7 +34,7 @@
void info()
{
cout << "This is smb4k_mount, the mount utility for Smb4K." << endl;
- cout << "(c) 2004-2005, Alexander Reinholdt" << endl << endl;
+ cout << "(c) 2004-2006, Alexander Reinholdt" << endl << endl;
cout << "Usage:" << endl;
cout << " smb4k_mount [--no-suid|--suid] <options>" << endl;
cout << " smb4k_mount --help" << endl << endl;
@@ -43,7 +43,9 @@
cout << " --suid\tsmb4k_mount invokes mount." << endl;
cout << " --help\tDisplays this help screen and exits." << endl;
cout << " <options>\tThese are the options that you have to pass to the mount" << endl;
- cout << "\t\tbinary." << endl;
+ cout << "\t\tbinary. Note, that under Linux you must specify the \'-t\'" << endl;
+ cout << "\t\toption under any circumstances. Under FreeBSD, however, it" << endl;
+ cout << "\t\tis not recognized and might cause problems." << endl;
cout << endl;
}
@@ -56,12 +58,12 @@
{
const char *paths[] = { "/bin/", "/sbin/", "/usr/bin/", "/usr/sbin/", "/usr/local/bin/", "/usr/local/sbin/" };
string file = "";
-
+
for ( uint i = 0; i < sizeof( paths ) / sizeof( char * ); i++ )
{
string path( paths[i] );
path.append( name );
-
+
if ( access( path.c_str(), X_OK ) == 0 )
{
file.assign( path );
@@ -74,7 +76,7 @@
cerr << "smb4k_mount: Could not find " << name << "." << endl;
exit( EXIT_FAILURE );
}
-
+
return file.c_str();
}
@@ -88,7 +90,7 @@
const char *replace_special_characters( const char *str )
{
string s( str );
-
+
for ( uint i = 0; i < s.length(); i++ )
{
switch ( s[i] )
@@ -232,7 +234,7 @@
break;
}
}
-
+
return s.c_str();
}
@@ -248,12 +250,13 @@
info();
exit( EXIT_FAILURE );
}
-
+
bool fs_exists = false;
bool suid_arg_exists = false;
+ bool use_suid = false;
char *args[25];
int k = 0;
-
+
// Loop through the argument
for ( int i = 1; i < argc; i++ )
{
@@ -264,48 +267,57 @@
}
else if ( !strcmp( argv[i], "--no-suid" ) )
{
- char *p = (char *)malloc( 100*sizeof(char) );
-
+ // Under FreeBSD, we can put the binary in the array already
+ // at this point, because there is only one. Under Linux, we
+ // have to determine the filesystem type before.
+
+#ifdef __FreeBSD__
+ char *p = new char[100];
+
if ( !p )
{
cerr << "smb4k_mount: Out of memory" << endl;
exit( EXIT_FAILURE );
}
-
-#ifndef __FreeBSD__
- args[k] = strcpy( p, findprog( "smbmount" ) );
-#else
+
args[k] = strcpy( p, findprog( "mount_smbfs" ) );
#endif
+
k++;
- fs_exists = true;
suid_arg_exists = true;
+ use_suid = false;
continue;
}
else if ( !strcmp( argv[i], "--suid" ) )
{
- char *p = (char *)malloc( 100*sizeof(char) );
-
+ // Under FreeBSD, we can put the binary in the array already
+ // at this point, because there is only one. Under Linux, we
+ // have to determine the filesystem type before.
+
+#ifdef __FreeBSD__
+ char *p = new char[100];
+
if ( !p )
{
cerr << "smb4k_mount: Out of memory" << endl;
exit( EXIT_FAILURE );
}
-
-#ifndef __FreeBSD__
- args[k] = strcpy( p, findprog( "mount" ) );
-#else
+
args[k] = strcpy( p, findprog( "mount_smbfs" ) );
#endif
+
k++;
suid_arg_exists = true;
+ use_suid = true;
continue;
}
else
{
#ifndef __FreeBSD__
if ( !strcmp( argv[i], "-t" ) )
- {
+ {
+ fs_exists = true;
+
if ( strcmp( argv[i+1], "smbfs" ) != 0 && strcmp( argv[i+1], "cifs" ) != 0 )
{
cerr << "smb4k_mount: You specified an invalid filesystem." << endl;
@@ -313,55 +325,97 @@
}
else
{
- fs_exists = true;
+ // Put the binary into the first position.
+
+ if ( suid_arg_exists )
+ {
+ if ( use_suid )
+ {
+ char *p = new char[100];
+
+ if ( !p )
+ {
+ cerr << "smb4k_mount: Out of memory" << endl;
+ exit( EXIT_FAILURE );
+ }
+
+ args[0] = strcpy( p, findprog( "mount" ) );
+ }
+ else
+ {
+ char *p = new char[100];
+
+ if ( !p )
+ {
+ cerr << "smb4k_mount: Out of memory" << endl;
+ exit( EXIT_FAILURE );
+ }
+
+ if ( !strcmp( argv[i+1], "smbfs" ) )
+ {
+ args[0] = strcpy( p, findprog( "smbmount" ) );
+ }
+ else if ( !strcmp( argv[i+1], "cifs" ) )
+ {
+ args[0] = strcpy( p, findprog( "mount.cifs" ) );
+ }
+
+ // For smbmount and mount.cifs, we do not need the -t option.
+ // Jump to the next argument.
+ i++;
+
+ continue;
+ }
+ }
+ else
+ {
+ cerr << "smb4k_mount: You have to supply either the '--suid' or '--no-suid' argument." << endl;
+ exit( EXIT_FAILURE );
+ }
}
}
#endif
-
- char *t = (char *)malloc( 250*sizeof(char) );
-
+
+ char *t = new char[strlen( argv[i] )+1];
+
if ( !t )
{
cerr << "smb4k_mount: Out of memory" << endl;
exit( EXIT_FAILURE );
}
-
- if ( strlen( argv[i] ) > 250 )
- {
- cerr << "smb4k_mount: One or more arguments exceed the limit of 250 characters!" << endl;
- exit( EXIT_FAILURE );
- }
-
+
args[k] = strcpy( t, replace_special_characters( argv[i] ) );
k++;
-
+
continue;
}
}
-
+
args[k] = NULL;
-
+
+ // FIXME: Do we need the following under FreeBSD?
+
if ( !suid_arg_exists )
{
cerr << "smb4k_mount: You have to supply either the '--suid' or '--no-suid' argument." << endl;
exit( EXIT_FAILURE );
}
-#ifndef __FreeBSD__
+#ifndef __FreeBSD__
if ( !fs_exists )
{
cerr << "smb4k_mount: You haven't specified a filesystem (smbfs or cifs)." << endl;
exit( EXIT_FAILURE );
}
#endif
-
+
if ( execve( args[0], args, envp ) == -1 )
{
int err_code = errno;
-
+
cerr << "smb4k_mount: " << strerror( err_code ) << endl;
exit( EXIT_FAILURE );
}
-
+
return EXIT_SUCCESS;
}
diff -urN smb4k-0.6.7/utilities/smb4k_umount.cpp smb4k-0.6.8rc/utilities/smb4k_umount.cpp
--- smb4k-0.6.7/utilities/smb4k_umount.cpp 2005-10-20 07:38:13.000000000 +0200
+++ smb4k-0.6.8rc/utilities/smb4k_umount.cpp 2006-02-17 07:38:08.000000000 +0100
@@ -24,19 +24,18 @@
#include <cstring>
#include <cerrno>
#include <unistd.h>
-#ifndef __FreeBSD__
+
+#if !defined(__FreeBSD__) && !defined(__solaris__)
#include <sys/statfs.h>
-#else
+#elif defined(__solaris__)
+#include <sys/types.h>
+#include <sys/statvfs.h>
+#elif defined(__FreeBSD__)
#include <sys/param.h>
#include <sys/mount.h>
#endif
-using namespace std;
-
-//
-// Global variable that carries the name of the file system
-//
-char fs[5];
+using namespace std;
//
// Returns the information about the program
@@ -45,15 +44,13 @@
void info()
{
cout << "This is smb4k_umount, the unmount utility for Smb4K." << endl;
- cout << "(c) 2004-2005, Alexander Reinholdt" << endl << endl;
+ cout << "(c) 2004-2006, Alexander Reinholdt" << endl << endl;
cout << "Usage:" << endl;
- cout << " smb4k_umount [--no-suid|--suid] [--cifs|--smbfs] <mountpoint>" << endl;
+ cout << " smb4k_umount [--no-suid|--suid] <mountpoint>" << endl;
cout << " smb4k_umount --help" << endl << endl;
cout << "Arguments:" << endl;
- cout << " --no-suid\tsmb4k_umount invokes smbumount." << endl;
+ cout << " --no-suid\tsmb4k_umount invokes smbumount or umount.cifs." << endl;
cout << " --suid\tsmb4k_umount invokes umount." << endl;
- cout << " --cifs\tUnmount a CIFS share." << endl;
- cout << " --smbfs\tUnmount an SMBFS share." << endl;
cout << " --help\tDisplays this help screen and exits." << endl;
cout << " <mountpoint>\tThe mountpoint of the share." << endl;
cout << endl;
@@ -253,11 +250,19 @@
// Checks wether the user is allowed to unmount the
// specified filesystem
//
-bool check( const char *path )
+bool check( const char *path, char *fs_buf )
{
+#if !defined(__solaris__)
struct statfs filesystem;
+#else
+ struct statvfs filesystem;
+#endif
+#if !defined(__solaris__)
if ( statfs( path, &filesystem ) == -1 )
+#else
+ if ( statvfs( path, &filesystem ) == -1 )
+#endif
{
int err_code = errno;
@@ -268,25 +273,26 @@
}
else
{
- return true; // Bypass the check below, because it would yield ok = FALSE
+ return true; // Bypass the check below, because it would yield ok == FALSE
// and we want to be able to unmount broken shares as well.
}
}
bool ok = false;
-#ifndef __FreeBSD__
+#if !defined(__FreeBSD__) && !defined(__solaris__)
// First entry is for CIFS, the second for SMBFS.
if ( (uint)filesystem.f_type == 0xFF534D42 || (uint)filesystem.f_type == 0x517B )
{
-// if ( ((uint)filesystem.f_type == 0xFF534D42 && strcmp( fs, "cifs" )) ||
-// ((uint)filesystem.f_type == 0x517B && strcmp( fs, "smbfs" )) )
-// {
-// cerr << "smb4k_umount: Wrong filesystem argument! Unmounting might fail." << endl;
-// }
-#else
+ strcpy( fs_buf, (uint)filesystem.f_type == 0xFF534D42 ? "cifs" : "smbfs" );
+#elif defined(__FreeBSD__)
if ( !strcmp( filesystem.f_fstypename, "smbfs" ) )
{
+ strcpy( fs_buf, "smbfs" );
+#elif defined(__solaris__)
+ if ( (uint)filesystem.f_basetype == 0xFF534D42 || (uint)filesystem.f_basetype == 0x517B )
+ {
+ strcpy( fs_buf, (uint)filesystem.f_basetype == 0xFF534D42 ? "cifs" : "smbfs" );
#endif
ok = true;
}
@@ -308,20 +314,10 @@
exit( EXIT_FAILURE );
}
- char *args[25];
int k = 0;
- char *path = (char *)malloc( 250*sizeof(char) );
-
- if ( !path )
- {
- cerr << "smb4k_umount: Out of memory" << endl;
- exit( EXIT_FAILURE );
- }
-
bool suid_arg_exists = false;
- bool fs_arg_exists = false;
-
- int pos;
+ bool use_suid = false;
+ char *args[5];
for ( int i = 1; i < argc; i++ )
{
@@ -332,115 +328,113 @@
}
else if ( !strcmp( argv[i], "--no-suid" ) )
{
- char *p = (char *)malloc( 100*sizeof(char) );
-
- if ( !p )
- {
- cerr << "smb4k_umount: Out of memory" << endl;
- exit( EXIT_FAILURE );
- }
-
- args[k] = strcpy( p, findprog( "smbumount" ) );
- pos = k;
- k++;
suid_arg_exists = true;
+ use_suid = false;
+ // Leave first entry in args[] free:
+ k++;
+
continue;
}
else if ( !strcmp( argv[i], "--suid" ) )
{
- char *p = (char *)malloc( 100*sizeof(char) );
-
- if ( !p )
- {
- cerr << "smb4k_umount: Out of memory" << endl;
- exit( EXIT_FAILURE );
- }
-
- args[k] = strcpy( p, findprog( "umount" ) );
- pos = k;
- k++;
suid_arg_exists = true;
+ use_suid = true;
+ // Leave first entry in args[] free:
+ k++;
+
continue;
}
- else if ( !strcmp( argv[i], "--smbfs" ) )
- {
- fs_arg_exists = true;
- strcpy( fs, "smbfs" );
- continue;
- }
- else if ( !strcmp( argv[i], "--cifs" ) )
+ else
{
- fs_arg_exists = true;
- strcpy( fs, "cifs" );
-
- if ( strcmp( args[pos], findprog( "umount" ) ) )
+ // Only do something, if the argument is a mount point:
+ if ( argv[i][0] == '/' )
{
- free( args[pos] );
+ char *path = new char[strlen( argv[i] )+1];
- char *p = (char *)malloc( 100*sizeof(char) );
-
- if ( !p )
+ if ( !path )
{
cerr << "smb4k_umount: Out of memory" << endl;
exit( EXIT_FAILURE );
}
- args[k] = strcpy( p, findprog( "umount" ) );
- }
+ args[k++] = strcpy( path, replace_special_characters( argv[i] ) );
- continue;
- }
- else
- {
- char *t = (char *)malloc( 250*sizeof(char) );
+ char fs[6];
- if ( !t )
- {
- cerr << "smb4k_umount: Out of memory" << endl;
- exit( EXIT_FAILURE );
- }
+ if ( check( path, fs ) )
+ {
+ // FIXME: Put the command together.
- if ( strlen( argv[i] ) > 250 )
- {
- cerr << "smb4k_umount: One or more arguments exceed 250 characters." << endl;
- exit( EXIT_FAILURE );
- }
+ char *t = new char[strlen( argv[i] )+1];
- args[k] = strcpy( t, replace_special_characters( argv[i] ) );
+ if ( !t )
+ {
+ cerr << "smb4k_umount: Out of memory" << endl;
+ exit( EXIT_FAILURE );
+ }
+
+ if ( suid_arg_exists )
+ {
+ if ( !use_suid )
+ {
+ if ( !strcmp( fs, "smbfs" ) )
+ {
+ args[0] = strcpy( t, findprog( "smbumount" ) );
+ }
+ else if ( !strcmp( fs, "cifs" ) )
+ {
+ args[0] = strcpy( t, findprog( "umount.cifs" ) );
+ }
+ else
+ {
+ delete [] t;
+ }
+ }
+ else
+ {
+ if ( !strcmp( fs, "smbfs" ) || !strcmp( fs, "cifs" ) )
+ {
+ args[0] = strcpy( t, findprog( "umount" ) );
+ }
+ else
+ {
+ delete [] t;
+ }
+ }
+ }
+ else
+ {
+ cerr << "smb4k_mount: You have neither supplied the '--suid' nor '--no-suid' argument." << endl;
+ exit( EXIT_FAILURE );
+ }
+ }
+ else
+ {
+ cerr << "smb4k_umount: You are not allowed to unmount this filesystem type." << endl;
+ exit( EXIT_FAILURE );
+ }
- if ( args[k][0] == '/' )
- {
- path = strcpy( path, args[k] );
+ continue;
}
+ else
+ {
+ char *t = new char[strlen( argv[i] )+1];
- k++;
+ if ( !t )
+ {
+ cerr << "smb4k_umount: Out of memory" << endl;
+ exit( EXIT_FAILURE );
+ }
- continue;
+ args[k++] = strcpy( t, argv[i] );
+
+ continue;
+ }
}
}
args[k] = NULL;
- if ( !suid_arg_exists )
- {
- cerr << "smb4k_mount: You have neither supplied the '--suid' nor '--no-suid' argument." << endl;
- exit( EXIT_FAILURE );
- }
-
- if ( !fs_arg_exists )
- {
- cerr << "smb4k_umount: The filesystem argument is missing." << endl;
- exit( EXIT_FAILURE );
- }
-
- if ( !check( path ) )
- {
- cerr << "smb4k_umount: You are not allowed to unmount this filesystem type." << endl;
- exit( EXIT_FAILURE );
- }
-
- free( path );
-
if ( execve( args[0], args, envp ) == -1 )
{
int err_code = errno;
Index: smb4k.spec
===================================================================
RCS file: /cvs/extras/rpms/smb4k/devel/smb4k.spec,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- smb4k.spec 14 Feb 2006 17:48:11 -0000 1.4
+++ smb4k.spec 17 Feb 2006 11:17:05 -0000 1.5
@@ -1,6 +1,6 @@
Name: smb4k
Version: 0.6.7
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: The SMB/CIFS Share Browser for KDE
Group: Applications/Internet
@@ -8,7 +8,7 @@
URL: http://smb4k.berlios.de/
Source0: http://download.berlios.de/smb4k/%{name}-%{version}.tar.gz
Patch0: smb4k-0.6.5-desktop.patch
-Patch1: smb4k-0.6.5-buff.patch
+Patch1: smb4k-0.6.8-mount.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: kdelibs-devel kdebase-devel gettext
@@ -109,6 +109,10 @@
%{_libdir}/*.so
%changelog
+* Fri Feb 17 2006 Marcin Garski <mgarski[AT]post.pl> 0.6.7-3
+- Add support of mount.cifs/umount.cifs (bug #181638)
+- Remove smb4k-0.6.5-buff.patch
+
* Tue Feb 14 2006 Marcin Garski <mgarski[AT]post.pl> 0.6.7-2
- Rebuild
--- smb4k-0.6.5-buff.patch DELETED ---
More information about the scm-commits
mailing list