/* * Copyright (c) 2000 Proofpoint, Inc. and its suppliers. * All rights reserved. * * By using this file, you agree to the terms and conditions set * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. */ #include <sm/gen.h> SM_RCSID("@(#)$Id: xtrap.c,v 1.6 2013-11-22 20:51:44 ca Exp $") #include <sm/xtrap.h> SM_ATOMIC_UINT_T SmXtrapCount; SM_DEBUG_T SmXtrapDebug = SM_DEBUG_INITIALIZER("sm_xtrap", "@(#)$Debug: sm_xtrap - raise exception at N'th xtrap point $"); SM_DEBUG_T SmXtrapReport = SM_DEBUG_INITIALIZER("sm_xtrap_report", "@(#)$Debug: sm_xtrap_report - report xtrap count on exit $");
/* undef all macro versions of the "functions" so they can be specified here */ #undef sm_malloc #undef sm_malloc_x #undef sm_malloc_tagged #undef sm_malloc_tagged_x #undef sm_free #undef sm_free_tagged #undef sm_realloc #if SM_HEAP_CHECK # undef sm_heap_register # undef sm_heap_checkptr # undef sm_heap_report #endif /* SM_HEAP_CHECK */ #if SM_HEAP_CHECK SM_DEBUG_T SmHeapCheck = SM_DEBUG_INITIALIZER("sm_check_heap", "@(#)$Debug: sm_check_heap - check sm_malloc, sm_realloc, sm_free calls $"); # define HEAP_CHECK sm_debug_active(&SmHeapCheck, 1) static int ptrhash __P((void *p)); #endif /* SM_HEAP_CHECK */ const SM_EXC_TYPE_T SmHeapOutOfMemoryType = { SmExcTypeMagic, "F:sm.heap", "", sm_etype_printf, "out of memory", }; SM_EXC_T SmHeapOutOfMemory = SM_EXC_INITIALIZER(&SmHeapOutOfMemoryType, NULL);
# include <stdlib.h> # include <unistd.h> # include <sm/bitops.h> # include <sm/clock.h> # include <sm/conf.h> # include <sm/debug.h> # include <sm/errstring.h> # include <sm/ldap.h> # include <sm/string.h> # ifdef EX_OK # undef EX_OK /* for SVr4.2 SMP */ # endif /* EX_OK */ # include <sm/sysexits.h> SM_DEBUG_T SmLDAPTrace = SM_DEBUG_INITIALIZER("sm_trace_ldap", "@(#)$Debug: sm_trace_ldap - trace LDAP operations $"); static void ldaptimeout __P((int)); static bool sm_ldap_has_objectclass __P((SM_LDAP_STRUCT *, LDAPMessage *, char *)); static SM_LDAP_RECURSE_ENTRY *sm_ldap_add_recurse __P((SM_LDAP_RECURSE_LIST **, char *, int, SM_RPOOL_T *)); /* ** SM_LDAP_CLEAR -- set default values for SM_LDAP_STRUCT ** ** Parameters: ** lmap -- pointer to SM_LDAP_STRUCT to clear ** ** Returns: ** None. ** */
*/ #include <signal.h> #include <stdlib.h> #include <unistd.h> #include <sm/assert.h> #include <sm/exc.h> #include <sm/io.h> #include <sm/varargs.h> /* ** Debug categories that are used to guard expensive assertion checks. */ SM_DEBUG_T SmExpensiveAssert = SM_DEBUG_INITIALIZER("sm_check_assert", "@(#)$Debug: sm_check_assert - check assertions $"); SM_DEBUG_T SmExpensiveRequire = SM_DEBUG_INITIALIZER("sm_check_require", "@(#)$Debug: sm_check_require - check function preconditions $"); SM_DEBUG_T SmExpensiveEnsure = SM_DEBUG_INITIALIZER("sm_check_ensure", "@(#)$Debug: sm_check_ensure - check function postconditions $"); /* ** Debug category: send self SIGSTOP on fatal error, ** so that you can run a debugger on the stopped process. */ SM_DEBUG_T SmAbortStop = SM_DEBUG_INITIALIZER("sm_abort_stop", "@(#)$Debug: sm_abort_stop - stop process on fatal error $");