コード例 #1
0
 ~MapiDebug()
 {
     if (m_enabled) {
         if (MAPI_E_SUCCESS != SetMAPIDebugLevel(m_context, 0)) {
             kError() << "cannot reset debug level" << mapiError();
         }
         if (MAPI_E_SUCCESS != SetMAPIDumpData(m_context, false)) {
             kError() << "cannot reset dump data" << mapiError();
         }
     }
 }
コード例 #2
0
ファイル: mapitest.c プロジェクト: ThHirsch/openchange
/**
 * Retrieve server specific information
 */
static bool mapitest_get_server_info(struct mapitest *mt,
				     char *opt_profname,
				     const char *password,
				     bool opt_dumpdata,
				     const char *opt_debug)
{
	TALLOC_CTX		*mem_ctx;
	enum MAPISTATUS		retval;
	struct emsmdb_info	*info = NULL;
	struct mapi_session	*session = NULL;

	/* if the user explicitly asked for just the no-server tests 
	to be run, then we're done here */
	if (mt->no_server == true) return 0;

	mem_ctx = talloc_named(NULL, 0, "mapitest_get_server_info");

	/* if no profile was specified, get the default */
	if (!opt_profname) {
		retval = GetDefaultProfile(mt->mapi_ctx, &opt_profname);
		if (retval != MAPI_E_SUCCESS) {
			mapi_errstr("GetDefaultProfile", retval);
			talloc_free(mem_ctx);
			return false;
		}
	}
		

	/* debug options */
	SetMAPIDumpData(mt->mapi_ctx, opt_dumpdata);

	if (opt_debug) {
		SetMAPIDebugLevel(mt->mapi_ctx, atoi(opt_debug));
	}

	retval = MapiLogonEx(mt->mapi_ctx, &session, opt_profname, password);
	MAPIFreeBuffer(opt_profname);
	talloc_free(mem_ctx);
	if (retval != MAPI_E_SUCCESS) {
		mapi_errstr("MapiLogonEx", retval);
		return false;
	}
	mt->session = session;
	mt->profile = session->profile;

	info = emsmdb_get_info(session);
	memcpy(&mt->info, info, sizeof (struct emsmdb_info));

	/* extract org and org_unit from info.mailbox */
	mt->org = x500_get_dn_element(mt->mem_ctx, info->szDNPrefix, "/o=");
	mt->org_unit = x500_get_dn_element(mt->mem_ctx, info->szDNPrefix, "/ou=");
	
	return true;
}
コード例 #3
0
 MapiDebug(MapiProfiles *context, bool enable) :
     m_context(context->m_context),
     m_enabled(enable)
 {
     if (m_enabled) {
         if (MAPI_E_SUCCESS != SetMAPIDebugLevel(m_context, 9)) {
             kError() << "cannot set debug level" << mapiError();
         }
         if (MAPI_E_SUCCESS != SetMAPIDumpData(m_context, true)) {
             kError() << "cannot set dump data" << mapiError();
         }
     }
 }