LCOV - code coverage report
Current view: top level - libreoffice/extensions/source/config/ldap - ldapaccess.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 3 0.0 %
Date: 2012-12-27 Functions: 0 5 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef EXTENSIONS_CONFIG_LDAP_LDAPACCESS_HXX_
      21             : #define EXTENSIONS_CONFIG_LDAP_LDAPACCESS_HXX_
      22             : 
      23             : #include "sal/config.h"
      24             : 
      25             : #include <map>
      26             : 
      27             : #ifdef WNT
      28             : #include <windows.h>
      29             : #include <winldap.h>
      30             : #else // !defined WNT
      31             : #include <ldap.h>
      32             : #endif // WNT
      33             : 
      34             : #include <com/sun/star/ldap/LdapGenericException.hpp>
      35             : 
      36             : #include <com/sun/star/ldap/LdapConnectionException.hpp>
      37             : #include <com/sun/star/lang/IllegalArgumentException.hpp>
      38             : #include <osl/module.h>
      39             : 
      40             : namespace extensions { namespace config { namespace ldap {
      41             : 
      42             : namespace uno = css::uno ;
      43             : namespace lang = css::lang ;
      44             : namespace ldap = css::ldap ;
      45             : //------------------------------------------------------------------------------
      46             : struct LdapUserProfile;
      47             : 
      48             : //------------------------------------------------------------------------------
      49             : /** Struct containing the information on LDAP connection */
      50           0 : struct LdapDefinition
      51             : {
      52             :     /** LDAP server name */
      53             :     rtl::OUString mServer ;
      54             :     /** LDAP server port number */
      55             :     sal_Int32 mPort ;
      56             :     /** Repository base DN */
      57             :     rtl::OUString mBaseDN ;
      58             :     /** DN to use for "anonymous" connection */
      59             :     rtl::OUString mAnonUser ;
      60             :     /** Credentials to use for "anonymous" connection */
      61             :     rtl::OUString mAnonCredentials ;
      62             :     /** User Entity Object Class */
      63             :     rtl::OUString mUserObjectClass;
      64             :     /** User Entity Unique Attribute */
      65             :     rtl::OUString mUserUniqueAttr;
      66             :  } ;
      67             : 
      68             : typedef std::map< rtl::OUString, rtl::OUString > LdapData; // key/value pairs
      69             : 
      70             : /** Class encapulating all LDAP functionality */
      71             : class LdapConnection
      72             : {
      73             :     friend struct LdapMessageHolder;
      74             : public:
      75             : 
      76             :     /** Default constructor */
      77           0 :     LdapConnection(void) : mConnection(NULL),mLdapDefinition() {}
      78             :     /** Destructor, releases the connection */
      79             :     ~LdapConnection(void) ;
      80             :     /** Make connection to LDAP server */
      81             :     void  connectSimple(const LdapDefinition& aDefinition)
      82             :         throw (ldap::LdapConnectionException,
      83             :                 ldap::LdapGenericException);
      84             : 
      85             :     /**
      86             :         Gets LdapUserProfile from LDAP repository for specified user
      87             :         @param aUser    name of logged on user
      88             :         @param aUserProfileMap  Map containing LDAP->00o mapping
      89             :        @param aUserProfile     struct for holding OOo values
      90             : 
      91             :          @throws com::sun::star::ldap::LdapGenericException
      92             :                   if an LDAP error occurs.
      93             :     */
      94             :     void getUserProfile(const rtl::OUString& aUser, LdapData * data)
      95             :          throw (lang::IllegalArgumentException,
      96             :                  ldap::LdapConnectionException,
      97             :                  ldap::LdapGenericException);
      98             : 
      99             :     /** finds DN of user
     100             :         @return  DN of User
     101             :     */
     102             :     rtl::OUString findUserDn(const rtl::OUString& aUser)
     103             :         throw (lang::IllegalArgumentException,
     104             :                 ldap::LdapConnectionException,
     105             :                 ldap::LdapGenericException);
     106             : 
     107             : private:
     108             : 
     109             :     void initConnection()
     110             :          throw (ldap::LdapConnectionException);
     111             :     void disconnect();
     112             :     /**
     113             :       Indicates whether the connection is in a valid state.
     114             :       @return   sal_True if connection is valid, sal_False otherwise
     115             :       */
     116           0 :     bool isValid(void) const { return mConnection != NULL ; }
     117             : 
     118             :     void  connectSimple()
     119             :         throw (ldap::LdapConnectionException,
     120             :                 ldap::LdapGenericException);
     121             : 
     122             :     /** LDAP connection object */
     123             :     LDAP* mConnection ;
     124             :     LdapDefinition mLdapDefinition;
     125             : } ;
     126             : 
     127             : //------------------------------------------------------------------------------
     128             : }} }
     129             : 
     130             : #endif // EXTENSIONS_CONFIG_LDAP_LDAPUSERPROFILE_HXX_
     131             : 
     132             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10