Commit be1dda4d authored by Laurent Montel's avatar Laurent Montel 😁

Move kioslave ldap here

parent 9def83a2
......@@ -19,6 +19,14 @@ include(ECMQtDeclareLoggingCategory)
set(KF5_VERSION "5.19.0")
set(KLDAP_LIB_VERSION "5.2.40")
set(MBOXLIB_VERSION "5.2.40")
find_package(KF5KIO ${KF5_VERSION} CONFIG REQUIRED)
find_package(KF5I18n ${KF5_VERSION} CONFIG REQUIRED)
find_package(KF5DocTools ${KF5_VERSION} CONFIG REQUIRED)
find_package(KF5Mbox ${MBOXLIB_VERSION} CONFIG REQUIRED)
add_definitions("-DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII")
ecm_setup_version(${KLDAP_LIB_VERSION} VARIABLE_PREFIX KLDAP
VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kldap_version.h"
......@@ -79,9 +87,11 @@ install(FILES
########### Targets ###########
add_subdirectory(cmake)
add_subdirectory(src)
add_subdirectory(kioslave)
if(BUILD_TESTING)
add_subdirectory(autotests)
endif()
install( FILES kldap.categories DESTINATION ${KDE_INSTALL_CONFDIR} )
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
SKIP /tests/
REVIEWBOARD_URL = "https://git.reviewboard.kde.org"
#REPOSITORY = "git://anongit.kde.org/kioslave"
BRANCH = "master"
TARGET_GROUPS = "kdepimlibs"
TARGET_PEOPLE = "mlaurent"
add_definitions("-DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII")
add_subdirectory(src)
add_subdirectory(docs)
add_subdirectory(ldap)
########### install files ###############
kdoctools_create_handbook(index.docbook INSTALL_DESTINATION ${KDE_INSTALL_DOCBUNDLEDIR}/en SUBDIR kioslave5/ldap)
<?xml version="1.0" ?>
<!DOCTYPE article PUBLIC "-//KDE//DTD DocBook XML V4.5-Based Variant V1.1//EN"
"dtd/kdedbx45.dtd" [
<!ENTITY % addindex "IGNORE">
<!ENTITY % English "INCLUDE" > <!-- change language only here -->
]>
<article lang="&language;" id="ldap">
<title>ldap</title>
<articleinfo>
<authorgroup>
<author>&Lauri.Watts; &Lauri.Watts.mail;</author>
<!-- TRANS:ROLES_OF_TRANSLATORS -->
</authorgroup>
</articleinfo>
<para><acronym>ldap</acronym> is the lightweight directory access
protocol. It provides access to an X.500 directory, or to a stand-alone
<acronym>LDAP</acronym> server.</para>
<para>You can use the ldap kioslave as follows:</para>
<para><userinput>ldap://host:port/ou=People,o=where,c=de??sub</userinput>
for a subtree-query</para>
<para>or
<userinput>ldap://host:port/cn=MM,ou=People,o=where,c=de??base</userinput>
for a complete branch.</para>
</article>
log_kldap kioslave (kldap)
log_sieve kioslave (sieve)
log_smtp kioslave (smtp)
log_pop3 kioslave (pop3)
remove_definitions(-DQT_NO_CAST_FROM_BYTEARRAY)
add_subdirectory(ldap)
/* This file is part of the KDE project
Copyright (C) 2008 Jarosław Staniek <staniek@kde.org>
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.
*/
#ifndef _KIOSLAVE_COMMON_H
#define _KIOSLAVE_COMMON_H
#include <stdio.h>
#include <QFile>
#include <QDir>
extern "C" {
#include <sasl/sasl.h>
}
inline bool initSASL()
{
#ifdef Q_OS_WIN32 //krazy:exclude=cpp
QByteArray libInstallPath(QFile::encodeName(QDir::toNativeSeparators(KGlobal::dirs()->installPath("lib") + QLatin1String("sasl2"))));
QByteArray configPath(QFile::encodeName(QDir::toNativeSeparators(KGlobal::dirs()->installPath("config") + QLatin1String("sasl2"))));
if (sasl_set_path(SASL_PATH_TYPE_PLUGIN, libInstallPath.data()) != SASL_OK ||
sasl_set_path(SASL_PATH_TYPE_CONFIG, configPath.data()) != SASL_OK) {
fprintf(stderr, "SASL path initialization failed!\n");
return false;
}
#endif
if (sasl_client_init(NULL) != SASL_OK) {
fprintf(stderr, "SASL library initialization failed!\n");
return false;
}
return true;
}
#endif
set(kio_ldap_PART_SRCS kio_ldap.cpp)
ecm_qt_declare_logging_category(kio_ldap_PART_SRCS HEADER kldap_debug.h IDENTIFIER KLDAP_LOG CATEGORY_NAME log_kldap)
add_library(kio_ldap MODULE ${kio_ldap_PART_SRCS})
target_link_libraries(kio_ldap KF5::KIOCore KF5::I18n KF5::Ldap KF5::Mbox)
set_target_properties(kio_ldap PROPERTIES OUTPUT_NAME "ldap")
install(TARGETS kio_ldap DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf5/kio)
########### install files ###############
install( FILES ldap.protocol ldaps.protocol DESTINATION ${KDE_INSTALL_KSERVICES5DIR} )
#! /usr/bin/env bash
$XGETTEXT *.cpp -o $podir/kio_ldap.pot
This diff is collapsed.
/*
Copyright (c) 2004-2007 Szombathelyi György <gyurco@freemail.hu>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef __LDAP_H__
#define __LDAP_H__
#include <kio/slavebase.h>
#include <kio/authinfo.h>
#include <kldap/ldapdefs.h>
#include <kldap/ldapurl.h>
#include <kldap/ldapcontrol.h>
#include <kldap/ldapconnection.h>
#include <kldap/ldapdn.h>
#include <kldap/ldapoperation.h>
class LDAPProtocol : public KIO::SlaveBase
{
public:
LDAPProtocol(const QByteArray &protocol, const QByteArray &pool, const QByteArray &app);
virtual ~LDAPProtocol();
virtual void setHost(const QString &host, quint16 port,
const QString &user, const QString &pass) Q_DECL_OVERRIDE;
void openConnection() Q_DECL_OVERRIDE;
void closeConnection() Q_DECL_OVERRIDE;
void get(const QUrl &url) Q_DECL_OVERRIDE;
void stat(const QUrl &url) Q_DECL_OVERRIDE;
void listDir(const QUrl &url) Q_DECL_OVERRIDE;
void del(const QUrl &url, bool isfile) Q_DECL_OVERRIDE;
void put(const QUrl &url, int permissions, KIO::JobFlags flags) Q_DECL_OVERRIDE;
private:
KLDAP::LdapConnection mConn;
KLDAP::LdapOperation mOp;
KLDAP::LdapServer mServer;
bool mConnected;
void controlsFromMetaData(KLDAP::LdapControls &serverctrls,
KLDAP::LdapControls &clientctrls);
void LDAPEntry2UDSEntry(const KLDAP::LdapDN &dn, KIO::UDSEntry &entry,
const KLDAP::LdapUrl &usrc, bool dir = false);
int asyncSearch(KLDAP::LdapUrl &usrc, const QByteArray &cookie = "");
void LDAPErr(int err = KLDAP_SUCCESS);
void changeCheck(const KLDAP::LdapUrl &url);
};
#endif
[Protocol]
exec=kf5/kio/ldap
protocol=ldap
input=none
output=filesystem
listing=Name,
reading=true
source=true
writing=true
#makedir=true
deleting=true
#linking=true
#moving=true
mimetype=text/plain
determineMimetypeFromExtension=false
X-DocPath=kioslave5/ldap/index.html
Icon=office-address-book
[Protocol]
exec=kf5/kio/ldap
protocol=ldaps
input=none
output=filesystem
listing=Name,
reading=true
source=true
writing=true
#makedir=true
deleting=true
#linking=true
#moving=true
mimetype=text/plain
determineMimetypeFromExtension=false
X-DocPath=kioslave5/ldap/index.html
Icon=office-address-book
log_kldap kioslave (kldap)
log_sieve kioslave (sieve)
log_smtp kioslave (smtp)
log_pop3 kioslave (pop3)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment