├── python └── openchange │ ├── web │ ├── __init__.py │ └── auth │ │ └── __init__.py │ ├── utils │ └── __init__.py │ ├── tests │ ├── __init__.py │ ├── test_provision.py │ └── test_mailbox.py │ ├── urlutils.py │ └── __init__.py ├── script ├── uno.dfn ├── samba4_ver.sh ├── installoc.sh ├── installman.sh ├── uninstallman.sh ├── mapi_object_init.prop └── mkrelease.sh ├── mapiproxy ├── services │ ├── client │ │ ├── OCSManager │ │ │ ├── __init__.py │ │ │ └── ClientNotification.py │ │ └── ocsmanager.cfg │ ├── ocsmanager │ │ ├── ocsmanager │ │ │ ├── __init__.py │ │ │ ├── lib │ │ │ │ ├── __init__.py │ │ │ │ ├── helpers.py │ │ │ │ ├── utils.py │ │ │ │ ├── base.py │ │ │ │ └── app_globals.py │ │ │ ├── model │ │ │ │ ├── __init__.py │ │ │ │ ├── auth │ │ │ │ │ ├── __init__.py │ │ │ │ │ └── SingleAuthenticateModel.py │ │ │ │ ├── OCSAuthenticator.py │ │ │ │ ├── RPCProxyAuthenticateModel.py │ │ │ │ └── AuthenticateModel.py │ │ │ ├── config │ │ │ │ ├── __init__.py │ │ │ │ ├── routing.py │ │ │ │ └── deployment.ini_tmpl │ │ │ ├── tests │ │ │ │ ├── test_models.py │ │ │ │ ├── functional │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── test_rpcproxy.py │ │ │ │ │ ├── test_notification.py │ │ │ │ │ └── test_authenticate.py │ │ │ │ └── __init__.py │ │ │ ├── controllers │ │ │ │ ├── __init__.py │ │ │ │ ├── rpcproxy.py │ │ │ │ ├── error.py │ │ │ │ └── notification.py │ │ │ ├── templates │ │ │ │ ├── notification.xml │ │ │ │ ├── error.xml │ │ │ │ ├── login.xml │ │ │ │ └── token.xml │ │ │ └── websetup.py │ │ ├── MANIFEST.in │ │ ├── ocsmanager-apache.conf │ │ ├── test.ini │ │ ├── docs │ │ │ └── index.txt │ │ ├── setup.cfg │ │ ├── setup.py │ │ ├── production.ini │ │ └── ocsmanager.ini │ ├── web │ │ └── rpcproxy │ │ │ ├── rpcproxy │ │ │ ├── __init__.py │ │ │ └── utils.py │ │ │ ├── setup.py │ │ │ ├── rpcproxy.conf │ │ │ └── rpcproxy.wsgi │ ├── utils │ │ └── genpass.py │ ├── setup.sh │ └── plugins │ │ └── dovecot │ │ └── ocsmanager-plugin.h ├── documentation │ └── pictures │ │ ├── devdoc.png │ │ ├── userdoc.png │ │ ├── mapiproxy.png │ │ ├── mapistore.png │ │ ├── mpm_stack.png │ │ ├── mpm_pack_pack.png │ │ ├── mapiproxy_logo.png │ │ ├── mapistore_logo.png │ │ ├── mpm_pack_unpack.png │ │ ├── mapiproxy_overview.png │ │ ├── mapiproxy_struct.png │ │ ├── mpm_cache_case_one.png │ │ ├── mpm_cache_case_two.png │ │ ├── mapiproxy_error_001.png │ │ ├── mapiproxy_error_002.png │ │ ├── mapiproxy_hook_life.png │ │ ├── mapiproxy_emsmdb_graph.png │ │ ├── mapiproxy_error_001_fix.png │ │ ├── dcerpc_mapiproxy_server_true.png │ │ ├── dcerpc_mapiproxy_server_false_nspi.png │ │ └── dcerpc_mapiproxy_server_true_custom_nspi.png ├── libmapistore.pc.in ├── libmapiserver.pc.in ├── libmapiproxy.pc.in ├── servers │ └── default │ │ └── rfr │ │ └── dcesrv_exchange_ds_rfr.h ├── libmapiserver │ ├── libmapiserver_oxorule.c │ └── libmapiserver_oxcperm.c ├── dcesrv_mapiproxy_rfr.c ├── dcesrv_mapiproxy.h └── libmapistore │ └── mgmt │ └── mapistore_mgmt.idl ├── testprogs ├── blackbox │ ├── expected_output--version.txt │ ├── expected_output--ocpf-syntax2.txt │ ├── expected_output--ocpf-syntax1.txt │ ├── expected_output--usage.txt │ ├── test_openchangeclient.py │ ├── test_mapiprofile.sh │ └── subunit.sh └── check_mbox.py ├── bin └── .dummy ├── doc ├── doxygen │ ├── pictures │ │ ├── header.jpg │ │ ├── nav_tab.gif │ │ ├── middle_bg.jpg │ │ ├── pixel_grey.gif │ │ ├── body_top_bg2.jpg │ │ ├── 24px-Cc-by_white.svg.png │ │ ├── 24px-Cc-sa_white.svg.png │ │ └── CC_SomeRightsReserved.png │ ├── header.html │ ├── index.html │ ├── footer.html │ └── libmapi-concepts.doxy └── examples │ ├── Makefile │ └── mapi_sample1.c ├── setup ├── openchangedb │ ├── oc_provision_openchange_mailbox.ldif │ └── oc_provision_openchange_init.ldif ├── profiles │ └── oc_profiles_init.ldif ├── AD │ ├── provision_schema_basedn_modify.ldif │ ├── prefixMap.txt │ ├── oc_provision_configuration_finalize.ldif │ └── oc_provision_schema_possSuperior.ldif ├── openchange_newuser └── openchange_provision ├── utils ├── mapitest │ ├── data │ │ └── lzxpress │ │ │ ├── 001_Outlook_2007_in_ModifyRecipients_comp.dat │ │ │ └── 002_Outlook_2007_in_Tables_operations_comp.dat │ └── modules │ │ ├── mapitest.doxy │ │ ├── module_oxorule.c │ │ └── module_lcid.c ├── mapitrace │ ├── Makefile.PL │ └── lib │ │ └── MAPI │ │ └── Regression.pm ├── schemaIDGUID.c ├── openchangepfadmin.h └── openchange-tools.h ├── qt ├── demo │ ├── main.cpp │ └── demoapp.h └── lib │ ├── messagesmodel.h │ ├── foldermodel.h │ └── messagesmodel.cpp ├── libmapiadmin ├── libmapiadmin-mainpage.doxy └── mapiadmin.c ├── libocpf ├── ocpf_bison.supp ├── lex.h ├── examples │ ├── common_OLEGUID.ocpf │ ├── sample_task.ocpf │ └── sample_appointment.ocpf └── ocpf_dump.h ├── libocpf.pc.in ├── libmapi++.pc.in ├── libmapi.pc.in ├── libmapiadmin.pc.in ├── libmapi++ ├── tests │ ├── exception_test.cpp │ └── profile_test.cpp ├── clibmapi.h ├── src │ ├── mapi_exception.cpp │ ├── object.cpp │ ├── message.cpp │ └── session.cpp ├── libmapi++.h ├── libmapi++-example.doxy ├── examples │ └── messages.cpp └── message.h ├── IDL_LICENSE.txt ├── pyopenchange ├── tests │ ├── properties.py │ ├── sogo_readdir.py │ ├── ocpf_test.py │ ├── mapistore_test.py │ ├── mapistore_mgmt.py │ └── mapistore_sogo.py ├── pyocpf.h ├── pymapi.h └── mapistore │ ├── table.c │ └── gen_errors.py ├── packaging └── rhel │ ├── ocsmanager-ini-path-fix.diff │ ├── doxygen_to_devhelp.xsl │ └── openchange-ocsmanager.init ├── libexchange2ical ├── libical2exchange.c └── libexchange2ical.c ├── .gitignore ├── libmapi ├── mapi_id_array.h ├── socket │ └── netif.h ├── mapi_context.h ├── mapidump.h ├── nspi.h ├── idset.h ├── mapi_provider.h ├── emsmdb.h ├── mapi_profile.h ├── fxparser.h ├── mapi_notification.h └── async_emsmdb.c ├── .bzrignore ├── Mainpage.doxy ├── VERSION └── autogen.sh /python/openchange/web/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /script/uno.dfn: -------------------------------------------------------------------------------- 1 | UnoType _Bool; 2 | -------------------------------------------------------------------------------- /python/openchange/utils/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /python/openchange/web/auth/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /mapiproxy/services/client/OCSManager/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /mapiproxy/services/ocsmanager/ocsmanager/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /mapiproxy/services/web/rpcproxy/rpcproxy/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /mapiproxy/services/ocsmanager/ocsmanager/lib/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /mapiproxy/services/ocsmanager/ocsmanager/model/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /mapiproxy/services/ocsmanager/ocsmanager/config/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /mapiproxy/services/ocsmanager/ocsmanager/model/auth/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /mapiproxy/services/ocsmanager/ocsmanager/tests/test_models.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /mapiproxy/services/ocsmanager/ocsmanager/controllers/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /mapiproxy/services/ocsmanager/ocsmanager/tests/functional/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testprogs/blackbox/expected_output--version.txt: -------------------------------------------------------------------------------- 1 | Version 0.10 (Nomad) 2 | -------------------------------------------------------------------------------- /bin/.dummy: -------------------------------------------------------------------------------- 1 | # This file is here so that git creates the bin/ directory on checkout. 2 | -------------------------------------------------------------------------------- /script/samba4_ver.sh: -------------------------------------------------------------------------------- 1 | SAMBA4_GIT_REV= 2 | SAMBA4_GIT_VER=4.0.1 3 | SAMBA4_RELEASE=4.0.1 4 | 5 | -------------------------------------------------------------------------------- /doc/doxygen/pictures/header.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inverse-inc/openchange/HEAD/doc/doxygen/pictures/header.jpg -------------------------------------------------------------------------------- /doc/doxygen/pictures/nav_tab.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inverse-inc/openchange/HEAD/doc/doxygen/pictures/nav_tab.gif -------------------------------------------------------------------------------- /doc/doxygen/pictures/middle_bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inverse-inc/openchange/HEAD/doc/doxygen/pictures/middle_bg.jpg -------------------------------------------------------------------------------- /doc/doxygen/pictures/pixel_grey.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inverse-inc/openchange/HEAD/doc/doxygen/pictures/pixel_grey.gif -------------------------------------------------------------------------------- /doc/doxygen/pictures/body_top_bg2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inverse-inc/openchange/HEAD/doc/doxygen/pictures/body_top_bg2.jpg -------------------------------------------------------------------------------- /mapiproxy/services/ocsmanager/ocsmanager/templates/notification.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /doc/doxygen/pictures/24px-Cc-by_white.svg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inverse-inc/openchange/HEAD/doc/doxygen/pictures/24px-Cc-by_white.svg.png -------------------------------------------------------------------------------- /doc/doxygen/pictures/24px-Cc-sa_white.svg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inverse-inc/openchange/HEAD/doc/doxygen/pictures/24px-Cc-sa_white.svg.png -------------------------------------------------------------------------------- /mapiproxy/documentation/pictures/devdoc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inverse-inc/openchange/HEAD/mapiproxy/documentation/pictures/devdoc.png -------------------------------------------------------------------------------- /mapiproxy/documentation/pictures/userdoc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inverse-inc/openchange/HEAD/mapiproxy/documentation/pictures/userdoc.png -------------------------------------------------------------------------------- /doc/doxygen/pictures/CC_SomeRightsReserved.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inverse-inc/openchange/HEAD/doc/doxygen/pictures/CC_SomeRightsReserved.png -------------------------------------------------------------------------------- /mapiproxy/documentation/pictures/mapiproxy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inverse-inc/openchange/HEAD/mapiproxy/documentation/pictures/mapiproxy.png -------------------------------------------------------------------------------- /mapiproxy/documentation/pictures/mapistore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inverse-inc/openchange/HEAD/mapiproxy/documentation/pictures/mapistore.png -------------------------------------------------------------------------------- /mapiproxy/documentation/pictures/mpm_stack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inverse-inc/openchange/HEAD/mapiproxy/documentation/pictures/mpm_stack.png -------------------------------------------------------------------------------- /setup/openchangedb/oc_provision_openchange_mailbox.ldif: -------------------------------------------------------------------------------- 1 | dn: CN=${FOLDER_IDX},${USERDN} 2 | cn: ${FOLDER_IDX} 3 | fid: ${FOLDER_IDX} 4 | name: ${NAME} 5 | -------------------------------------------------------------------------------- /mapiproxy/documentation/pictures/mpm_pack_pack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inverse-inc/openchange/HEAD/mapiproxy/documentation/pictures/mpm_pack_pack.png -------------------------------------------------------------------------------- /mapiproxy/documentation/pictures/mapiproxy_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inverse-inc/openchange/HEAD/mapiproxy/documentation/pictures/mapiproxy_logo.png -------------------------------------------------------------------------------- /mapiproxy/documentation/pictures/mapistore_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inverse-inc/openchange/HEAD/mapiproxy/documentation/pictures/mapistore_logo.png -------------------------------------------------------------------------------- /mapiproxy/documentation/pictures/mpm_pack_unpack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inverse-inc/openchange/HEAD/mapiproxy/documentation/pictures/mpm_pack_unpack.png -------------------------------------------------------------------------------- /mapiproxy/documentation/pictures/mapiproxy_overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inverse-inc/openchange/HEAD/mapiproxy/documentation/pictures/mapiproxy_overview.png -------------------------------------------------------------------------------- /mapiproxy/documentation/pictures/mapiproxy_struct.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inverse-inc/openchange/HEAD/mapiproxy/documentation/pictures/mapiproxy_struct.png -------------------------------------------------------------------------------- /mapiproxy/documentation/pictures/mpm_cache_case_one.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inverse-inc/openchange/HEAD/mapiproxy/documentation/pictures/mpm_cache_case_one.png -------------------------------------------------------------------------------- /mapiproxy/documentation/pictures/mpm_cache_case_two.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inverse-inc/openchange/HEAD/mapiproxy/documentation/pictures/mpm_cache_case_two.png -------------------------------------------------------------------------------- /mapiproxy/documentation/pictures/mapiproxy_error_001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inverse-inc/openchange/HEAD/mapiproxy/documentation/pictures/mapiproxy_error_001.png -------------------------------------------------------------------------------- /mapiproxy/documentation/pictures/mapiproxy_error_002.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inverse-inc/openchange/HEAD/mapiproxy/documentation/pictures/mapiproxy_error_002.png -------------------------------------------------------------------------------- /mapiproxy/documentation/pictures/mapiproxy_hook_life.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inverse-inc/openchange/HEAD/mapiproxy/documentation/pictures/mapiproxy_hook_life.png -------------------------------------------------------------------------------- /mapiproxy/services/client/ocsmanager.cfg: -------------------------------------------------------------------------------- 1 | [Config] 2 | username = openchange 3 | password = {SSHA}I6Hy5Wv0wuxyXvMBFWFQDVVN12_CLaX9 4 | host = 127.0.0.1 5 | port = 5000 6 | -------------------------------------------------------------------------------- /mapiproxy/documentation/pictures/mapiproxy_emsmdb_graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inverse-inc/openchange/HEAD/mapiproxy/documentation/pictures/mapiproxy_emsmdb_graph.png -------------------------------------------------------------------------------- /mapiproxy/documentation/pictures/mapiproxy_error_001_fix.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inverse-inc/openchange/HEAD/mapiproxy/documentation/pictures/mapiproxy_error_001_fix.png -------------------------------------------------------------------------------- /mapiproxy/services/ocsmanager/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include ocsmanager/config/deployment.ini_tmpl 2 | recursive-include ocsmanager/public * 3 | recursive-include ocsmanager/templates * 4 | -------------------------------------------------------------------------------- /mapiproxy/documentation/pictures/dcerpc_mapiproxy_server_true.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inverse-inc/openchange/HEAD/mapiproxy/documentation/pictures/dcerpc_mapiproxy_server_true.png -------------------------------------------------------------------------------- /mapiproxy/services/ocsmanager/ocsmanager/templates/error.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | ${c.message} 4 | -------------------------------------------------------------------------------- /mapiproxy/services/ocsmanager/ocsmanager/templates/login.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | ${c.tokenLogin} 4 | ${c.ttl} 5 | -------------------------------------------------------------------------------- /mapiproxy/documentation/pictures/dcerpc_mapiproxy_server_false_nspi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inverse-inc/openchange/HEAD/mapiproxy/documentation/pictures/dcerpc_mapiproxy_server_false_nspi.png -------------------------------------------------------------------------------- /setup/openchangedb/oc_provision_openchange_init.ldif: -------------------------------------------------------------------------------- 1 | dn: @OPTIONS 2 | checkBaseOnSearch: TRUE 3 | 4 | dn: @INDEXLIST 5 | @IDXATTR: cn 6 | 7 | dn: @ATTRIBUTES 8 | cn: CASE_INSENSITIVE 9 | dn: CASE_INSENSITIVE -------------------------------------------------------------------------------- /utils/mapitest/data/lzxpress/001_Outlook_2007_in_ModifyRecipients_comp.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inverse-inc/openchange/HEAD/utils/mapitest/data/lzxpress/001_Outlook_2007_in_ModifyRecipients_comp.dat -------------------------------------------------------------------------------- /utils/mapitest/data/lzxpress/002_Outlook_2007_in_Tables_operations_comp.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inverse-inc/openchange/HEAD/utils/mapitest/data/lzxpress/002_Outlook_2007_in_Tables_operations_comp.dat -------------------------------------------------------------------------------- /mapiproxy/documentation/pictures/dcerpc_mapiproxy_server_true_custom_nspi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inverse-inc/openchange/HEAD/mapiproxy/documentation/pictures/dcerpc_mapiproxy_server_true_custom_nspi.png -------------------------------------------------------------------------------- /setup/profiles/oc_profiles_init.ldif: -------------------------------------------------------------------------------- 1 | dn: @ATTRIBUTES 2 | dnsDomain: CASE_INSENSITIVE 3 | cn: CASE_INSENSITIVE 4 | dc: CASE_INSENSITIVE 5 | name: CASE_INSENSITIVE 6 | dn: CASE_INSENSITIVE 7 | objectClass: CASE_INSENSITIVE 8 | -------------------------------------------------------------------------------- /utils/mapitrace/Makefile.PL: -------------------------------------------------------------------------------- 1 | use ExtUtils::MakeMaker; 2 | WriteMakefile( 3 | 'NAME' => 'MAPI::Mapitrace', 4 | 'VERSION_FROM' => 'lib/MAPI/EcDoRpc.pm', 5 | 'EXE_FILES' => [ 'mapitrace' ], 6 | ); 7 | -------------------------------------------------------------------------------- /mapiproxy/services/ocsmanager/ocsmanager/templates/token.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | ${c.token_salt} 4 | ${c.salt} 5 | 10 6 | -------------------------------------------------------------------------------- /qt/demo/main.cpp: -------------------------------------------------------------------------------- 1 | #include "demoapp.h" 2 | 3 | #include 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | QApplication app(argc, argv); 8 | 9 | DemoApp *demo = new DemoApp(); 10 | demo->show(); 11 | 12 | return app.exec(); 13 | } 14 | -------------------------------------------------------------------------------- /mapiproxy/services/ocsmanager/ocsmanager/tests/functional/test_rpcproxy.py: -------------------------------------------------------------------------------- 1 | from ocsmanager.tests import * 2 | 3 | class TestRpcproxyController(TestController): 4 | 5 | def test_index(self): 6 | response = self.app.get(url(controller='rpcproxy', action='index')) 7 | # Test response... 8 | -------------------------------------------------------------------------------- /mapiproxy/services/ocsmanager/ocsmanager/tests/functional/test_notification.py: -------------------------------------------------------------------------------- 1 | from ocsmanager.tests import * 2 | 3 | class TestNotificationController(TestController): 4 | 5 | def test_index(self): 6 | response = self.app.get(url(controller='notification', action='index')) 7 | # Test response... 8 | -------------------------------------------------------------------------------- /libmapiadmin/libmapiadmin-mainpage.doxy: -------------------------------------------------------------------------------- 1 | /** 2 | \mainpage libmapiadmin 3 | 4 |

Client library for OpenChange Administration

5 | 6 | libmapiadmin provides administration client capabilities for 7 | OpenChange and Exchange servers. 8 | 9 | \note As of version 0.8, libmapiadmin is considered alpha quality. 10 | 11 | */ 12 | -------------------------------------------------------------------------------- /mapiproxy/services/ocsmanager/ocsmanager/lib/helpers.py: -------------------------------------------------------------------------------- 1 | """Helper functions 2 | 3 | Consists of functions to typically be used within templates, but also 4 | available to Controllers. This module is available to templates as 'h'. 5 | """ 6 | # Import helpers as desired, or define your own, ie: 7 | #from webhelpers.html.tags import checkbox, password 8 | -------------------------------------------------------------------------------- /libocpf/ocpf_bison.supp: -------------------------------------------------------------------------------- 1 | { 2 | ocpf_bison1 3 | Memcheck:Addr1 4 | fun:__GI_strlen 5 | fun:talloc_strdup 6 | ... 7 | fun:ocpf_yyparse 8 | fun:ocpf_parse 9 | } 10 | 11 | { 12 | ocpf_bison2 13 | Memcheck:Addr1 14 | fun:memcpy 15 | fun:__talloc_strlendup 16 | ... 17 | fun:ocpf_yyparse 18 | fun:ocpf_parse 19 | } 20 | -------------------------------------------------------------------------------- /libocpf.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | datarootdir=@prefix@/share 6 | datadir=@datadir@ 7 | 8 | Name: OpenChange Property File 9 | Description: OCPF file format support 10 | Version: @PACKAGE_VERSION@ 11 | Libs: -L${libdir} -locpf 12 | Cflags: -I${includedir} 13 | Requires: libmapi 14 | -------------------------------------------------------------------------------- /libmapi++.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | datarootdir=@prefix@/share 6 | datadir=@datadir@ 7 | 8 | Name: OpenChange C++ bindings 9 | Description: C++ bindings for the OpenChange MAPI library 10 | Version: @PACKAGE_VERSION@ 11 | Libs: -L${libdir} -lmapipp 12 | Cflags: -I${includedir} 13 | Requires: libmapi 14 | -------------------------------------------------------------------------------- /setup/AD/provision_schema_basedn_modify.ldif: -------------------------------------------------------------------------------- 1 | ############################### 2 | # Schema Naming Context 3 | ############################### 4 | dn: ${SCHEMADN} 5 | changetype: modify 6 | replace: fSMORoleOwner 7 | fSMORoleOwner: CN=NTDS Settings,${SERVERDN} 8 | - 9 | replace: objectVersion 10 | objectVersion: 30 11 | - 12 | replace: prefixMap 13 | prefixMap:: ${PREFIXMAP_B64} 14 | 15 | -------------------------------------------------------------------------------- /python/openchange/tests/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | def test_suite(): 3 | import unittest 4 | loader = unittest.TestLoader() 5 | suite = unittest.TestSuite() 6 | from openchange.tests import (test_provision, 7 | test_mailbox) 8 | suite.addTests(loader.loadTestsFromModule(test_provision)) 9 | suite.addTests(loader.loadTestsFromModule(test_mailbox)) 10 | return suite 11 | -------------------------------------------------------------------------------- /doc/doxygen/header.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | $projectname $projectnumber API Documentation 4 | 5 | 6 | 7 | 8 |
9 |
10 |
11 |
12 | -------------------------------------------------------------------------------- /doc/doxygen/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | OpenChange API Documentation 4 | 5 | 6 | 7 |

Redirecting you to the OpenChange API documentation 8 | overview.

9 | 10 | 11 | -------------------------------------------------------------------------------- /mapiproxy/libmapistore.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | datarootdir=@prefix@/share 6 | datadir=@datadir@ 7 | 8 | Name: MAPISTORE 9 | Description: MAPI Storage Abstraction Layer library 10 | Version: @PACKAGE_VERSION@ 11 | Libs: -L${libdir} -lmapistore 12 | Libs.private: @LIBS@ 13 | Cflags: -I${includedir} 14 | Requires: talloc tdb libmapi 15 | -------------------------------------------------------------------------------- /libmapi.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | datarootdir=@prefix@/share 6 | datadir=@datadir@ 7 | 8 | Name: MAPI 9 | Description: MAPI Protocol Implementation 10 | Version: @PACKAGE_VERSION@ 11 | Libs: -L${libdir} -lmapi 12 | Libs.private: @LIBS@ 13 | Cflags: -I${includedir} 14 | Requires: talloc dcerpc ndr tevent 15 | Requires.private: samba-hostconfig ldb 16 | -------------------------------------------------------------------------------- /libmapiadmin.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | datarootdir=@prefix@/share 6 | datadir=@datadir@ 7 | 8 | Name: MAPI admin library 9 | Description: Library supporting MAPI administration actions 10 | Version: @PACKAGE_VERSION@ 11 | Libs: -L${libdir} -lmapiadmin 12 | Libs.private: @LIBS@ 13 | Cflags: -I${includedir} 14 | Requires: libmapi dcerpc_samr 15 | 16 | -------------------------------------------------------------------------------- /script/installoc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # install OpenChange miscellaneous files 3 | 4 | SRCDIR="$1" 5 | JSDIR="$2" 6 | SETUPDIR="$3" 7 | 8 | cd $SRCDIR || exit 1 9 | 10 | echo "Installing OpenChange js libs.." 11 | cp libmapi/setup/scripting/libjs/*.js $JSDIR || exit 1 12 | echo "Done.." 13 | 14 | echo "Installing OpenChange setup templates.." 15 | cp libmapi/setup/*.ldif $SETUPDIR || exit 1 16 | echo "All Ok" 17 | 18 | exit 0 19 | -------------------------------------------------------------------------------- /libmapi++/tests/exception_test.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | static void dotest() throw(libmapipp::mapi_exception) 6 | { 7 | throw libmapipp::mapi_exception(MAPI_E_SUCCESS, "mapi_exception test"); 8 | } 9 | 10 | int main() 11 | { 12 | try { 13 | dotest(); 14 | } 15 | catch (libmapipp::mapi_exception e) { 16 | std::cout << e.what() << std::endl; 17 | } 18 | 19 | return 0; 20 | } 21 | 22 | -------------------------------------------------------------------------------- /mapiproxy/libmapiserver.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | datarootdir=@prefix@/share 6 | datadir=@datadir@ 7 | modulesdir=@modulesdir@/dcerpc_mapiproxy_server 8 | 9 | Name: MAPISERVER 10 | Description: Server side MAPI library 11 | Version: @PACKAGE_VERSION@ 12 | Libs: -L${libdir} -lmapiserver 13 | Libs.private: @LIBS@ 14 | Cflags: -I${includedir} 15 | Requires: talloc 16 | -------------------------------------------------------------------------------- /mapiproxy/services/utils/genpass.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | import os 4 | import sys 5 | import hashlib 6 | from base64 import urlsafe_b64encode as encode 7 | 8 | def main(): 9 | if len(sys.argv) != 2: 10 | print '%s password' % (sys.argv[0]) 11 | 12 | salt = os.urandom(4) 13 | h = hashlib.sha1(sys.argv[0]) 14 | h.update(salt) 15 | print "{SSHA}" + encode(h.digest() + salt) 16 | sys.exit() 17 | 18 | if __name__ == "__main__": 19 | main() 20 | -------------------------------------------------------------------------------- /utils/mapitrace/lib/MAPI/Regression.pm: -------------------------------------------------------------------------------- 1 | ############################################# 2 | # EcDoRpc package for mapitrace tool 3 | # Copyright Julien Kerihuel 2007 4 | # 5 | # 6 | # released under the GNU GPL v3 or later 7 | # 8 | package MAPI::Regression; 9 | 10 | require Exporter; 11 | @ISA = qw(Exporter); 12 | @EXPORT = qw(); 13 | use vars qw($AUTOLOAD $VERSION); 14 | $VERSION = '0.01'; 15 | 16 | use strict; 17 | 18 | 1; 19 | -------------------------------------------------------------------------------- /IDL_LICENSE.txt: -------------------------------------------------------------------------------- 1 | The IDL files in this directory are made available by the OpenChange Team 2 | under the following license: 3 | 4 | Permission to use, copy, modify, and distribute these interface 5 | definitions for any purpose is hereby granted without fee. 6 | 7 | This work is distributed in the hope that it will be useful, but 8 | WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | -------------------------------------------------------------------------------- /mapiproxy/services/ocsmanager/ocsmanager-apache.conf: -------------------------------------------------------------------------------- 1 | 2 | ProxyRequests Off 3 | SetEnv proxy-nokeepalive 1 4 | ProxyPreserveHost On 5 | 6 | ProxyPass /autodiscover http://127.0.0.1:5000/autodiscover retry=0 7 | ProxyPass /ews http://127.0.0.1:5000/ews retry=0 8 | ProxyPass /_debug http://127.0.0.1:5000/_debug retry=0 9 | 10 | 11 | Order allow,deny 12 | Allow from all 13 | 14 | 15 | -------------------------------------------------------------------------------- /mapiproxy/libmapiproxy.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | datarootdir=@prefix@/share 6 | datadir=@datadir@ 7 | modulesdir=@modulesdir@/dcerpc_mapiproxy 8 | 9 | Name: MAPIPROXY 10 | Description: MAPI Proxy and Server Module Library 11 | Version: @PACKAGE_VERSION@ 12 | Libs: -L${libdir} -lmapiproxy 13 | Libs.private: @LIBS@ 14 | Cflags: -I${includedir} 15 | Requires: talloc dcerpc ndr ldb 16 | Requires.private: samba-hostconfig 17 | -------------------------------------------------------------------------------- /pyopenchange/tests/properties.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | import sys 4 | 5 | sys.path.append("python") 6 | 7 | from openchange import mapi 8 | import time 9 | 10 | SPropValue = mapi.SPropValue() 11 | SPropValue.add(mapi.PidTagSubject, "This is a test") 12 | SPropValue.add(mapi.PidTagImportance, 4096) 13 | SPropValue.add(mapi.PidTagMessageToMe, True) 14 | SPropValue.add(mapi.PidTagMessageCcMe, False) 15 | SPropValue.add(mapi.PidTagStartDate, time.time()) 16 | 17 | SPropValue.dump("Python: ") 18 | 19 | -------------------------------------------------------------------------------- /mapiproxy/services/web/rpcproxy/setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | from distutils.core import setup 4 | 5 | setup(name="rpcproxy", 6 | version="1.0", 7 | description="A RPC-over-HTTP implementation for Samba, using wsgi", 8 | author="Julien Kerihuel, Wolfgang Sourdeau", 9 | author_email="j.kerihuel@openchange.org, wsourdeau@inverse.ca", 10 | url="http://www.openchange.org/", 11 | scripts=["rpcproxy.wsgi"], 12 | packages=["rpcproxy"], 13 | requires=["openchange"] 14 | ) 15 | -------------------------------------------------------------------------------- /utils/mapitest/modules/mapitest.doxy: -------------------------------------------------------------------------------- 1 | /** 2 | \mainpage %mapitest documentation 3 | 4 | %mapitest acts as stand-alone torture test of a range of MAPI function 5 | calls. It is intended to validate the implementation of various 6 | functions, and to ensure that existing functionality does not suffer 7 | regression between releases. 8 | 9 | As a general principle, %mapitest calls should leave the system in the 10 | same state at the end as at the start - it is meant to clean up after 11 | itself. 12 | 13 | */ 14 | 15 | -------------------------------------------------------------------------------- /qt/lib/messagesmodel.h: -------------------------------------------------------------------------------- 1 | #ifndef MESSAGESMODEL_H 2 | #define MESSAGESMODEL_H 3 | 4 | class QStandardItem; 5 | #include 6 | 7 | namespace libmapipp 8 | { 9 | class folder; 10 | class session; 11 | } 12 | 13 | 14 | class MessagesModel : public QStandardItemModel 15 | { 16 | Q_OBJECT 17 | 18 | public: 19 | MessagesModel( libmapipp::folder *folder ); 20 | 21 | QStandardItemModel *buildModel(); 22 | 23 | private: 24 | libmapipp::folder *m_mapi_folder; 25 | }; 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /mapiproxy/services/ocsmanager/ocsmanager/websetup.py: -------------------------------------------------------------------------------- 1 | """Setup the ocsmanager application""" 2 | import logging 3 | 4 | import pylons.test 5 | 6 | from ocsmanager.config.environment import load_environment 7 | 8 | log = logging.getLogger(__name__) 9 | 10 | def setup_app(command, conf, vars): 11 | """Place any commands to setup ocsmanager here""" 12 | # Don't reload the app if it was loaded under the testing environment 13 | if not pylons.test.pylonsapp: 14 | load_environment(conf.global_conf, conf.local_conf) 15 | -------------------------------------------------------------------------------- /packaging/rhel/ocsmanager-ini-path-fix.diff: -------------------------------------------------------------------------------- 1 | Index: mapiproxy/services/ocsmanager/ocsmanager.ini 2 | =================================================================== 3 | --- mapiproxy/services/ocsmanager/ocsmanager.ini (revision 4075) 4 | +++ mapiproxy/services/ocsmanager/ocsmanager.ini (working copy) 5 | @@ -14,8 +14,8 @@ 6 | # auth = file 7 | #auth = ldap 8 | auth = single 9 | -mapistore_root = /var/lib/samba/private 10 | -mapistore_data = /var/lib/samba/private/mapistore 11 | +mapistore_root = /var/lib/samba4/private 12 | +mapistore_data = /var/lib/samba4/private/mapistore 13 | debug = no 14 | 15 | [auth:file] 16 | -------------------------------------------------------------------------------- /mapiproxy/services/ocsmanager/test.ini: -------------------------------------------------------------------------------- 1 | # 2 | # ocsmanager - Pylons testing environment configuration 3 | # 4 | # The %(here)s variable will be replaced with the parent directory of this file 5 | # 6 | [DEFAULT] 7 | debug = true 8 | # Uncomment and replace with the address which should receive any error reports 9 | #email_to = you@yourdomain.com 10 | smtp_server = localhost 11 | error_email_from = paste@localhost 12 | 13 | [server:main] 14 | use = egg:Paste#http 15 | host = 127.0.0.1 16 | port = 5000 17 | 18 | [app:main] 19 | use = config:development.ini 20 | 21 | # Add additional test specific configuration options as necessary. 22 | -------------------------------------------------------------------------------- /mapiproxy/services/ocsmanager/ocsmanager/lib/utils.py: -------------------------------------------------------------------------------- 1 | """The applications Utils function""" 2 | 3 | from lxml import etree 4 | 5 | def validateDocXML(payload): 6 | """Perform common preliminary XML checks on payload and return 7 | lxml object on success with error status set to False.""" 8 | 9 | try: 10 | xmlData = etree.XML(payload) 11 | except etree.XMLSyntaxError: 12 | return (True, 'Invalid document') 13 | 14 | if xmlData.tag is None: return (True, 'Invalid root element') 15 | if xmlData.tag != 'ocsmanager': return (True, 'Invalid root element %s' % xmlData.tag) 16 | 17 | return (False, xmlData) 18 | -------------------------------------------------------------------------------- /qt/lib/foldermodel.h: -------------------------------------------------------------------------------- 1 | #ifndef FOLDERMODEL_H 2 | #define FOLDERMODEL_H 3 | 4 | class QStandardItem; 5 | class QStandardItemModel; 6 | 7 | namespace libmapipp 8 | { 9 | class folder; 10 | class session; 11 | } 12 | 13 | class FolderModel : public QStandardItemModel 14 | { 15 | Q_OBJECT 16 | 17 | public: 18 | FolderModel( libmapipp::session *mapi_session ); 19 | 20 | QStandardItemModel* buildModel(); 21 | 22 | private: 23 | libmapipp::session *m_mapi_session; 24 | QStandardItemModel *m_folderModel; 25 | 26 | void add_folder_to_tree(libmapipp::folder& up_folder, QStandardItem *parentItem); 27 | }; 28 | 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /mapiproxy/services/ocsmanager/ocsmanager/lib/base.py: -------------------------------------------------------------------------------- 1 | """The base Controller API 2 | 3 | Provides the BaseController class for subclassing. 4 | """ 5 | from pylons.controllers import WSGIController 6 | from pylons.templating import render_mako as render 7 | 8 | class BaseController(WSGIController): 9 | 10 | def __call__(self, environ, start_response): 11 | """Invoke the Controller""" 12 | # WSGIController.__call__ dispatches to the Controller method 13 | # the request is routed to. This routing information is 14 | # available in environ['pylons.routes_dict'] 15 | return WSGIController.__call__(self, environ, start_response) 16 | -------------------------------------------------------------------------------- /mapiproxy/services/web/rpcproxy/rpcproxy.conf: -------------------------------------------------------------------------------- 1 | ## The extremely high timeout is required by outlook 2 | KeepAliveTimeout 120 3 | 4 | WSGILazyInitialization On 5 | WSGIPythonPath /usr/lib/openchange/web/rpcproxy 6 | 7 | 8 | SetEnv RPCPROXY_LOGLEVEL INFO 9 | SetEnv NTLMAUTHHANDLER_WORKDIR /var/cache/ntlmauthhandler 10 | SetEnv SAMBA_HOST 127.0.0.1 11 | WSGIPassAuthorization On 12 | WSGIProcessGroup %{GLOBAL} 13 | 14 | 15 | WSGIScriptAlias /rpc/rpcproxy.dll /usr/lib/openchange/web/rpcproxy/rpcproxy.wsgi 16 | WSGIScriptAlias /rpcwithcert/rpcproxy.dll /usr/lib/openchange/web/rpcproxy/rpcproxy.wsgi 17 | 18 | -------------------------------------------------------------------------------- /mapiproxy/services/ocsmanager/ocsmanager/lib/app_globals.py: -------------------------------------------------------------------------------- 1 | """The application's Globals object""" 2 | 3 | from beaker.cache import CacheManager 4 | from beaker.util import parse_cache_config_options 5 | 6 | class Globals(object): 7 | 8 | """Globals acts as a container for objects available throughout the 9 | life of the application 10 | 11 | """ 12 | 13 | def __init__(self, config): 14 | """One instance of Globals is created during application 15 | initialization and is available during requests via the 16 | 'app_globals' variable 17 | 18 | """ 19 | self.cache = CacheManager(**parse_cache_config_options(config)) 20 | -------------------------------------------------------------------------------- /mapiproxy/services/ocsmanager/docs/index.txt: -------------------------------------------------------------------------------- 1 | ocsmanager 2 | ++++++++++ 3 | 4 | This is the main index page of your documentation. It should be written in 5 | `reStructuredText format `_. 6 | 7 | You can generate your documentation in HTML format by running this command:: 8 | 9 | setup.py pudge 10 | 11 | For this to work you will need to download and install `buildutils`_, 12 | `pudge`_, and `pygments`_. The ``pudge`` command is disabled by 13 | default; to ativate it in your project, run:: 14 | 15 | setup.py addcommand -p buildutils.pudge_command 16 | 17 | .. _buildutils: http://pypi.python.org/pypi/buildutils 18 | .. _pudge: http://pudge.lesscode.org/ 19 | .. _pygments: http://pygments.org/ 20 | -------------------------------------------------------------------------------- /mapiproxy/services/ocsmanager/setup.cfg: -------------------------------------------------------------------------------- 1 | [egg_info] 2 | tag_build = dev 3 | tag_svn_revision = true 4 | 5 | [easy_install] 6 | find_links = http://www.pylonshq.com/download/ 7 | 8 | [nosetests] 9 | with-pylons = test.ini 10 | 11 | [compile_catalog] 12 | domain = ocsmanager 13 | directory = ocsmanager/i18n 14 | statistics = true 15 | 16 | [extract_messages] 17 | add_comments = TRANSLATORS: 18 | output_file = ocsmanager/i18n/ocsmanager.pot 19 | width = 80 20 | 21 | [init_catalog] 22 | domain = ocsmanager 23 | input_file = ocsmanager/i18n/ocsmanager.pot 24 | output_dir = ocsmanager/i18n 25 | 26 | [update_catalog] 27 | domain = ocsmanager 28 | input_file = ocsmanager/i18n/ocsmanager.pot 29 | output_dir = ocsmanager/i18n 30 | previous = true 31 | 32 | -------------------------------------------------------------------------------- /script/installman.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | MANDIR=$1 4 | shift 1 5 | MANPAGES=$* 6 | 7 | for I in $MANPAGES 8 | do 9 | SECTION=`echo $I | grep -o '.$'` 10 | DIR="$MANDIR/man$SECTION" 11 | if [ ! -d "$DIR" ] 12 | then 13 | mkdir -p "$DIR" 14 | fi 15 | 16 | BASE=`basename $I` 17 | 18 | echo "Installing manpage \"$BASE\" in $DIR" 19 | cp $I $DIR 20 | done 21 | 22 | cat << EOF 23 | ====================================================================== 24 | The man pages have been installed. You may uninstall them using the command 25 | the command "make uninstallman" or make "uninstall" to uninstall binaries, 26 | man pages and shell scripts. 27 | ====================================================================== 28 | EOF 29 | 30 | exit 0 31 | -------------------------------------------------------------------------------- /doc/examples/Makefile: -------------------------------------------------------------------------------- 1 | all: fetchappointment \ 2 | fetchmail \ 3 | mapi_sample1 \ 4 | multiple_notif \ 5 | fetch_addressbook 6 | 7 | clean: 8 | rm -f fetch_addressbook fetchappointment fetchmail mapi_sample1 multiple_notif 9 | 10 | fetchappointment: 11 | gcc fetchappointment.c -o fetchappointment `pkg-config libmapi --cflags --libs` 12 | 13 | fetchmail: 14 | gcc fetchmail.c -o fetchmail `pkg-config libmapi --cflags --libs` 15 | 16 | mapi_sample1: 17 | gcc mapi_sample1.c -o mapi_sample1 `pkg-config libmapi --cflags --libs` 18 | 19 | multiple_notif: 20 | gcc multiple_notif.c -o multiple_notif `pkg-config libmapi --cflags --libs` -lpthread -lpopt 21 | 22 | fetch_addressbook: fetch_addressbook.c 23 | gcc fetch_addressbook.c -o fetch_addressbook `pkg-config libmapi --cflags --libs` 24 | -------------------------------------------------------------------------------- /script/uninstallman.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 4 July 96 Dan.Shearer@UniSA.edu.au 3 | # Updated for Samba4 by Jelmer Vernooij 4 | 5 | MANDIR=$1 6 | shift 1 7 | MANPAGES=$* 8 | 9 | for I in $MANPAGES 10 | do 11 | SECTION=`echo $I | grep -o '.$'` 12 | MAN=`echo $I | grep -o '[a-zA-Z_]*\.[0-9]'` 13 | FNAME=$MANDIR/man$SECTION/$MAN 14 | if test -f $FNAME; then 15 | echo Deleting $FNAME 16 | rm -f $FNAME 17 | test -f $FNAME && echo Cannot remove $FNAME... does $USER have privileges? 18 | fi 19 | done 20 | 21 | cat << EOF 22 | ====================================================================== 23 | The man pages have been uninstalled. You may install them again using 24 | the command "make installman" or make "install" to install binaries, 25 | man pages and shell scripts. 26 | ====================================================================== 27 | EOF 28 | exit 0 29 | -------------------------------------------------------------------------------- /libexchange2ical/libical2exchange.c: -------------------------------------------------------------------------------- 1 | /* 2 | Common conversion routines for exchange2ical 3 | 4 | OpenChange Project 5 | 6 | Copyright (C) Julien Kerihuel 2008 7 | 8 | This program is free software; you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation; either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . 20 | */ 21 | 22 | #include "libexchange2ical/libexchange2ical.h" 23 | -------------------------------------------------------------------------------- /libmapi++/clibmapi.h: -------------------------------------------------------------------------------- 1 | /* 2 | libmapi C++ Wrapper 3 | 4 | Copyright (C) Alan Alvarez 2008. 5 | 6 | This program is free software; you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | */ 19 | 20 | #ifndef __CLIBMAPI_H 21 | #define __CLIBMAPI_H 22 | 23 | extern "C" { 24 | #include 25 | } 26 | 27 | #endif /* ! __CLIBMAPI_H */ 28 | -------------------------------------------------------------------------------- /doc/doxygen/footer.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 | 5 | 10 |
6 | Creative Commons License
7 | Creative Commons Attribution icon 8 | Creative Commons Share Alike icon 9 |
This content is licensed under the Creative Commons
11 | Attribution ShareAlike License v. 3.0:
12 | http://creativecommons.org/licenses/by-sa/3.0/
13 |
14 |
15 |
16 |
17 | 18 | 19 | -------------------------------------------------------------------------------- /script/mapi_object_init.prop: -------------------------------------------------------------------------------- 1 | void 2 | uno_check(void) 3 | { /* warning, named args to select() are currently not supported */ 4 | 5 | if (select("mapi_object_init", FCALL, NONE)) /* unmarked symbols of type function call */ 6 | { if (select("", USE, NONE)) /* unmarked symbols USEd in those stmnts */ 7 | { if (match(1, DEF, NONE)) /* are there matching symbols with mark 1? */ 8 | error("mapi_object_init follows mapi_object_init"); 9 | else 10 | mark(1); /* mark 1 */ 11 | } 12 | } 13 | 14 | if (select("mapi_object_release", FCALL, NONE)) 15 | { if (select("", USE, NONE)) 16 | { if (match(1, USE, NONE)) 17 | unmark(); /* remove mark */ 18 | else 19 | error("mapi_object_release without mapi_object_init"); 20 | } else 21 | error("no argument to mapi_object_release"); 22 | } 23 | 24 | if (path_ends()) 25 | { if (marked(1, ANY, NONE)) 26 | { if (known_zero()) 27 | no_error(); 28 | else 29 | error("mapi_object_init without mapi_object_release"); 30 | } } 31 | } 32 | -------------------------------------------------------------------------------- /libmapi++/src/mapi_exception.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | libmapi C++ Wrapper 3 | mapi_exception Class implementation. 4 | 5 | Copyright (C) Alan Alvarez 2008. 6 | 7 | This program is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . 19 | */ 20 | 21 | #include 22 | 23 | namespace libmapipp { 24 | 25 | mapi_exception::status_map mapi_exception::sm_status_map = status_map(); 26 | 27 | } // namespace libmapipp 28 | 29 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | aclocal.m4 2 | *.o 3 | *.po 4 | *.so.* 5 | *.so 6 | *~ 7 | configure 8 | Doxyfile 9 | bin/ 10 | config.h 11 | config.h.in 12 | config.log 13 | config.mk 14 | config.status 15 | apidocs/ 16 | gen_ndr/ 17 | libmapi++.pc 18 | libmapi++/Doxyfile 19 | libmapi++/examples/foldertree 20 | libmapi++/examples/messages 21 | libmapi.pc 22 | libmapi/Doxyfile 23 | libmapi/codepage_lcid.c 24 | libmapi/mapicode.c 25 | libmapi/version.h 26 | libmapiadmin.pc 27 | libmapiadmin/Doxyfile 28 | libocpf.pc 29 | libocpf/Doxyfile 30 | libocpf/lex.yy.c 31 | libocpf/ocpf.tab.c 32 | libocpf/ocpf.tab.h 33 | mapicodes_enum.h 34 | mapiproxy/Doxyfile 35 | mapiproxy/libmapiproxy.pc 36 | mapiproxy/libmapiserver.pc 37 | mapiproxy/libmapistore.pc 38 | mapiproxy/libmapistore/Doxyfile 39 | mapiproxy/libmapistore/mapistore_nameid.h 40 | mapiproxy/libmapistore/mgmt/gen_ndr/ 41 | pyopenchange/mapistore/errors.c 42 | setup/mapistore/ 43 | stamp-h1 44 | utils/mapitest/Doxyfile 45 | utils/mapitest/mapitest_proto.h 46 | utils/mapitest/proto.h 47 | _trial_temp 48 | *.orig 49 | *.rej 50 | *.pyc 51 | samba4 52 | samba-*.tar.gz 53 | -------------------------------------------------------------------------------- /testprogs/check_mbox.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import argparse 4 | import mailbox 5 | import os 6 | import shutil 7 | import subprocess 8 | import tempfile 9 | 10 | mboxparser = argparse.ArgumentParser(description='Test an mbox file for general compatibility') 11 | mboxparser.add_argument('--mbox', required=True) 12 | 13 | args = mboxparser.parse_args() 14 | 15 | ###----------------------- 16 | print "Internal (python mailbox) parser:" 17 | print "\tmessage count", len(mailbox.mbox(args.mbox)) 18 | 19 | ###----------------------- 20 | print "mbox2eml:" 21 | emldir = tempfile.mkdtemp() 22 | print "\treturn code:", subprocess.call(["mbox2eml", "--input-file", args.mbox, "--output-dir", emldir]) 23 | print "\tmessage count", len(os.listdir(emldir)) 24 | shutil.rmtree(emldir, ignore_errors=True) 25 | 26 | ###----------------------- 27 | print "mailx:" 28 | p1 = subprocess.Popen(["mailx", "-H", "-f", args.mbox,], stdout=subprocess.PIPE) 29 | p2 = subprocess.Popen(["wc", "-l"], stdin=p1.stdout, stdout=subprocess.PIPE) 30 | print "\tmessage count", p2.communicate()[0] 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /python/openchange/urlutils.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | # OpenChange provisioning 4 | # Copyright (C) Jelmer Vernooij 2008-2009 5 | # Copyright (C) Julien Kerihuel 2009 6 | # Copyright (C) Brad Hards 2010 7 | # 8 | # This program is free software; you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation; either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # This program is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with this program. If not, see . 20 | # 21 | 22 | import os 23 | 24 | def openchangedb_url(lp): 25 | return os.path.join(lp.get("private dir"), "openchange.ldb") 26 | -------------------------------------------------------------------------------- /libocpf/lex.h: -------------------------------------------------------------------------------- 1 | /* 2 | OpenChange OCPF (OpenChange Property File) implementation. 3 | 4 | Copyright (C) Julien Kerihuel 2008. 5 | 6 | This program is free software; you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | */ 19 | 20 | #ifndef __LEX_H_ 21 | #define __LEX_H_ 22 | 23 | void ocpf_error_message (struct ocpf_context *, const char *, ...) __attribute__ ((format (printf, 2, 3))); 24 | 25 | extern int error_flag; 26 | 27 | /* int ocpf_yylex(YYSTYPE *); */ 28 | 29 | #endif /* __LEX_H_ */ 30 | -------------------------------------------------------------------------------- /pyopenchange/pyocpf.h: -------------------------------------------------------------------------------- 1 | /* 2 | OpenChange OCPF (OpenChange Property File) implementation. 3 | 4 | Python interface to ocpf 5 | 6 | Copyright (C) Julien Kerihuel 2010. 7 | 8 | This program is free software; you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation; either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . 20 | */ 21 | 22 | #ifndef _PYOCPF_H_ 23 | #define _PYOCPF_H_ 24 | 25 | #include 26 | #include 27 | 28 | typedef struct { 29 | PyObject_HEAD 30 | uint32_t context_id; 31 | TALLOC_CTX *mem_ctx; 32 | } PyOcpfObject; 33 | 34 | #endif /* !_PYOCPF_H_ */ 35 | -------------------------------------------------------------------------------- /mapiproxy/services/ocsmanager/ocsmanager/model/OCSAuthenticator.py: -------------------------------------------------------------------------------- 1 | import ldap 2 | import logging 3 | 4 | 5 | logger = logging.getLogger(__name__) 6 | 7 | 8 | class OCSAuthenticator(object): 9 | def __init__(self, config): 10 | self.config = config 11 | 12 | def __call__(self, environ, username, password): 13 | result = False 14 | 15 | config = self.config['ocsmanager']['rpcproxy'] 16 | # FIXME: we should perform an indirect bind, based on sAMAccountName 17 | userdn = 'CN=%s,%s' % (username, config['ldap_basedn']) 18 | 19 | try: 20 | # FIXME: should be # 'ocsmanager' alone since we require auth from 21 | # all actions 22 | l = ldap.open(config['ldap_host']) 23 | l.protocol_version = ldap.VERSION3 24 | l.simple_bind(userdn, password) 25 | l.result() # this will cause an exception in case of a failure 26 | result = True 27 | except ldap.LDAPError, e: 28 | logger.info("authentication failure for '%s'", userdn) 29 | logger.debug(e) 30 | l.unbind() 31 | 32 | return result 33 | 34 | -------------------------------------------------------------------------------- /libmapi++/src/object.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | libmapi C++ Wrapper 3 | Object Class implementation. 4 | 5 | Copyright (C) Alan Alvarez 2008. 6 | 7 | This program is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . 19 | */ 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | namespace libmapipp { 26 | 27 | property_container object::get_property_container() 28 | { 29 | return property_container(m_session.get_memory_ctx(), m_object); 30 | } 31 | 32 | } // namespace libmapipp 33 | 34 | -------------------------------------------------------------------------------- /testprogs/blackbox/expected_output--ocpf-syntax2.txt: -------------------------------------------------------------------------------- 1 | ../../libocpf/examples/sample_task.ocpf:46: Unknown OOM 2 | ../../libocpf/examples/sample_task.ocpf:47: Unknown OOM 3 | ../../libocpf/examples/sample_task.ocpf:48: Unknown OOM 4 | 5 | TYPE: 6 | ===== 7 | * IPM.Task 8 | 9 | FOLDER: 10 | ======= 11 | * 0xd 12 | 13 | OLEGUID: 14 | ======== 15 | PS_PUBLIC_STRINGS : 00020329-0000-0000-c000-000000000046 16 | PSETID_Common : 00062008-0000-0000-c000-000000000046 17 | PSETID_Task : 00062003-0000-0000-c000-000000000046 18 | 19 | RECIPIENTS: 20 | =========== 21 | * To: 22 | * Cc: 23 | * Bcc: 24 | 25 | VARIABLE: 26 | ========= 27 | task_status 28 | importance 29 | end_date 30 | start_date 31 | body 32 | subject 33 | 34 | PROPERTIES: 35 | =========== 36 | 0x00360003 = PR_SENSITIVITY 37 | 0x00170003 = PR_IMPORTANCE 38 | 0x1000001e = PR_BODY 39 | 0x0e1d001e = PR_NORMALIZED_SUBJECT 40 | 0x0070001e = PR_CONVERSATION_TOPIC 41 | 42 | NAMED PROPERTIES: 43 | ================= 44 | 45 | OOM: 46 | ---- 47 | * Private 48 | * Companies 49 | 50 | MNID_ID: 51 | -------- 52 | 53 | MNID_STRING: 54 | ------------ 55 | * Keywords 56 | -------------------------------------------------------------------------------- /testprogs/blackbox/expected_output--ocpf-syntax1.txt: -------------------------------------------------------------------------------- 1 | 2 | TYPE: 3 | ===== 4 | * IPM.Appointment 5 | 6 | FOLDER: 7 | ======= 8 | * 0x9 9 | 10 | OLEGUID: 11 | ======== 12 | PS_PUBLIC_STRINGS : 00020329-0000-0000-c000-000000000046 13 | PSETID_Common : 00062008-0000-0000-c000-000000000046 14 | PSETID_Appointment : 00062002-0000-0000-c000-000000000046 15 | 16 | RECIPIENTS: 17 | =========== 18 | * To: 19 | * Cc: 20 | * Bcc: 21 | 22 | VARIABLE: 23 | ========= 24 | wrong 25 | private 26 | keywords 27 | reminder 28 | end_date 29 | start_date 30 | subject 31 | 32 | PROPERTIES: 33 | =========== 34 | 0x00360003 = PR_SENSITIVITY 35 | 0x00610040 = PR_END_DATE 36 | 0x00600040 = PR_START_DATE 37 | 0x1000001e = PR_BODY 38 | 0x0e1d001e = PR_NORMALIZED_SUBJECT 39 | 0x0070001e = PR_CONVERSATION_TOPIC 40 | 41 | NAMED PROPERTIES: 42 | ================= 43 | 44 | OOM: 45 | ---- 46 | * Private 47 | * Location 48 | * CommonEnd 49 | * ApptEndDate 50 | * CommonStart 51 | * ApptStartDate 52 | * BusyStatus 53 | 54 | MNID_ID: 55 | -------- 56 | * 0x8501 57 | * 0x8217 58 | 59 | MNID_STRING: 60 | ------------ 61 | * Keywords 62 | -------------------------------------------------------------------------------- /mapiproxy/services/ocsmanager/ocsmanager/tests/__init__.py: -------------------------------------------------------------------------------- 1 | """Pylons application test package 2 | 3 | This package assumes the Pylons environment is already loaded, such as 4 | when this script is imported from the `nosetests --with-pylons=test.ini` 5 | command. 6 | 7 | This module initializes the application via ``websetup`` (`paster 8 | setup-app`) and provides the base testing objects. 9 | """ 10 | from unittest import TestCase 11 | 12 | from paste.deploy import loadapp 13 | from paste.script.appinstall import SetupCommand 14 | from pylons import url 15 | from routes.util import URLGenerator 16 | from webtest import TestApp 17 | 18 | import pylons.test 19 | 20 | __all__ = ['environ', 'url', 'TestController'] 21 | 22 | # Invoke websetup with the current config file 23 | SetupCommand('setup-app').run([pylons.test.pylonsapp.config['__file__']]) 24 | 25 | environ = {} 26 | 27 | class TestController(TestCase): 28 | 29 | def __init__(self, *args, **kwargs): 30 | wsgiapp = pylons.test.pylonsapp 31 | config = wsgiapp.config 32 | self.app = TestApp(wsgiapp) 33 | url._push_object(URLGenerator(config['routes.map'], environ)) 34 | TestCase.__init__(self, *args, **kwargs) 35 | -------------------------------------------------------------------------------- /doc/examples/mapi_sample1.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define DEFAULT_PROFDB_PATH "%s/.openchange/profiles.ldb" 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | TALLOC_CTX *mem_ctx; 8 | struct mapi_context *mapi_ctx; 9 | enum MAPISTATUS retval; 10 | struct mapi_session *session = NULL; 11 | char *profdb; 12 | char *profname; 13 | 14 | mem_ctx = talloc_named(NULL, 0, "mapi_sample1"); 15 | 16 | profdb = talloc_asprintf(mem_ctx, DEFAULT_PROFDB_PATH, getenv("HOME")); 17 | 18 | retval = MAPIInitialize(&mapi_ctx, profdb); 19 | mapi_errstr("MAPIInitialize", GetLastError()); 20 | if (retval != MAPI_E_SUCCESS) return -1; 21 | 22 | retval = GetDefaultProfile(mapi_ctx, &profname); 23 | mapi_errstr("GetDefaultProfile", GetLastError()); 24 | if (retval != MAPI_E_SUCCESS) return -1; 25 | 26 | retval = MapiLogonEx(mapi_ctx, &session, profname, NULL); 27 | mapi_errstr("MapiLogonEx", GetLastError()); 28 | if (retval != MAPI_E_SUCCESS) return -1; 29 | 30 | MAPIUninitialize(mapi_ctx); 31 | talloc_free(mem_ctx); 32 | 33 | return 0; 34 | } 35 | -------------------------------------------------------------------------------- /mapiproxy/services/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo '############################################################' 4 | echo 'Run the script from local directory' 5 | echo 'Also ensure OpenChange is compiled prior running the script' 6 | echo '############################################################' 7 | 8 | echo '[*] Installing virtualenv' 9 | sudo easy_install virtualenv 10 | 11 | echo '[*] Creating the isolated python environment' 12 | virtualenv mydevenv 13 | 14 | echo '[*] Installing Pylons 1.0 in mydevenv' 15 | curl http://pylonshq.com/download/1.0/go-pylons.py | python - mydevenv 16 | 17 | echo '[*] Copying OpenChange bindings in mydevenv' 18 | cp -rfi ../../python/openchange mydevenv/lib/python2.7/site-packages/ 19 | 20 | echo '[*] Activating the virtual environment' 21 | source mydevenv/bin/activate 22 | 23 | echo '[*] Reconfiguring ocsmanager' 24 | cd ocsmanager 25 | python setup.py develop 26 | 27 | echo '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@' 28 | echo 'To run the ocsmanager service:' 29 | echo 'source mydevenv/bin/activate' 30 | echo 'cd ocsmanager' 31 | echo 'paster serve --reload development.ini' 32 | echo '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@' 33 | -------------------------------------------------------------------------------- /setup/AD/prefixMap.txt: -------------------------------------------------------------------------------- 1 | 0:2.5.4 2 | 1:2.5.6 3 | 2:1.2.840.113556.1.2 4 | 3:1.2.840.113556.1.3 5 | 4:2.16.840.1.101.2.2.1 6 | 5:2.16.840.1.101.2.2.3 7 | 6:2.16.840.1.101.2.1.5 8 | 7:2.16.840.1.101.2.1.4 9 | 8:2.5.5 10 | 9:1.2.840.113556.1.4 11 | 10:1.2.840.113556.1.5 12 | 19:0.9.2342.19200300.100 13 | 20:2.16.840.1.113730.3 14 | 21:0.9.2342.19200300.100.1 15 | 22:2.16.840.1.113730.3.1 16 | 23:1.2.840.113556.1.5.7000 17 | 24:2.5.21 18 | 25:2.5.18 19 | 26:2.5.20 20 | 11:1.2.840.113556.1.4.260 21 | 12:1.2.840.113556.1.5.56 22 | 13:1.2.840.113556.1.4.262 23 | 14:1.2.840.113556.1.5.57 24 | 15:1.2.840.113556.1.4.263 25 | 16:1.2.840.113556.1.5.58 26 | 17:1.2.840.113556.1.5.73 27 | 18:1.2.840.113556.1.4.305 28 | 27:1.3.6.1.4.1.1466.101.119 29 | 28:2.16.840.1.113730.3.2 30 | 29:1.3.6.1.4.1.250.1 31 | 30:1.2.840.113549.1.9 32 | 31:0.9.2342.19200300.100.4 33 | 32:1.2.840.113556.1.6.23 34 | 33:1.2.840.113556.1.6.18.1 35 | 34:1.2.840.113556.1.6.18.2 36 | 35:1.2.840.113556.1.6.13.3 37 | 36:1.2.840.113556.1.6.13.4 38 | 37:1.3.6.1.1.1.1 39 | 38:1.3.6.1.1.1.2 40 | 39:1.3.6.1.4.1.7165.4.1 41 | 40:1.3.6.1.4.1.7165.4.2 42 | 41:1.2.840.113556.1.5.7000.62 43 | 42:1.2.840.113556.1.4.7000.102 44 | 43:1.2.840.113556.1.6.20.1 45 | 44:1.2.840.113556.1.6.20.2 46 | -------------------------------------------------------------------------------- /libmapi/mapi_id_array.h: -------------------------------------------------------------------------------- 1 | /* 2 | OpenChange MAPI implementation. 3 | 4 | Copyright (C) Julien Kerihuel 2008. 5 | 6 | This program is free software; you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | */ 19 | 20 | #ifndef __MAPI_ID_ARRAY_H 21 | #define __MAPI_ID_ARRAY_H 22 | 23 | typedef struct mapi_container_list { 24 | struct mapi_container_list *prev; 25 | struct mapi_container_list *next; 26 | mapi_id_t id; 27 | } mapi_container_list_t; 28 | 29 | typedef struct mapi_id_array { 30 | uint16_t count; 31 | mapi_container_list_t *lpContainerList; 32 | } mapi_id_array_t; 33 | 34 | #endif /* __MAPI_ID_ARRAY_H */ 35 | -------------------------------------------------------------------------------- /mapiproxy/services/ocsmanager/ocsmanager/controllers/rpcproxy.py: -------------------------------------------------------------------------------- 1 | import logging 2 | 3 | from pylons import request, response, session, tmpl_context as c, url 4 | from pylons.controllers.util import abort, redirect 5 | # from ocsmanager.model import RPCProxyAuthenticateModel 6 | 7 | from ocsmanager.lib.base import BaseController, render 8 | 9 | log = logging.getLogger(__name__) 10 | 11 | class RpcproxyController(BaseController): 12 | 13 | def index(self): 14 | # auth = RPCProxyAuthenticateModel.RPCProxyAuthenticateModel() 15 | if request.method == 'RPC_IN_DATA': 16 | log.debug('IN Channel Request') 17 | # retval = auth.Authenticate(request.authorization) 18 | response.headers['Content-Type'] = 'application/rpc' 19 | # if retval == 1: 20 | # log.debug('Authentication failure') 21 | # return 22 | elif request.method == 'RPC_OUT_DATA': 23 | log.debug('OUT Channel Request') 24 | # retval = auth.Authenticate(request.authorization) 25 | response.headers['Content-Type'] = 'application/rpc' 26 | 27 | if retval == 1: 28 | log.debug('Authentication failure') 29 | 30 | return '' 31 | 32 | -------------------------------------------------------------------------------- /mapiproxy/services/ocsmanager/ocsmanager/controllers/error.py: -------------------------------------------------------------------------------- 1 | import cgi 2 | 3 | from paste.urlparser import PkgResourcesParser 4 | from pylons import request 5 | from pylons.controllers.util import forward 6 | from pylons.middleware import error_document_template 7 | from webhelpers.html.builder import literal 8 | 9 | 10 | from ocsmanager.lib.base import BaseController 11 | 12 | class ErrorController(BaseController): 13 | 14 | """Generates error documents as and when they are required. 15 | 16 | The ErrorDocuments middleware forwards to ErrorController when error 17 | related status codes are returned from the application. 18 | 19 | This behaviour can be altered by changing the parameters to the 20 | ErrorDocuments middleware in your config/middleware.py file. 21 | 22 | """ 23 | 24 | def document(self): 25 | """Render the error document""" 26 | resp = request.environ.get('pylons.original_response') 27 | content = cgi.escape(request.GET.get('message', '')) 28 | page = """ 29 | 30 | 31 | %(message)s 32 | 33 | """ % {'code':cgi.escape(request.GET.get('code', str(resp.status_int))), 'message': content} 34 | return page 35 | -------------------------------------------------------------------------------- /libmapi++/libmapi++.h: -------------------------------------------------------------------------------- 1 | /* 2 | libmapi C++ Wrapper 3 | MAPI Exception Class 4 | 5 | Copyright (C) Alan Alvarez 2008. 6 | 7 | This program is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . 19 | */ 20 | 21 | #ifndef __LIBMAPIPP_H 22 | #define __LIBMAPIPP_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | #endif /* ! __LIBMAPIPP_H */ 35 | -------------------------------------------------------------------------------- /script/mkrelease.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # ./script/mkrelease.sh VERSION NICKNAME NICKNAME2 FIRST_REVISION 5 | # ./script/mkrelease.sh 0.7 PHASER Phaser 308 6 | # 7 | 8 | TMPDIR=`mktemp openchange-XXXXX` 9 | rm $TMPDIR || exit 1 10 | svn export . $TMPDIR || exit 1 11 | svn log -r$4:HEAD > $TMPDIR/CHANGELOG || exit 1 12 | 13 | ( cd $TMPDIR/ 14 | ./autogen.sh || exit 1 15 | ./configure || exit 1 16 | make || exit 1 17 | sed -i "s/^OPENCHANGE_VERSION_IS_SVN_SNAPSHOT=yes/OPENCHANGE_VERSION_IS_SVN_SNAPSHOT=no/g" VERSION || exit 1 18 | sed -i "s/^OPENCHANGE_VERSION_RELEASE_NICKNAME=.*/OPENCHANGE_VERSION_RELEASE_NICKNAME=$3/g" VERSION || exit 1 19 | sed -i "s/^OPENCHANGE_VERSION_RELEASE_NUMBER=.*/OPENCHANGE_VERSION_RELEASE_NUMBER=$1/g" VERSION || exit 1 20 | 21 | ./autogen.sh || exit 1 22 | ./configure || exit 1 23 | make doxygen || exit 1 24 | make distclean || exit 1 25 | rm .bzrignore 26 | ) || exit 1 27 | 28 | VERSION=$1-$2 29 | mv $TMPDIR openchange-$VERSION || exit 1 30 | tar -cf openchange-$VERSION.tar openchange-$VERSION || exit 1 31 | echo "Now run: " 32 | echo "gpg --detach-sign --armor openchange-$VERSION.tar" 33 | echo "gzip openchange-$VERSION.tar" 34 | echo "And then upload " 35 | echo "openchange-$VERSION.tar.gz openchange-$VERSION.tar.asc" 36 | -------------------------------------------------------------------------------- /testprogs/blackbox/expected_output--usage.txt: -------------------------------------------------------------------------------- 1 | Usage: openchangeclient [-?SFmDV] [-?|--help] [--usage] [-f|--database STRING] 2 | [--pf] [-p|--profile STRING] [-P|--password STRING] [-S|--sendmail] 3 | [--sendappointment] [--sendcontact] [--sendtask] [--sendnote] 4 | [-F|--fetchmail] [--fetchsummary] [-G|--storemail STRING] 5 | [-i|--fetch-items STRING] [--freebusy=STRING] [--force] 6 | [--delete=STRING] [-u|--update STRING] [-m|--mailbox] [-D|--deletemail] 7 | [-A|--attachments STRING] [-I|--html-inline STRING] 8 | [-W|--html-file STRING] [-t|--to STRING] [-c|--cc STRING] 9 | [-b|--bcc STRING] [-s|--subject STRING] [-B|--body STRING] 10 | [--location=STRING] [--label=STRING] [--dtstart=STRING] 11 | [--dtend=STRING] [--busystatus=STRING] [--taskstatus=STRING] 12 | [--importance=STRING] [--email=STRING] [--fullname=STRING] 13 | [--cardname=STRING] [--color=STRING] [--notifications] 14 | [--folder=STRING] [--mkdir] [--rmdir] [--userlist] 15 | [--folder-name=STRING] [--folder-comment=STRING] 16 | [-d|--debuglevel STRING] [--dump-data] [--private] 17 | [--ocpf-file=STRING] [--ocpf-dump=STRING] [--ocpf-syntax] 18 | [--ocpf-sender] [-V|--version] 19 | -------------------------------------------------------------------------------- /libmapi/socket/netif.h: -------------------------------------------------------------------------------- 1 | /* 2 | Unix SMB/CIFS implementation. 3 | 4 | structures for socke/netif.c and socket/interface.c 5 | 6 | Copyright (C) Andrew Tridgell 2004 7 | 8 | This program is free software; you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation; either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . 20 | */ 21 | 22 | /** used for network interfaces */ 23 | struct interface { 24 | struct interface *next, *prev; 25 | struct in_addr ip; 26 | struct in_addr nmask; 27 | const char *ip_s; 28 | const char *bcast_s; 29 | const char *nmask_s; 30 | }; 31 | 32 | struct iface_struct { 33 | char name[16]; 34 | struct in_addr ip; 35 | struct in_addr netmask; 36 | }; 37 | 38 | #define MAX_INTERFACES 128 39 | -------------------------------------------------------------------------------- /mapiproxy/services/ocsmanager/setup.py: -------------------------------------------------------------------------------- 1 | try: 2 | from setuptools import setup, find_packages 3 | except ImportError: 4 | from ez_setup import use_setuptools 5 | use_setuptools() 6 | from setuptools import setup, find_packages 7 | 8 | setup( 9 | name='ocsmanager', 10 | version='0.1', 11 | description='OpenChange Service Manager', 12 | author='Julien Kerihuel', 13 | author_email='j.kerihuel@openchange.org', 14 | url='http://www.openchange.org', 15 | install_requires=[ 16 | "Pylons>=0.10", 17 | ], 18 | setup_requires=["PasteScript>=1.6.3"], 19 | packages=find_packages(exclude=['ez_setup']), 20 | include_package_data=True, 21 | test_suite='nose.collector', 22 | package_data={'ocsmanager': ['i18n/*/LC_MESSAGES/*.mo']}, 23 | #message_extractors={'ocsmanager': [ 24 | # ('**.py', 'python', None), 25 | # ('templates/**.mako', 'mako', {'input_encoding': 'utf-8'}), 26 | # ('public/**', 'ignore', None)]}, 27 | zip_safe=False, 28 | paster_plugins=['PasteScript', 'Pylons'], 29 | entry_points=""" 30 | [paste.app_factory] 31 | main = ocsmanager.config.middleware:make_app 32 | 33 | [paste.app_install] 34 | main = pylons.util:PylonsInstaller 35 | """, 36 | ) 37 | -------------------------------------------------------------------------------- /.bzrignore: -------------------------------------------------------------------------------- 1 | aclocal.m4 2 | config.h 3 | config.h.in 4 | config.log 5 | config.status 6 | libmapi.pc 7 | configure 8 | gen_ndr 9 | libmapi/mapicode.c 10 | libmapi/mapicode.h 11 | libmapi/mapitags.c 12 | libmapi/mapitags.h 13 | libmapi/proto.h 14 | libmapi/utf8_convert.yy.c 15 | server/dcesrv_proto.h 16 | torture/torture_proto.h 17 | libmapi.so.* 18 | mapicodes_enum.h 19 | mapitags_enum.h 20 | bin/* 21 | libmapi/proto_private.h 22 | providers/providers_proto.h 23 | tags 24 | *.pc 25 | *.so.* 26 | libmapiadmin/proto.h 27 | libmapiadmin/proto_private.h 28 | *.po 29 | libmapi/mapi_nameid_private.h 30 | Doxyfile 31 | libmapi/version.h 32 | config.mk 33 | libocpf/ocpf.tab.c 34 | libocpf/ocpf.tab.c 35 | libocpf/lex.yy.c 36 | libocpf/proto.h 37 | libocpf/proto_private.h 38 | libocpf/proto_private.h 39 | libocpf/ocpf.tab.h 40 | autom4te.cache 41 | apidocs 42 | utils/mapitest/mapitest_proto.h 43 | utils/mapitest/proto.h 44 | samba4 45 | tags 46 | libmapi/mapi_namedid.h 47 | libmapi/mapi_nameid.h 48 | libmapi++/examples/foldertree 49 | libmapi++/examples/messages 50 | _trial_temp 51 | mapiproxy/libmapiproxy/openchangedb_property.c 52 | stamp-h1 53 | libmapi/codepage_lcid.c 54 | pyopenchange/pymapi_properties.c 55 | setup/mapistore/mapistore_namedprops.ldif 56 | mapiproxy/libmapistore/mapistore_nameid.h 57 | -------------------------------------------------------------------------------- /libmapi/mapi_context.h: -------------------------------------------------------------------------------- 1 | /* 2 | OpenChange MAPI implementation. 3 | MAPI Context. 4 | 5 | Copyright (C) Julien Kerihuel 2007-2010. 6 | Copyright (C) Fabien Le Mentec 2007. 7 | 8 | This program is free software; you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation; either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . 20 | */ 21 | 22 | #ifndef _MAPI_CONTEXT_H 23 | #define _MAPI_CONTEXT_H 24 | 25 | #include 26 | 27 | struct ldb_context; 28 | struct mapi_session; 29 | 30 | struct mapi_context 31 | { 32 | TALLOC_CTX *mem_ctx; 33 | struct ldb_context *ldb_ctx; 34 | struct mapi_session *session; 35 | bool dumpdata; 36 | struct loadparm_context *lp_ctx; 37 | }; 38 | 39 | 40 | #endif /* ! _MAPI_CONTEXT_H */ 41 | -------------------------------------------------------------------------------- /pyopenchange/tests/sogo_readdir.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | import sys 5 | 6 | sys.path.append("python") 7 | 8 | import os 9 | import openchange 10 | import openchange.mapistore as mapistore 11 | from openchange import mapi 12 | 13 | dirname = "/tmp/mapistore" 14 | if not os.path.exists(dirname): 15 | os.mkdir("/tmp/mapistore") 16 | 17 | mapistore.set_mapping_path("/tmp/mapistore") 18 | MAPIStore = mapistore.mapistore() 19 | ctx_id = MAPIStore.add_context("sogo://openchange:openchange@mail/") 20 | 21 | count = MAPIStore.get_folder_count(ctx_id, 0x0000000000160001, 22 | mapistore.MAPISTORE_FOLDER) 23 | 24 | print "Number of folders in INBOX: %d" % (count) 25 | 26 | SPropValue = mapi.SPropValue() 27 | SPropValue.add(mapi.PR_PARENT_FID, 0x0000000000160001) 28 | SPropValue.add(mapi.PR_DISPLAY_NAME, "testé") 29 | SPropValue.add(mapi.PR_COMMENT, "test folder") 30 | SPropValue.add(mapi.PR_FOLDER_TYPE, 1) 31 | 32 | MAPIStore.mkdir(ctx_id, 0x0000000000160001, 0x00000000001620001, SPropValue) 33 | 34 | count = MAPIStore.get_folder_count(ctx_id, 0x0000000000160001, 35 | mapistore.MAPISTORE_FOLDER) 36 | 37 | print "Number of folders in INBOX: %d" % (count) 38 | 39 | MAPIStore.del_context(ctx_id) 40 | -------------------------------------------------------------------------------- /mapiproxy/services/ocsmanager/ocsmanager/config/routing.py: -------------------------------------------------------------------------------- 1 | """Routes configuration 2 | 3 | The more specific and detailed routes should be defined first so they 4 | may take precedent over the more generic routes. For more information 5 | refer to the routes manual at http://routes.groovie.org/docs/ 6 | """ 7 | from routes import Mapper 8 | 9 | def make_map(config): 10 | """Create, configure and return the routes Mapper""" 11 | map = Mapper(directory=config['pylons.paths']['controllers'], 12 | always_scan=config['debug']) 13 | map.minimization = False 14 | map.explicit = False 15 | 16 | # The ErrorController route (handles 404/500 error pages); it should 17 | # likely stay at the top, ensuring it can always be resolved 18 | map.connect('/error/{action}', controller='error') 19 | map.connect('/error/{action}/{id}', controller='error') 20 | 21 | # CUSTOM ROUTES HERE 22 | 23 | map.connect('/autodiscover/{action}.xml', controller="autodiscover") 24 | map.connect('/ews/{controller}') 25 | map.connect('/ews/{controller}.wsdl') 26 | map.connect('/{controller}/{action}') 27 | map.connect('/{controller}/{action}/{id}') 28 | 29 | # RPC over HTTP 30 | map.connect('/rpc/rpcproxy.dll', controller='rpcproxy') 31 | 32 | return map 33 | -------------------------------------------------------------------------------- /mapiproxy/services/web/rpcproxy/rpcproxy/utils.py: -------------------------------------------------------------------------------- 1 | # utils.py -- OpenChange RPC-over-HTTP implementation 2 | # 3 | # Copyright (C) 2012 Wolfgang Sourdeau 4 | # 5 | # This program is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see . 17 | # 18 | 19 | import json 20 | 21 | 22 | def prettify_dict(adict): 23 | """This method makes use of the JSON API to return a properly indented 24 | representation of a dict. 25 | 26 | """ 27 | 28 | def _unhandled_objects(obj): 29 | return str(obj) 30 | lines = json.dumps(adict, default=_unhandled_objects, 31 | sort_keys=True, indent=4) 32 | return "%s\n" % "\n".join([l.rstrip() for l in lines.splitlines()]) 33 | -------------------------------------------------------------------------------- /qt/demo/demoapp.h: -------------------------------------------------------------------------------- 1 | #ifndef DEMOAPP_H 2 | #define DEMOAPP_H 3 | 4 | #include 5 | #include 6 | 7 | class QAction; 8 | class QMenu; 9 | class QTextEdit; 10 | class QStandardItem; 11 | class QTableView; 12 | 13 | namespace libmapipp 14 | { 15 | class session; 16 | class folder; 17 | }; 18 | 19 | class DemoApp : public QMainWindow 20 | { 21 | Q_OBJECT 22 | 23 | public: 24 | DemoApp(); 25 | 26 | private slots: 27 | void about(); 28 | void folderChanged( const QModelIndex &index ); 29 | void messageChanged( const QModelIndex &index ); 30 | 31 | private: 32 | void createActions(); 33 | void createMenus(); 34 | 35 | void login(); 36 | 37 | void addFolderDockWidget(); 38 | void addMessagesDockWidget(); 39 | 40 | void openMessage( quint32 messageNumber ); 41 | 42 | QMenu *m_fileMenu; 43 | QMenu *m_helpMenu; 44 | 45 | QAction *m_quitAction; 46 | QAction *m_aboutAction; 47 | 48 | QDockWidget *m_folderDock; 49 | QStandardItemModel *m_folderModel; 50 | 51 | QTableView *m_messagesDockView; 52 | QStandardItemModel *m_messagesModel; 53 | 54 | libmapipp::folder *m_folder; 55 | QTextEdit *m_textEdit; 56 | 57 | libmapipp::session *m_mapi_session; 58 | }; 59 | 60 | #endif 61 | 62 | -------------------------------------------------------------------------------- /pyopenchange/pymapi.h: -------------------------------------------------------------------------------- 1 | /* 2 | OpenChange MAPI implementation. 3 | 4 | Python interface to openchange 5 | 6 | Copyright (C) Julien Kerihuel 2010. 7 | 8 | This program is free software; you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation; either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . 20 | */ 21 | 22 | #ifndef __PYMAPI_H_ 23 | #define __PYMAPI_H_ 24 | 25 | #include 26 | #include "libmapi/libmapi.h" 27 | #include 28 | 29 | typedef struct { 30 | PyObject_HEAD 31 | TALLOC_CTX *mem_ctx; 32 | struct SPropValue *SPropValue; 33 | uint32_t cValues; 34 | } PySPropValueObject; 35 | 36 | PyAPI_DATA(PyTypeObject) PySPropValue; 37 | 38 | /* definitions from auto-generated pymapi_properties.c */ 39 | int pymapi_add_properties(PyObject *); 40 | 41 | #endif /* ! __PYMAPI_H_ */ 42 | -------------------------------------------------------------------------------- /mapiproxy/servers/default/rfr/dcesrv_exchange_ds_rfr.h: -------------------------------------------------------------------------------- 1 | /* 2 | MAPI Proxy - Exchange RFR Server 3 | 4 | OpenChange Project 5 | 6 | Copyright (C) Julien Kerihuel 2009 7 | 8 | This program is free software; you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation; either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . 20 | */ 21 | 22 | #ifndef __DCESRV_EXCHANGE_DS_RFR_H 23 | #define __DCESRV_EXCHANGE_DS_RFR_H 24 | 25 | #include "mapiproxy/libmapiproxy/libmapiproxy.h" 26 | #include 27 | 28 | #ifndef __BEGIN_DECLS 29 | #ifdef __cplusplus 30 | #define __BEGIN_DECLS extern "C" { 31 | #define __END_DECLS } 32 | #else 33 | #define __BEGIN_DECLS 34 | #define __END_DECLS 35 | #endif 36 | #endif 37 | 38 | __BEGIN_DECLS 39 | 40 | NTSTATUS samba_init_module(void); 41 | 42 | __END_DECLS 43 | 44 | #endif /* __DCESRV_EXCHANGE_DS_RFR_H */ 45 | -------------------------------------------------------------------------------- /libmapi/mapidump.h: -------------------------------------------------------------------------------- 1 | /* 2 | OpenChange MAPI implementation. 3 | 4 | Copyright (C) Julien Kerihuel 2007. 5 | 6 | This program is free software; you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | */ 19 | 20 | #ifndef __MAPIDUMP_H__ 21 | #define __MAPIDUMP_H__ 22 | 23 | struct mdump_msgflags { 24 | uint16_t flag; 25 | const char *value; 26 | }; 27 | 28 | struct mdump_msgflags mdump_msgflags[] = { 29 | {0x1, "MSGFLAG_READ"}, 30 | {0x2, "MSGFLAG_UNMODIFIED"}, 31 | {0x4, "MSGFLAG_SUBMIT"}, 32 | {0x8, "MSGFLAG_UNSENT"}, 33 | {0x10, "MSGFLAG_HASATTACH"}, 34 | {0x20, "MSGFLAG_FROMME"}, 35 | {0x40, "MSGFLAG_ASSOCIATED"}, 36 | {0x80, "MSGFLAG_RESEND"}, 37 | {0x100, "MSGFLAG_RN_PENDING"}, 38 | {0x200, "MSGFLAG_NRN_PENDING"}, 39 | {0, NULL} 40 | }; 41 | 42 | #endif /* __MAPIDUMP_H__ */ 43 | -------------------------------------------------------------------------------- /mapiproxy/services/ocsmanager/ocsmanager/controllers/notification.py: -------------------------------------------------------------------------------- 1 | import logging 2 | 3 | from pylons import request, response, session, tmpl_context as c, url 4 | from pylons.controllers.util import abort, redirect 5 | from pylons.decorators.rest import restrict 6 | from ocsmanager.model import AuthenticateModel 7 | from ocsmanager.model import NotificationModel 8 | 9 | from ocsmanager.lib.base import BaseController, render 10 | 11 | log = logging.getLogger(__name__) 12 | 13 | class NotificationController(BaseController): 14 | 15 | def _abort(self, code, message): 16 | c.code = code 17 | c.message = message 18 | return render('/error.xml') 19 | 20 | @restrict('PUT') 21 | def newmail(self): 22 | """ Send a newmail notification to be dispatched to OpenChange 23 | Server. 24 | """ 25 | notification = NotificationModel.NotificationModel() 26 | authModel = AuthenticateModel.AuthenticateModel() 27 | token = authModel.getSessionToken(request.body) 28 | if token is None: return self._abort(472, 'Invalid token') 29 | if token != session['tokenLogin']: return self._abort(403, 'Access forbidden') 30 | 31 | (error,params) = notification.getNewMailParams(request.body) 32 | if error is True: return self._abort(417, params) 33 | 34 | print params 35 | 36 | return render('/notification.xml') 37 | 38 | -------------------------------------------------------------------------------- /packaging/rhel/doxygen_to_devhelp.xsl: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | .html# 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /pyopenchange/tests/ocpf_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | import sys 4 | 5 | sys.path.append("python") 6 | 7 | import os 8 | import openchange 9 | import openchange.ocpf as ocpf 10 | import openchange.mapi as mapi 11 | from openchange.ocpf import Ocpf 12 | 13 | filename = os.getcwd() + "/../../libocpf/examples/sample_appointment.ocpf"; 14 | ctx = Ocpf(filename, ocpf.OCPF_FLAGS_READ) 15 | 16 | ret = ctx.parse() 17 | ret = ctx.set_SPropValue_array() 18 | SPropValue = ctx.get_SPropValue() 19 | ret = ctx.dump() 20 | SPropValue.dump("1. SPropValue: ") 21 | 22 | 23 | del SPropValue 24 | SPropValue = mapi.SPropValue() 25 | SPropValue.add(mapi.PR_CONVERSATION_TOPIC, "New subject from python") 26 | SPropValue.add(mapi.PR_NORMALIZED_SUBJECT, "New subject from python") 27 | ret = ctx.add_SPropValue(SPropValue) 28 | ret = ctx.set_SPropValue_array() 29 | 30 | print "\n" 31 | print "New SpropValue after replacing subject:" 32 | print "=======================================" 33 | del SPropValue 34 | SPropValue = ctx.get_SPropValue() 35 | SPropValue.dump("2. SPropValue: ") 36 | 37 | print 38 | print "Writing ocpf_test.ocpf file:" 39 | print "============================" 40 | filename = os.getcwd() + "/ocpf_test.ocpf"; 41 | ctx2 = Ocpf(filename, ocpf.OCPF_FLAGS_CREATE) 42 | # dummy test to ensure we can set an ocpf parameter properly 43 | ret = ctx2.write_init(0x12345678) 44 | ret = ctx2.write(SPropValue) 45 | ret = ctx2.write_commit() 46 | ret = ctx2.dump() 47 | 48 | del ctx 49 | -------------------------------------------------------------------------------- /libmapi/nspi.h: -------------------------------------------------------------------------------- 1 | /* 2 | OpenChange NSPI implementation. 3 | 4 | Copyright (C) Julien Kerihuel 2005. 5 | 6 | This program is free software; you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | */ 19 | 20 | #ifndef __NSPI_H__ 21 | #define __NSPI_H__ 22 | 23 | struct nspi_context { 24 | struct dcerpc_pipe *rpc_connection; 25 | struct policy_handle handle; 26 | TALLOC_CTX *mem_ctx; 27 | struct cli_credentials *cred; 28 | struct STAT *pStat; 29 | struct mapi_profile *profile; 30 | struct SRowSet *rowSet; 31 | char *org; 32 | char *org_unit; 33 | char *servername; 34 | uint32_t version; 35 | }; 36 | 37 | #define ORG "/o=" 38 | #define ORG_UNIT "/ou=" 39 | #define SERVER_DN "/o=%s/ou=%s/cn=Configuration/cn=Servers/cn=%s" 40 | #define SERVERNAME "/cn=Servers/cn=" 41 | #define RECIPIENT_DN "/o=%s/ou=%s/cn=Recipients/cn=%s" 42 | 43 | #endif /* __NSPI_H__ */ 44 | -------------------------------------------------------------------------------- /libocpf/examples/common_OLEGUID.ocpf: -------------------------------------------------------------------------------- 1 | /* 2 | * OpenChange Property File 3 | * 4 | * Copyright (C) Julien Kerihuel 2008. 5 | * 6 | * Registers common OLEGUID 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see 20 | */ 21 | 22 | OLEGUID PSETID_Appointment "00062002-0000-0000-c000-000000000046" 23 | OLEGUID PSETID_Task "00062003-0000-0000-c000-000000000046" 24 | OLEGUID PSETID_Address "00062004-0000-0000-c000-000000000046" 25 | OLEGUID PSETID_Common "00062008-0000-0000-c000-000000000046" 26 | OLEGUID PSETID_Note "0006200e-0000-0000-c000-000000000046" 27 | OLEGUID PSETID_Log "0006200a-0000-0000-c000-000000000046" 28 | OLEGUID PS_PUBLIC_STRINGS "00020329-0000-0000-c000-000000000046" 29 | OLEGUID PS_INTERNET_HEADERS "00020386-0000-0000-c000-000000000046" 30 | -------------------------------------------------------------------------------- /utils/schemaIDGUID.c: -------------------------------------------------------------------------------- 1 | /* 2 | MAPI Implementation 3 | 4 | OpenChange Project 5 | 6 | Copyright (C) Julien Kerihuel 2006 7 | 8 | This program is free software; you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation; either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . 20 | */ 21 | 22 | #include "libmapi/libmapi.h" 23 | #include 24 | 25 | static void usage(void) 26 | { 27 | printf("schemaIDGUID \n"); 28 | exit(0); 29 | } 30 | 31 | int main(int argc, char *argv[]) 32 | { 33 | TALLOC_CTX *mem_ctx; 34 | DATA_BLOB blob; 35 | struct GUID *guid; 36 | char *schemaIDGUID; 37 | 38 | if (argc != 2) { 39 | usage(); 40 | } 41 | 42 | mem_ctx = talloc_named(NULL, 0, "SchemaIDGUID"); 43 | 44 | blob = data_blob_talloc(mem_ctx, argv[1], strlen(argv[1])+1); 45 | blob.length = ldb_base64_decode((char *)blob.data); 46 | guid = (struct GUID *) blob.data; 47 | schemaIDGUID = GUID_string(mem_ctx, guid); 48 | printf("%s\n", schemaIDGUID); 49 | return (0); 50 | } 51 | -------------------------------------------------------------------------------- /mapiproxy/services/plugins/dovecot/ocsmanager-plugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | OpenChange Service Manager Plugin for Dovecot 3 | 4 | OpenChange Project 5 | 6 | Copyright (C) Julien Kerihuel 2011. 7 | 8 | This program is free software; you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation; either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . 20 | */ 21 | 22 | #ifndef __OCSMANAGER_PLUGIN_H 23 | #define __OCSMANAGER_PLUGIN_H 24 | 25 | #include "lib.h" 26 | #include "llist.h" 27 | #include "array.h" 28 | #include "config.h" 29 | #include "module-dir.h" 30 | #include "mail-user.h" 31 | #include "mail-storage-private.h" 32 | #include "mailbox-list-private.h" 33 | #include "notify-plugin.h" 34 | 35 | #include 36 | #include 37 | 38 | extern const char *ocsmanager_plugin_dependencies[]; 39 | 40 | const char *ocsmanager_plugin_version = DOVECOT_VERSION; 41 | 42 | void ocsmanager_plugin_init(struct module *); 43 | void ocsmanager_plugin_deinit(void); 44 | 45 | #endif /* __OCSMANAGER_PLUGIN_H */ 46 | -------------------------------------------------------------------------------- /mapiproxy/libmapiserver/libmapiserver_oxorule.c: -------------------------------------------------------------------------------- 1 | /* 2 | libmapiserver - MAPI library for Server side 3 | 4 | OpenChange Project 5 | 6 | Copyright (C) Julien Kerihuel 2009 7 | 8 | This program is free software; you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation; either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . 20 | */ 21 | 22 | /** 23 | \file libmapiserver_oxorule.c 24 | 25 | \brief OXORULE ROP Response size calculations 26 | */ 27 | 28 | #include "libmapiserver.h" 29 | 30 | /** 31 | \details Calculate GetRulesTable Rop size 32 | 33 | \return Size of GetRulesTable response 34 | */ 35 | _PUBLIC_ uint16_t libmapiserver_RopGetRulesTable_size(void) 36 | { 37 | uint16_t size = SIZE_DFLT_MAPI_RESPONSE; 38 | 39 | return size; 40 | } 41 | 42 | 43 | /** 44 | \details Calculate ModifyRules Rop size 45 | 46 | \return Size of ModifyRules response 47 | */ 48 | _PUBLIC_ uint16_t libmapiserver_RopModifyRules_size(void) 49 | { 50 | uint16_t size = SIZE_DFLT_MAPI_RESPONSE; 51 | 52 | return size; 53 | } 54 | -------------------------------------------------------------------------------- /libmapi++/libmapi++-example.doxy: -------------------------------------------------------------------------------- 1 | /** \example test.cpp 2 | 3 | An example that shows reading mail. 4 | 5 | */ 6 | 7 | /** \example attach_test.cpp 8 | 9 | An example that shows reading of attachments. 10 | 11 | */ 12 | 13 | /** \example foldertree.cpp 14 | 15 | This example lists the top level folders in the message store, 16 | with output like: 17 | \code 18 | Message store display name: Mailbox - Test User1 19 | |-----> Calendar (0 items, 0 unread) 20 | |-----> Contacts (0 items, 0 unread) 21 | |-----> Deleted Items (0 items, 0 unread) 22 | |-----> Drafts (0 items, 0 unread) 23 | |-----> Inbox (26 items, 24 unread) 24 | |-----> Journal (0 items, 0 unread) 25 | |-----> Notes (0 items, 0 unread) 26 | |-----> Outbox (9 items, 0 unread) 27 | |-----> Sent Items (0 items, 0 unread) 28 | |-----> Tasks (0 items, 0 unread) 29 | \endcode 30 | 31 | The example shows how to create a session, get the message_store, get 32 | properties of the message store, and then gets the list of child folders and 33 | some associated folder properties. 34 | 35 | */ 36 | 37 | /** \example messages.cpp 38 | 39 | This example displays information about the messages in the inbox, with 40 | output like: 41 | \code 42 | Inbox contains 2 messages 43 | |-----> Test User1 | Working Remotely with Windows Small Business Server 44 | |-----> Test User1 | Welcome to Windows Small Business Server 2003 45 | \endcode 46 | 47 | The example shows how to create a session, get the message_store, and open 48 | the inbox folder. It then determines how many messages are in the inbox folder, 49 | and retrieves and prints the intended addressee and the message subject. 50 | 51 | */ 52 | -------------------------------------------------------------------------------- /mapiproxy/services/ocsmanager/ocsmanager/config/deployment.ini_tmpl: -------------------------------------------------------------------------------- 1 | # 2 | # ocsmanager - Pylons configuration 3 | # 4 | # The %(here)s variable will be replaced with the parent directory of this file 5 | # 6 | [DEFAULT] 7 | debug = true 8 | email_to = you@yourdomain.com 9 | smtp_server = localhost 10 | error_email_from = paste@localhost 11 | 12 | [server:main] 13 | use = egg:Paste#http 14 | host = 0.0.0.0 15 | port = 5000 16 | 17 | [app:main] 18 | use = egg:ocsmanager 19 | full_stack = true 20 | static_files = true 21 | 22 | cache_dir = %(here)s/data 23 | beaker.session.key = ocsmanager 24 | beaker.session.secret = ${app_instance_secret} 25 | app_instance_uuid = ${app_instance_uuid} 26 | 27 | # If you'd like to fine-tune the individual locations of the cache data dirs 28 | # for the Cache data, or the Session saves, un-comment the desired settings 29 | # here: 30 | #beaker.cache.data_dir = %(here)s/data/cache 31 | #beaker.session.data_dir = %(here)s/data/sessions 32 | 33 | # WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* 34 | # Debug mode will enable the interactive debugging tool, allowing ANYONE to 35 | # execute malicious code after an exception is raised. 36 | set debug = false 37 | 38 | 39 | # Logging configuration 40 | [loggers] 41 | keys = root 42 | 43 | [handlers] 44 | keys = console 45 | 46 | [formatters] 47 | keys = generic 48 | 49 | [logger_root] 50 | level = INFO 51 | handlers = console 52 | 53 | [handler_console] 54 | class = StreamHandler 55 | args = (sys.stderr,) 56 | level = NOTSET 57 | formatter = generic 58 | 59 | [formatter_generic] 60 | format = %(asctime)s %(levelname)-5.5s [%(name)s] [%(threadName)s] %(message)s 61 | -------------------------------------------------------------------------------- /mapiproxy/dcesrv_mapiproxy_rfr.c: -------------------------------------------------------------------------------- 1 | /* 2 | MAPI Proxy - RFR 3 | 4 | OpenChange Project 5 | 6 | Copyright (C) Julien Kerihuel 2008 7 | 8 | This program is free software; you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation; either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . 20 | */ 21 | 22 | #include "mapiproxy/dcesrv_mapiproxy.h" 23 | #include "mapiproxy/dcesrv_mapiproxy_proto.h" 24 | 25 | /** 26 | \file dcesrv_mapiproxy_rfr.c 27 | 28 | \brief NSPI Referral hook functions 29 | */ 30 | 31 | 32 | /** 33 | \details This function replaces the Exchange server FQDN with 34 | mapiproxy one. 35 | 36 | \return true on success, otherwise false 37 | */ 38 | bool mapiproxy_RfrGetNewDSA(struct dcesrv_call_state *dce_call, struct RfrGetNewDSA *r) 39 | { 40 | /* Sanity checks */ 41 | if (!r->out.ppszServer) return false; 42 | 43 | *r->out.ppszServer = talloc_asprintf(dce_call, "%s.%s", 44 | lpcfg_netbios_name(dce_call->conn->dce_ctx->lp_ctx), 45 | lpcfg_realm(dce_call->conn->dce_ctx->lp_ctx)); 46 | *r->out.ppszServer = strlower_talloc(dce_call, *r->out.ppszServer); 47 | 48 | return true; 49 | } 50 | -------------------------------------------------------------------------------- /setup/AD/oc_provision_configuration_finalize.ldif: -------------------------------------------------------------------------------- 1 | 2 | 3 | # 4 | # Finalize First Administrative Group 5 | # 6 | dn: CN=First Administrative Group,CN=Administrative Groups,${FIRSTORGDN} 7 | changetype: modify 8 | add: siteFolderServer 9 | siteFolderServer: CN=Public Folder Store (${NETBIOSNAME}),CN=First Storage Group,CN=InformationStore,CN=${NETBIOSNAME},CN=Servers,CN=First Administrative Group,CN=Administrative Groups,${FIRSTORGDN} 10 | 11 | # 12 | # Finalize root Exchange service 13 | # 14 | 15 | dn: CN=Microsoft Exchange,CN=Services,${CONFIGDN} 16 | changetype: modify 17 | add: addressBookRoots 18 | addressBookRoots: CN=All Address Lists,CN=Address Lists Container,${FIRSTORGDN} 19 | add: globalAddressList 20 | globalAddressList: CN=Default Global Address List,CN=All Global Address Lists,CN=Address Lists Container,${FIRSTORGDN} 21 | add: templateRoots 22 | templateRoots: CN=Addressing,${FIRSTORGDN} 23 | 24 | # 25 | # Finalize Mailbox Store (${NETBIOSNAME}) 26 | # 27 | dn: CN=Mailbox Store (${NETBIOSNAME}),CN=First Storage Group,CN=InformationStore,CN=${NETBIOSNAME},CN=Servers,CN=First Administrative Group,CN=Administrative Groups,${FIRSTORGDN} 28 | changetype: modify 29 | # (disabled, see previous ldif) msExchUseOAB: CN=Default Offline Address List,CN=Offline Address Lists,CN=Address Lists Container,${FIRSTORGDN} 30 | add: msExchOwningServer 31 | msExchOwningServer: CN=${NETBIOSNAME},CN=Servers,CN=First Administrative Group,CN=Administrative Groups,${FIRSTORGDN} 32 | add: msExchHomePublicMDB 33 | msExchHomePublicMDB: CN=Public Folder Store (${NETBIOSNAME}),CN=First Storage Group,CN=InformationStore,CN=${NETBIOSNAME},CN=Servers,CN=First Administrative Group,CN=Administrative Groups,${FIRSTORGDN} 34 | -------------------------------------------------------------------------------- /libmapi/idset.h: -------------------------------------------------------------------------------- 1 | /* 2 | OpenChange MAPI implementation. 3 | 4 | Copyright (C) Wolfgang Sourdeau 2011 5 | 6 | This program is free software; you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | */ 19 | 20 | #ifndef __LIBMAPI_IDSET_H_ 21 | #define __LIBMAPI_IDSET_H_ 22 | 23 | #include 24 | 25 | struct idset { 26 | bool idbased; /* replid-/replguid based */ 27 | union { 28 | uint16_t id; 29 | struct GUID guid; 30 | } repl; 31 | bool single; /* single range */ 32 | uint32_t range_count; 33 | struct globset_range *ranges; 34 | struct idset *next; 35 | }; 36 | 37 | struct globset_range { 38 | uint64_t low; 39 | uint64_t high; 40 | struct globset_range *prev; 41 | struct globset_range *next; 42 | }; 43 | 44 | struct rawidset { 45 | TALLOC_CTX *mem_ctx; 46 | bool idbased; /* replid-/replguid based */ 47 | union { 48 | uint16_t id; 49 | struct GUID guid; 50 | } repl; 51 | bool single; /* single range */ 52 | uint64_t *globcnts; 53 | int count; 54 | int max_count; 55 | struct rawidset *next; 56 | }; 57 | 58 | #endif /* __LIBMAPI_IDSET_H_ */ 59 | -------------------------------------------------------------------------------- /pyopenchange/tests/mapistore_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | import sys 4 | 5 | sys.path.append("python") 6 | 7 | import os 8 | import openchange 9 | import openchange.mapistore as mapistore 10 | from openchange import mapi 11 | 12 | dirname = "/tmp/mapistore" 13 | if not os.path.exists(dirname): 14 | os.mkdir("/tmp/mapistore") 15 | 16 | mapistore.set_mapping_path("/tmp/mapistore") 17 | MAPIStore = mapistore.mapistore() 18 | ctx_id = MAPIStore.add_context("sogo://openchange:openchange@mail/") 19 | 20 | SPropParent = mapi.SPropValue() 21 | SPropParent.add(mapi.PR_FID, 0x0000000000160001) 22 | SPropParent.add(mapi.PR_DISPLAY_NAME, "parent") 23 | SPropParent.add(mapi.PR_COMMENT, "test parent") 24 | SPropParent.add(mapi.PR_FOLDER_TYPE, 1) 25 | MAPIStore.setprops(ctx_id, 0x0000000000160001, mapistore.MAPISTORE_FOLDER, SPropParent) 26 | 27 | SPropValue = mapi.SPropValue() 28 | SPropValue.add(mapi.PR_PARENT_FID, 0x0000000000010001) 29 | SPropValue.add(mapi.PR_DISPLAY_NAME, "test") 30 | SPropValue.add(mapi.PR_COMMENT, "test folder") 31 | SPropValue.add(mapi.PR_FOLDER_TYPE, 1) 32 | 33 | MAPIStore.mkdir(ctx_id, 0x0000000000160001, 0x0000000000020001, SPropValue) 34 | 35 | count = MAPIStore.get_folder_count(ctx_id, 0x0000000000010001, mapistore.MAPISTORE_FOLDER) 36 | print "After mkdir: %d" % (count) 37 | 38 | MAPIStore.rmdir(ctx_id, 0x0000000000160001, 0x0000000000020001, mapistore.DEL_FOLDERS) 39 | 40 | count = MAPIStore.get_folder_count(ctx_id, 0x0000000000010001, mapistore.MAPISTORE_FOLDER) 41 | print "After rmdir: %d" % (count) 42 | 43 | count = MAPIStore.get_folder_count(ctx_id, 0x0000000000010001, mapistore.MAPISTORE_MESSAGE) 44 | print "List messages: %d" % (count) 45 | 46 | MAPIStore.del_context(ctx_id) 47 | 48 | -------------------------------------------------------------------------------- /libocpf/ocpf_dump.h: -------------------------------------------------------------------------------- 1 | /* 2 | OpenChange OCPF (OpenChange Property File) implementation. 3 | 4 | Copyright (C) Julien Kerihuel 2008. 5 | 6 | This program is free software; you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | */ 19 | 20 | #ifndef __OCPF_DUMP_H_ 21 | #define __OCPF_DUMP_H_ 22 | 23 | #define INDENT() \ 24 | do { \ 25 | uint32_t i; \ 26 | \ 27 | for (i = 0; i < indent; i++) { \ 28 | printf("\t"); \ 29 | } \ 30 | } while (0); 31 | 32 | 33 | #define OCPF_DUMP(x) (ocpf_do_dump x) 34 | 35 | #define OCPF_DUMP_TITLE(indent, txt, type) \ 36 | do { \ 37 | size_t odt_i; \ 38 | size_t txt_len; \ 39 | \ 40 | printf("\n"); \ 41 | INDENT(); \ 42 | printf("%s:\n", txt); \ 43 | \ 44 | INDENT(); \ 45 | txt_len = strlen(txt) + 1; \ 46 | for (odt_i = 0; odt_i < txt_len; odt_i++) { \ 47 | printf("%c", type ? '-' : '='); \ 48 | } \ 49 | printf("\n"); \ 50 | } while (0); 51 | 52 | 53 | #define OCPF_DUMP_TOPLEVEL 0 54 | #define OCPF_DUMP_SUBLEVEL 1 55 | 56 | 57 | unsigned int indent; 58 | 59 | 60 | 61 | #endif /* ! __OCPF_DUMP_H_ */ 62 | -------------------------------------------------------------------------------- /python/openchange/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | # OpenChange Python bindings 4 | # Copyright (C) Jelmer Vernooij 2008 5 | # 6 | # This program is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program. If not, see . 18 | # 19 | 20 | __docformat__ = 'restructuredText' 21 | 22 | import os, sys 23 | 24 | try: 25 | import samba 26 | except ImportError: 27 | # Try to fix up sys.path if Samba is installed in an unusual location 28 | SAMBA_PREFIXES = ["/usr/local/samba", "/opt/samba"] 29 | for samba_prefix in SAMBA_PREFIXES: 30 | if not os.path.isdir(samba_prefix): 31 | continue 32 | for lib_dir in ["lib", "lib64"]: 33 | python_version = "%d.%d" % sys.version_info[:2] 34 | path = os.path.join(samba_prefix, lib_dir, 35 | "python%s" % python_version, "site-packages") 36 | if os.path.isdir(os.path.join(path, "samba")): 37 | sys.path.append(path) 38 | break 39 | import samba 40 | 41 | 42 | def test_suite(): 43 | import openchange.tests 44 | return openchange.tests.test_suite() 45 | 46 | -------------------------------------------------------------------------------- /pyopenchange/tests/mapistore_mgmt.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | # NOTE: 4 | # 5 | # For this test, we are running the whole environment on a different 6 | # server: imap, ldap, postgresql, postfix, openchange, samba and sogo. 7 | # We have configured SOGo backend locally and adjusted defaults to 8 | # connect to this remote server. 9 | # 10 | # Finally we are accessing the openchange.ldb file through sshfs and 11 | # map it to expected /usr/local/samba/private folder. 12 | # sshfs openchange@ip_addr:/usr/local/samba/private /usr/local/samba/private 13 | # We have also adjusted the permissions to allow openchange user to 14 | # read/write openchange.ldb file remotely. 15 | # 16 | # Do not forget to run memcached with the user account running the 17 | # script. 18 | # 19 | 20 | import os 21 | import sys 22 | import time 23 | 24 | sys.path.append("python") 25 | 26 | import openchange.mapistore as mapistore 27 | 28 | dirname = "/usr/local/samba/private/mapistore" 29 | if not os.path.exists(dirname): 30 | os.mkdir("/usr/local/samba/private/mapistore") 31 | 32 | mapistore.set_mapping_path(dirname) 33 | MAPIStore = mapistore.mapistore(syspath="/usr/local/samba/private") 34 | mgmt = MAPIStore.management() 35 | #while 1: 36 | # time.sleep(5) 37 | # d = mgmt.registered_users("SOGo", "Administrator") 38 | # print d 39 | print "Is SOGo backend registered: %s" % mgmt.registered_backend("SOGo") 40 | print "Is NonExistent backend registered: %s" % mgmt.registered_backend("NonExistent") 41 | print "Registered message: %s" % mgmt.registered_message("SOGo", "Administrator", "Administrator", "inbox", "61") 42 | print "Registered message: %s" % mgmt.registered_message("SOGo", "Administrator", "Administrator", "inbox", "74") 43 | 44 | mgmt.existing_users("SOGo", "Administrator", "inbox") 45 | -------------------------------------------------------------------------------- /mapiproxy/libmapiserver/libmapiserver_oxcperm.c: -------------------------------------------------------------------------------- 1 | /* 2 | libmapiserver - MAPI library for Server side 3 | 4 | OpenChange Project 5 | 6 | Copyright (C) Julien Kerihuel 2010 7 | 8 | This program is free software; you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation; either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . 20 | */ 21 | 22 | /** 23 | \file libmapiserver_oxcmsg.c 24 | 25 | \brief OXCMSG ROP Response size calculations 26 | */ 27 | 28 | #include "libmapiserver.h" 29 | 30 | /** 31 | \details Calculate GetPermissionsTable Rop size 32 | 33 | \param response pointer to the GetPermissionsTable EcDoRpc_MAPI_REPL 34 | structure 35 | 36 | \return Size of GetPermissionsTable response 37 | */ 38 | _PUBLIC_ uint16_t libmapiserver_RopGetPermissionsTable_size(struct EcDoRpc_MAPI_REPL *response) 39 | { 40 | return SIZE_DFLT_MAPI_RESPONSE; 41 | } 42 | 43 | /** 44 | \details Calculate ModifyPermissions Rop size 45 | 46 | \param response pointer to the ModifyPermissions EcDoRpc_MAPI_REPL structure 47 | 48 | \return Size of ModifyPermissions response 49 | */ 50 | _PUBLIC_ uint16_t libmapiserver_RopModifyPermissions_size(struct EcDoRpc_MAPI_REPL *response) 51 | { 52 | return SIZE_DFLT_MAPI_RESPONSE; 53 | } 54 | -------------------------------------------------------------------------------- /libmapi/mapi_provider.h: -------------------------------------------------------------------------------- 1 | /* 2 | OpenChange MAPI implementation. 3 | 4 | Copyright (C) Julien Kerihuel 2007. 5 | Copyright (C) Fabien Le Mentec 2007. 6 | 7 | This program is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . 19 | */ 20 | 21 | #ifndef __MAPI_PROVIDER_H 22 | #define __MAPI_PROVIDER_H 23 | 24 | 25 | /* forward decls */ 26 | struct mapi_object; 27 | struct mapi_profile; 28 | struct mapi_notify_ctx; 29 | 30 | enum PROVIDER_ID { 31 | PROVIDER_ID_EMSMDB = 0x1, 32 | PROVIDER_ID_NSPI = 0x2, 33 | PROVIDER_ID_UNKNOWN 34 | }; 35 | 36 | struct mapi_provider { 37 | enum PROVIDER_ID id; 38 | void *ctx; 39 | }; 40 | 41 | struct mapi_objects { 42 | struct mapi_object *object; 43 | struct mapi_objects *prev; 44 | struct mapi_objects *next; 45 | }; 46 | 47 | struct mapi_session { 48 | struct mapi_provider *emsmdb; 49 | struct mapi_provider *nspi; 50 | struct mapi_profile *profile; 51 | struct mapi_notify_ctx *notify_ctx; 52 | struct mapi_objects *objects; 53 | struct mapi_context *mapi_ctx; 54 | uint8_t logon_ids[255]; 55 | 56 | struct mapi_session *next; 57 | struct mapi_session *prev; 58 | }; 59 | 60 | #endif /* !__MAPI_PROVIDER_H */ 61 | -------------------------------------------------------------------------------- /pyopenchange/mapistore/table.c: -------------------------------------------------------------------------------- 1 | /* 2 | OpenChange MAPI implementation. 3 | 4 | Python interface to mapistore table 5 | 6 | Copyright (C) Julien Kerihuel 2011. 7 | 8 | This program is free software; you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation; either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . 20 | */ 21 | 22 | #include 23 | #include "pyopenchange/mapistore/pymapistore.h" 24 | #include "gen_ndr/exchange.h" 25 | 26 | static void py_MAPIStoreTable_dealloc(PyObject *_self) 27 | { 28 | PyObject_Del(_self); 29 | } 30 | 31 | static PyMethodDef mapistore_table_methods[] = { 32 | { NULL }, 33 | }; 34 | 35 | static PyGetSetDef mapistore_table_getsetters[] = { 36 | { NULL } 37 | }; 38 | 39 | PyTypeObject PyMAPIStoreTable = { 40 | PyObject_HEAD_INIT(NULL) 0, 41 | .tp_name = "MAPIStoreTable", 42 | .tp_basicsize = sizeof (PyMAPIStoreTableObject), 43 | .tp_methods = mapistore_table_methods, 44 | .tp_getset = mapistore_table_getsetters, 45 | .tp_doc = "mapistore table object", 46 | .tp_dealloc = (destructor)py_MAPIStoreTable_dealloc, 47 | .tp_flags = Py_TPFLAGS_DEFAULT, 48 | }; 49 | 50 | void initmapistore_table(PyObject *m) 51 | { 52 | if (PyType_Ready(&PyMAPIStoreTable) < 0) { 53 | return; 54 | } 55 | Py_INCREF(&PyMAPIStoreTable); 56 | } 57 | -------------------------------------------------------------------------------- /mapiproxy/services/client/OCSManager/ClientNotification.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | import os 4 | from lxml import etree 5 | 6 | """ 7 | OCSManager Client Notification documentation 8 | """ 9 | 10 | class ClientNotification(object): 11 | """Client Notification class documentation. Prepare XML request 12 | payloads and analyze response payloads. 13 | """ 14 | 15 | def __init__(self): 16 | return None 17 | 18 | def setNewMailPayload(self, tokenLogin=None, newmail=None): 19 | """Prepare newmail payload. 20 | """ 21 | if tokenLogin is None: return (True, 'User not authenticated') 22 | if newmail is None: return (True, 'Missing newmail arguments') 23 | 24 | # Sanity checks on newmail dictionary 25 | if not "backend" in newmail: return (True, 'Missing backend parameter') 26 | if not "username" in newmail: return (True, 'Missing username parameter') 27 | if not "folder" in newmail: return (True, 'Missing folder parameter') 28 | if not "msgid" in newmail: return (True, 'Missing msgid parameter') 29 | 30 | root = etree.Element('ocsmanager') 31 | token = etree.SubElement(root, "token") 32 | token.text = tokenLogin 33 | 34 | notification = etree.SubElement(root, "notification", category="newmail") 35 | 36 | backend = etree.SubElement(notification, "backend") 37 | backend.text = newmail['backend'] 38 | 39 | username = etree.SubElement(notification, "username") 40 | username.text = newmail['username'] 41 | 42 | folder = etree.SubElement(notification, "folder") 43 | folder.text = newmail['folder'] 44 | 45 | messageID = etree.SubElement(notification, "messageID") 46 | messageID.text = newmail['msgid'] 47 | 48 | return (False, etree.tostring(root, xml_declaration=True, encoding="utf-8")) 49 | -------------------------------------------------------------------------------- /libmapi/emsmdb.h: -------------------------------------------------------------------------------- 1 | /* 2 | OpenChange MAPI implementation. 3 | 4 | Copyright (C) Jelmer Vernooij 2005. 5 | Copyright (C) Julien Kerihuel 2008. 6 | 7 | This program is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . 19 | */ 20 | 21 | #ifndef __EMSMDB_H__ 22 | #define __EMSMDB_H__ 23 | 24 | struct emsmdb_info { 25 | char *szDisplayName; 26 | char *szDNPrefix; 27 | uint32_t pcmsPollsMax; 28 | uint32_t pcRetry; 29 | uint32_t pcmsRetryDelay; 30 | uint32_t picxr; 31 | uint16_t rgwServerVersion[3]; 32 | }; 33 | 34 | struct emsmdb_context { 35 | struct dcerpc_pipe *rpc_connection; 36 | struct policy_handle handle; 37 | struct nspi_context *nspi; 38 | struct cli_credentials *cred; 39 | TALLOC_CTX *mem_ctx; 40 | struct EcDoRpc_MAPI_REQ **cache_requests; 41 | uint32_t cache_size; 42 | uint8_t cache_count; 43 | uint16_t prop_count; 44 | enum MAPITAGS *properties; 45 | uint16_t max_data; 46 | bool setup; 47 | struct emsmdb_info info; 48 | struct policy_handle async_handle; ///< The handle to use for Async notification requests 49 | struct dcerpc_pipe *async_rpc_connection; 50 | }; 51 | 52 | #define MAILBOX_PATH "/o=%s/ou=%s/cn=Recipients/cn=%s" 53 | 54 | #endif /* __EMSMDB_H__ */ 55 | -------------------------------------------------------------------------------- /libmapi/mapi_profile.h: -------------------------------------------------------------------------------- 1 | /* 2 | OpenChange MAPI implementation. 3 | 4 | Copyright (C) Julien Kerihuel 2007-2009. 5 | Copyright (C) Fabien Le Mentec 2007. 6 | 7 | This program is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . 19 | */ 20 | 21 | #ifndef __MAPI_PROFILE_H 22 | #define __MAPI_PROFILE_H 23 | 24 | 25 | #include 26 | 27 | 28 | /* forward decls */ 29 | struct cli_credentials; 30 | struct ldb_context; 31 | 32 | 33 | /* mapi profile 34 | */ 35 | struct mapi_profile 36 | { 37 | struct mapi_context *mapi_ctx; 38 | struct cli_credentials *credentials; 39 | char *profname; 40 | const char *org; 41 | const char *ou; 42 | const char *username; 43 | const char *password; 44 | const char *mailbox; 45 | const char *workstation; 46 | const char *homemdb; 47 | const char *domain; 48 | const char *realm; 49 | const char *server; 50 | const char *localaddr; 51 | bool seal; 52 | uint32_t codepage; 53 | uint32_t language; 54 | uint32_t method; 55 | uint32_t exchange_version; 56 | const char *kerberos; 57 | }; 58 | 59 | typedef int (*mapi_profile_callback_t)(struct PropertyRowSet_r *, const void *); 60 | 61 | #define OC_PROFILE_NOPASSWORD 1 62 | 63 | #endif /* ! __MAPI_PROFILE_H__ */ 64 | -------------------------------------------------------------------------------- /libmapi/fxparser.h: -------------------------------------------------------------------------------- 1 | /* 2 | OpenChange MAPI implementation. 3 | 4 | Copyright (C) Brad Hards 2010 5 | 6 | This program is free software; you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | */ 19 | 20 | #ifndef __LIBMAPI_FXPARSER_H__ 21 | #define __LIBMAPI_FXPARSER_H__ 22 | 23 | /* This header is private to the parser. If you use this directly, you may suffer API or ABI breakage. 24 | 25 | We mean it. 26 | */ 27 | 28 | enum fx_parser_state { ParserState_Entry, ParserState_HaveTag, ParserState_HavePropTag }; 29 | 30 | struct fx_parser_context { 31 | TALLOC_CTX *mem_ctx; 32 | DATA_BLOB data; /* the data we have (so far) to parse */ 33 | uint32_t idx; /* where we are up to in the data blob */ 34 | enum fx_parser_state state; 35 | struct SPropValue lpProp; /* the current property tag and value we are parsing */ 36 | struct MAPINAMEID namedprop; /* the current named property we are parsing */ 37 | bool enough_data; 38 | uint32_t tag; 39 | void *priv; 40 | 41 | /* callbacks for parser actions */ 42 | enum MAPISTATUS (*op_marker)(uint32_t, void *); 43 | enum MAPISTATUS (*op_delprop)(uint32_t, void *); 44 | enum MAPISTATUS (*op_namedprop)(uint32_t, struct MAPINAMEID, void *); 45 | enum MAPISTATUS (*op_property)(struct SPropValue, void *); 46 | }; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /Mainpage.doxy: -------------------------------------------------------------------------------- 1 | /** @mainpage The OpenChange Library API Reference 2 | 3 | This is the online reference for developing with the OpenChange client 4 | libraries. 5 | 6 | Among other things, the OpenChange client libraries provide: 7 | - MAPI client library (libmapi) 8 | - MAPI administration libraries (libmapiadmin) 9 | - OpenChange Property Files (libocpf) 10 | - A regression test framework (mapitest) 11 | - MAPIProxy project (mapiproxy) 12 | - C++ bindings for libmapi (libmapi++) 13 | 14 |

OpenChange Project Goals

15 | 16 | The OpenChange Project aims to provide a portable Open Source 17 | implementation of Microsoft Exchange Server and Exchange 18 | protocols. Exchange is a groupware server designed to work with 19 | Microsoft Outlook, and providing features such as a messaging server, 20 | shared calendars, contact databases, public folders, notes and tasks. 21 | 22 | The OpenChange project has three goals: 23 | 24 | - To provide a library for interoperability with Exchange 25 | protocols, and to assist implementors to use this to create 26 | groupware that interoperates with both Exchange and other 27 | OpenChange-based software. 28 | 29 | - To provide an alternative to Microsoft Exchange Server which uses 30 | native Exchange protocols and provides exactly equivalent 31 | functionality when viewed from Microsoft Outlook clients. 32 | 33 | - To develop a body of knowledge about the most popular groupware 34 | protocols in use commercially today in order to promote development 35 | of a documented and unencumbered standard, with all the benefits that 36 | standards bring. 37 | 38 |

More information

39 | 40 | Visit the OpenChange web site for 41 | other useful information. 42 | 43 | */ 44 | -------------------------------------------------------------------------------- /libocpf/examples/sample_task.ocpf: -------------------------------------------------------------------------------- 1 | /* 2 | * OpenChange Property File 3 | * 4 | * Copyright (C) Julien Kerihuel 2008. 5 | * 6 | * Sample task 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see 20 | */ 21 | 22 | TYPE "IPM.Task" 23 | FOLDER "olFolderTasks" 24 | 25 | OLEGUID PSETID_Task "00062003-0000-0000-c000-000000000046" 26 | OLEGUID PSETID_Common "00062008-0000-0000-c000-000000000046" 27 | OLEGUID PS_PUBLIC_STRINGS "00020329-0000-0000-c000-000000000046" 28 | 29 | SET $subject = "[OCPF] Sample Task" 30 | SET $body = "This is the sample task body" 31 | SET $start_date = T2008-03-06 20:00:00 32 | SET $end_date = T2008-03-06 23:00:00 33 | SET $importance = 2 /* IMPORTANCE_HIGH */ 34 | SET $task_status = 3 /* Waiting */ 35 | 36 | PROPERTY { 37 | PR_CONVERSATION_TOPIC = $subject 38 | PR_NORMALIZED_SUBJECT = $subject 39 | PR_BODY = $body 40 | PR_IMPORTANCE = $importance 41 | PR_SENSITIVITY = 2 /* needed to have private box ticked */ 42 | }; 43 | 44 | NPROPERTY { 45 | OOM:Companies:PSETID_Common = {"OpenChange Project", "Samba Project" } 46 | OOM:StartDate:PSETID_Task = $start_date 47 | OOM:DueDate:PSETID_Task = $end_date 48 | OOM:Status:PSETID_Task = $task_status 49 | OOM:Private:PSETID_Common = B"true" 50 | MNID_STRING:"Keywords":PS_PUBLIC_STRINGS = { "Category1", "Category2" } 51 | }; -------------------------------------------------------------------------------- /qt/lib/messagesmodel.cpp: -------------------------------------------------------------------------------- 1 | #include "messagesmodel.h" 2 | 3 | #include 4 | 5 | using namespace libmapipp; 6 | 7 | MessagesModel::MessagesModel( libmapipp::folder *folder ): 8 | m_mapi_folder( folder ) 9 | { 10 | } 11 | 12 | QStandardItemModel* MessagesModel::buildModel() 13 | { 14 | // Fetch messages in Inbox Folder 15 | folder::message_container_type messages = m_mapi_folder->fetch_messages(); 16 | 17 | QStandardItemModel *messagesModel = new QStandardItemModel(); 18 | QStringList messagesModelHeaders; 19 | messagesModelHeaders << QString( "Topic" ) << QString( "To" ) << QString( "From" ); 20 | messagesModel->setHorizontalHeaderLabels( messagesModelHeaders ); 21 | 22 | for ( unsigned int i = 0; i < messages.size(); ++i ) { 23 | property_container message_property_container = messages[i]->get_property_container(); 24 | 25 | // Add Property Tags to be fetched and then fetch the properties. 26 | message_property_container << PR_DISPLAY_TO << PR_CONVERSATION_TOPIC << PR_SENDER_NAME; 27 | message_property_container.fetch_all(); 28 | 29 | std::string to; 30 | std::string subject; 31 | std::string from; 32 | 33 | for (property_container::iterator Iter = message_property_container.begin(); Iter != message_property_container.end(); Iter++) 34 | { 35 | if (Iter.get_tag() == PR_DISPLAY_TO) 36 | to = (const char*) *Iter; 37 | else if (Iter.get_tag() == PR_CONVERSATION_TOPIC) 38 | subject = (const char*) *Iter; 39 | else if (Iter.get_tag() == PR_SENDER_NAME) 40 | from = (const char*) *Iter; 41 | } 42 | QList< QStandardItem * > row; 43 | row << new QStandardItem( QString::fromStdString( subject ) ); 44 | row[0]->setData( (quint32) i ); 45 | row << new QStandardItem( QString::fromStdString( to ) ); 46 | row << new QStandardItem( QString::fromStdString( from ) ); 47 | messagesModel->appendRow( row ); 48 | } 49 | 50 | return messagesModel; 51 | } 52 | 53 | 54 | 55 | #include "messagesmodel.moc" 56 | -------------------------------------------------------------------------------- /mapiproxy/services/ocsmanager/production.ini: -------------------------------------------------------------------------------- 1 | # 2 | # ocsmanager - Pylons development environment configuration 3 | # 4 | # The %(here)s variable will be replaced with the parent directory of this file 5 | # 6 | [DEFAULT] 7 | debug = true 8 | # Uncomment and replace with the address which should receive any error reports 9 | #email_to = you@yourdomain.com 10 | smtp_server = localhost 11 | error_email_from = paste@localhost 12 | 13 | [server:main] 14 | use = egg:Paste#http 15 | host = 127.0.0.1 16 | port = 5000 17 | 18 | [app:main] 19 | use = egg:ocsmanager 20 | full_stack = true 21 | static_files = true 22 | 23 | cache_dir = %(here)s/data 24 | beaker.session.key = ocsmanager 25 | beaker.session.secret = somesecret 26 | 27 | # If you'd like to fine-tune the individual locations of the cache data dirs 28 | # for the Cache data, or the Session saves, un-comment the desired settings 29 | # here: 30 | #beaker.cache.data_dir = %(here)s/data/cache 31 | #beaker.session.data_dir = %(here)s/data/sessions 32 | 33 | # WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* 34 | # Debug mode will enable the interactive debugging tool, allowing ANYONE to 35 | # execute malicious code after an exception is raised. 36 | set debug = false 37 | 38 | 39 | # Logging configuration 40 | [loggers] 41 | keys = root, routes, ocsmanager 42 | 43 | [handlers] 44 | keys = console 45 | 46 | [formatters] 47 | keys = generic 48 | 49 | [logger_root] 50 | level = INFO 51 | handlers = console 52 | 53 | [logger_routes] 54 | level = INFO 55 | handlers = 56 | qualname = routes.middleware 57 | # "level = DEBUG" logs the route matched and routing variables. 58 | 59 | [logger_ocsmanager] 60 | level = DEBUG 61 | handlers = 62 | qualname = ocsmanager 63 | 64 | [handler_console] 65 | class = StreamHandler 66 | args = (sys.stderr,) 67 | level = NOTSET 68 | formatter = generic 69 | 70 | [formatter_generic] 71 | format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] [%(threadName)s] %(message)s 72 | datefmt = %H:%M:%S 73 | -------------------------------------------------------------------------------- /mapiproxy/dcesrv_mapiproxy.h: -------------------------------------------------------------------------------- 1 | /* 2 | MAPI Proxy 3 | 4 | OpenChange Project 5 | 6 | Copyright (C) Julien Kerihuel 2008 7 | 8 | This program is free software; you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation; either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . 20 | */ 21 | 22 | #ifndef __DCESRV_MAPIPROXY_H__ 23 | #define __DCESRV_MAPIPROXY_H__ 24 | 25 | #ifndef _GNU_SOURCE 26 | #define _GNU_SOURCE 1 27 | #endif 28 | 29 | #include 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | #include 39 | #include 40 | #include 41 | 42 | #include 43 | #include 44 | #include 45 | #include 46 | 47 | #include "gen_ndr/exchange.h" 48 | #include "gen_ndr/ndr_exchange.h" 49 | #include "mapiproxy/libmapiproxy/libmapiproxy.h" 50 | 51 | struct dcesrv_mapiproxy_private { 52 | struct dcerpc_pipe *c_pipe; 53 | char *exchname; 54 | bool server_mode; 55 | bool connected; 56 | struct cli_credentials *credentials; 57 | }; 58 | 59 | enum exchange_handle { 60 | EXCHANGE_HANDLE_NSP, 61 | EXCHANGE_HANDLE_EMSMDB, 62 | EXCHANGE_HANDLE_DS_RFR 63 | }; 64 | 65 | /* Forward declarations */ 66 | struct composite_context; 67 | 68 | #define MAXHOSTNAMELEN 255 69 | #define SERVERNAME "/cn=Servers/cn=" 70 | 71 | #endif /* !__DCESRV_MAPIPROXY_H__ */ 72 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | ######################################################## 2 | # OPENCHANGE Version # 3 | # # 4 | # script/mkversion.sh # 5 | # will use this file to create # 6 | # libmapi/version.h # 7 | # # 8 | ######################################################## 9 | 10 | ######################################################## 11 | # To mark SVN snapshots this should be set to 'yes' # 12 | # in the development BRANCH, and set to 'no' only in # 13 | # the release BRANCH # 14 | # # 15 | # .[...]-SVN-build-xxx # 16 | # # 17 | # e.g. OPENCHANGE_VERSION_IS_SVN_SNAPSHOT=yes # 18 | # -> "0.7-SVN-build-199" # 19 | ######################################################## 20 | OPENCHANGE_VERSION_IS_SVN_SNAPSHOT=yes 21 | 22 | 23 | ############################################################# 24 | # This is for specifying a release nickname # 25 | # # 26 | # e.g. OPENCHANGE_VERSION_RELEASE_NICKNAME=Nicky Nickname # 27 | # -> "0.7 (Nicky Nickname)" # 28 | ############################################################# 29 | OPENCHANGE_VERSION_RELEASE_NICKNAME=Quadrant 30 | 31 | 32 | ############################################################# 33 | # This is for specifying a release number # 34 | # # 35 | # e.g. OPENCHANGE_VERSION_RELEASE_VERSION=0.8.2 # 36 | # -> "0.8.2 (Nicky Nickname)" # 37 | ############################################################# 38 | OPENCHANGE_VERSION_RELEASE_NUMBER=2.0 39 | -------------------------------------------------------------------------------- /libmapiadmin/mapiadmin.c: -------------------------------------------------------------------------------- 1 | /* 2 | OpenChange Exchange Administration library. 3 | 4 | Copyright (C) Julien Kerihuel 2007. 5 | 6 | This program is free software; you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | */ 19 | 20 | #include "libmapiadmin/libmapiadmin.h" 21 | 22 | /** 23 | \file 24 | Housekeeping functions for mapiadmin 25 | */ 26 | 27 | /** 28 | Create and initialise a mapiadmin_ctx structure 29 | 30 | You should use mapiadmin_release to clean up the mapiadmin_ctx 31 | structure when done. 32 | */ 33 | _PUBLIC_ struct mapiadmin_ctx *mapiadmin_init(struct mapi_session *session) 34 | { 35 | struct mapiadmin_ctx *mapiadmin_ctx; 36 | 37 | if (!session) return NULL; 38 | if (!session->profile) return NULL; 39 | 40 | mapiadmin_ctx = talloc_zero((TALLOC_CTX *)session, struct mapiadmin_ctx); 41 | 42 | mapiadmin_ctx->binding = talloc_asprintf((TALLOC_CTX *)mapiadmin_ctx, "ncacn_np:%s", 43 | session->profile->server); 44 | mapiadmin_ctx->session = session; 45 | 46 | return mapiadmin_ctx; 47 | } 48 | 49 | /** 50 | Clean up a mapiadmin_ctx structure 51 | 52 | The structure is assumed to have been allocated using mapiadmin_init() or 53 | equivalent code. 54 | */ 55 | _PUBLIC_ enum MAPISTATUS mapiadmin_release(struct mapiadmin_ctx *mapiadmin_ctx) 56 | { 57 | MAPI_RETVAL_IF(!mapiadmin_ctx, MAPI_E_NOT_INITIALIZED, NULL); 58 | 59 | talloc_free(mapiadmin_ctx); 60 | 61 | return MAPI_E_SUCCESS; 62 | } 63 | -------------------------------------------------------------------------------- /python/openchange/tests/test_provision.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | # OpenChange provisioning 4 | # Copyright (C) Jelmer Vernooij 2009 5 | # 6 | # This program is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program. If not, see . 18 | # 19 | 20 | from samba import param 21 | from samba.credentials import Credentials 22 | from samba.tests import TestCaseInTempDir 23 | from samba.tests.samdb import SamDBTestCase 24 | from openchange.provision import (install_schemas, openchangedb_provision, 25 | guess_names_from_smbconf, find_setup_dir) 26 | 27 | import os 28 | import shutil 29 | 30 | 31 | class ExtendedSamDBTestCase(SamDBTestCase): 32 | 33 | def test_install_schemas(self): 34 | def setup_path(relpath): 35 | return os.path.join(find_setup_dir(), relpath) 36 | 37 | names = guess_names_from_smbconf(self.lp) 38 | creds = Credentials() 39 | creds.set_anonymous() 40 | self.lp.set("sam database", os.path.join(self.tempdir, "samdb.ldb")) 41 | install_schemas(setup_path, names, self.lp, creds) 42 | 43 | 44 | class OpenChangeDBProvisionTestCase(TestCaseInTempDir): 45 | 46 | def test_provision(self): 47 | lp = param.LoadParm() 48 | lp.load_default() 49 | lp.set("private dir", self.tempdir) 50 | openchangedb_provision(lp) 51 | shutil.rmtree(os.path.join(self.tempdir, "mapistore")) 52 | os.unlink(os.path.join(self.tempdir, "openchange.ldb")) 53 | -------------------------------------------------------------------------------- /mapiproxy/services/ocsmanager/ocsmanager/model/auth/SingleAuthenticateModel.py: -------------------------------------------------------------------------------- 1 | import os, sys 2 | import hashlib 3 | 4 | from base64 import urlsafe_b64encode as encode 5 | from base64 import urlsafe_b64decode as decode 6 | from pylons import config 7 | 8 | class SingleAuthenticateModel(object): 9 | def __init__(self): 10 | self.username = config['ocsmanager']['auth']['username'] 11 | self.password = config['ocsmanager']['auth']['password'] 12 | self.encryption = config['ocsmanager']['auth']['encryption'] 13 | 14 | if self.encryption == "plain": 15 | self.salt = os.urandom(4) 16 | elif self.encryption == "ssha": 17 | challenge_bytes = decode(self.password[6:]) 18 | self.salt = challenge_bytes[20:] 19 | else: 20 | log.error("%s: Unsupported password encryption: %s", self.encryption) 21 | sys.exit() 22 | 23 | def getSalt(self, username): 24 | if username != self.username: return None 25 | return encode(self.salt) 26 | 27 | def verifyPassword(self, username, token_salt64, salt64, payload): 28 | if username != self.username: return (True, 'Invalid Username/Password') 29 | 30 | salt = decode(salt64) 31 | token_salt = decode(token_salt64) 32 | 33 | # Recreate the payload and compare it 34 | if self.encryption == "plain": 35 | h = hashlib.sha1(self.password) 36 | h.update(salt) 37 | sshaPassword = "{SSHA}" + encode(h.digest() + salt) 38 | elif self.encryption == "ssha": 39 | sshaPassword = self.password 40 | else: 41 | log.error("%s: Unsupported password encryption: %s", self.encryption) 42 | sys.exit() 43 | 44 | h = hashlib.sha1(str(username) + ':' + str(sshaPassword) + ':' + str(token_salt)) 45 | h.update(token_salt) 46 | phash = h.hexdigest() 47 | 48 | # Final authentication check 49 | if phash == payload: return (False, None) 50 | 51 | return (True, 'Invalid Credentials') 52 | -------------------------------------------------------------------------------- /mapiproxy/services/ocsmanager/ocsmanager/model/RPCProxyAuthenticateModel.py: -------------------------------------------------------------------------------- 1 | import ldap 2 | import logging 3 | from pylons import config 4 | 5 | from base64 import urlsafe_b64encode as encode 6 | from base64 import urlsafe_b64decode as decode 7 | 8 | log = logging.getLogger(__name__) 9 | 10 | class RPCProxyAuthenticateModel: 11 | 12 | def __init__(self): 13 | self.auth_type = None 14 | self.ldap = {} 15 | self.ldap['host'] = config['ocsmanager']['rpcproxy']['ldap_host'] 16 | self.ldap['post'] = config['ocsmanager']['rpcproxy']['ldap_port'] 17 | self.ldap['basedn'] = config['ocsmanager']['rpcproxy']['ldap_basedn'] 18 | 19 | return 20 | 21 | def Authenticate(self, auth): 22 | """ Authenticate user depending on the authentication type. 23 | Return 0 on success otherwise 1. 24 | """ 25 | if auth is None or len(auth) != 2: 26 | return 1 27 | 28 | if auth[0] == 'Basic': 29 | return self.AuthenticateBasic(auth[1]) 30 | elif auth[0] == 'NTLM': 31 | return self.AuthenticateNTLM(auth[1]) 32 | else: 33 | return 1 34 | 35 | def AuthenticateBasic(self, payload): 36 | """ Implement Basic authentication scheme support. 37 | """ 38 | blob = decode(payload) 39 | credentials = blob.split(':') 40 | if len(credentials[0].split('\\')) == 2: 41 | username = credentials[0].split('\\')[1] 42 | else: 43 | username = credentials[0] 44 | 45 | try: 46 | l = ldap.open(self.ldap['host']) 47 | l.protocol_version = ldap.VERSION3 48 | username = 'CN=%s,%s' % (username, self.ldap['basedn']) 49 | password = credentials[1] 50 | l.simple_bind(username, password) 51 | except ldap.LDAPError, e: 52 | log.debug(e) 53 | return 1 54 | 55 | return 0 56 | 57 | def AuthenticateNTLM(self, payload): 58 | """ Implement NTLM authentication scheme support. 59 | """ 60 | return 1 61 | -------------------------------------------------------------------------------- /mapiproxy/services/web/rpcproxy/rpcproxy.wsgi: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # 3 | # rpcproxy.wsgi -- OpenChange RPC-over-HTTP implementation 4 | # 5 | # Copyright (C) 2012 Julien Kerihuel 6 | # Wolfgang Sourdeau 7 | # 8 | # This program is free software; you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation; either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # This program is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with this program. If not, see . 20 | # 21 | 22 | # this is the WSGI starting point for rpcproxy 23 | 24 | import logging 25 | import traceback 26 | 27 | from openchange.web.auth.NTLMAuthHandler import * 28 | from rpcproxy.RPCProxyApplication import * 29 | 30 | def application(environ, start_response): 31 | 32 | SAMBA_HOST = environ.get('SAMBA_HOST', "127.0.0.1") 33 | RPCPROXY_LOGLEVEL = environ.get('RPCPROXY_LOGLEVEL', logging.INFO) 34 | log_level = logging.getLevelName(RPCPROXY_LOGLEVEL) 35 | 36 | # set a basic logger here for NTLMAuthHandler 37 | logging.basicConfig(level=log_level) 38 | log = logging.getLogger(__name__) 39 | 40 | app = NTLMAuthHandler(RPCProxyApplication(samba_host=SAMBA_HOST, 41 | log_level=log_level)) 42 | try: 43 | return app(environ, start_response) 44 | except Exception as e: 45 | trace = traceback.format_exc() 46 | log.critical("Uncaught exception: %s\n%s", e,trace) 47 | status = "500 Internal Error" 48 | response_headers = [("content-type", "text/plain"), 49 | ("content-length", str(len(status)))] 50 | start_response(status, response_headers) 51 | return status 52 | -------------------------------------------------------------------------------- /setup/AD/oc_provision_schema_possSuperior.ldif: -------------------------------------------------------------------------------- 1 | dn: CN=ms-Exch-Admin-Group,${SCHEMADN} 2 | changetype: modify 3 | add: possSuperiors 4 | possSuperiors: msExchAdminGroupContainer 5 | 6 | dn: CN=ms-Exch-Exchange-Server,${SCHEMADN} 7 | changetype: modify 8 | add: possSuperiors 9 | possSuperiors: msExchServersContainer 10 | 11 | dn: CN=ms-Exch-Connector,${SCHEMADN} 12 | changetype: modify 13 | add: possSuperiors 14 | possSuperiors: msExchConnectors 15 | 16 | dn: CN=ms-Exch-SMTP-Turf-List,${SCHEMADN} 17 | changetype: modify 18 | add: possSuperiors 19 | possSuperiors: msExchMessageDeliveryConfig 20 | 21 | dn: CN=ms-Exch-Conference-Site,${SCHEMADN} 22 | changetype: modify 23 | add: possSuperiors 24 | possSuperiors: msExchConferenceContainer 25 | 26 | dn: CN=ms-Exch-Protocol-Cfg-Shared-Container,${SCHEMADN} 27 | changetype: modify 28 | add: possSuperiors 29 | possSuperiors: protocolCfgSharedServer 30 | 31 | dn: CN=ms-Exch-Protocol-Cfg-Protocol-Container,${SCHEMADN} 32 | changetype: modify 33 | add: possSuperiors 34 | possSuperiors: protocolCfgSharedServer 35 | 36 | dn: CN=ms-Exch-MDB,${SCHEMADN} 37 | changetype: modify 38 | add: possSuperiors 39 | possSuperiors: msExchStorageGroup 40 | 41 | dn: CN=ms-Exch-Connectors,${SCHEMADN} 42 | changetype: modify 43 | add: possSuperiors 44 | possSuperiors: msExchRoutingGroup 45 | 46 | dn: CN=ms-Exch-Protocol-Cfg-SMTP-Domain-Container,${SCHEMADN} 47 | changetype: modify 48 | add: possSuperiors 49 | possSuperiors: protocolCfgSMTPServer 50 | 51 | dn: CN=ms-Exch-Protocol-Cfg-SMTP-IP-Address-Container,${SCHEMADN} 52 | changetype: modify 53 | add: possSuperiors 54 | possSuperiors: protocolCfgSMTPServer 55 | 56 | dn: CN=ms-Exch-Chat-Ban,${SCHEMADN} 57 | changetype: modify 58 | add: possSuperiors 59 | possSuperiors: msExchChatVirtualNetwork 60 | 61 | dn: CN=ms-Exch-Chat-Channel,${SCHEMADN} 62 | changetype: modify 63 | add: possSuperiors 64 | possSuperiors: msExchChatVirtualNetwork 65 | 66 | dn: CN=ms-Exch-Chat-User-Class,${SCHEMADN} 67 | changetype: modify 68 | add: possSuperiors 69 | possSuperiors: msExchChatVirtualNetwork 70 | 71 | dn: CN=ms-Exch-MCU,${SCHEMADN} 72 | changetype: modify 73 | add: possSuperiors 74 | possSuperiors: msExchMCUContainer 75 | -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Run this script to build openchange from SVN 4 | 5 | ## insert all possible names (only works with 6 | ## autoconf 2.x 7 | TESTAUTOHEADER="autoheader autoheader-2.53 autoheader2.50 autoheader259 autoheader253" 8 | TESTAUTOCONF="autoconf autoconf-2.53 autoconf2.50 autoconf259 autoconf253" 9 | TESTACLOCAL="aclocal aclocal19" 10 | 11 | AUTOHEADERFOUND="0" 12 | AUTOCONFFOUND="0" 13 | ACLOCALFOUND="0" 14 | 15 | ## 16 | ## Look for autoheader 17 | ## 18 | for i in $TESTAUTOHEADER; do 19 | if which $i > /dev/null 2>&1; then 20 | if test `$i --version | head -n 1 | cut -d. -f 2 | tr -d [:alpha:]` -ge 53; then 21 | AUTOHEADER=$i 22 | AUTOHEADERFOUND="1" 23 | break 24 | fi 25 | fi 26 | done 27 | 28 | ## 29 | ## Look for autoconf 30 | ## 31 | 32 | for i in $TESTAUTOCONF; do 33 | if which $i > /dev/null 2>&1; then 34 | if test `$i --version | head -n 1 | cut -d. -f 2 | tr -d [:alpha:]` -ge 53; then 35 | AUTOCONF=$i 36 | AUTOCONFFOUND="1" 37 | break 38 | fi 39 | fi 40 | done 41 | 42 | ## 43 | ## Look for aclocal 44 | ## 45 | for i in $TESTACLOCAL; do 46 | if which $i > /dev/null 2>&1; then 47 | ACLOCAL=$i 48 | ACLOCALFOUND="1" 49 | break 50 | fi 51 | done 52 | 53 | 54 | ## 55 | ## do we have it? 56 | ## 57 | if test "$AUTOCONFFOUND" = "0" -o "$AUTOHEADERFOUND" = "0"; then 58 | echo "$0: need autoconf 2.53 or later to build openchange from SVN" >&2 59 | exit 1 60 | fi 61 | 62 | if test "$ACLOCALFOUND" = "0"; then 63 | echo "$0: aclocal not found" >&2 64 | exit 1 65 | fi 66 | 67 | 68 | rm -rf autom4te*.cache 69 | rm -f configure include/config.h* 70 | 71 | echo "$0: running $ACLOCAL" 72 | $ACLOCAL || exit 1 73 | 74 | echo "$0: running $AUTOHEADER" 75 | $AUTOHEADER || exit 1 76 | 77 | echo "$0: running $AUTOCONF" 78 | $AUTOCONF || exit 1 79 | 80 | 81 | rm -rf autom4te*.cache 82 | 83 | echo "Now run ./configure and gmake" 84 | exit 0 85 | -------------------------------------------------------------------------------- /testprogs/blackbox/test_openchangeclient.py: -------------------------------------------------------------------------------- 1 | import testtools 2 | import unittest 3 | import subprocess 4 | import subunit 5 | from testtools.matchers import DocTestMatches 6 | import sys 7 | 8 | class TestProgram(testtools.TestCase): 9 | 10 | def get_output(self, args, retcode=0): 11 | proc = subprocess.Popen(args, stdin=None, stdout=subprocess.PIPE, 12 | stderr=subprocess.PIPE) 13 | out, err = proc.communicate() 14 | self.assertEqual(retcode, proc.returncode, 15 | "Unexpected return code %d, stdout=%r, stderr=%r" % (proc.returncode, out, err)) 16 | return out, err 17 | 18 | class OpenChangeTestCase(TestProgram): 19 | 20 | progpath = "../../bin/openchangeclient" 21 | 22 | def verify_command_noerrors(self, command, expectedStandardOutput): 23 | out, err = self.get_output(command) 24 | self.assertThat(err, DocTestMatches("")) 25 | self.assertThat(out, DocTestMatches(expectedStandardOutput)) 26 | 27 | def test_help(self): 28 | refout = open("expected_output--help.txt").read() 29 | self.verify_command_noerrors([self.progpath, "--help"], refout) 30 | self.verify_command_noerrors([self.progpath, "-?"], refout) 31 | 32 | def test_version(self): 33 | refout = open("expected_output--version.txt").read() 34 | self.verify_command_noerrors([self.progpath, "--version"], refout) 35 | 36 | def test_usage(self): 37 | refout = open("expected_output--usage.txt").read() 38 | self.verify_command_noerrors([self.progpath, "--usage"], refout) 39 | 40 | def test_ocpf_syntax1(self): 41 | refout = open("expected_output--ocpf-syntax1.txt").read() 42 | self.verify_command_noerrors([self.progpath, "--ocpf-syntax", "--ocpf-file=../../libocpf/examples/sample_appointment.ocpf"], refout) 43 | 44 | def test_ocpf_syntax2(self): 45 | refout = open("expected_output--ocpf-syntax2.txt").read() 46 | self.verify_command_noerrors([self.progpath, "--ocpf-syntax", "--ocpf-file=../../libocpf/examples/sample_task.ocpf"], refout) 47 | 48 | if __name__ == '__main__': 49 | unittest.main() 50 | -------------------------------------------------------------------------------- /testprogs/blackbox/test_mapiprofile.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Black tests for mapiprofile 3 | # Copyright (C) 2009 Julien Kerihuel 4 | 5 | if [ $# -lt 4 ]; then 6 | cat <MAPI objects 5 | 6 | Almost any MAPI data you access, read or edit is associated with an 7 | object. No matter whether you intend to browse mailbox hierarchy, open 8 | folders, create tables or access items (messages, appointments, 9 | contacts, tasks, notes), you will have to initialize and use MAPI 10 | objects: object understanding and manipulation is 11 | fundamental. 12 | 13 | - When developing MAPI clients with Microsoft framework, instantiated 14 | objects inherit from parent classes. As a matter of fact, developers 15 | know which methods they can apply to objects and we suppose it makes 16 | their life easier. 17 | - In OpenChange, objects are opaque. They are generic data structures 18 | which content is set and accessed through MAPI public 19 | functions. Therefore, Linux MAPI developers must know what they are 20 | doing. 21 | 22 | An example of MAPI object manipulation is shown below: 23 | \code 24 | mapi_object obj_store; 25 | 26 | [...] 27 | 28 | mapi_object_init(&obj_store); 29 | retval = OpenMsgStore(&obj_store); 30 | if (retval != MAPI_E_SUCCESS) { 31 | mapi_errstr("OpenMsgStore", GetLastError()); 32 | exit (1); 33 | } 34 | mapi_object_release(&obj_store); 35 | \endcode 36 | 37 |

MAPI Handles

38 | 39 | Beyond memory management considerations, understanding MAPI handles 40 | role in object manipulation provides a better understanding why 41 | mapi_object_release() matters. 42 | 43 | Handles are temporary identifiers returned by Exchange when you access 44 | or create objects on the server. They are used to make reference to a 45 | particular object all along its session lifetime. They are stored in 46 | unsigned integers, are unique for each object but temporary along MAPI 47 | session. Handles are the only links between objects accessed on the 48 | client side and efficiently stored on the server side. 49 | 50 | Although OpenChange MAPI makes handles manipulation transparent for 51 | developers, mapi_object_release() frees both the allocated memory 52 | for the object on client side, but also releases the object on the 53 | server. 54 | 55 | */ 56 | -------------------------------------------------------------------------------- /libexchange2ical/libexchange2ical.c: -------------------------------------------------------------------------------- 1 | /* 2 | Convert Exchange appointments to ICAL 3 | 4 | OpenChange Project 5 | 6 | Copyright (C) Julien Kerihuel 2008 7 | 8 | This program is free software; you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation; either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . 20 | */ 21 | 22 | #include "libexchange2ical/libexchange2ical.h" 23 | 24 | 25 | icalcomponent * Exchange2Ical(mapi_object_t *obj_folder) 26 | { 27 | struct exchange2ical_check exchange2ical_check; 28 | exchange2ical_check.eFlags=EntireFlag; 29 | 30 | return _Exchange2Ical(obj_folder, &exchange2ical_check); 31 | } 32 | 33 | 34 | icalcomponent * Exchange2IcalRange(mapi_object_t *obj_folder, struct tm *begin, struct tm *end) 35 | { 36 | struct exchange2ical_check exchange2ical_check; 37 | exchange2ical_check.eFlags=RangeFlag; 38 | exchange2ical_check.begin = begin; 39 | exchange2ical_check.end = end; 40 | return _Exchange2Ical(obj_folder, &exchange2ical_check); 41 | } 42 | 43 | 44 | icalcomponent *Exchange2IcalEvent(mapi_object_t *obj_folder, struct GlobalObjectId *GlobalObjectId, uint32_t Sequence) 45 | { 46 | struct exchange2ical_check exchange2ical_check; 47 | exchange2ical_check.eFlags=EventFlag; 48 | exchange2ical_check.GlobalObjectId=GlobalObjectId; 49 | exchange2ical_check.Sequence=Sequence; 50 | return _Exchange2Ical(obj_folder, &exchange2ical_check); 51 | } 52 | 53 | 54 | icalcomponent *Exchange2IcalEvents(mapi_object_t *obj_folder, struct GlobalObjectId *GlobalObjectId) 55 | { 56 | struct exchange2ical_check exchange2ical_check; 57 | exchange2ical_check.eFlags=EventsFlag; 58 | exchange2ical_check.GlobalObjectId=GlobalObjectId; 59 | return _Exchange2Ical(obj_folder, &exchange2ical_check); 60 | } 61 | -------------------------------------------------------------------------------- /testprogs/blackbox/subunit.sh: -------------------------------------------------------------------------------- 1 | # 2 | # subunit.sh: shell functions to report test status via the subunit protocol. 3 | # Copyright (C) 2006 Robert Collins 4 | # Copyright (C) 2008 Jelmer Vernooij 5 | # 6 | # This program is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 2 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program; if not, write to the Free Software 18 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | # 20 | 21 | subunit_start_test () { 22 | # emit the current protocol start-marker for test $1 23 | echo "test: $1" 24 | } 25 | 26 | 27 | subunit_pass_test () { 28 | # emit the current protocol test passed marker for test $1 29 | echo "success: $1" 30 | } 31 | 32 | 33 | subunit_fail_test () { 34 | # emit the current protocol fail-marker for test $1, and emit stdin as 35 | # the error text. 36 | # we use stdin because the failure message can be arbitrarily long, and this 37 | # makes it convenient to write in scripts (using <&1` 60 | status=$? 61 | if [ x$status = x0 ]; then 62 | subunit_pass_test "$name" 63 | else 64 | echo "$output" | subunit_fail_test "$name" 65 | fi 66 | return $status 67 | } 68 | -------------------------------------------------------------------------------- /libmapi/mapi_notification.h: -------------------------------------------------------------------------------- 1 | /* 2 | OpenChange MAPI implementation. 3 | 4 | Copyright (C) Julien Kerihuel 2007. 5 | 6 | This program is free software; you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | */ 19 | 20 | #ifndef __MAPI_NOTIFICATION_H__ 21 | #define __MAPI_NOTIFICATION_H__ 22 | 23 | /* notification which takes: 24 | * - ulEvenType = type of notification 25 | * - void * = notification data 26 | * - void * = private data pointer 27 | */ 28 | typedef int (*mapi_notify_callback_t)(uint16_t, void *, void *); 29 | 30 | typedef int (*mapi_notify_continue_callback_t)(void *); 31 | 32 | struct notifications { 33 | uint32_t ulConnection; /* connection number */ 34 | uint32_t NotificationFlags; /* events mask associated */ 35 | mapi_id_t parentID; /* parent EntryID == FID here */ 36 | mapi_notify_callback_t callback; /* callback to run when */ 37 | void *private_data; /* private data for the callback */ 38 | struct mapi_object obj_notif; /* notification object */ 39 | struct notifications *prev; 40 | struct notifications *next; 41 | }; 42 | 43 | struct mapi_notify_ctx { 44 | struct NOTIFKEY key; /* unique identifier */ 45 | int fd; /* UDP socket file descriptor */ 46 | struct sockaddr *addr; 47 | struct notifications *notifications; 48 | }; 49 | 50 | struct mapi_notify_continue_callback_data { 51 | mapi_notify_continue_callback_t callback; /* Consulted for continuing processing events*/ 52 | void *data; /* Data for callback */ 53 | struct timeval tv; /* Timeout for Select call */ 54 | }; 55 | 56 | #define DFLT_NOTIF_PORT 2500 57 | 58 | #endif /*!__MAPI_NOTIFICATION_H__ */ 59 | -------------------------------------------------------------------------------- /utils/openchangepfadmin.h: -------------------------------------------------------------------------------- 1 | /* 2 | Public Folders Administration Tool 3 | 4 | OpenChange Project 5 | 6 | Copyright (C) Julien Kerihuel 2007 7 | 8 | This program is free software; you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation; either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . 20 | */ 21 | 22 | #ifndef __OPENCHANGEPFADMIN_H__ 23 | #define __OPENCHANGEPFADMIN_H__ 24 | 25 | #define DEFAULT_PROFDB "%s/.openchange/profiles.ldb" 26 | 27 | struct aclrights { 28 | const char *name; 29 | uint32_t value; 30 | }; 31 | 32 | const struct aclrights aclrights[] = { 33 | {"RightsNone", 0x00000000}, 34 | {"RightsReadItems", 0x00000001}, 35 | {"RightsCreateItems", 0x00000002}, 36 | {"RightsEditOwn", 0x00000008}, 37 | {"RightsDeleteOwn", 0x00000010}, 38 | {"RightsEditAll", 0x00000020}, 39 | {"RightsDeleteAll", 0x00000040}, 40 | {"RightsCreateSubfolders", 0x00000080}, 41 | {"RightsFolderOwner", 0x00000100}, 42 | {"RightsFolderContact", 0x00000200}, 43 | {"RoleNone", 0x00000400}, 44 | {"RoleReviewer", 0x00000401}, 45 | {"RoleContributor", 0x00000402}, 46 | {"RoleNoneditingAuthor", 0x00000413}, 47 | {"RoleAuthor", 0x0000041B}, 48 | {"RoleEditor", 0x0000047B}, 49 | {"RolePublishAuthor", 0x0000049B}, 50 | {"RolePublishEditor", 0x000004FB}, 51 | {"RightsAll", 0x000005FB}, 52 | {"RoleOwner", 0x000007FB}, 53 | {NULL, 0} 54 | }; 55 | 56 | const char * IPF_class[] = { IPF_APPOINTMENT, 57 | IPF_CONTACT, 58 | IPF_JOURNAL, 59 | IPF_NOTE, 60 | IPF_STICKYNOTE, 61 | IPF_TASK, 62 | IPF_POST, 63 | NULL}; 64 | 65 | #endif /* __OPENCHANGEPFADMIN_H__ */ 66 | -------------------------------------------------------------------------------- /utils/openchange-tools.h: -------------------------------------------------------------------------------- 1 | /* 2 | OpenChange Tools includes 3 | 4 | OpenChange Project 5 | 6 | Copyright (C) Julien Kerihuel 2007 7 | 8 | This program is free software; you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation; either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . 20 | */ 21 | 22 | #ifndef __OPENCHANGETOOLS_H__ 23 | #define __OPENCHANGETOOLS_H__ 24 | 25 | #include 26 | 27 | #define DEFAULT_PROFDB "%s/.openchange/profiles.ldb" 28 | #define DEFAULT_TDB "%s/.openchange/index.tdb" 29 | #define DEFAULT_MBOX "%s/.openchange/mbox" 30 | #define DEFAULT_ICAL "%s/.openchange/ical" 31 | #define DEFAULT_VCF "%s/.openchange/vcf" 32 | #define DEFAULT_DIR "%s/.openchange" 33 | 34 | #ifndef __BEGIN_DECLS 35 | #ifdef __cplusplus 36 | #define __BEGIN_DECLS extern "C" { 37 | #define __END_DECLS } 38 | #else 39 | #define __BEGIN_DECLS 40 | #define __END_DECLS 41 | #endif 42 | #endif 43 | 44 | /* Common popt structures for tool */ 45 | extern struct poptOption popt_openchange_version[]; 46 | 47 | #define POPT_OPENCHANGE_VERSION { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_openchange_version, 0, "Common openchange options:", NULL }, 48 | 49 | #ifndef _PUBLIC_ 50 | #define _PUBLIC_ 51 | #endif 52 | 53 | __BEGIN_DECLS 54 | _PUBLIC_ enum MAPISTATUS octool_message(TALLOC_CTX *, mapi_object_t *); 55 | _PUBLIC_ void *octool_get_propval(struct SRow *, uint32_t); 56 | _PUBLIC_ enum MAPISTATUS octool_get_body(TALLOC_CTX *, mapi_object_t *, 57 | struct SRow *, DATA_BLOB *); 58 | _PUBLIC_ enum MAPISTATUS octool_get_stream(TALLOC_CTX *mem_ctx, 59 | mapi_object_t *obj_stream, 60 | DATA_BLOB *body); 61 | _PUBLIC_ struct mapi_session *octool_init_mapi(struct mapi_context *, const char *, const char *, uint32_t); 62 | __END_DECLS 63 | 64 | #endif /*!__OPENCHANGETOOLS_H__ */ 65 | -------------------------------------------------------------------------------- /libocpf/examples/sample_appointment.ocpf: -------------------------------------------------------------------------------- 1 | /* 2 | * OpenChange Property File 3 | * 4 | * Copyright (C) Julien Kerihuel 2008. 5 | * 6 | * Sample appointment 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see 20 | */ 21 | 22 | TYPE "IPM.Appointment" 23 | 24 | FOLDER "olFolderCalendar" 25 | 26 | OLEGUID PSETID_Appointment "00062002-0000-0000-c000-000000000046" 27 | OLEGUID PSETID_Common "00062008-0000-0000-c000-000000000046" 28 | OLEGUID PS_PUBLIC_STRINGS "00020329-0000-0000-c000-000000000046" 29 | 30 | SET $subject = "[OCPF] Julien Kerihuel Birthday" 31 | SET $start_date = T2008-03-06 22:00:00 32 | SET $end_date = T2008-03-06 23:45:00 33 | SET $reminder = 45 34 | SET $keywords = { "candles", "friends", "family" } 35 | SET $private = B"true" 36 | SET $wrong = 0 37 | 38 | PROPERTY { 39 | PR_CONVERSATION_TOPIC = $subject 40 | PR_NORMALIZED_SUBJECT = $subject 41 | PR_BODY = "Another year, another pleasure" 42 | PR_START_DATE = $start_date 43 | PR_END_DATE = $end_date 44 | PR_SENSITIVITY = 2 45 | }; 46 | 47 | NPROPERTY { 48 | OOM:BusyStatus:PSETID_Appointment = 9 49 | 50 | OOM:ApptStartDate:PSETID_Appointment = $start_date 51 | OOM:CommonStart:PSETID_Common = $start_date 52 | OOM:ApptEndDate:PSETID_Appointment = $end_date 53 | OOM:CommonEnd:PSETID_Common = $end_date 54 | 55 | OOM:Location:PSETID_Appointment = W"Home Sweet Home" 56 | 57 | /* MeetingStatus */ 58 | MNID_ID:0x8217:PSETID_Appointment = $wrong 59 | 60 | OOM:Private:PSETID_Common = $private 61 | 62 | /* Set a reminder */ 63 | MNID_ID:0x8501:PT_LONG:PSETID_Common = $reminder 64 | 65 | /* Add categories */ 66 | MNID_STRING:"Keywords":PS_PUBLIC_STRINGS = $keywords 67 | }; -------------------------------------------------------------------------------- /libmapi++/src/message.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | libmapi C++ Wrapper 3 | Message class implementation 4 | 5 | Copyright (C) Alan Alvarez 2008. 6 | 7 | This program is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . 19 | */ 20 | 21 | #include 22 | 23 | namespace libmapipp { 24 | 25 | message::attachment_container_type message::fetch_attachments() 26 | { 27 | mapi_object_t attachment_table; 28 | 29 | mapi_object_init(&attachment_table); 30 | if (GetAttachmentTable(&m_object, &attachment_table) != MAPI_E_SUCCESS) { 31 | mapi_object_release(&attachment_table); 32 | throw mapi_exception(GetLastError(), "message::fetch_attachments : GetAttachmentTable"); 33 | } 34 | 35 | SPropTagArray* property_tag_array = set_SPropTagArray(m_session.get_memory_ctx(), 0x1, PR_ATTACH_NUM); 36 | 37 | if (SetColumns(&attachment_table, property_tag_array) != MAPI_E_SUCCESS) { 38 | MAPIFreeBuffer(property_tag_array); 39 | mapi_object_release(&attachment_table); 40 | throw mapi_exception(GetLastError(), "message::fetch_attachments : SetColumns"); 41 | } 42 | 43 | MAPIFreeBuffer(property_tag_array); 44 | 45 | SRowSet row_set; 46 | attachment_container_type attachment_container; 47 | 48 | while( (QueryRows(&attachment_table, 0x32, TBL_ADVANCE, &row_set) == MAPI_E_SUCCESS) && row_set.cRows) { 49 | for (unsigned int i = 0; i < row_set.cRows; ++i) { 50 | try { 51 | attachment_container.push_back(attachment_shared_ptr(new attachment(*this, row_set.aRow[i].lpProps[0].value.l))); 52 | } 53 | catch(mapi_exception e) { 54 | mapi_object_release(&attachment_table); 55 | throw; 56 | } 57 | } 58 | } 59 | mapi_object_release(&attachment_table); 60 | 61 | return attachment_container; 62 | } 63 | 64 | } // namespace libmapipp 65 | -------------------------------------------------------------------------------- /pyopenchange/tests/mapistore_sogo.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | # NOTE: 4 | # 5 | # For this test, we are running the whole environment on a different 6 | # server: imap, ldap, postgresql, postfix, openchange, samba and sogo. 7 | # We have configured SOGo backend locally and adjusted defaults to 8 | # connect to this remote server. 9 | # 10 | # Finally we are accessing the openchange.ldb file through sshfs and 11 | # map it at the top of the checkout within private folder: 12 | # sshfs openchange@ip_addr:/usr/local/samba/private private 13 | # We have also adjusted the permissions to allow openchange user to 14 | # read/write openchange.ldb file remotely. 15 | # 16 | # Do not forget to run memcached with the user account running the 17 | # script. 18 | # 19 | 20 | import os 21 | import sys 22 | import time 23 | 24 | sys.path.append("python") 25 | 26 | import openchange.mapistore as mapistore 27 | 28 | dirname = "/usr/local/samba/private/mapistore" 29 | if not os.path.exists(dirname): 30 | os.mkdir("/usr/local/samba/private/mapistore") 31 | 32 | mapistore.set_mapping_path(dirname) 33 | MAPIStore = mapistore.mapistore(syspath="/usr/local/samba/private") 34 | MAPICtx = MAPIStore.add_context("sogo://Administrator:Administrator@inbox/", "Administrator") 35 | Inbox = MAPICtx.open() 36 | identifier = MAPICtx.add_subscription("sogo://Administrator:Administrator@inbox/", False, 0x2) 37 | while 1: 38 | time.sleep(1) 39 | MAPICtx.get_notifications() 40 | 41 | time.sleep(15) 42 | MAPICtx.delete_subscription("sogo://Administrator:Administrator@inbox/", False, 0x2, identifier) 43 | 44 | #Calendar = MAPIStore.add_context("sogo://Administator:Administrator@inbox/", "Administrator").open() 45 | #time.sleep(5) 46 | #print Calendar.folder_count 47 | #time.sleep(5) 48 | #MAPICtx = MAPIStore.add_context("sogo://Administrator:Administrator@inbox/", "GoodAdmin") 49 | Inbox.create_folder(name="Test") 50 | time.sleep(15) 51 | NewCalender = MAPICtx.open() 52 | 53 | print "[I] We have %d sub folders, %d messages and %d fai messages within %s" % (Inbox.folder_count, 54 | Inbox.message_count, 55 | Inbox.fai_message_count, 56 | hex(Inbox.fid)) 57 | MAPIStore.delete_context(MAPICtx) 58 | 59 | -------------------------------------------------------------------------------- /mapiproxy/services/ocsmanager/ocsmanager.ini: -------------------------------------------------------------------------------- 1 | # 2 | # ocsmanager - Pylons configuration 3 | # 4 | # The %(here)s variable will be replaced with the parent directory of this file 5 | # 6 | [DEFAULT] 7 | debug = true 8 | email_to = you@yourdomain.com 9 | smtp_server = localhost 10 | error_email_from = paste@localhost 11 | 12 | [main] 13 | # Possible authentication system 14 | # auth = file 15 | #auth = ldap 16 | auth = single 17 | mapistore_root = /var/lib/samba/private 18 | mapistore_data = /var/lib/samba/private/mapistore 19 | debug = no 20 | 21 | [auth:file] 22 | #file = 23 | 24 | [auth:ldap] 25 | host = ldap://xxx 26 | port = 489 27 | bind_dn = 28 | bind_pw = 29 | basedn = 30 | #filter = (cn=%s) 31 | #attrs = userPassword, x-isActive 32 | 33 | [auth:single] 34 | username = openchange 35 | # password is test 36 | password = {SSHA}I6Hy5Wv0wuxyXvMBFWFQDVVN12_CLaX9 37 | 38 | [server:main] 39 | use = egg:Paste#http 40 | host = 127.0.0.1 41 | port = 5000 42 | protocol_version = HTTP/1.1 43 | 44 | [app:main] 45 | use = egg:ocsmanager 46 | full_stack = true 47 | static_files = true 48 | cache_dir = %(here)s/data 49 | beaker.session.key = ocsmanager 50 | beaker.session.secret = SDyKK3dKyDgW0mlpqttTMGU1f 51 | app_instance_uuid = {ee533ebc-f266-49d1-ae10-d017ee6aa98c} 52 | NTLMAUTHHANDLER_WORKDIR = /var/cache/ntlmauthhandler 53 | SAMBA_HOST = 127.0.0.1 54 | 55 | [rpcproxy:ldap] 56 | host = localhost 57 | port = 389 58 | basedn = CN=Users,DC=example,DC=com 59 | 60 | # If you'd like to fine-tune the individual locations of the cache data dirs 61 | # for the Cache data, or the Session saves, un-comment the desired settings 62 | # here: 63 | #beaker.cache.data_dir = %(here)s/data/cache 64 | #beaker.session.data_dir = %(here)s/data/sessions 65 | 66 | # WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* 67 | # Debug mode will enable the interactive debugging tool, allowing ANYONE to 68 | # execute malicious code after an exception is raised. 69 | set debug = false 70 | 71 | 72 | # Logging configuration 73 | [loggers] 74 | keys = root 75 | 76 | [handlers] 77 | keys = console 78 | 79 | [formatters] 80 | keys = generic 81 | 82 | [logger_root] 83 | level = INFO 84 | handlers = console 85 | 86 | [handler_console] 87 | class = StreamHandler 88 | args = (sys.stderr,) 89 | level = NOTSET 90 | formatter = generic 91 | 92 | [formatter_generic] 93 | format = %(asctime)s %(levelname)-5.5s [%(name)s] [%(threadName)s] %(message)s 94 | -------------------------------------------------------------------------------- /setup/openchange_newuser: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # OpenChange provision script 3 | # 4 | # Copyright (C) Jelmer Vernooij 2008 5 | # 6 | # This program is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program. If not, see . 18 | # 19 | 20 | import optparse 21 | import os,sys 22 | 23 | # To allow running from the source directory 24 | sys.path.append("python") 25 | 26 | import openchange 27 | 28 | import samba 29 | import samba.getopt as options 30 | import openchange.provision as openchange 31 | 32 | parser = optparse.OptionParser("openchange_newuser [options] ") 33 | 34 | sambaopts = options.SambaOptions(parser) 35 | parser.add_option_group(sambaopts) 36 | 37 | credopts = options.CredentialsOptions(parser) 38 | parser.add_option_group(credopts) 39 | parser.add_option("--enable", action="store_true", metavar="ENABLE", 40 | help="Enable access to OpenChange server") 41 | parser.add_option("--disable", action="store_true", metavar="DISABLE", 42 | help="Disable access to OpenChange server") 43 | parser.add_option("--create", action="store_true", metavar="CREATE", 44 | help="Create the OpenChange user account") 45 | parser.add_option("--mailbox", action="store_true", metavar="MAILBOX", 46 | help="Create the OpenChange user mailbox") 47 | opts, args = parser.parse_args() 48 | 49 | if len(args) == 0: 50 | parser.print_usage() 51 | sys.exit(1) 52 | 53 | lp = sambaopts.get_loadparm() 54 | creds = credopts.get_credentials(lp) 55 | 56 | def setup_path(*args): 57 | return os.path.join(os.path.dirname(__file__), *args) 58 | 59 | if opts.enable == True: 60 | openchange.accountcontrol(lp, creds, username=args[0], value=0) 61 | 62 | if opts.disable == True: 63 | openchange.accountcontrol(lp, creds, username=args[0], value=2) 64 | 65 | if opts.create == True: 66 | openchange.newuser(lp, creds, username=args[0]) 67 | 68 | if opts.mailbox == True: 69 | print "Mailbox provisioning is now performed automatically at user logon" 70 | 71 | -------------------------------------------------------------------------------- /utils/mapitest/modules/module_oxorule.c: -------------------------------------------------------------------------------- 1 | /* 2 | Stand-alone MAPI testsuite 3 | 4 | OpenChange Project - E-MAIL RULES PROTOCOL operations 5 | 6 | Copyright (C) Julien Kerihuel 2008 7 | 8 | This program is free software; you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation; either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . 20 | */ 21 | 22 | #include "utils/mapitest/mapitest.h" 23 | #include "utils/mapitest/proto.h" 24 | 25 | /** 26 | \file module_oxorule.c 27 | 28 | \brief E-Mail Rules Protocol test suite 29 | */ 30 | 31 | 32 | /** 33 | \details Test the GetRulesTable (0x3f) operation 34 | 35 | This function: 36 | -# Log on the user private mailbox 37 | -# Open the inbox folder 38 | -# Retrieve the rules table 39 | 40 | \param mt pointer on the top-level mapitest structure 41 | 42 | \return true on success, otherwise false 43 | */ 44 | _PUBLIC_ bool mapitest_oxorule_GetRulesTable(struct mapitest *mt) 45 | { 46 | enum MAPISTATUS retval; 47 | bool ret = true; 48 | mapi_object_t obj_store; 49 | mapi_object_t obj_folder; 50 | mapi_object_t obj_rtable; 51 | 52 | /* Step 1. Logon */ 53 | mapi_object_init(&obj_store); 54 | mapi_object_init(&obj_folder); 55 | mapi_object_init(&obj_rtable); 56 | 57 | retval = OpenMsgStore(mt->session, &obj_store); 58 | if (retval != MAPI_E_SUCCESS) { 59 | ret = false; 60 | goto cleanup; 61 | } 62 | 63 | /* Step 2. Open the Inbox folder */ 64 | ret = mapitest_common_folder_open(mt, &obj_store, &obj_folder, olFolderInbox); 65 | if (ret == false) { 66 | goto cleanup; 67 | } 68 | 69 | /* Step 3. Retrieve the rules table */ 70 | retval = GetRulesTable(&obj_folder, &obj_rtable, RulesTableFlags_Unicode); 71 | mapitest_print_retval(mt, "GetRulesTable"); 72 | if (retval != MAPI_E_SUCCESS) { 73 | ret = false; 74 | goto cleanup; 75 | } 76 | 77 | cleanup: 78 | /* Release */ 79 | mapi_object_release(&obj_rtable); 80 | mapi_object_release(&obj_folder); 81 | mapi_object_release(&obj_store); 82 | 83 | return ret; 84 | } 85 | -------------------------------------------------------------------------------- /packaging/rhel/openchange-ocsmanager.init: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ### BEGIN INIT INFO 3 | # Provides: ocsmanager 4 | # Required-Start: $remote_fs $network 5 | # Required-Stop: $remote_fs $network 6 | # Default-Start: 2 3 4 5 7 | # Default-Stop: 0 1 6 8 | # Short-Description: OCSManager server 9 | ### END INIT INFO 10 | 11 | # OCSManager init script for Debian GNU/Linux 12 | # 13 | # Copyright (C) 2012 Inverse inc. 14 | # 15 | # Author: Wolfgang Sourdeau 16 | # 17 | # This file is free software; you can redistribute it and/or modify 18 | # it under the terms of the GNU General Public License as published by 19 | # the Free Software Foundation; either version 2, or (at your option) 20 | # any later version. 21 | # 22 | # This file is distributed in the hope that it will be useful, 23 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 | # GNU General Public License for more details. 26 | # 27 | # You should have received a copy of the GNU General Public License 28 | # along with this program; see the file COPYING. If not, write to 29 | # the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 30 | # Boston, MA 02111-1307, USA. 31 | PATH=/sbin:/bin:/usr/sbin:/usr/bin 32 | 33 | NAME=ocsmanager 34 | DAEMON=/usr/bin/paster 35 | DESC="OCSManager application" 36 | 37 | # OCSManager must be run as root, for now 38 | USER=root 39 | 40 | CONFFILE=/etc/ocsmanager/$NAME.ini 41 | PIDFILE=/var/run/ocsmanager/$NAME.pid 42 | LOGFILE=/var/log/ocsmanager/$NAME.log 43 | 44 | if [ ! -x $DAEMON ]; then 45 | echo "$DAEMON is not executable." 46 | exit 1 47 | fi 48 | 49 | set -e 50 | 51 | case "$1" in 52 | start) 53 | echo "Starting $DESC" 54 | 55 | # Ensure directory's existence and permissions 56 | install -o $USER -g adm -m 755 -d /var/run/$NAME 57 | install -o $USER -g adm -m 750 -d /var/log/$NAME 58 | 59 | $DAEMON serve $CONFFILE --daemon --pid-file $PIDFILE --log-file $LOGFILE || /bin/true 60 | ;; 61 | stop) 62 | echo "Stopping $DESC" 63 | $DAEMON serve $CONFFILE --stop-daemon --pid-file $PIDFILE || /bin/true 64 | ;; 65 | restart|force-reload) 66 | echo "Restarting $DESC" 67 | $DAEMON serve $CONFFILE --stop-daemon --pid-file $PIDFILE || /bin/true 68 | $DAEMON serve $CONFFILE --daemon --pid-file $PIDFILE --log-file $LOGFILE || /bin/true 69 | ;; 70 | status) 71 | $DAEMON serve $CONFFILE --status --pid-file $PIDFILE 72 | ;; 73 | *) 74 | echo "Usage: $NAME {start|stop|restart|status}" >&2 75 | exit 1 76 | ;; 77 | esac 78 | 79 | exit 0 80 | -------------------------------------------------------------------------------- /mapiproxy/services/ocsmanager/ocsmanager/model/AuthenticateModel.py: -------------------------------------------------------------------------------- 1 | from pylons import config 2 | from lxml import etree 3 | import re 4 | 5 | from base64 import urlsafe_b64encode as encode 6 | from base64 import urlsafe_b64decode as decode 7 | 8 | from ocsmanager.model.auth import SingleAuthenticateModel as single 9 | from ocsmanager.lib.utils import validateDocXML 10 | #from ocsmanager.model.auth import LDAPAuthenticateModel as ldap 11 | #from ocsmanager.model.auth import FileAuthenticateModel as mfile 12 | 13 | class AuthenticateModel: 14 | 15 | def __init__(self): 16 | auth_type = config['ocsmanager']['auth']['type'] 17 | if auth_type == 'single': 18 | self.model = single.SingleAuthenticateModel() 19 | # elif auth_type == 'ldap': 20 | # self.model = ldap.LDAPAuthenticateModel() 21 | # elif auth_type == 'file': 22 | # self.model = mfile.FileAuthenticateModel() 23 | else: 24 | log.error('Unsupported authentication scheme: %s', auth_type) 25 | sys.exit() 26 | 27 | def getTokenLoginSalt(self, login): 28 | """Returns the salt of the SSHA user password on success, 29 | otherwise None.""" 30 | return self.model.getSalt(login) 31 | 32 | def getSessionToken(self, payload): 33 | """Validate XML document and extract authentication token from 34 | the payload.""" 35 | (error, xmlData) = validateDocXML(payload) 36 | if error is True: return None 37 | 38 | token = xmlData.find('token') 39 | if token is None: return None 40 | return decode(token.text) 41 | 42 | 43 | 44 | def getTokenLogin(self, payload): 45 | """Validate XML document and retrieve the login from XML payload.""" 46 | (error, xmlData) = validateDocXML(payload) 47 | if error is True: return None 48 | 49 | login = xmlData.find('login') 50 | if login is None: return None 51 | 52 | # Ensure login is made of allowed characters (prevent from injections) 53 | if re.match(r'^[A-Za-z0-9_.@-]+$', login.text) is None: return None 54 | 55 | return login.text 56 | 57 | def verifyPassword(self, login, token_salt, salt, payload): 58 | """Check if the supplied login hash is correct. 59 | """ 60 | (error, xmlData) = validateDocXML(payload) 61 | if error is True: return (error, xmlData) 62 | 63 | token = xmlData.find('token') 64 | if token is None: return (True, 'No token parameter found') 65 | 66 | return self.model.verifyPassword(login, token_salt, salt, token.text) 67 | -------------------------------------------------------------------------------- /mapiproxy/services/ocsmanager/ocsmanager/tests/functional/test_authenticate.py: -------------------------------------------------------------------------------- 1 | from ocsmanager.tests import * 2 | import paste.httpexceptions as httpexceptions 3 | from xml.etree import ElementTree as ET 4 | 5 | class TestAuthenticateController(TestController): 6 | 7 | def test_token(self): 8 | """ Test token function with XML payload using valid username. """ 9 | response = self.app.post(url(controller='authenticate', action='token'), 10 | params={'payload':'jkerihuel'}) 11 | xmlData = ET.XML(response.body) 12 | assert xmlData is not None, "expected valid XML to be returned" 13 | 14 | tokens = xmlData.findall("token") 15 | assert tokens is not None, "No token received" 16 | assert len(tokens) == 2, "2 tokens expected got %d" % len(tokens) 17 | number = 0 18 | for token in tokens: 19 | assert "type" in token.attrib, 'no type option specified: %s' % token.attrib 20 | assert token.text is not None, 'no text value for token type=%s' % token.attrib['type'] 21 | if "type" in token.attrib: 22 | if token.attrib["type"] == "session": number += 1 23 | if token.attrib["type"] == "salt" : number += 1 24 | assert number == 2, "Invalid token types: got %d on 2" % number 25 | 26 | salt = xmlData.find("salt") 27 | assert salt is not None, "No salt received" 28 | 29 | def test_token_no_login(self): 30 | """ Test token function with XML payload without username. """ 31 | response = self.app.post(url(controller='authenticate', action='token'), 32 | params={'payload':''}) 33 | xmlData = ET.XML(response.body) 34 | assert xmlData is not None, "expected valid XML to be returned" 35 | error = xmlData.find('error') 36 | assert error is not None 37 | code = error.attrib['code'] 38 | assert code == '417', "Invalid error code %s, expected 417" % code 39 | 40 | def test_token_no_payload(self): 41 | """ Test token with no payload. Expect error XML with code 417.""" 42 | response = self.app.post(url(controller='authenticate', action='token'), 43 | params='') 44 | xmlData = ET.XML(response.body) 45 | assert xmlData is not None, "expected valid XML to be returned" 46 | error = xmlData.find('error') 47 | assert error is not None 48 | code = error.attrib['code'] 49 | assert code == '417', "Invalid error code %s, expected 417" % code 50 | 51 | -------------------------------------------------------------------------------- /pyopenchange/mapistore/gen_errors.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | import os 4 | from os.path import dirname 5 | import sys 6 | 7 | def parse_equality(line, last_value): 8 | if line[-1] == ",": 9 | line = line[:-1] 10 | 11 | error_name = None 12 | error_value = -1 13 | 14 | equ_idx = line.find("=") 15 | if equ_idx > -1: 16 | error_name = line[0:equ_idx].strip() 17 | error_value = int(line[equ_idx+1:].strip()) 18 | else: 19 | error_name = line.strip() 20 | error_value = last_value + 1 21 | 22 | return (error_name, error_value) 23 | 24 | def read_errors(errors_file): 25 | errors = {} 26 | 27 | in_enum = False 28 | done = False 29 | error_value = -1 30 | 31 | while not done: 32 | line = errors_file.readline().strip() 33 | if in_enum: 34 | if line.find("}") > -1: 35 | done = True 36 | elif line.find("MAPISTORE_") > -1: 37 | (error_name, error_value) \ 38 | = parse_equality(line, error_value) 39 | if error_name is not None: 40 | errors[error_name] = error_value 41 | elif line.find("enum mapistore_error") > -1: 42 | in_enum = True 43 | 44 | return errors 45 | 46 | def output_errors(output_file, errors): 47 | output_file.write("""/* mapistore_errors.c -- auto-generated */ 48 | 49 | #include 50 | #include "pymapistore.h" 51 | 52 | void initmapistore_errors(PyObject *parent_module) 53 | { 54 | PyObject *errors_module; 55 | 56 | errors_module = Py_InitModule3("errors", NULL, 57 | "Error codes of the mapistore operations"); 58 | if (errors_module == NULL) { 59 | return; 60 | } 61 | PyModule_AddObject(parent_module, "errors", errors_module); 62 | 63 | """) 64 | 65 | for error_name, error_value in errors.iteritems(): 66 | error_value = errors[error_name] 67 | output_file.write(" PyModule_AddObject(errors_module, \"%s\"," \ 68 | " PyInt_FromLong(%d));\n" 69 | % (error_name, error_value)) 70 | output_file.write("}\n") 71 | 72 | if __name__ == "__main__": 73 | if len(sys.argv) > 2: 74 | errors_file = open(sys.argv[1]) 75 | errors = read_errors(errors_file) 76 | if sys.argv[2] == "-": 77 | output_file = sys.stdout 78 | close_out = False 79 | else: 80 | output_file = open(sys.argv[2], "w+") 81 | output_errors(output_file, errors) 82 | else: 83 | sys.stderr.write("2 arguments required: mapistore_error.h and output" 84 | " filename (or \"-\")\n") 85 | sys.exit(-1) 86 | -------------------------------------------------------------------------------- /utils/mapitest/modules/module_lcid.c: -------------------------------------------------------------------------------- 1 | /* 2 | Stand-alone MAPI testsuite 3 | 4 | OpenChange Project - MS-LCID tests 5 | 6 | Copyright (C) Brad Hards 2009 7 | 8 | This program is free software; you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation; either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . 20 | */ 21 | 22 | #include "utils/mapitest/mapitest.h" 23 | #include "utils/mapitest/proto.h" 24 | 25 | /** 26 | \file module_lcid.c 27 | 28 | \brief Language Code checks (MS-LCID) 29 | 30 | \note This is low level (internal) checking, and application programmers 31 | do not normally need to deal with the functions checked in this test suite. 32 | */ 33 | 34 | /** 35 | \details Verify libmapi/util/lcid.c functions 36 | 37 | This function: 38 | -# exercises lcid_langcode2langtag() 39 | 40 | \param mt pointer to the top-level mapitest structure 41 | 42 | \return true on success, otherwise false 43 | */ 44 | _PUBLIC_ bool mapitest_lcid_langcode2langtag(struct mapitest *mt) 45 | { 46 | const char *locale; 47 | 48 | locale = mapi_get_locale_from_lcid(0x0409); 49 | if (strcmp(locale, "en_US") != 0) { 50 | mapitest_print(mt, "* %-35s: [FAILURE] - %s\n", "Step 1 - mismatch", locale); 51 | return false; 52 | } else { 53 | mapitest_print(mt, "* %-35s: [SUCCESS]\n", "Step 1"); 54 | } 55 | 56 | locale = mapi_get_locale_from_lcid(0x0439); 57 | if (strcmp(locale, "hi_IN") != 0) { 58 | mapitest_print(mt, "* %-35s: [FAILURE] - %s\n", "Step 2 - mismatch", locale); 59 | return false; 60 | } else { 61 | mapitest_print(mt, "* %-35s: [SUCCESS]\n", "Step 2"); 62 | } 63 | 64 | locale = mapi_get_locale_from_lcid(0x1401); 65 | if (strcmp(locale, "ar_DZ") != 0) { 66 | mapitest_print(mt, "* %-35s: [FAILURE] - %s\n", "Step 3 - mismatch", locale); 67 | return false; 68 | } else { 69 | mapitest_print(mt, "* %-35s: [SUCCESS]\n", "Step 3"); 70 | } 71 | 72 | locale = mapi_get_locale_from_lcid(0x0); 73 | if (locale != NULL) { 74 | mapitest_print(mt, "* %-35s: [FAILURE] - %s\n", "Step 4 - expected NULL", locale); 75 | return false; 76 | } else { 77 | mapitest_print(mt, "* %-35s: [SUCCESS]\n", "Step 4"); 78 | } 79 | return true; 80 | } 81 | 82 | -------------------------------------------------------------------------------- /setup/openchange_provision: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # OpenChange provision script 3 | # 4 | # Copyright (C) Jelmer Vernooij 2008 5 | # 6 | # This program is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program. If not, see . 18 | # 19 | 20 | import optparse 21 | import os,sys 22 | 23 | # To allow running from the source directory 24 | sys.path.append("python") 25 | 26 | import openchange 27 | 28 | import samba 29 | import samba.getopt as options 30 | import openchange.provision as openchange 31 | 32 | parser = optparse.OptionParser("openchange_provision [options]") 33 | 34 | sambaopts = options.SambaOptions(parser) 35 | parser.add_option_group(sambaopts) 36 | 37 | credopts = options.CredentialsOptions(parser) 38 | parser.add_option_group(credopts) 39 | parser.add_option("--firstorg", type="string", metavar="FIRSTORG", 40 | help="set OpenChange First Organization (otherwise First Organization)") 41 | parser.add_option("--firstou", type="string", metavar="FIRSTOU", 42 | help="set OpenChange First Organization Unit (otherwise First Organization Unit)") 43 | parser.add_option("--openchangedb", action="store_true", help="Initialize OpenChange dispatcher database") 44 | parser.add_option("--deprovision", action="store_true", help="Uninstall the Exchange schema and objects from AD") 45 | opts,args = parser.parse_args() 46 | if len(args) != 0: 47 | parser.print_usage() 48 | sys.exit(1) 49 | 50 | lp = sambaopts.get_loadparm() 51 | creds = credopts.get_credentials(lp) 52 | 53 | _setupdir = os.path.dirname(__file__) 54 | if not os.path.exists(os.path.join(_setupdir, "AD")): 55 | _setupdir = samba.param.setup_dir() 56 | 57 | def setup_path(*args): 58 | global _setupdir 59 | return os.path.join(_setupdir, *args) 60 | 61 | if not opts.openchangedb: 62 | if opts.deprovision: 63 | openchange.deprovision(setup_path, lp, creds, firstorg=opts.firstorg, firstou=opts.firstou) 64 | else: 65 | openchange.provision(setup_path, lp, creds, firstorg=opts.firstorg, firstou=opts.firstou) 66 | else: 67 | openchange.openchangedb_provision(lp, firstorg=opts.firstorg, firstou=opts.firstou) 68 | -------------------------------------------------------------------------------- /mapiproxy/libmapistore/mgmt/mapistore_mgmt.idl: -------------------------------------------------------------------------------- 1 | /* 2 | IDL struct for mapistore mgmt interface 3 | */ 4 | 5 | [ 6 | pointer_default(unique) 7 | ] 8 | 9 | interface mapistore_mgmt 10 | { 11 | typedef [enum8bit] enum { 12 | MAPISTORE_COMMAND_NOTIF_REGISTER_PRIO = 26, 13 | MAPISTORE_COMMAND_NOTIF_UNREGISTER_PRIO = 27, 14 | MAPISTORE_COMMAND_NOTIF_SOCKET_REGISTER_PRIO = 28, 15 | MAPISTORE_COMMAND_NOTIF_SOCKET_UNREGISTER_PRIO = 29, 16 | MAPISTORE_COMMAND_USER_REGISTER_PRIO = 30, 17 | MAPISTORE_COMMAND_USER_UNREGISTER_PRIO = 31 18 | } mapistore_mgmt_command_priority; 19 | 20 | typedef [enum16bit] enum { 21 | MAPISTORE_MGMT_SEND = 0x0, 22 | MAPISTORE_MGMT_REGISTER = 0x1, 23 | MAPISTORE_MGMT_UNREGISTER = 0x2 24 | } mapistore_mgmt_status; 25 | 26 | typedef [public] struct { 27 | mapistore_mgmt_status status; 28 | [string, charset(UTF16)] uint16 *backend; 29 | [string, charset(UTF16)] uint16 *username; 30 | [string, charset(UTF16)] uint16 *vuser; 31 | } mapistore_mgmt_user_cmd; 32 | 33 | typedef [public] struct { 34 | [string, charset(UTF16)] uint16 *username; 35 | uint16 cbContext; 36 | [size_is(cbContext)] uint8 rgbContext[*]; 37 | uint16 cbCallbackAddress; 38 | [size_is(cbCallbackAddress)] uint8 rgbCallbackAddress[*]; 39 | } mapistore_mgmt_bind_cmd; 40 | 41 | typedef [public,bitmap16bit] bitmap { 42 | mgmt_notification_type_newmail = 0x2, 43 | mgmt_notification_type_objectcreated = 0x4, 44 | mgmt_notification_type_objectmodified = 0x10, 45 | mgmt_notification_type_Tbit = 0x1000, 46 | mgmt_notification_type_Ubit = 0x2000, 47 | mgmt_notification_type_Mbit = 0x8000 48 | } mapistore_mgmt_notification_type; 49 | 50 | typedef [public] struct { 51 | mapistore_mgmt_status status; 52 | mapistore_mgmt_notification_type NotificationFlags; 53 | [string, charset(UTF16)] uint16 *username; 54 | boolean8 WholeStore; 55 | hyper FolderID; 56 | hyper MessageID; 57 | [string, charset(UTF16)] uint16 *MAPIStoreURI; 58 | uint32 TotalNumberOfMessages; 59 | uint32 UnreadNumberOfMessages; 60 | 61 | } mapistore_mgmt_notification_cmd; 62 | 63 | typedef [enum16bit] enum { 64 | MAPISTORE_MGMT_USER = 0x1, 65 | MAPISTORE_MGMT_BIND = 0x2, 66 | MAPISTORE_MGMT_NOTIF = 0x3 67 | } mapistore_mgmt_command_type; 68 | 69 | typedef [public,switch_type(uint16)] union { 70 | [case(MAPISTORE_MGMT_USER)] mapistore_mgmt_user_cmd user; 71 | [case(MAPISTORE_MGMT_BIND)] mapistore_mgmt_bind_cmd bind; 72 | [case(MAPISTORE_MGMT_NOTIF)] mapistore_mgmt_notification_cmd notification; 73 | } mapistore_mgmt_commands; 74 | 75 | typedef [public] struct { 76 | mapistore_mgmt_command_type type; 77 | [switch_is(type)] mapistore_mgmt_commands command; 78 | } mapistore_mgmt_command; 79 | } -------------------------------------------------------------------------------- /libmapi/async_emsmdb.c: -------------------------------------------------------------------------------- 1 | /* 2 | OpenChange MAPI implementation. 3 | 4 | Copyright (C) Brad Hards 2010. 5 | 6 | This program is free software; you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | */ 19 | 20 | #include "libmapi/libmapi.h" 21 | #include "libmapi/libmapi_private.h" 22 | #include "gen_ndr/ndr_exchange.h" 23 | #include "gen_ndr/ndr_exchange_c.h" 24 | 25 | /** 26 | \file async_emsmdb.c 27 | 28 | \brief Async_EMSMDB stack functions 29 | */ 30 | 31 | /** 32 | \details Create an asynchronous wait call 33 | 34 | This basically "parks" a call on the AsyncEMSMDB interface to allow 35 | asynchronous notification to the client of changes on the server. 36 | This call (probably) won't return immediately, but will return when 37 | the server makes a change, or 300 seconds (5 minutes) elapses. This 38 | call will then need to be re-queued if further change notifications 39 | are wanted. 40 | 41 | \param emsmdb_ctx pointer to the EMSMDB context 42 | \param flagsIn input flags (currently must be 0x00000000) 43 | \param flagsOut output flags (zero for a call completion with no changes, non-zero if there are changes) 44 | 45 | \return MAPI_E_SUCCESS on success, otherwise MAPI error 46 | */ 47 | enum MAPISTATUS emsmdb_async_waitex(struct emsmdb_context *emsmdb_ctx, uint32_t flagsIn, uint32_t *flagsOut) 48 | { 49 | NTSTATUS status; 50 | enum MAPISTATUS retval; 51 | struct EcDoAsyncWaitEx r; 52 | 53 | /* Sanity Checks */ 54 | OPENCHANGE_RETVAL_IF(!emsmdb_ctx, MAPI_E_NOT_INITIALIZED, NULL); 55 | OPENCHANGE_RETVAL_IF(!(emsmdb_ctx->mem_ctx), MAPI_E_NOT_INITIALIZED, NULL); 56 | OPENCHANGE_RETVAL_IF(!(emsmdb_ctx->async_rpc_connection), MAPI_E_NOT_INITIALIZED, NULL); 57 | 58 | r.in.async_handle = &(emsmdb_ctx->async_handle); 59 | r.in.ulFlagsIn = flagsIn; 60 | r.out.pulFlagsOut = flagsOut; 61 | dcerpc_binding_handle_set_timeout(emsmdb_ctx->async_rpc_connection->binding_handle, 400); 62 | status = dcerpc_EcDoAsyncWaitEx_r(emsmdb_ctx->async_rpc_connection->binding_handle, emsmdb_ctx->mem_ctx, &r); 63 | retval = r.out.result; 64 | OPENCHANGE_RETVAL_IF(!NT_STATUS_IS_OK(status), retval, NULL); 65 | OPENCHANGE_RETVAL_IF(retval, retval, NULL); 66 | 67 | return MAPI_E_SUCCESS; 68 | } 69 | -------------------------------------------------------------------------------- /libmapi++/src/session.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | libmapi C++ Wrapper 3 | Session Class implementation. 4 | 5 | Copyright (C) Alan Alvarez 2008. 6 | 7 | This program is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . 19 | */ 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | namespace libmapipp { 26 | 27 | session::session(const std::string& profiledb, bool debug) throw(std::runtime_error, mapi_exception) 28 | : m_session(NULL), m_mapi_context(0), m_memory_ctx(talloc_named(NULL, 0, "libmapipp-session")), m_message_store(new message_store(*this)) 29 | { 30 | mapi_exception::fill_status_map(); 31 | 32 | std::string profile_path; 33 | 34 | // If profile is not provided, attempt to get it from default location 35 | // (~/.openchange/profiles.ldb) 36 | if (profiledb == "") { 37 | profile_path = profile_database::get_default_profile_path(); 38 | if (profile_path == "") { 39 | talloc_free(m_memory_ctx); 40 | delete m_message_store; 41 | throw std::runtime_error("libmapipp::session(): Failed to get $HOME env variable"); 42 | } 43 | } else { 44 | profile_path = profiledb; 45 | } 46 | 47 | if (MAPIInitialize(&m_mapi_context, profile_path.c_str()) != MAPI_E_SUCCESS) { 48 | talloc_free(m_memory_ctx); 49 | delete m_message_store; 50 | throw mapi_exception(GetLastError(), "session::session : MAPIInitialize"); 51 | } 52 | 53 | if (debug) { 54 | m_mapi_context->dumpdata = true; 55 | } 56 | } 57 | 58 | void session::login(const std::string& profile_name, const std::string& password) throw (mapi_exception) 59 | { 60 | m_profile_name = profile_name; 61 | if (m_profile_name == "") { // if profile is not set, try to get default profile 62 | try { 63 | m_profile_name = profile_database().get_default_profile_name(); 64 | } catch(mapi_exception e) { 65 | uninitialize(); 66 | throw; 67 | } 68 | } 69 | 70 | if (MapiLogonEx(m_mapi_context, &m_session, m_profile_name.c_str(), (password != "") ? password.c_str() : 0 ) != MAPI_E_SUCCESS) { 71 | uninitialize(); 72 | throw mapi_exception(GetLastError(), "session::session : MapiLogonEx"); 73 | } 74 | 75 | try { 76 | m_message_store->open(m_session); 77 | } catch (mapi_exception e) { 78 | throw; 79 | } 80 | } 81 | 82 | } // namespace libmapipp 83 | -------------------------------------------------------------------------------- /python/openchange/tests/test_mailbox.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | # OpenChange provisioning 4 | # Copyright (C) Jelmer Vernooij 2009 5 | # 6 | # This program is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program. If not, see . 18 | # 19 | 20 | from openchange.mailbox import NoSuchServer, OpenChangeDB, gen_mailbox_folder_fid 21 | 22 | import os 23 | import unittest 24 | 25 | class OpenChangeDBTests(unittest.TestCase): 26 | """Tests for OpenChangeDB.""" 27 | 28 | def setUp(self): 29 | if os.path.exists("openchange.ldb"): 30 | os.unlink("openchange.ldb") 31 | self.db = OpenChangeDB("openchange.ldb") 32 | self.db.setup() 33 | 34 | def test_user_exists_no_server(self): 35 | self.assertRaises(NoSuchServer, self.db.user_exists, "someserver", "foo") 36 | 37 | def test_server_lookup_doesnt_exist(self): 38 | self.assertRaises(NoSuchServer, self.db.lookup_server, 39 | "nonexistantserver") 40 | 41 | def test_server_lookup(self): 42 | self.db.add_server("dc=blaserver", "blaserver", "firstorg", "firstou") 43 | self.assertEquals("dc=blaserver", str(self.db.lookup_server("blaserver")['dn'])) 44 | 45 | def test_add_mailbox_user(self): 46 | self.db.add_server("cn=myserver", "myserver", "firstorg", "firstou") 47 | self.db.add_mailbox_user("cn=firstorg,cn=firstou,cn=myserver", "someuser") 48 | self.assertTrue(self.db.user_exists("myserver", "someuser")) 49 | 50 | def test_msg_globalcount_initial(self): 51 | self.db.add_server("dc=myserver", "myserver", "firstorg", "firstou") 52 | self.assertEquals(1, self.db.get_message_GlobalCount("myserver")) 53 | 54 | def test_set_msg_globalcount(self): 55 | self.db.add_server("dc=myserver", "myserver", "firstorg", "firstou") 56 | self.db.set_message_GlobalCount("myserver", 42) 57 | self.assertEquals(42, self.db.get_message_GlobalCount("myserver")) 58 | 59 | def test_msg_replicaid_initial(self): 60 | self.db.add_server("dc=myserver", "myserver", "firstorg", "firstou") 61 | self.assertEquals(1, self.db.get_message_ReplicaID("myserver")) 62 | 63 | 64 | class MailboxFIDTests(unittest.TestCase): 65 | 66 | def test_simple(self): 67 | self.assertEquals("0x00000000109282806", gen_mailbox_folder_fid(4242, 534534)) 68 | 69 | -------------------------------------------------------------------------------- /libmapi++/tests/profile_test.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | libmapi C++ Wrapper 3 | 4 | Test application for profile database and profile classes 5 | 6 | Copyright (C) Brad Hards 2010. 7 | 8 | This program is free software; you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation; either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . 20 | */ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | #include 27 | #define PROFILEDB_NAME_TEMPLATE "/tmp/mapidbXXXXXX" 28 | int main () 29 | { 30 | try { 31 | libmapipp::profile_database db; 32 | 33 | std::cout << "default profile name: " << db.get_default_profile_name() << std::endl; 34 | 35 | { 36 | char *tmpname = (char*) calloc(sizeof(PROFILEDB_NAME_TEMPLATE) + 1, sizeof(char)); 37 | strncpy(tmpname, PROFILEDB_NAME_TEMPLATE, sizeof(PROFILEDB_NAME_TEMPLATE)); 38 | int ret = mkstemp(tmpname); 39 | if (ret < 0) { 40 | std::cout << "failed to create temporary file: " << strerror(errno) << std::endl; 41 | } 42 | if (libmapipp::profile_database::create_profile_store(tmpname)) { 43 | std::cout << "success creating a temporary profile store" << std::endl; 44 | } else { 45 | std::cout << "failed to create a temporary profile store" << std::endl; 46 | } 47 | unlink(tmpname); 48 | } 49 | 50 | { 51 | char *tmpname2 = (char*) calloc(sizeof(PROFILEDB_NAME_TEMPLATE) + 1, sizeof(char)); 52 | strncpy(tmpname2, PROFILEDB_NAME_TEMPLATE, sizeof(PROFILEDB_NAME_TEMPLATE)); 53 | int ret = mkstemp(tmpname2); 54 | if (ret < 0) { 55 | std::cout << "failed to create temporary file: " << strerror(errno) << std::endl; 56 | } 57 | if (libmapipp::profile_database::create_profile_store(std::string(tmpname2))) { 58 | std::cout << "success creating a temporary profile store with std::string" << std::endl; 59 | } else { 60 | std::cout << "failed to create a temporary profile store with std::string" << std::endl; 61 | } 62 | unlink(tmpname2); 63 | } 64 | 65 | std::cout << "finished profile and profile database tests" << std::endl; 66 | } 67 | catch (libmapipp::mapi_exception e) // Catch any mapi exceptions 68 | { 69 | std::cout << "MAPI Exception @ main: " << e.what() << std::endl; 70 | } 71 | catch (std::runtime_error e) // Catch runtime exceptions 72 | { 73 | std::cout << "std::runtime_error exception @ main: " << e.what() << std::endl; 74 | 75 | } 76 | 77 | return 0; 78 | } 79 | -------------------------------------------------------------------------------- /libmapi++/examples/messages.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | libmapi C++ Wrapper 3 | 4 | Sample folder message application 5 | 6 | Copyright (C) Brad Hards 2008. 7 | 8 | This program is free software; you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation; either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . 20 | */ 21 | 22 | #include 23 | #include 24 | 25 | #include 26 | 27 | int main () 28 | { 29 | try { 30 | // Initialize MAPI Session 31 | libmapipp::session mapi_session; 32 | // You could log in with a non-default profile here 33 | mapi_session.login(); 34 | 35 | // Get the private (user) folders message store 36 | libmapipp::message_store &msg_store = mapi_session.get_message_store(); 37 | 38 | // We start off by fetching the inbox 39 | mapi_id_t inbox_id = msg_store.get_default_folder(olFolderInbox); 40 | libmapipp::folder inbox_folder(msg_store, inbox_id); 41 | // Now get the messages in this folder These are returned as 42 | // a std::vector of pointers to messages 43 | libmapipp::folder::message_container_type messages = inbox_folder.fetch_messages(); 44 | std::cout << "Inbox contains " << messages.size() << " messages" << std::endl; 45 | 46 | // Work through each message 47 | for (unsigned int i = 0; i < messages.size(); ++i) { 48 | // Get the properties we are interested in 49 | libmapipp::property_container msg_props = messages[i]->get_property_container(); 50 | // We get the "to" addressee, and the subject 51 | // You can get a lot of other properties here (e.g. sender, body, etc). 52 | msg_props << PR_DISPLAY_TO << PR_CONVERSATION_TOPIC; 53 | msg_props.fetch(); 54 | // Display those properties 55 | if (msg_props[PR_DISPLAY_TO] != 0) { 56 | std::cout << "|-----> " << (const char*)msg_props[PR_DISPLAY_TO]; 57 | if(msg_props[PR_CONVERSATION_TOPIC] != 0) { 58 | std::cout << "\t\t| " << (const char*)msg_props[PR_CONVERSATION_TOPIC]; 59 | } 60 | std::cout << std::endl; 61 | } 62 | } 63 | } 64 | catch (libmapipp::mapi_exception e) // Catch any MAPI exceptions 65 | { 66 | std::cout << "MAPI Exception in main: " << e.what() 67 | << std::endl; 68 | } 69 | catch (std::runtime_error e) // Catch any other runtime exceptions 70 | { 71 | std::cout << "std::runtime_error exception in main: " 72 | << e.what() << std::endl; 73 | } 74 | 75 | return 0; 76 | } 77 | -------------------------------------------------------------------------------- /libmapi++/message.h: -------------------------------------------------------------------------------- 1 | /* 2 | libmapi C++ Wrapper 3 | Message Class 4 | 5 | Copyright (C) Alan Alvarez 2008. 6 | 7 | This program is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . 19 | */ 20 | 21 | 22 | #ifndef LIBMAPIPP__MESSAGE_H__ 23 | #define LIBMAPIPP__MESSAGE_H__ 24 | 25 | #include //for debugging 26 | #include 27 | #include 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | namespace libmapipp 36 | { 37 | class attachment; 38 | 39 | /** 40 | * \brief This class represents a %message in Exchange. 41 | * 42 | * It is important to note that a %message is not necessarily an email %message. 43 | * It could be a contact, journal or anything else that is not a folder. 44 | */ 45 | class message : public object { 46 | public: 47 | typedef boost::shared_ptr attachment_shared_ptr; 48 | typedef std::vector attachment_container_type; 49 | 50 | /** 51 | * \brief Constructor 52 | * 53 | * \param mapi_session The session to use to retrieve this %message. 54 | * \param folder_id The id of the folder this %message belongs to. 55 | * \param message_id The %message id. 56 | */ 57 | message(session& mapi_session, const mapi_id_t folder_id, const mapi_id_t message_id) throw(mapi_exception) 58 | : object(mapi_session, "message"), m_folder_id(folder_id), m_id(message_id) 59 | { 60 | if (OpenMessage(&mapi_session.get_message_store().data(), folder_id, message_id, &m_object, 0) != MAPI_E_SUCCESS) 61 | throw mapi_exception(GetLastError(), "message::message : OpenMessage"); 62 | } 63 | 64 | /** 65 | * \brief Fetches all attachments in this %message. 66 | * 67 | * \return A container of attachment shared pointers. 68 | */ 69 | attachment_container_type fetch_attachments(); 70 | 71 | /** 72 | * \brief Get this %message's ID. 73 | */ 74 | mapi_id_t get_id() const { return m_id; } 75 | 76 | /** 77 | * \brief Get this message's parent folder ID. 78 | */ 79 | mapi_id_t get_folder_id() const { return m_folder_id; } 80 | 81 | /** 82 | * Destructor 83 | */ 84 | virtual ~message() throw() 85 | { 86 | } 87 | 88 | private: 89 | mapi_id_t m_folder_id; 90 | mapi_id_t m_id; 91 | 92 | }; 93 | 94 | } // namespace libmapipp 95 | 96 | #endif //!LIBMAPIPP__MESSAGE_H__ 97 | --------------------------------------------------------------------------------