From 4aed2c8219774f5d797760606b8489a92ddc5163 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kioslave/smb/Makefile.am | 37 +++ kioslave/smb/configure.in.bot | 9 + kioslave/smb/configure.in.in | 34 +++ kioslave/smb/kio_smb.cpp | 77 ++++++ kioslave/smb/kio_smb.h | 301 ++++++++++++++++++++++ kioslave/smb/kio_smb_auth.cpp | 206 +++++++++++++++ kioslave/smb/kio_smb_browse.cpp | 476 +++++++++++++++++++++++++++++++++++ kioslave/smb/kio_smb_config.cpp | 66 +++++ kioslave/smb/kio_smb_dir.cpp | 345 +++++++++++++++++++++++++ kioslave/smb/kio_smb_file.cpp | 279 ++++++++++++++++++++ kioslave/smb/kio_smb_internal.cpp | 135 ++++++++++ kioslave/smb/kio_smb_internal.h | 118 +++++++++ kioslave/smb/kio_smb_mount.cpp | 211 ++++++++++++++++ kioslave/smb/libsmbclient-HOWTO.txt | 11 + kioslave/smb/smb-network.desktop | 80 ++++++ kioslave/smb/smb.protocol | 12 + kioslave/smb/x-smb-server.desktop | 76 ++++++ kioslave/smb/x-smb-workgroup.desktop | 74 ++++++ 18 files changed, 2547 insertions(+) create mode 100644 kioslave/smb/Makefile.am create mode 100644 kioslave/smb/configure.in.bot create mode 100644 kioslave/smb/configure.in.in create mode 100644 kioslave/smb/kio_smb.cpp create mode 100644 kioslave/smb/kio_smb.h create mode 100644 kioslave/smb/kio_smb_auth.cpp create mode 100644 kioslave/smb/kio_smb_browse.cpp create mode 100644 kioslave/smb/kio_smb_config.cpp create mode 100644 kioslave/smb/kio_smb_dir.cpp create mode 100644 kioslave/smb/kio_smb_file.cpp create mode 100644 kioslave/smb/kio_smb_internal.cpp create mode 100644 kioslave/smb/kio_smb_internal.h create mode 100644 kioslave/smb/kio_smb_mount.cpp create mode 100644 kioslave/smb/libsmbclient-HOWTO.txt create mode 100644 kioslave/smb/smb-network.desktop create mode 100644 kioslave/smb/smb.protocol create mode 100644 kioslave/smb/x-smb-server.desktop create mode 100644 kioslave/smb/x-smb-workgroup.desktop (limited to 'kioslave/smb') diff --git a/kioslave/smb/Makefile.am b/kioslave/smb/Makefile.am new file mode 100644 index 000000000..a75cf6c6f --- /dev/null +++ b/kioslave/smb/Makefile.am @@ -0,0 +1,37 @@ +## Makefile.am of kdebase/kioslave/man + +INCLUDES=$(all_includes) + +kde_module_LTLIBRARIES = kio_smb.la +kio_smb_la_SOURCES = kio_smb.cpp \ + kio_smb_auth.cpp \ + kio_smb_browse.cpp \ + kio_smb_config.cpp \ + kio_smb_dir.cpp \ + kio_smb_file.cpp \ + kio_smb_internal.cpp \ + kio_smb_mount.cpp + +kio_smb_la_LIBADD = -lkio -lsmbclient $(SMBCLIENT_EXTRA_LIBS) + +kio_smb_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) + +noinst_HEADERS = kio_smb.h kio_smb_internal.h + +kdelnk_DATA = smb.protocol + +kdelnkdir = $(kde_servicesdir) + +dirtree_DATA = smb-network.desktop +dirtreedir = $(kde_datadir)/konqueror/dirtree/remote + +remote_DATA = smb-network.desktop +remotedir = $(kde_datadir)/remoteview + +METASOURCES = AUTO + +mimetypedir = $(kde_mimedir)/application +mimetype_DATA = x-smb-workgroup.desktop x-smb-server.desktop + +messages: + $(XGETTEXT) *.cpp -o $(podir)/kio_smb.pot diff --git a/kioslave/smb/configure.in.bot b/kioslave/smb/configure.in.bot new file mode 100644 index 000000000..0d478c414 --- /dev/null +++ b/kioslave/smb/configure.in.bot @@ -0,0 +1,9 @@ +if test "x$with_samba" = xcheck && test "x$have_libsmbclient" = xno; then + echo "" + echo "You're missing libsmbclient from samba 3.0" + echo "KDE will not be able to browse windows shares without it," + echo "consider installing it." + echo "Look at kioslave/smb/libsmbclient-HOWTO.txt" + echo "" + all_tests=bad +fi diff --git a/kioslave/smb/configure.in.in b/kioslave/smb/configure.in.in new file mode 100644 index 000000000..0a0cdcc86 --- /dev/null +++ b/kioslave/smb/configure.in.in @@ -0,0 +1,34 @@ +AC_DEFUN([SMB_CHECK], +[ +AC_REQUIRE([KDE_CHECK_LARGEFILE]) + +AC_ARG_WITH(samba, + [AC_HELP_STRING(--with-samba, + [enable the samba ioslave @<:@default=check@:>@])], + [], with_samba=check) + +have_libsmbclient=no +if test "x$with_samba" != xno; then + have_libsmbclient=yes + KDE_CHECK_HEADER(libsmbclient.h, [], [have_libsmbclient=no]) + KDE_CHECK_LIB(smbclient, smbc_new_context, [], [have_libsmbclient=no]) + + SMBCLIENT_EXTRA_LIBS="" + AC_CHECK_FUNC(yp_get_default_domain, [], + [ + KDE_CHECK_LIB(nsl, yp_get_default_domain, + [SMBCLIENT_EXTRA_LIBS="-lnsl"] ) + ]) + + AC_SUBST(SMBCLIENT_EXTRA_LIBS) + + if test "x$with_samba" != xcheck && test "x$have_libsmbclient" = xno; then + AC_MSG_ERROR([--with-samba was given, but test for libsmbclient failed]) + fi +fi + +AM_CONDITIONAL(include_kioslave_smb, test "x$have_libsmbclient" = xyes) + +]) + +SMB_CHECK diff --git a/kioslave/smb/kio_smb.cpp b/kioslave/smb/kio_smb.cpp new file mode 100644 index 000000000..05db789ee --- /dev/null +++ b/kioslave/smb/kio_smb.cpp @@ -0,0 +1,77 @@ +///////////////////////////////////////////////////////////////////////////// +// +// Project: SMB kioslave for KDE2 +// +// File: Top level implementation file for kio_smb.cpp +// +// Abstract: member function implementations for SMBSlave +// +// Author(s): Matthew Peterson +// +//--------------------------------------------------------------------------- +// +// Copyright (c) 2000 Caldera Systems, Inc. +// +// This program is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2.1 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; see the file COPYING. If not, please obtain +// a copy from http://www.gnu.org/copyleft/gpl.html +// +///////////////////////////////////////////////////////////////////////////// + +#include "kio_smb.h" +#include "kio_smb_internal.h" + +//=========================================================================== +SMBSlave::SMBSlave(const QCString& pool, const QCString& app) + : SlaveBase( "smb", pool, app ) +{ + m_initialized_smbc = false; + + //read in the default workgroup info... + reparseConfiguration(); + + //initialize the library... + auth_initialize_smbc(); +} + + +//=========================================================================== +SMBSlave::~SMBSlave() +{ +} + + +//=========================================================================== +// pointer to the slave created in kdemain +SMBSlave* G_TheSlave; + +//=========================================================================== +int KDE_EXPORT kdemain( int argc, char **argv ) +{ + + KInstance instance( "kio_smb" ); + if( argc != 4 ) + { + kdDebug(KIO_SMB) << "Usage: kio_smb protocol domain-socket1 domain-socket2" + << endl; + return -1; + } + + SMBSlave slave( argv[2], argv[3] ); + + G_TheSlave = &slave; + slave.dispatchLoop(); + + return 0; +} + diff --git a/kioslave/smb/kio_smb.h b/kioslave/smb/kio_smb.h new file mode 100644 index 000000000..a04d7b3fa --- /dev/null +++ b/kioslave/smb/kio_smb.h @@ -0,0 +1,301 @@ +///////////////////////////////////////////////////////////////////////////// +// +// Project: SMB kioslave for KDE2 +// +// File: kio_smb.h +// +// Abstract: The main kio slave class declaration. For convenience, +// in concurrent devlopment, the implementation for this class +// is separated into several .cpp files -- the file containing +// the implementation should be noted in the comments for each +// member function. +// +// Author(s): Matthew Peterson +// +//--------------------------------------------------------------------------- +// +// Copyright (c) 2000 Caldera Systems, Inc. +// +// This program is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2.1 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; see the file COPYING. If not, please obtain +// a copy from http://www.gnu.org/copyleft/gpl.html +// +///////////////////////////////////////////////////////////////////////////// + + +#ifndef KIO_SMB_H_INCLUDED +#define KIO_SMB_H_INCLUDED + +//------------- +// QT includes +//------------- +#include +#include +#include +#include +#include + +//-------------- +// KDE includes +//-------------- +#include +#include +#include +#include +#include +#include + +//----------------------------- +// Standard C library includes +//----------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//------------------------------- +// Samba client library includes +//------------------------------- +extern "C" +{ +#include +} + +//--------------------------- +// kio_smb internal includes +//--------------------------- +#include "kio_smb_internal.h" + +#define MAX_XFER_BUF_SIZE 16348 +#define KIO_SMB 7106 + +using namespace KIO; +class KProcess; + +//=========================================================================== + + +class SMBSlave : public QObject, public KIO::SlaveBase +{ + Q_OBJECT + +private: + //--------------------------------------------------------------------- + // please make sure your private data does not duplicate existing data + //--------------------------------------------------------------------- + bool m_initialized_smbc; + + /** + * From Controlcenter + */ + QString m_default_user; +// QString m_default_workgroup; //currently unused, Alex + QString m_default_password; + QString m_default_encoding; + + /** + * we store the current url, it's needed for + * callback authorisation method + */ + SMBUrl m_current_url; + + /** + * From Controlcenter, show SHARE$ or not + */ +// bool m_showHiddenShares; //currently unused, Alex + + /** + * libsmbclient need global variables to store in, + * else it crashes on exit next method after use cache_stat, + * looks like gcc (C/C++) failure + */ + struct stat st; +protected: + //--------------------------------------------- + // Authentication functions (kio_smb_auth.cpp) + //--------------------------------------------- + // (please prefix functions with auth) + + + /** + * Description : Initilizes the libsmbclient + * Return : true on success false with errno set on error + */ + bool auth_initialize_smbc(); + + bool checkPassword(SMBUrl &url); + + + //--------------------------------------------- + // Cache functions (kio_smb_auth.cpp) + //--------------------------------------------- + + //Stat methods + + //----------------------------------------- + // Browsing functions (kio_smb_browse.cpp) + //----------------------------------------- + // (please prefix functions with browse) + + /** + * Description : Return a stat of given SMBUrl. Calls cache_stat and + * pack it in UDSEntry. UDSEntry will not be cleared + * Parameter : SMBUrl the url to stat + * ignore_errors do not call error(), but warning() + * Return : false if any error occoured (errno), else true + */ + bool browse_stat_path(const SMBUrl& url, UDSEntry& udsentry, bool ignore_errors); + + /** + * Description : call smbc_stat and return stats of the url + * Parameter : SMBUrl the url to stat + * Return : stat* of the url + * Note : it has some problems with stat in method, looks like + * something leave(or removed) on the stack. If your + * method segfault on returning try to change the stat* + * variable + */ + int cache_stat( const SMBUrl& url, struct stat* st ); + + //--------------------------------------------- + // Configuration functions (kio_smb_config.cpp) + //--------------------------------------------- + // (please prefix functions with config) + + + //--------------------------------------- + // Directory functions (kio_smb_dir.cpp) + //--------------------------------------- + // (please prefix functions with dir) + + + //-------------------------------------- + // File IO functions (kio_smb_file.cpp) + //-------------------------------------- + // (please prefix functions with file) + + //---------------------------- + // Misc functions (this file) + //---------------------------- + + + /** + * Description : correct a given URL + * valid URL's are + * + * smb://[[domain;]user[:password]@]server[:port][/share[/path[/file]]] + * smb:/[[domain;]user[:password]@][group/[server[/share[/path[/file]]]]] + * domain = workgroup(domain) of the user + * user = username + * password = password of useraccount + * group = workgroup(domain) of server + * server = host to connect + * share = a share of the server (host) + * path = a path of the share + * Parameter : KURL the url to check + * Return : new KURL if its corrected. else the same KURL + */ + KURL checkURL(const KURL& kurl) const; + + void reportError(const SMBUrl &kurl); + +public: + + //----------------------------------------------------------------------- + // smbclient authentication callback (note that this is called by the + // global ::auth_smbc_get_data() call. + void auth_smbc_get_data(const char *server,const char *share, + char *workgroup, int wgmaxlen, + char *username, int unmaxlen, + char *password, int pwmaxlen); + + + //----------------------------------------------------------------------- + // Overwritten functions from the base class that define the operation of + // this slave. (See the base class headerfile slavebase.h for more + // details) + //----------------------------------------------------------------------- + + // Functions overwritten in kio_smb.cpp + SMBSlave(const QCString& pool, const QCString& app); + virtual ~SMBSlave(); + + // Functions overwritten in kio_smb_browse.cpp + virtual void listDir( const KURL& url ); + virtual void stat( const KURL& url ); + + // Functions overwritten in kio_smb_config.cpp + virtual void reparseConfiguration(); + + // Functions overwritten in kio_smb_dir.cpp + virtual void copy( const KURL& src, const KURL &dest, int permissions, bool overwrite ); + virtual void del( const KURL& kurl, bool isfile); + virtual void mkdir( const KURL& kurl, int permissions ); + virtual void rename( const KURL& src, const KURL& dest, bool overwrite ); + + // Functions overwritten in kio_smb_file.cpp + virtual void get( const KURL& kurl ); + virtual void put( const KURL& kurl, int permissions, bool overwrite, bool resume ); + + // Functions not implemented (yet) + //virtual void setHost(const QString& host, int port, const QString& user, const QString& pass); + //virtual void openConnection(); + //virtual void closeConnection(); + //virtual void slave_status(); + virtual void special( const QByteArray & ); + +private slots: + void readOutput(KProcess *proc, char *buffer, int buflen); + void readStdErr(KProcess *proc, char *buffer, int buflen); + +private: + QString mybuf, mystderr; + +}; + +//=========================================================================== +// pointer to the slave created in kdemain +extern SMBSlave* G_TheSlave; + + +//========================================================================== +// the global libsmbclient authentication callback function +extern "C" +{ + +void auth_smbc_get_data(const char *server,const char *share, + char *workgroup, int wgmaxlen, + char *username, int unmaxlen, + char *password, int pwmaxlen); + +} + + +//=========================================================================== +// Main slave entrypoint (see kio_smb.cpp) +extern "C" +{ + +int kdemain( int argc, char **argv ); + +} + + +#endif //#endif KIO_SMB_H_INCLUDED diff --git a/kioslave/smb/kio_smb_auth.cpp b/kioslave/smb/kio_smb_auth.cpp new file mode 100644 index 000000000..60d9ac285 --- /dev/null +++ b/kioslave/smb/kio_smb_auth.cpp @@ -0,0 +1,206 @@ +///////////////////////////////////////////////////////////////////////////// +// +// Project: SMB kioslave for KDE2 +// +// File: kio_smb_auth.cpp +// +// Abstract: member function implementations for SMBSlave that deal with +// SMB directory access +// +// Author(s): Matthew Peterson +// +//--------------------------------------------------------------------------- +// +// Copyright (c) 2000 Caldera Systems, Inc. +// +// This program is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2.1 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; see the file COPYING. If not, please obtain +// a copy from http://www.gnu.org/copyleft/gpl.html +// +///////////////////////////////////////////////////////////////////////////// + +#include "kio_smb.h" +#include "kio_smb_internal.h" + +#include +#include +#include + +// call for libsmbclient +//========================================================================== +void auth_smbc_get_data(const char *server,const char *share, + char *workgroup, int wgmaxlen, + char *username, int unmaxlen, + char *password, int pwmaxlen) +//========================================================================== +{ + G_TheSlave->auth_smbc_get_data(server, share, + workgroup,wgmaxlen, + username, unmaxlen, + password, pwmaxlen); +} + +//-------------------------------------------------------------------------- +void SMBSlave::auth_smbc_get_data(const char *server,const char *share, + char *workgroup, int wgmaxlen, + char *username, int unmaxlen, + char *password, int pwmaxlen) +//-------------------------------------------------------------------------- +{ + //check this to see if we "really" need to authenticate... + SMBUrlType t = m_current_url.getType(); + if( t == SMBURLTYPE_ENTIRE_NETWORK ) + { + kdDebug(KIO_SMB) << "we don't really need to authenticate for this top level url, returning" << endl; + return; + } + kdDebug(KIO_SMB) << "AAAAAAAAAAAAAA auth_smbc_get_dat: set user=" << username << ", workgroup=" << workgroup + << " server=" << server << ", share=" << share << endl; + + QString s_server = QString::fromUtf8(server); + QString s_share = QString::fromUtf8(share); + workgroup[wgmaxlen - 1] = 0; + QString s_workgroup = QString::fromUtf8(workgroup); + username[unmaxlen - 1] = 0; + QString s_username = QString::fromUtf8(username); + password[pwmaxlen - 1] = 0; + QString s_password = QString::fromUtf8(password); + + KIO::AuthInfo info; + info.url = KURL("smb:///"); + info.url.setHost(s_server); + info.url.setPath("/" + s_share); + + info.username = s_username; + info.password = s_password; + info.verifyPath = true; + + kdDebug(KIO_SMB) << "libsmb-auth-callback URL:" << info.url << endl; + + if ( !checkCachedAuthentication( info ) ) + { + if ( m_default_user.isEmpty() ) + { + // ok, we do not know the password. Let's try anonymous before we try for real + info.username = "anonymous"; + info.password = QString::null; + } + else + { + // user defined a default username/password in kcontrol; try this + info.username = m_default_user; + info.password = m_default_password; + } + + } else + kdDebug(KIO_SMB) << "got password through cache" << endl; + + strncpy(username, info.username.utf8(), unmaxlen - 1); + strncpy(password, info.password.utf8(), pwmaxlen - 1); +} + +bool SMBSlave::checkPassword(SMBUrl &url) +{ + kdDebug(KIO_SMB) << "checkPassword for " << url << endl; + + KIO::AuthInfo info; + info.url = KURL("smb:///"); + info.url.setHost(url.host()); + + QString share = url.path(); + int index = share.find('/', 1); + if (index > 1) + share = share.left(index); + if (share.at(0) == '/') + share = share.mid(1); + info.url.setPath("/" + share); + info.verifyPath = true; + + if ( share.isEmpty() ) + info.prompt = i18n( + "Please enter authentication information for %1" ) + .arg( url.host() ); + else + info.prompt = i18n( + "Please enter authentication information for:\n" + "Server = %1\n" + "Share = %2" ) + .arg( url.host() ) + .arg( share ); + + info.username = url.user(); + kdDebug(KIO_SMB) << "call openPassDlg for " << info.url << endl; + + if ( openPassDlg(info) ) { + kdDebug(KIO_SMB) << "openPassDlg returned " << info.username << endl; + url.setUser(info.username); + return true; + } + kdDebug(KIO_SMB) << "no value from openPassDlg\n"; + return false; +} + +//-------------------------------------------------------------------------- +// Initalizes the smbclient library +// +// Returns: 0 on success -1 with errno set on error +bool SMBSlave::auth_initialize_smbc() +{ + SMBCCTX *smb_context = NULL; + + kdDebug(KIO_SMB) << "auth_initialize_smbc " << endl; + if(m_initialized_smbc == false) + { + kdDebug(KIO_SMB) << "smbc_init call" << endl; + KSimpleConfig cfg( "kioslaverc", true ); + + cfg.setGroup( "SMB" ); + int debug_level = cfg.readNumEntry( "DebugLevel", 0 ); + +#if 0 + /* old API initialisation routine does not allow to set flags */ + + if(smbc_init(::auth_smbc_get_data,debug_level) == -1) + { + SlaveBase::error(ERR_INTERNAL, i18n("libsmbclient failed to initialize")); + return false; + } +#endif + smb_context = smbc_new_context(); + if (smb_context == NULL) { + SlaveBase::error(ERR_INTERNAL, i18n("libsmbclient failed to create context")); + return false; + } + + smb_context->debug = debug_level; + smb_context->callbacks.auth_fn = ::auth_smbc_get_data; + + if (!smbc_init_context(smb_context)) { + smbc_free_context(smb_context, false); + smb_context = NULL; + SlaveBase::error(ERR_INTERNAL, i18n("libsmbclient failed to initialize context")); + return false; + } + +#if defined(SMB_CTX_FLAG_USE_KERBEROS) && defined(SMB_CTX_FLAG_FALLBACK_AFTER_KERBEROS) + smb_context->flags |= SMB_CTX_FLAG_USE_KERBEROS | SMB_CTX_FLAG_FALLBACK_AFTER_KERBEROS; +#endif + + smbc_set_context(smb_context); + + m_initialized_smbc = true; + } + + return true; +} + diff --git a/kioslave/smb/kio_smb_browse.cpp b/kioslave/smb/kio_smb_browse.cpp new file mode 100644 index 000000000..de6bf4ed2 --- /dev/null +++ b/kioslave/smb/kio_smb_browse.cpp @@ -0,0 +1,476 @@ + +///////////////////////////////////////////////////////////////////////////// +// +// Project: SMB kioslave for KDE2 +// +// File: kio_smb_browse.cpp +// +// Abstract: member function implementations for SMBSlave that deal with +// SMB browsing +// +// Author(s): Matthew Peterson +// +//--------------------------------------------------------------------------- +// +// Copyright (c) 2000 Caldera Systems, Inc. +// +// This program is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2.1 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; see the file COPYING. If not, please obtain +// a copy from http://www.gnu.org/copyleft/gpl.html +// +///////////////////////////////////////////////////////////////////////////// + +#include +#include +#include + +#include + +#include + +#include "kio_smb.h" +#include "kio_smb_internal.h" + +using namespace KIO; + +int SMBSlave::cache_stat(const SMBUrl &url, struct stat* st ) +{ + int result = smbc_stat( url.toSmbcUrl(), st); + kdDebug(KIO_SMB) << "smbc_stat " << url << " " << errno << " " << result << endl; + kdDebug(KIO_SMB) << "size " << (KIO::filesize_t)st->st_size << endl; + return result; +} + +//--------------------------------------------------------------------------- +bool SMBSlave::browse_stat_path(const SMBUrl& _url, UDSEntry& udsentry, bool ignore_errors) + // Returns: true on success, false on failure +{ + UDSAtom udsatom; + + SMBUrl url = _url; + + if(cache_stat(url, &st) == 0) + { + if(!S_ISDIR(st.st_mode) && !S_ISREG(st.st_mode)) + { + kdDebug(KIO_SMB)<<"SMBSlave::browse_stat_path mode: "<pw_name; + else + udsatom.m_str = QString::number( uid ); + udsentry.append(udsatom); + + udsatom.m_uds = KIO::UDS_GROUP; + gid_t gid = st.st_gid; + struct group *grp = getgrgid( gid ); + if ( grp ) + udsatom.m_str = grp->gr_name; + else + udsatom.m_str = QString::number( gid ); + udsentry.append(udsatom); + + udsatom.m_uds = KIO::UDS_ACCESS; + udsatom.m_long = st.st_mode & 07777; + udsentry.append(udsatom); + + udsatom.m_uds = UDS_MODIFICATION_TIME; + udsatom.m_long = st.st_mtime; + udsentry.append(udsatom); + + udsatom.m_uds = UDS_ACCESS_TIME; + udsatom.m_long = st.st_atime; + udsentry.append(udsatom); + + udsatom.m_uds = UDS_CREATION_TIME; + udsatom.m_long = st.st_ctime; + udsentry.append(udsatom); + + } + else + { + if (!ignore_errors) { + if (errno == EPERM || errno == EACCES) + if (checkPassword(url)) { + redirection( url ); + return false; + } + + reportError(url); + } else if (errno == ENOENT || errno == ENOTDIR) { + warning(i18n("File does not exist: %1").arg(url.url())); + } + kdDebug(KIO_SMB) << "SMBSlave::browse_stat_path ERROR!!"<< endl; + return false; + } + + return true; +} + +//=========================================================================== +void SMBSlave::stat( const KURL& kurl ) +{ + kdDebug(KIO_SMB) << "SMBSlave::stat on "<< kurl << endl; + // make a valid URL + KURL url = checkURL(kurl); + + // if URL is not valid we have to redirect to correct URL + if (url != kurl) + { + kdDebug() << "redirection " << url << endl; + redirection(url); + finished(); + return; + } + + m_current_url = url; + + UDSAtom udsatom; + UDSEntry udsentry; + // Set name + udsatom.m_uds = KIO::UDS_NAME; + udsatom.m_str = kurl.fileName(); + udsentry.append( udsatom ); + + switch(m_current_url.getType()) + { + case SMBURLTYPE_UNKNOWN: + error(ERR_MALFORMED_URL,m_current_url.prettyURL()); + finished(); + return; + + case SMBURLTYPE_ENTIRE_NETWORK: + case SMBURLTYPE_WORKGROUP_OR_SERVER: + udsatom.m_uds = KIO::UDS_FILE_TYPE; + udsatom.m_long = S_IFDIR; + udsentry.append(udsatom); + break; + + case SMBURLTYPE_SHARE_OR_PATH: + if (browse_stat_path(m_current_url, udsentry, false)) + break; + else { + kdDebug(KIO_SMB) << "SMBSlave::stat ERROR!!"<< endl; + finished(); + return; + } + default: + kdDebug(KIO_SMB) << "SMBSlave::stat UNKNOWN " << url << endl; + finished(); + return; + } + + statEntry(udsentry); + finished(); +} + +//=========================================================================== +// TODO: complete checking +KURL SMBSlave::checkURL(const KURL& kurl) const +{ + kdDebug(KIO_SMB) << "checkURL " << kurl << endl; + QString surl = kurl.url(); + if (surl.startsWith("smb:/")) { + if (surl.length() == 5) // just the above + return kurl; // unchanged + + if (surl.at(5) != '/') { + surl = "smb://" + surl.mid(5); + kdDebug(KIO_SMB) << "checkURL return1 " << surl << " " << KURL(surl) << endl; + return KURL(surl); + } + } + + // smb:/ normaly have no userinfo + // we must redirect ourself to remove the username and password + if (surl.contains('@') && !surl.contains("smb://")) { + KURL url(kurl); + url.setPath("/"+kurl.url().right( kurl.url().length()-kurl.url().find('@') -1)); + QString userinfo = kurl.url().mid(5, kurl.url().find('@')-5); + if(userinfo.contains(':')) { + url.setUser(userinfo.left(userinfo.find(':'))); + url.setPass(userinfo.right(userinfo.length()-userinfo.find(':')-1)); + } else { + url.setUser(userinfo); + } + kdDebug(KIO_SMB) << "checkURL return2 " << url << endl; + return url; + } + + // no emtpy path + KURL url(kurl); + + if (url.path().isEmpty()) + url.setPath("/"); + + kdDebug(KIO_SMB) << "checkURL return3 " << url << endl; + return url; +} + +void SMBSlave::reportError(const SMBUrl &url) +{ + kdDebug(KIO_SMB) << "reportError " << url << " " << perror << endl; + switch(errno) + { + case ENOENT: + if (url.getType() == SMBURLTYPE_ENTIRE_NETWORK) + error( ERR_SLAVE_DEFINED, i18n("Unable to find any workgroups in your local network. This might be caused by an enabled firewall.")); + else + error( ERR_DOES_NOT_EXIST, url.prettyURL()); + break; +#ifdef ENOMEDIUM + case ENOMEDIUM: + error( ERR_SLAVE_DEFINED, + i18n( "No media in device for %1" ).arg( url.prettyURL() ) ); + break; +#endif +#ifdef EHOSTDOWN + case EHOSTDOWN: +#endif + case ECONNREFUSED: + error( ERR_SLAVE_DEFINED, + i18n( "Could not connect to host for %1" ).arg( url.prettyURL() ) ); + break; + case ENOTDIR: + error( ERR_CANNOT_ENTER_DIRECTORY, url.prettyURL()); + break; + case EFAULT: + case EINVAL: + error( ERR_DOES_NOT_EXIST, url.prettyURL()); + break; + case EPERM: + case EACCES: + error( ERR_ACCESS_DENIED, url.prettyURL() ); + break; + case EIO: + case ENETUNREACH: + if ( url.getType() == SMBURLTYPE_ENTIRE_NETWORK || url.getType() == SMBURLTYPE_WORKGROUP_OR_SERVER ) + error( ERR_SLAVE_DEFINED, i18n( "Error while connecting to server responsible for %1" ).arg( url.prettyURL() ) ); + else + error( ERR_CONNECTION_BROKEN, url.prettyURL()); + break; + case ENOMEM: + error( ERR_OUT_OF_MEMORY, url.prettyURL() ); + break; + case ENODEV: + error( ERR_SLAVE_DEFINED, i18n("Share could not be found on given server")); + break; + case EBADF: + error( ERR_INTERNAL, i18n("BAD File descriptor")); + break; + case ETIMEDOUT: + error( ERR_SERVER_TIMEOUT, url.host() ); + break; +#ifdef ENOTUNIQ + case ENOTUNIQ: + error( ERR_SLAVE_DEFINED, i18n( "The given name could not be resolved to a unique server. " + "Make sure your network is setup without any name conflicts " + "between names used by Windows and by UNIX name resolution." ) ); + break; +#endif + case 0: // success + error( ERR_INTERNAL, i18n("libsmbclient reported an error, but did not specify " + "what the problem is. This might indicate a severe problem " + "with your network - but also might indicate a problem with " + "libsmbclient.\n" + "If you want to help us, please provide a tcpdump of the " + "network interface while you try to browse (be aware that " + "it might contain private data, so do not post it if you are " + "unsure about that - you can send it privately to the developers " + "if they ask for it)") ); + break; + default: + error( ERR_INTERNAL, i18n("Unknown error condition in stat: %1").arg(QString::fromLocal8Bit( strerror(errno))) ); + } +} + +//=========================================================================== +void SMBSlave::listDir( const KURL& kurl ) +{ + kdDebug(KIO_SMB) << "SMBSlave::listDir on " << kurl << endl; + + // check (correct) URL + KURL url = checkURL(kurl); + // if URL is not valid we have to redirect to correct URL + if (url != kurl) + { + redirection(url); + finished(); + return; + } + + m_current_url = kurl; + + int dirfd; + struct smbc_dirent *dirp = NULL; + UDSEntry udsentry; + UDSAtom atom; + + dirfd = smbc_opendir( m_current_url.toSmbcUrl() ); + kdDebug(KIO_SMB) << "SMBSlave::listDir open " << m_current_url.toSmbcUrl() << " " << m_current_url.getType() << " " << dirfd << endl; + if(dirfd >= 0) + { + do { + kdDebug(KIO_SMB) << "smbc_readdir " << endl; + dirp = smbc_readdir(dirfd); + if(dirp == 0) + break; + + // Set name + atom.m_uds = KIO::UDS_NAME; + QString dirpName = QString::fromUtf8( dirp->name ); + // We cannot trust dirp->commentlen has it might be with or without the NUL character + // See KDE bug #111430 and Samba bug #3030 + QString comment = QString::fromUtf8( dirp->comment ); + if ( dirp->smbc_type == SMBC_SERVER || dirp->smbc_type == SMBC_WORKGROUP ) { + atom.m_str = dirpName.lower(); + atom.m_str.at( 0 ) = dirpName.at( 0 ).upper(); + if ( !comment.isEmpty() && dirp->smbc_type == SMBC_SERVER ) + atom.m_str += " (" + comment + ")"; + } else + atom.m_str = dirpName; + + kdDebug(KIO_SMB) << "dirp->name " << dirp->name << " " << dirpName << " '" << comment << "'" << " " << dirp->smbc_type << endl; + + udsentry.append( atom ); + if (atom.m_str.upper()=="IPC$" || atom.m_str=="." || atom.m_str == ".." || + atom.m_str.upper() == "ADMIN$" || atom.m_str.lower() == "printer$" || atom.m_str.lower() == "print$" ) + { +// fprintf(stderr,"----------- hide: -%s-\n",dirp->name); + // do nothing and hide the hidden shares + } + else if(dirp->smbc_type == SMBC_FILE) + { + // Set stat information + m_current_url.addPath(dirpName); + browse_stat_path(m_current_url, udsentry, true); + m_current_url.cd(".."); + + // Call base class to list entry + listEntry(udsentry, false); + } + else if(dirp->smbc_type == SMBC_DIR) + { + m_current_url.addPath(dirpName); + browse_stat_path(m_current_url, udsentry, true); + m_current_url.cd(".."); + + // Call base class to list entry + listEntry(udsentry, false); + } + else if(dirp->smbc_type == SMBC_SERVER || + dirp->smbc_type == SMBC_FILE_SHARE) + { + // Set type + atom.m_uds = KIO::UDS_FILE_TYPE; + atom.m_long = S_IFDIR; + udsentry.append( atom ); + + // Set permissions + atom.m_uds = KIO::UDS_ACCESS; + atom.m_long = (S_IRUSR | S_IRGRP | S_IROTH | S_IXUSR | S_IXGRP | S_IXOTH); + udsentry.append(atom); + + if (dirp->smbc_type == SMBC_SERVER) { + atom.m_uds = KIO::UDS_URL; + // QString workgroup = m_current_url.host().upper(); + KURL u("smb:/"); + u.setHost(dirpName); + atom.m_str = u.url(); + + // when libsmbclient knows + // atom.m_str = QString("smb://%1?WORKGROUP=%2").arg(dirpName).arg(workgroup.upper()); + kdDebug(KIO_SMB) << "list item " << atom.m_str << endl; + udsentry.append(atom); + + atom.m_uds = KIO::UDS_MIME_TYPE; + atom.m_str = QString::fromLatin1("application/x-smb-server"); + udsentry.append(atom); + } + + // Call base class to list entry + listEntry(udsentry, false); + } + else if(dirp->smbc_type == SMBC_WORKGROUP) + { + // Set type + atom.m_uds = KIO::UDS_FILE_TYPE; + atom.m_long = S_IFDIR; + udsentry.append( atom ); + + // Set permissions + atom.m_uds = KIO::UDS_ACCESS; + atom.m_long = (S_IRUSR | S_IRGRP | S_IROTH | S_IXUSR | S_IXGRP | S_IXOTH); + udsentry.append(atom); + + atom.m_uds = KIO::UDS_MIME_TYPE; + atom.m_str = QString::fromLatin1("application/x-smb-workgroup"); + udsentry.append(atom); + + atom.m_uds = KIO::UDS_URL; + // QString workgroup = m_current_url.host().upper(); + KURL u("smb:/"); + u.setHost(dirpName); + atom.m_str = u.url(); + udsentry.append(atom); + + // Call base class to list entry + listEntry(udsentry, false); + } + else + { + kdDebug(KIO_SMB) << "SMBSlave::listDir SMBC_UNKNOWN :" << dirpName << endl; + // TODO: we don't handle SMBC_IPC_SHARE, SMBC_PRINTER_SHARE + // SMBC_LINK, SMBC_COMMS_SHARE + //SlaveBase::error(ERR_INTERNAL, TEXT_UNSUPPORTED_FILE_TYPE); + // continue; + } + udsentry.clear(); + } while (dirp); // checked already in the head + + // clean up + smbc_closedir(dirfd); + } + else + { + if (errno == EPERM || errno == EACCES) + if (checkPassword(m_current_url)) { + redirection( m_current_url ); + finished(); + return; + } + + reportError(m_current_url); + finished(); + return; + } + + listEntry(udsentry, true); + finished(); +} + diff --git a/kioslave/smb/kio_smb_config.cpp b/kioslave/smb/kio_smb_config.cpp new file mode 100644 index 000000000..c772f8b94 --- /dev/null +++ b/kioslave/smb/kio_smb_config.cpp @@ -0,0 +1,66 @@ +///////////////////////////////////////////////////////////////////////////// +// +// Project: SMB kioslave for KDE2 +// +// File: kio_smb_config.cpp +// +// Abstract: member function implementations for SMBSlave that deal with +// KDE/SMB slave configuration +// +// Author(s): Matthew Peterson +// +//--------------------------------------------------------------------------- +// +// Copyright (c) 2000 Caldera Systems, Inc. +// +// This program is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2.1 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; see the file COPYING. If not, please obtain +// a copy from http://www.gnu.org/copyleft/gpl.html +// +///////////////////////////////////////////////////////////////////////////// + +#include "kio_smb.h" +#include "kio_smb_internal.h" +#include + +#include +//=========================================================================== +void SMBSlave::reparseConfiguration() +{ + KConfig *cfg = new KConfig("kioslaverc", true); + cfg->setGroup("Browser Settings/SMBro"); + m_default_user=cfg->readEntry("User"); +// m_default_workgroup=cfg->readEntry("Workgroup"); +// m_showHiddenShares=cfg->readBoolEntry("ShowHiddenShares",false); + + QString m_encoding = QTextCodec::codecForLocale()->name(); + m_default_encoding = cfg->readEntry( "Encoding", m_encoding.lower() ); + + // unscramble, taken from Nicola Brodu's smb ioslave + //not really secure, but better than storing the plain password + QString scrambled = cfg->readEntry( "Password" ); + m_default_password = ""; + for (uint i=0; i +// +////--------------------------------------------------------------------------- +// +// Copyright (c) 2000 Caldera Systems, Inc. +// +// This program is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2.1 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; see the file COPYING. If not, please obtain +// a copy from http://www.gnu.org/copyleft/gpl.html +// +///////////////////////////////////////////////////////////////////////////// + +#include "kio_smb.h" +#include "kio_smb_internal.h" + + +//=========================================================================== +// TODO: add when libsmbclient supports it +void SMBSlave::copy( const KURL& ksrc, + const KURL& kdst, + int permissions, + bool overwrite) +{ + + SMBUrl src; + SMBUrl dst; + mode_t initialmode; + int n; + int dstflags; + int srcfd = -1; + int dstfd = -1; + KIO::filesize_t processed_size = 0; + unsigned char buf[MAX_XFER_BUF_SIZE]; + + kdDebug(KIO_SMB) << "SMBSlave::copy with src = " << ksrc << "and dest = " << kdst << endl; + + // setup urls + src = ksrc; + dst = kdst; + + // Obtain information about source + if(cache_stat(src, &st ) == -1) + { + if ( errno == EACCES ) + { + error( KIO::ERR_ACCESS_DENIED, src.prettyURL()); + } + else + { + error( KIO::ERR_DOES_NOT_EXIST, src.prettyURL()); + } + return; + } + if ( S_ISDIR( st.st_mode ) ) + { + error( KIO::ERR_IS_DIRECTORY, src.prettyURL() ); + return; + } + totalSize(st.st_size); + + // Check to se if the destination exists + if(cache_stat(dst, &st) != -1) + { + if(S_ISDIR(st.st_mode)) + { + error( KIO::ERR_DIR_ALREADY_EXIST, dst.prettyURL()); + return; + } + if(!overwrite) + { + error( KIO::ERR_FILE_ALREADY_EXIST, dst.prettyURL()); + return; + } + } + + // Open the source file + srcfd = smbc_open(src.toSmbcUrl(), O_RDONLY, 0); + if(srcfd < 0) + { + if(errno == EACCES) + { + error( KIO::ERR_ACCESS_DENIED, src.prettyURL() ); + } + else + { + error( KIO::ERR_DOES_NOT_EXIST, src.prettyURL() ); + } + return; + } + + // Determine initial creation mode + if(permissions != -1) + { + initialmode = permissions | S_IWUSR; + } + else + { + initialmode = 0 | S_IWUSR;//0666; + } + + + // Open the destination file + dstflags = O_CREAT | O_TRUNC | O_WRONLY; + if(!overwrite) + { + dstflags |= O_EXCL; + } + dstfd = smbc_open(dst.toSmbcUrl(), dstflags, initialmode); + if(dstfd < 0) + { + if(errno == EACCES) + { + error(KIO::ERR_WRITE_ACCESS_DENIED, dst.prettyURL()); + } + else + { + error(KIO::ERR_CANNOT_OPEN_FOR_READING, dst.prettyURL()); + } + if(srcfd >= 0 ) + { + smbc_close(srcfd); + } + return; + } + + + // Perform copy + while(1) + { + n = smbc_read(srcfd, buf, MAX_XFER_BUF_SIZE ); + if(n > 0) + { + n = smbc_write(dstfd, buf, n); + if(n == -1) + { + kdDebug(KIO_SMB) << "SMBSlave::copy copy now KIO::ERR_COULD_NOT_WRITE" << endl; + error( KIO::ERR_COULD_NOT_WRITE, dst.prettyURL()); + break; + } + + processed_size += n; + processedSize(processed_size); + } + else if(n == 0) + { + break; // finished + } + else + { + error( KIO::ERR_COULD_NOT_READ, src.prettyURL()); + break; + } + } + + + // FINISHED: + + if(srcfd >= 0 ) + { + smbc_close(srcfd); + } + + if(dstfd >= 0) + { + if(smbc_close(dstfd) == 0) + { + + // TODO: set final permissions + } + else + { + error( KIO::ERR_COULD_NOT_WRITE, dst.prettyURL()); + return; + } + } + + finished(); +} + +//=========================================================================== +void SMBSlave::del( const KURL &kurl, bool isfile) +{ + kdDebug(KIO_SMB) << "SMBSlave::del on " << kurl << endl; + m_current_url = kurl; + + if(isfile) + { + // Delete file + kdDebug(KIO_SMB) << "SMBSlave:: unlink " << kurl << endl; + if(smbc_unlink(m_current_url.toSmbcUrl()) == -1) + { + switch(errno) + { + case EISDIR: + error( KIO::ERR_IS_DIRECTORY, m_current_url.prettyURL()); + break; + default: + reportError(kurl); + } + } + } + else + { + kdDebug(KIO_SMB) << "SMBSlave:: rmdir " << kurl << endl; + // Delete directory + if(smbc_rmdir(m_current_url.toSmbcUrl()) == -1) + { + reportError(kurl); + } + } + + finished(); +} + +//=========================================================================== +void SMBSlave::mkdir( const KURL &kurl, int permissions ) +{ + kdDebug(KIO_SMB) << "SMBSlave::mkdir on " << kurl << endl; + m_current_url = kurl; + + if(smbc_mkdir(m_current_url.toSmbcUrl(), 0777) != 0) + { + if (errno == EEXIST) { + if(cache_stat(m_current_url, &st ) == 0) + { + if(S_ISDIR(st.st_mode )) + { + error( KIO::ERR_DIR_ALREADY_EXIST, m_current_url.prettyURL()); + } + } + else + { + error( KIO::ERR_FILE_ALREADY_EXIST, m_current_url.prettyURL()); + } + } else + reportError(kurl); + kdDebug(KIO_SMB) << "SMBSlave::mkdir exit with error " << kurl << endl; + } + else + { + if(permissions != -1) + { + // TODO enable the following when complete + //smbc_chmod( url.toSmbcUrl(), permissions ); + } + } + + finished(); +} + + +//=========================================================================== +void SMBSlave::rename( const KURL& ksrc, const KURL& kdest, bool overwrite ) +{ + + SMBUrl src; + SMBUrl dst; + + kdDebug(KIO_SMB) << "SMBSlave::rename, old name = " << ksrc << ", new name = " << kdest << endl; + + src = ksrc; + dst = kdest; + + // Check to se if the destination exists + + kdDebug(KIO_SMB) << "SMBSlave::rename stat dst" << endl; + if(cache_stat(dst, &st) != -1) + { + if(S_ISDIR(st.st_mode)) + { + kdDebug(KIO_SMB) << "SMBSlave::rename KIO::ERR_DIR_ALREADY_EXIST" << endl; + error( KIO::ERR_DIR_ALREADY_EXIST, dst.prettyURL()); + finished(); + return; + } + if(!overwrite) + { + kdDebug(KIO_SMB) << "SMBSlave::rename KIO::ERR_FILE_ALREADY_EXIST" << endl; + error( KIO::ERR_FILE_ALREADY_EXIST, dst.prettyURL()); + finished(); + return; + } + } + kdDebug(KIO_SMB ) << "smbc_rename " << src.toSmbcUrl() << " " << dst.toSmbcUrl() << endl; + if(smbc_rename(src.toSmbcUrl(), dst.toSmbcUrl())!=0) + { + kdDebug(KIO_SMB ) << "failed " << perror << endl; + switch(errno) + { + case ENOENT: + if(cache_stat(src, &st) == -1) + { + if(errno == EACCES) + { + kdDebug(KIO_SMB) << "SMBSlave::rename KIO::ERR_ACCESS_DENIED" << endl; + error(KIO::ERR_ACCESS_DENIED, src.prettyURL()); + } + else + { + kdDebug(KIO_SMB) << "SMBSlave::rename KIO::ERR_DOES_NOT_EXIST" << endl; + error(KIO::ERR_DOES_NOT_EXIST, src.prettyURL()); + } + } + break; + + case EACCES: + case EPERM: + kdDebug(KIO_SMB) << "SMBSlave::rename KIO::ERR_ACCESS_DENIED" << endl; + error( KIO::ERR_ACCESS_DENIED, dst.prettyURL() ); + break; + + default: + kdDebug(KIO_SMB) << "SMBSlave::rename KIO::ERR_CANNOT_RENAME" << endl; + error( KIO::ERR_CANNOT_RENAME, src.prettyURL() ); + + } + + kdDebug(KIO_SMB) << "SMBSlave::rename exit with error" << endl; + return; + } + + kdDebug(KIO_SMB ) << "everything fine\n"; + finished(); +} + + diff --git a/kioslave/smb/kio_smb_file.cpp b/kioslave/smb/kio_smb_file.cpp new file mode 100644 index 000000000..67fe0d213 --- /dev/null +++ b/kioslave/smb/kio_smb_file.cpp @@ -0,0 +1,279 @@ +//////////////////////////////////////////////////////////////////////////// +// +// Project: SMB kioslave for KDE2 +// +// File: kio_smb_file.cpp +// +// Abstract: member function implementations for SMBSlave that deal with +// SMB file access +// +// Author(s): Matthew Peterson +// +//--------------------------------------------------------------------------- +// +// Copyright (c) 2000 Caldera Systems, Inc. +// +// This program is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2.1 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; see the file COPYING. If not, please obtain +// a copy from http://www.gnu.org/copyleft/gpl.html +// +///////////////////////////////////////////////////////////////////////////// + + +#include "kio_smb.h" +#include "kio_smb_internal.h" + +#include + +//=========================================================================== +void SMBSlave::get( const KURL& kurl ) +{ + char buf[MAX_XFER_BUF_SIZE]; + int filefd = 0; + ssize_t bytesread = 0; + // time_t curtime = 0; + time_t lasttime = 0; + time_t starttime = 0; + KIO::filesize_t totalbytesread = 0; + QByteArray filedata; + SMBUrl url; + + kdDebug(KIO_SMB) << "SMBSlave::get on " << kurl << endl; + + // check (correct) URL + KURL kvurl = checkURL(kurl); + // if URL is not valid we have to redirect to correct URL + if (kvurl != kurl) { + redirection(kvurl); + finished(); + return; + } + + if(!auth_initialize_smbc()) + return; + + + // Stat + url = kurl; + if(cache_stat(url,&st) == -1 ) + { + if ( errno == EACCES ) + error( KIO::ERR_ACCESS_DENIED, url.prettyURL()); + else + error( KIO::ERR_DOES_NOT_EXIST, url.prettyURL()); + return; + } + if ( S_ISDIR( st.st_mode ) ) { + error( KIO::ERR_IS_DIRECTORY, url.prettyURL()); + return; + } + + // Set the total size + totalSize( st.st_size ); + + // Open and read the file + filefd = smbc_open(url.toSmbcUrl(),O_RDONLY,0); + if(filefd >= 0) + { + if(buf) + { + bool isFirstPacket = true; + lasttime = starttime = time(NULL); + while(1) + { + bytesread = smbc_read(filefd, buf, MAX_XFER_BUF_SIZE); + if(bytesread == 0) + { + // All done reading + break; + } + else if(bytesread < 0) + { + error( KIO::ERR_COULD_NOT_READ, url.prettyURL()); + return; + } + + filedata.setRawData(buf,bytesread); + if (isFirstPacket) + { + // We need a KMimeType::findByNameAndContent(filename,data) + // For now we do: find by extension, and if not found (or extension not reliable) + // then find by content. + bool accurate = false; + KMimeType::Ptr mime = KMimeType::findByURL( kurl, st.st_mode, false, true, &accurate ); + if ( !mime || mime->name() == KMimeType::defaultMimeType() + || !accurate ) + { + KMimeType::Ptr p_mimeType = KMimeType::findByContent(filedata); + if ( p_mimeType && p_mimeType->name() != KMimeType::defaultMimeType() ) + mime = p_mimeType; + } + mimeType(mime->name()); + isFirstPacket = false; + } + data( filedata ); + filedata.resetRawData(buf,bytesread); + + // increment total bytes read + totalbytesread += bytesread; + + processedSize(totalbytesread); + } + } + + smbc_close(filefd); + data( QByteArray() ); + processedSize(static_cast(st.st_size)); + + } + else + { + error( KIO::ERR_CANNOT_OPEN_FOR_READING, url.prettyURL()); + return; + } + + finished(); +} + + +//=========================================================================== +void SMBSlave::put( const KURL& kurl, + int permissions, + bool overwrite, + bool resume ) +{ + + void *buf; + size_t bufsize; + + m_current_url = kurl; + + int filefd; + bool exists; + mode_t mode; + QByteArray filedata; + + kdDebug(KIO_SMB) << "SMBSlave::put on " << kurl << endl; + + + exists = (cache_stat(m_current_url, &st) != -1 ); + if ( exists && !overwrite && !resume) + { + if (S_ISDIR(st.st_mode)) + { + kdDebug(KIO_SMB) << "SMBSlave::put on " << kurl <<" already isdir !!"<< endl; + error( KIO::ERR_DIR_ALREADY_EXIST, m_current_url.prettyURL()); + } + else + { + kdDebug(KIO_SMB) << "SMBSlave::put on " << kurl <<" already exist !!"<< endl; + error( KIO::ERR_FILE_ALREADY_EXIST, m_current_url.prettyURL()); + } + return; + } + + if (exists && !resume && overwrite) + { + kdDebug(KIO_SMB) << "SMBSlave::put exists try to remove " << m_current_url.toSmbcUrl()<< endl; + // remove(m_current_url.url().local8Bit()); + } + + + if (resume) + { + // append if resuming + kdDebug(KIO_SMB) << "SMBSlave::put resume " << m_current_url.toSmbcUrl()<< endl; + filefd = smbc_open(m_current_url.toSmbcUrl(), O_RDWR, 0 ); + smbc_lseek(filefd, 0, SEEK_END); + } + else + { + if (permissions != -1) + { + mode = permissions | S_IWUSR | S_IRUSR; + } + else + { + mode = 600;//0666; + } + + kdDebug(KIO_SMB) << "SMBSlave::put NO resume " << m_current_url.toSmbcUrl()<< endl; + filefd = smbc_open(m_current_url.toSmbcUrl(), O_CREAT | O_TRUNC | O_WRONLY, mode); + } + + if ( filefd < 0 ) + { + if ( errno == EACCES ) + { + kdDebug(KIO_SMB) << "SMBSlave::put error " << kurl <<" access denied !!"<< endl; + error( KIO::ERR_WRITE_ACCESS_DENIED, m_current_url.prettyURL()); + } + else + { + kdDebug(KIO_SMB) << "SMBSlave::put error " << kurl <<" can not open for writing !!"<< endl; + error( KIO::ERR_CANNOT_OPEN_FOR_WRITING, m_current_url.prettyURL()); + } + finished(); + return; + } + + // Loop until we got 0 (end of data) + while(1) + { + kdDebug(KIO_SMB) << "SMBSlave::put request data "<< endl; + dataReq(); // Request for data + kdDebug(KIO_SMB) << "SMBSlave::put write " << m_current_url.toSmbcUrl()<< endl; + + if (readData(filedata) <= 0) + { + kdDebug(KIO_SMB) << "readData <= 0" << endl; + break; + } + kdDebug(KIO_SMB) << "SMBSlave::put write " << m_current_url.toSmbcUrl()<< endl; + buf = filedata.data(); + bufsize = filedata.size(); + int size = smbc_write(filefd, buf, bufsize); + if ( size < 0) + { + kdDebug(KIO_SMB) << "SMBSlave::put error " << kurl <<" could not write !!"<< endl; + error( KIO::ERR_COULD_NOT_WRITE, m_current_url.prettyURL()); + finished(); + return; + } + kdDebug(KIO_SMB ) << "wrote " << size << endl; + } + kdDebug(KIO_SMB) << "SMBSlave::put close " << m_current_url.toSmbcUrl()<< endl; + + if(smbc_close(filefd)) + { + kdDebug(KIO_SMB) << "SMBSlave::put on " << kurl <<" could not write !!"<< endl; + error( KIO::ERR_COULD_NOT_WRITE, m_current_url.prettyURL()); + finished(); + return; + } + + // set final permissions, if the file was just created + if ( permissions != -1 && !exists ) + { + // TODO: did the smbc_chmod fail? + // TODO: put in call to chmod when it is working! + // smbc_chmod(url.toSmbcUrl(),permissions); + } + + // We have done our job => finish + finished(); +} + + + + diff --git a/kioslave/smb/kio_smb_internal.cpp b/kioslave/smb/kio_smb_internal.cpp new file mode 100644 index 000000000..27cdfb8d3 --- /dev/null +++ b/kioslave/smb/kio_smb_internal.cpp @@ -0,0 +1,135 @@ +///////////////////////////////////////////////////////////////////////////// +// +// Project: SMB kioslave for KDE2 +// +// File: kio_smb_internal.cpp +// +// Abstract: Utility class implementation used by SMBSlave +// +// Author(s): Matthew Peterson +// +//--------------------------------------------------------------------------- +// +// Copyright (c) 2000 Caldera Systems, Inc. +// +// This program is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2.1 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; see the file COPYING. If not, please obtain +// a copy from http://www.gnu.org/copyleft/gpl.html +// +///////////////////////////////////////////////////////////////////////////// + +#include "kio_smb.h" +#include "kio_smb_internal.h" + +#include + +#include +#include + + +//=========================================================================== +// SMBUrl Function Implementation +//=========================================================================== + +//----------------------------------------------------------------------- +SMBUrl::SMBUrl() +{ + m_type = SMBURLTYPE_UNKNOWN; +} + +//----------------------------------------------------------------------- +SMBUrl::SMBUrl(const KURL& kurl) + : KURL(kurl) + //----------------------------------------------------------------------- +{ + updateCache(); +} + + +//----------------------------------------------------------------------- +void SMBUrl::addPath(const QString &filedir) +{ + KURL::addPath(filedir); + updateCache(); +} + +//----------------------------------------------------------------------- +bool SMBUrl::cd(const QString &filedir) +{ + if (!KURL::cd(filedir)) + return false; + updateCache(); + return true; +} + +//----------------------------------------------------------------------- +void SMBUrl::updateCache() + //----------------------------------------------------------------------- +{ + cleanPath(); + + // SMB URLs are UTF-8 encoded + kdDebug(KIO_SMB) << "updateCache " << KURL::path() << endl; + if (KURL::url() == "smb:/") + m_surl = "smb://"; + else { + QString surl = "smb://"; + if (KURL::hasUser()) { + surl += KURL::encode_string(KURL::user(), 106); + if (KURL::hasPass()) { + surl += ":" + KURL::encode_string(KURL::pass(), 106); + } + surl += "@"; + } + surl += KURL::encode_string(KURL::host().upper(), 106); + surl += KURL::encode_string(KURL::path(), 106); + m_surl = surl.utf8(); + } + m_type = SMBURLTYPE_UNKNOWN; + // update m_type + (void)getType(); +} + +//----------------------------------------------------------------------- +SMBUrlType SMBUrl::getType() const + // Returns the type of this SMBUrl: + // SMBURLTYPE_UNKNOWN - Type could not be determined. Bad SMB Url. + // SMBURLTYPE_ENTIRE_NETWORK - "smb:/" is entire network + // SMBURLTYPE_WORKGROUP_OR_SERVER - "smb:/mygroup" or "smb:/myserver" + // SMBURLTYPE_SHARE_OR_PATH - "smb:/mygroupe/mymachine/myshare/mydir" + //----------------------------------------------------------------------- +{ + if(m_type != SMBURLTYPE_UNKNOWN) + return m_type; + + if (protocol() != "smb") + { + m_type = SMBURLTYPE_UNKNOWN; + return m_type; + } + + if (path(1) == "/") + { + if (host().isEmpty()) + m_type = SMBURLTYPE_ENTIRE_NETWORK; + else + m_type = SMBURLTYPE_WORKGROUP_OR_SERVER; + return m_type; + } + + // Check for the path if we get this far + m_type = SMBURLTYPE_SHARE_OR_PATH; + + return m_type; +} + diff --git a/kioslave/smb/kio_smb_internal.h b/kioslave/smb/kio_smb_internal.h new file mode 100644 index 000000000..aabfc7ab7 --- /dev/null +++ b/kioslave/smb/kio_smb_internal.h @@ -0,0 +1,118 @@ +///////////////////////////////////////////////////////////////////////////// +// +// Project: SMB kioslave for KDE2 +// +// File: kio_smb_internal.h +// +// Abstract: Utility classes used by SMBSlave +// +// Author(s): Matthew Peterson +// Frank Schwanz +//--------------------------------------------------------------------------- +// +// Copyright (c) 2000 Caldera Systems, Inc. +// +// This program is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2.1 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; see the file COPYING. If not, please obtain +// a copy from http://www.gnu.org/copyleft/gpl.html +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef KIO_SMB_INTERNAL_H_INCLUDED +#define KIO_SMB_INTERNAL_H_INCLUDED + +#include + +/** + * Types of a SMBURL : + * SMBURLTYPE_UNKNOWN - Type could not be determined. Bad SMB Url. + * SMBURLTYPE_ENTIRE_NETWORK - "smb:/" is entire network + * SMBURLTYPE_WORKGROUP_OR_SERVER - "smb:/mygroup" or "smb:/myserver" + * URLTYPE_SHARE_OR_PATH - "smb:/mygroupe/mymachine/myshare/mydir" + */ +enum SMBUrlType { + SMBURLTYPE_UNKNOWN = 0, SMBURLTYPE_ENTIRE_NETWORK = 1, + SMBURLTYPE_WORKGROUP_OR_SERVER = 2, SMBURLTYPE_SHARE_OR_PATH = 3 +}; + + +//=========================================================================== +/** + * Class to handle URL's + * it can convert KURL to smbUrl + * and Handle UserInfo + * it also check the correctness of the URL + */ +class SMBUrl : public KURL +{ + + +public: + SMBUrl(); + SMBUrl(const KURL & kurl); + + /** + * Appends the specified file and dir to this SMBUrl + * "smb://server/share" --> "smb://server/share/filedir" + */ + void addPath(const QString &filedir); + + bool cd(const QString &dir); + + /** + * Returns the type of this SMBUrl: + * SMBURLTYPE_UNKNOWN - Type could not be determined. Bad SMB Url. + * SMBURLTYPE_ENTIRE_NETWORK - "smb:/" is entire network + * SMBURLTYPE_WORKGROUP_OR_SERVER - "smb:/mygroup" or "smb:/myserver" + * URLTYPE_SHARE_OR_PATH - "smb:/mygroupe/mymachine/myshare/mydir" + */ + SMBUrlType getType() const; + + void setPass( const QString& _txt ) { KURL::setPass(_txt); updateCache(); } + void setUser( const QString& _txt ) { KURL::setUser(_txt); updateCache(); } + void setHost( const QString& _txt ) { KURL::setHost(_txt); updateCache(); } + + /** + * Returns the workgroup if it given in url + */ +// QString getWorkgroup() const; + + /** + * Returns path after workgroup + */ +// QString getServerShareDir() const; + + /** + * Return a URL that is suitable for libsmbclient + */ + QCString toSmbcUrl() const { return m_surl; } + +private: + /** + * Change from QString to QCString (MS Windows's character encoding) + */ + QCString fromUnicode( const QString &_str ) const; + + void updateCache(); + QCString m_surl; + + /** + * Type of URL + * @see _SMBUrlType + */ + mutable SMBUrlType m_type; +}; + + +#endif + diff --git a/kioslave/smb/kio_smb_mount.cpp b/kioslave/smb/kio_smb_mount.cpp new file mode 100644 index 000000000..08d62ed39 --- /dev/null +++ b/kioslave/smb/kio_smb_mount.cpp @@ -0,0 +1,211 @@ +/* This file is part of the KDE project + + Copyright (C) 2000 Alexander Neundorf + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "kio_smb.h" +#include +#include +#include +#include +#include + +void SMBSlave::readOutput(KProcess *, char *buffer, int buflen) +{ + mybuf += QString::fromLocal8Bit(buffer, buflen); +} + +void SMBSlave::readStdErr(KProcess *, char *buffer, int buflen) +{ + mystderr += QString::fromLocal8Bit(buffer, buflen); +} + +void SMBSlave::special( const QByteArray & data) +{ + kdDebug(KIO_SMB)<<"Smb::special()"<> tmp; + //mounting and umounting are both blocking, "guarded" by a SIGALARM in the future + switch (tmp) + { + case 1: + case 3: + { + QString remotePath, mountPoint, user; + stream >> remotePath >> mountPoint; + + QStringList sl=QStringList::split("/",remotePath); + QString share,host; + if (sl.count()>=2) + { + host=(*sl.at(0)).mid(2); + share=(*sl.at(1)); + kdDebug(KIO_SMB)<<"special() host -"<< host <<"- share -" << share <<"-"<> mountPoint; + + KProcess proc; + proc.setUseShell(true); + proc << "smbumount"; + proc << KProcess::quote(mountPoint); + + mybuf.truncate(0); + mystderr.truncate(0); + + connect(&proc, SIGNAL( receivedStdout(KProcess *, char *, int )), + SLOT(readOutput(KProcess *, char *, int))); + + connect(&proc, SIGNAL( receivedStderr(KProcess *, char *, int )), + SLOT(readStdErr(KProcess *, char *, int))); + + if ( !proc.start( KProcess::Block, KProcess::AllOutput ) ) + { + error(KIO::ERR_CANNOT_LAUNCH_PROCESS, + "smbumount"+i18n("\nMake sure that the samba package is installed properly on your system.")); + return; + } + + kdDebug(KIO_SMB) << "smbumount exit " << proc.exitStatus() << endl + << "stdout:" << mybuf << endl << "stderr:" << mystderr << endl; + + if (proc.exitStatus() != 0) + { + error(KIO::ERR_COULD_NOT_UNMOUNT, + i18n("Unmounting of mountpoint \"%1\" failed.\n%2") + .arg(mountPoint).arg(mybuf + "\n" + mystderr)); + return; + } + + if ( tmp == 4 ) + { + bool ok; + + QDir dir(mountPoint); + dir.cdUp(); + ok = dir.rmdir(mountPoint); + if ( ok ) + { + QString p=dir.path(); + dir.cdUp(); + ok = dir.rmdir(p); + } + + if ( !ok ) + { + error(KIO::ERR_COULD_NOT_RMDIR, mountPoint); + return; + } + } + + finished(); + } + break; + default: + break; + } + finished(); +} + +#include "kio_smb.moc" diff --git a/kioslave/smb/libsmbclient-HOWTO.txt b/kioslave/smb/libsmbclient-HOWTO.txt new file mode 100644 index 000000000..65ed7d086 --- /dev/null +++ b/kioslave/smb/libsmbclient-HOWTO.txt @@ -0,0 +1,11 @@ +HOWTO get the libsmbclient built, so that you can get the new smb ioslave built... + +1. Check out the samba sources from cvs with ( full directions are at: http://www.samba.org/samba/cvs.html + cvs -d :pserver:cvs@pserver.samba.org:/cvsroot login + use "cvs" as the password + cvs -z5 -d :pserver:cvs@pserver.samba.org:/cvsroot co -r SAMBA_3_0 samba/source +2. cd samba/source +3. sh autogen.sh +4. run ./configure && make +5. when compiling is done- shouldn't take more than 5-15 minutes depending on your machine, + you need to "make installclientlib installdat" - if you want all of samba, do "make install" diff --git a/kioslave/smb/smb-network.desktop b/kioslave/smb/smb-network.desktop new file mode 100644 index 000000000..de5406775 --- /dev/null +++ b/kioslave/smb/smb-network.desktop @@ -0,0 +1,80 @@ +[Desktop Entry] +Icon=network +Name=Samba Shares +Name[af]=Samba Hulpbronne +Name[ar]=مشاركات Samba +Name[az]=Samba Sahələri +Name[be]=Агульныя тэчкі Samba +Name[bg]=Ресурси на Samba +Name[bn]=সাম্বা শেয়ার +Name[br]=Rannadoù Samba +Name[bs]=Samba dijeljenje +Name[ca]=Recurs compartit de Samba +Name[cs]=Sdílené disky Samby +Name[csb]=Dostónczi Sambë +Name[cy]=Cydranniad Samba +Name[da]=Samba-shares +Name[de]=Samba-Freigaben +Name[el]=Κοινόχρηστοι πόροι Samba +Name[eo]=Sambo-opuzaĵoj +Name[es]=Comparticiones Samba +Name[et]=SMB jagatud ressursid +Name[eu]=Samba partekaketak +Name[fa]=مشترکات Samba +Name[fi]=Samba-jaot +Name[fr]=Partages Samba +Name[fy]=Sambanetwurk +Name[ga]=Comhranna Samba +Name[gl]=Comparticións de Samba +Name[he]=שיתופי Samba +Name[hi]=साम्बा साझेदारी +Name[hr]=Samba dijeljenja +Name[hu]=Samba-megosztások +Name[is]=Samba sameignir +Name[it]=Condivisioni Samba +Name[ja]=Samba 共有 +Name[ka]=Samba-ს საზიაროები +Name[kk]=Samba ресурстары +Name[ko]=삼바 공유 +Name[lo]=ສັບພະຍາກອນທີ່ໃຊ້ຮ່ວມກັນຂອງ Samba +Name[lt]=Samba bendri diskai +Name[lv]=Samba Šāres +Name[mk]=Samba-заеднички +Name[mn]=Samba-Нөөцүүд +Name[ms]=Perkongsian Samba +Name[mt]=Riżorsi Samba +Name[nb]=Samba-ressurser +Name[nds]=Samba-Freegaven +Name[ne]=साम्बा साझेदारी +Name[nl]=Sambanetwerk +Name[nn]=Samba-ressursar +Name[nso]=Dikabagano tsa Samba +Name[pa]=ਸਾਂਬਾ ਸਾਂਝ +Name[pl]=Zasoby Samby +Name[pt]=Partilhas de Samba +Name[pt_BR]=Compartilhamentos do Samba +Name[ro]=Partajări Samba +Name[ru]=Ресурсы Samba +Name[rw]=Imigabane Samba +Name[se]=Samba-resurssat +Name[sk]=Stav Samby +Name[sl]=Souporabe Sambe +Name[sr]=Samba дељења +Name[sr@Latn]=Samba deljenja +Name[sv]=Samba-utdelningar +Name[ta]=சம்பா பங்குகள் +Name[tg]=Иштирокоти Samba +Name[th]=ทรัพยากร Samba ที่ใช้ร่วมกัน +Name[tr]=Samba Payları +Name[tt]=Samba Urtaqları +Name[uk]=Спільні ресурси Samba +Name[ven]=Mikovhe ya Samba +Name[vi]=Chia sẻ Samba +Name[wa]=Pårtaedjes Samba +Name[xh]=Izahlulo ze Samba +Name[zh_CN]=Samba 共享 +Name[zh_TW]=Samba 資源分享 +Name[zu]=Izabelo ze-Samba +Open=false +Type=Link +URL=smb:/ diff --git a/kioslave/smb/smb.protocol b/kioslave/smb/smb.protocol new file mode 100644 index 000000000..dbfca9129 --- /dev/null +++ b/kioslave/smb/smb.protocol @@ -0,0 +1,12 @@ +[Protocol] +exec=kio_smb +protocol=smb +input=none +output=filesystem +listing=Name,Type,Size,Date,Access,Owner,Group +reading=true +writing=true +makedir=true +deleting=true +DocPath=kioslave/smb.html +Icon=samba diff --git a/kioslave/smb/x-smb-server.desktop b/kioslave/smb/x-smb-server.desktop new file mode 100644 index 000000000..2daee7cf5 --- /dev/null +++ b/kioslave/smb/x-smb-server.desktop @@ -0,0 +1,76 @@ +[Desktop Entry] +Comment=Windows Server +Comment[af]=Windows Bediener +Comment[ar]=خادم Windows +Comment[be]=Сервер Windows +Comment[bg]=Сървър Windows +Comment[bn]=উইণ্ডোস সার্ভার +Comment[br]=Servijer Windows +Comment[bs]=Windows server +Comment[ca]=Servidor Windows +Comment[cs]=Windows server +Comment[csb]=Serwera Windowsa +Comment[cy]=Grŵp Gwaith Windows +Comment[da]=Windows server +Comment[de]=Windows-Server +Comment[el]=Διακομιστής των Windows +Comment[eo]=Vindoza servilo +Comment[es]=Servidor Windows +Comment[et]=Windowsi server +Comment[eu]=Windows zerbitzaria +Comment[fa]=کارساز ویندوز +Comment[fi]=Windows-palvelin +Comment[fr]=Serveur Windows +Comment[fy]=Windows-tsjinner +Comment[ga]=Freastalaí Windows +Comment[he]=שרת Windows +Comment[hi]=विंडोज़ सर्वर +Comment[hr]=Windows poslužitelj +Comment[hu]=Windows kiszolgáló +Comment[is]=Windows þjónn +Comment[it]=Server Windows +Comment[ja]=Windows サーバ +Comment[ka]=Windows სერვერი +Comment[kk]=Windows сервері +Comment[km]=ម៉ាស៊ីន​បម្រើ Windows +Comment[ko]=윈도 공유 +Comment[lt]=Windows serveris +Comment[lv]=Windows serveris +Comment[mk]=Windows-сервер +Comment[ms]=Pelayan Windows +Comment[mt]=Server tal-Windows +Comment[nb]=Windows-tjener +Comment[nds]=Windows-Server +Comment[ne]=सञ्झ्याल सर्भर +Comment[nl]=Windows-server +Comment[nn]=Windows-tenar +Comment[pa]=ਵਿੰਡੋ ਸਰਵਰ +Comment[pl]=Serwer Windows +Comment[pt]=Servidor de Windows +Comment[pt_BR]=Servidor Windows +Comment[ro]=Servere Windows +Comment[ru]=Сервер Windows +Comment[rw]=Windows Seriveri +Comment[se]=Windows-bálvá +Comment[sk]=Server Windows +Comment[sl]=Strežnik za Windows +Comment[sr]=Windows сервер +Comment[sr@Latn]=Windows server +Comment[sv]=Windows server +Comment[ta]=சாளர சேவகன் +Comment[te]=విండొస్ సెర్వర్ +Comment[tg]=Хидматгоҳи Windows +Comment[th]=เครื่องให้บริการวินโดว์ส +Comment[tr]=Windows Sunucusu +Comment[uk]=Сервер Windows +Comment[uz]=Windows serveri +Comment[uz@cyrillic]=Windows сервери +Comment[vi]=Máy phục vụ Windows +Comment[wa]=Sierveu Windows +Comment[zh_CN]=Windows 服务器 +Comment[zh_TW]=視窗伺服器 +Icon=server +Type=MimeType +MimeType=application/x-smb-server +X-KDE-AutoEmbed=true +X-KDE-IsAlso=inode/directory diff --git a/kioslave/smb/x-smb-workgroup.desktop b/kioslave/smb/x-smb-workgroup.desktop new file mode 100644 index 000000000..c1ad4b95f --- /dev/null +++ b/kioslave/smb/x-smb-workgroup.desktop @@ -0,0 +1,74 @@ +[Desktop Entry] +Comment=Windows Workgroup +Comment[af]=Windows Werkgroep +Comment[ar]=مجموعة عمل Windows +Comment[be]=Працоўная група Windows +Comment[bg]=Работна група на Windows +Comment[bn]=উইণ্ডোস ওয়ার্কগ্রুপ +Comment[br]=Strollad labour Windows +Comment[bs]=Windows radna grupa +Comment[ca]=Grup de treball de Windows +Comment[cs]=Pracovní skupina Windows +Comment[csb]=Robòczé karno Windowsa +Comment[cy]=Gr?p Gwaith Windows +Comment[de]=Windows-Arbeitsgruppe +Comment[el]=Ομάδα εργασίας Windows +Comment[eo]=Vindoza laborgrupo +Comment[es]=Grupo de trabajo de Windows +Comment[et]=Windowsi töögrupp +Comment[eu]=Windows lan taldea +Comment[fa]=گروه کاری ویندوز +Comment[fi]=Windows-työryhmä +Comment[fr]=Groupe de travail Windows +Comment[fy]=Windows-wurkkeppel +Comment[ga]=Grúpa Oibre Windows +Comment[gl]=Grupo de Traballo de Windows +Comment[he]=קבוצת עבודה של חלונות +Comment[hi]=विंडोज़ वर्क बुक +Comment[hr]=Windows radna grupa +Comment[hu]=Windows-os munkacsoport +Comment[is]=Windows vinnuhópur +Comment[it]=Gruppo di lavoro di Windows +Comment[ja]=Windows ワークグループ +Comment[ka]=Windows სამუშაო გჯუფი +Comment[kk]=Windows жұмыс тобы +Comment[lt]=Windows darbo grupė +Comment[lv]=Windows darba grupa +Comment[mk]=Windows работна група +Comment[mn]=Цонхтой ажиллах бүлэг +Comment[ms]=Kumpulan Kerja Windows +Comment[mt]=Workgroup tal-Windows +Comment[nb]=Windows-arbeidsgruppe +Comment[nds]=Windows-Arbeitkoppel +Comment[ne]=सञ्झ्याल कार्य समूह +Comment[nl]=Windows-werkgroep +Comment[nn]=Windows-arbeidsgruppe +Comment[pa]=ਵਿੰਡੋ ਵਰਕਗਰੁੱਪ +Comment[pl]=Grupa robocza Windows +Comment[pt]=Grupos de Trabalho do Windows +Comment[pt_BR]=Grupo de trabalho do Windows +Comment[ro]=Grupuri de lucru Windows +Comment[ru]=Рабочая группа Windows +Comment[rw]=Itsindaumurimo Windows +Comment[se]=Windows-bargojoavku +Comment[sk]=Pracovná skupina Windows +Comment[sl]=Delovna skupina Windows +Comment[sv]=Windows arbetsgrupp +Comment[ta]=சாளரங்கள் பணிகுழு +Comment[te]=విండొస్ వర్క్ గ్రూప్ +Comment[tg]=Гурӯҳи кори Windows +Comment[th]=กลุ่มงานวินโดว์ส +Comment[tr]=Windows Çalışma Grubu +Comment[tt]=Windows Eştörkeme +Comment[uk]=Робоча група Windows +Comment[uz]=Windows ishchi guruhi +Comment[uz@cyrillic]=Windows ишчи гуруҳи +Comment[vi]=Nhóm làm việc Windows +Comment[wa]=Groupe d' ovraedje Windows +Comment[zh_CN]=Windows 工作组 +Comment[zh_TW]=視窗工作群組 +Icon=network_local +Type=MimeType +MimeType=application/x-smb-workgroup +X-KDE-AutoEmbed=true +X-KDE-IsAlso=inode/directory -- cgit v1.2.1