/* Generated from "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod" by precompile.pike running Pike v8.0 release 1737
 *
 * Do NOT edit this file.
 */

#undef PRECOMPILE_API_VERSION
#define PRECOMPILE_API_VERSION 6

#undef PRECOMPILE_SUB_PIKEVARS
#define PRECOMPILE_SUB_PIKEVARS 1

#undef PRECOMPILE_DYNAMIC_TYPES
#define PRECOMPILE_DYNAMIC_TYPES 1



#undef cmod___CMOD__
#define cmod___CMOD__ 1
#line 1 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
#line 1 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
#line 1 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
#line 3003 "/home/hww3/pike-git/lib/modules/Tools.pmod/Standalone.pmod/precompile.pike"







#line 3010 "/home/hww3/pike-git/lib/modules/Tools.pmod/Standalone.pmod/precompile.pike"
#line 1 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
#line 1 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
/* -*- c -*-
|| This file is part of Pike. For copyright information see COPYRIGHT.
|| Pike is distributed under GPL, LGPL and MPL. See the file COPYING
|| for more information.
*/

#include "global.h"
#include "stralloc.h"
#include "pike_macros.h"
#include "program.h"
#include "program_id.h"
#include "operators.h"
#include "fdlib.h"
#include "fd_control.h"
#include "backend.h"
#include "module_support.h"
#include "array.h"
#include "builtin_functions.h"
#include "mapping.h"
#include "pike_types.h"
#include "threads.h"
#include "pike_threadlib.h"
#include "dmalloc.h"

#include "zxid_config.h"



#ifndef PIKE_UNUSED_ATTRIBUTE
#define PIKE_UNUSED_ATTRIBUTE
#endif
#define CMOD_MAP_PROGRAM_IDS_DEFINED 1
static int ___cmod_map_program_ids(int id) PIKE_UNUSED_ATTRIBUTE;
#ifndef TYPEOF
/* Compat with older Pikes. */
#define TYPEOF(SVAL)	((SVAL).type)
#define SUBTYPEOF(SVAL)	((SVAL).subtype)
#define SET_SVAL_TYPE(SVAL, TYPE)	(TYPEOF(SVAL) = TYPE)
#define SET_SVAL_SUBTYPE(SVAL, TYPE)	(SUBTYPEOF(SVAL) = TYPE)
#define SET_SVAL(SVAL, TYPE, SUBTYPE, FIELD, EXPR) do {	\
    /* Set the type afterwards to avoid a clobbered	\
     * svalue in case EXPR throws. */			\
    (SVAL).u.FIELD = (EXPR);				\
    SET_SVAL_TYPE((SVAL), (TYPE));			\
    SET_SVAL_SUBTYPE((SVAL), (SUBTYPE));		\
  } while(0)
#endif /* !TYPEOF */
#ifndef PIKE_UNUSED
/* Compat with Pike 7.8 and earlier. */
/* NB: Not strictly correct; PIKE_UNUSED was added the
 *     day after set_program_id_to_id(), but good enough.
 */
#ifndef UNUSED
#define UNUSED(X)	X
#endif
#ifndef set_program_id_to_id
/* NB: Recent Pike 7.8 has a #define that conflicts with
 *     the following declaration.
 */
static void set_program_id_to_id(void*UNUSED(id)){}
#endif
#else /* */
PMOD_EXPORT void set_program_id_to_id( int (*to)(int) );
#endif /* !PIKE_UNUSED */


#ifndef DEFAULT_CMOD_STORAGE
#define CMOD_COND_USED
#define DEFAULT_CMOD_STORAGE static
#endif
#define module_strings_declared
static struct pike_string *module_strings[144] = {
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
};
#ifndef CMOD_COND_USED
# define f_ZXID_version_fun_num_used 1
#else
#undef f_ZXID_version_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_ZXID_Configuration_Session_authenticate_fun_num_used 1
#else
#undef f_ZXID_Configuration_Session_authenticate_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define ZXID_Configuration_Session_program_fun_num_used 1
#else
#undef ZXID_Configuration_Session_program_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_ZXID_Configuration_Session_create_fun_num_used 1
#else
#undef f_ZXID_Configuration_Session_create_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define ZXID_Configuration_program_fun_num_used 1
#else
#undef ZXID_Configuration_program_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_ZXID_Configuration_idp_list_fun_num_used 1
#else
#undef f_ZXID_Configuration_idp_list_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_ZXID_Configuration_create_fun_num_used 1
#else
#undef f_ZXID_Configuration_create_fun_num_used
#endif
#line 29 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
#ifdef HAVE_ZXID

/*! @module ZXID
 *!
 *! ZXID is a library that implements SAML 2.0, Liberty ID-WSF 2.0
 *! and XACML 2.0.
 *!
 *! This module implements a wrapper for ZXID. The interface is similar
 *! to the C one, but using generally accepted Pike syntax.
 */

/* This symbol conflicts with a definition of the same in <zxid/errmac.h>.
 */
#undef GETTIMEOFDAY

/* These defines are needed to get the right size for the zxid_conf struct! */
#define USE_CURL
#define USE_PTHREAD
#define USE_OPENSSL

#include <zxid/zxid.h>

/* Needed for some obscure macros (like ERR, DD, MB, ME, etc). */
#include <zxid/errmac.h>

/* Needed for zxid_new_at(). */
#include <zxid/zxidpriv.h>

/* Needed for zx_md_EntityDescriptor_s. */
/* #include <zxid/zx-md-data.h> */

#include "constants.h"

#ifdef malloc
/* DMALLOC or similar. */
void *malloc_wrapper(size_t bytes)
{
return malloc(bytes);
}
void *realloc_wrapper(void *ptr, size_t bytes)
{
return realloc(ptr, bytes);
}
void free_wrapper(void *ptr)
{
free(ptr);
}
#endif

#ifdef HAVE_STRUCT_ZXID_CONF_BURL
/* These fields were renamed 2013-12-05. */
#define BURL(CONF)	((CONF).burl)
#define CPATH(CONF)	((CONF).cpath)
#define CPATH_LEN(CONF)	((CONF).cpath_len)
#else
#define BURL(CONF)	((CONF).url)
#define CPATH(CONF)	((CONF).path)
#define CPATH_LEN(CONF)	((CONF).path_len)
#endif

#ifndef ERRMAC_INOUT
/* These were renamed 2013-11-13. */
#define errmac_debug	zx_debug
#define ERRMAC_INOUT	ZXID_INOUT
#endif

/*! @class Configuration
 *!
 *! A set of configuration parameters for a ZXID context.
 *!
 *! This is typically overloaded with new definitions
 *! for the various callback functions.
 */

#undef class_ZXID_Configuration_defined
#define class_ZXID_Configuration_defined
DEFAULT_CMOD_STORAGE struct program *ZXID_Configuration_program=NULL;

#ifdef ZXID_Configuration_program_fun_num_used
DEFAULT_CMOD_STORAGE int ZXID_Configuration_program_fun_num=-1;
#endif /* ZXID_Configuration_program_fun_num_used */

#undef var_conf_ZXID_Configuration_defined
#define var_conf_ZXID_Configuration_defined

#undef var_conf_m_ZXID_Configuration_defined
#define var_conf_m_ZXID_Configuration_defined

#undef THIS
#define THIS ((struct ZXID_Configuration_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef THIS_ZXID_CONFIGURATION
#define THIS_ZXID_CONFIGURATION ((struct ZXID_Configuration_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef OBJ2_ZXID_CONFIGURATION
#define OBJ2_ZXID_CONFIGURATION(o) ((struct ZXID_Configuration_struct *)(o->storage+ZXID_Configuration_storage_offset))

#undef GET_ZXID_CONFIGURATION_STORAGE
#define GET_ZXID_CONFIGURATION_STORAGE(o) ((struct ZXID_Configuration_struct *)(o->storage+ZXID_Configuration_storage_offset)
static ptrdiff_t ZXID_Configuration_storage_offset;
struct ZXID_Configuration_struct {

#ifdef var_conf_ZXID_Configuration_defined
#line 103 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
zxid_conf conf;
#endif /* var_conf_ZXID_Configuration_defined */

#ifdef var_conf_m_ZXID_Configuration_defined
  struct mapping * conf_m;

#endif /* var_conf_m_ZXID_Configuration_defined */
};
#ifdef PIKE_DEBUG
/* Ensure the struct is used in a variable declaration, or else gdb might not see it. */
static struct ZXID_Configuration_struct *ZXID_Configuration_gdb_dummy_ptr;
#endif

#undef internal_init_ZXID_Configuration_defined
#define internal_init_ZXID_Configuration_defined

#undef ZXID_Configuration_event_handler_defined
#define ZXID_Configuration_event_handler_defined
static void init_ZXID_Configuration_struct(void)
#line 108 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
{
THIS->conf.ctx = zx_init_ctx();

#ifdef malloc
 /* Support for dmalloc. */
THIS->conf.ctx->malloc_func = malloc_wrapper;
THIS->conf.ctx->realloc_func = realloc_wrapper;
THIS->conf.ctx->free_func = free_wrapper;
#endif

zxid_init_conf(&THIS->conf, NULL);
THIS->conf_m = allocate_mapping(8);
#ifdef USE_CURL
 LOCK(THIS->conf.curl_mx, "curl init");
THIS->conf.curl = curl_easy_init();
UNLOCK(THIS->conf.curl_mx, "curl init");
if (!THIS->conf.curl) {
Pike_error("Failed to init curl bindings.\n");
}
#endif
 }


#undef ZXID_Configuration_gc_live_obj
#define ZXID_Configuration_gc_live_obj

#undef internal_exit_ZXID_Configuration_defined
#define internal_exit_ZXID_Configuration_defined

#undef ZXID_Configuration_event_handler_defined
#define ZXID_Configuration_event_handler_defined
static void exit_ZXID_Configuration_struct(void)
#line 130 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
{
struct zx_ctx *ctx = THIS->conf.ctx;

zxid_free_conf(&THIS->conf);

zx_free_ctx(ctx);
}

/*! @decl void create(string|mapping(string(0..255):string(0..255)) conf)
   *!
   *!   Create a new @[Configuration].
   *!
   *! @param conf
   *!   ZXID configuration parameters. Either as a
   *!   configuration string (as per the ZXID book chapter 7 and 10),
   *!   or as a mapping of parameter settings. These are the most
   *!   common parameters:
   *!   @mapping
   *!     @member string(0..255) "PATH"
   *!       Path to the directory containing the @expr{"zxid.conf"@}
   *!       file.
   *!     @member string(0..255) "URL"
   *!       URL of the SP.
   *!     @member string(0..255) "CDC_URL"
   *!       The Common Domain URL.
   *!   @endmapping
   */
#define f_ZXID_Configuration_create_defined

#ifdef f_ZXID_Configuration_create_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_ZXID_Configuration_create_fun_num = 0;

#endif /* f_ZXID_Configuration_create_fun_num_used */
DEFAULT_CMOD_STORAGE void f_ZXID_Configuration_create(INT32 args) {
#line 157 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
struct mapping * conf;
#line 157 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
if(args != 1) wrong_number_of_args_error("create",args,1);
#line 157 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
if(TYPEOF(Pike_sp[0-1]) != PIKE_T_MAPPING) SIMPLE_ARG_TYPE_ERROR("create",1,"mapping(string(0..255):string(0..255))");
#line 157 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
debug_malloc_pass(conf=Pike_sp[0-1].u.mapping);
#line 159 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
{
struct svalue *s;

#define LOW_CHECK_ARG(ARG, CHECK, CODE) do {			\
      if ((s = low_mapping_string_lookup(conf, (ARG))) &&	\
	  (CHECK)) {						\
	CODE;							\
      }								\
    } while(0)

#define CHECK_ARG_KEEP(ARG, CHECK, CODE)			\
    LOW_CHECK_ARG(ARG, CHECK,					\
		  do {						\
		    mapping_string_insert(THIS->conf_m,		\
					  (ARG), s);		\
		    CODE;					\
		  } while(0))

#define CHECK_ARG_STRING(ARG, FIELD)				\
    CHECK_ARG_KEEP(ARG, ((TYPEOF(*s) == PIKE_T_STRING) &&	\
			!s->u.string->size_shift),		\
		   (FIELD) = s->u.string->str)

#define CHECK_ARG_STRING_VOID(ARG, FIELD)			\
    CHECK_ARG_KEEP(ARG, (((TYPEOF(*s) == PIKE_T_STRING) &&	\
			  !s->u.string->size_shift) ||		\
			 ((TYPEOF(*s) == PIKE_T_INT) &&		\
			  !s->u.integer)),			\
			 do {					\
			   if (TYPEOF(*s) == PIKE_T_STRING) {	\
			     (FIELD) = s->u.string->str;	\
			   } else {				\
			     (FIELD) = NULL;			\
			   }					\
			 } while(0))

#define CHECK_ARG_CHAR(ARG, FIELD) 				\
    LOW_CHECK_ARG(ARG, ((TYPEOF(*s) == PIKE_T_STRING) &&	\
			!s->u.string->size_shift &&		\
			s->u.string->len),			\
		  (FIELD) = s->u.string->str[0])

#define CHECK_ARG_INT(ARG, FIELD) 				\
    LOW_CHECK_ARG(ARG, (TYPEOF(*s) == PIKE_T_INT),		\
		  (FIELD) = s->u.integer)

#define CHECK_ARG_PARSER_FUNC(ARG, FIELD, FUNC)			\
    LOW_CHECK_ARG(ARG,((TYPEOF(*s) == PIKE_T_STRING) &&		\
		       !s->u.string->size_shift),		\
		  (FIELD) = (FUNC)(&THIS->conf, (FIELD),	\
				   s->u.string->str))

#define CHECK_ARG_MAP(ARG, FIELD)				\
    CHECK_ARG_PARSER_FUNC(ARG, FIELD, zxid_load_map)

#define CHECK_ARG_NEED(ARG, FIELD)				\
    CHECK_ARG_PARSER_FUNC(ARG, FIELD, zxid_load_need)

#define CHECK_ARG_CSTR_LIST(ARG, FIELD)				\
    CHECK_ARG_PARSER_FUNC(ARG, FIELD, zxid_load_cstr_list)

CHECK_ARG_INT(module_strings[0] /* "AUTO_CERT" */, THIS->conf.auto_cert);
CHECK_ARG_INT(module_strings[1] /* "AUTHN_REQ_SIGN" */, THIS->conf.authn_req_sign);
CHECK_ARG_INT(module_strings[2] /* "ACT" */, THIS->conf.log_act);
CHECK_ARG_INT(module_strings[3] /* "ACT_IN_ERR" */, THIS->conf.log_err_in_act);
CHECK_ARG_INT(module_strings[4] /* "AUDIENCE_FATAL" */, THIS->conf.audience_fatal);
CHECK_ARG_INT(module_strings[5] /* "AFTER_SLOP" */, THIS->conf.after_slop);
CHECK_ARG_STRING(module_strings[6] /* "ANON_OK" */, THIS->conf.anon_ok);
CHECK_ARG_STRING(module_strings[7] /* "AN_PAGE" */, THIS->conf.an_page);
CHECK_ARG_STRING(module_strings[8] /* "AN_TEMPL_FILE" */, THIS->conf.an_templ_file);
CHECK_ARG_STRING(module_strings[9] /* "AN_TEMPL" */, THIS->conf.an_templ);
CHECK_ARG_STRING(module_strings[10] /* "ATSEL_PAGE" */, THIS->conf.atsel_page);
LOW_CHECK_ARG(module_strings[11] /* "ATTRSRC" */,
((TYPEOF(*s) == PIKE_T_STRING) && !s->u.string->size_shift),
THIS->conf.attrsrc =
zxid_load_atsrc(&THIS->conf, THIS->conf.attrsrc,
s->u.string->str));
CHECK_ARG_INT(module_strings[12] /* "A7NTTL" */, THIS->conf.a7nttl);
CHECK_ARG_INT(module_strings[13] /* "AS_ENA" */, THIS->conf.as_ena);
CHECK_ARG_INT(module_strings[14] /* "AZ_OPT" */, THIS->conf.az_opt);
CHECK_ARG_INT(module_strings[15] /* "BEFORE_SLOP" */, THIS->conf.before_slop);
CHECK_ARG_INT(module_strings[16] /* "BOOTSTRAP_LEVEL" */, THIS->conf.bootstrap_level);
CHECK_ARG_INT(module_strings[17] /* "BARE_URL_ENTITYID" */,
THIS->conf.bare_url_entityid);
/* FIXME: BUTTON_URL */
CHECK_ARG_STRING(module_strings[18] /* "CDC_URL" */, THIS->conf.cdc_url);
CHECK_ARG_INT(module_strings[19] /* "CDC_CHOICE" */, THIS->conf.cdc_choice);
CHECK_ARG_STRING(module_strings[20] /* "CONTACT_ORG" */, THIS->conf.contact_org);
CHECK_ARG_STRING(module_strings[21] /* "CONTACT_NAME" */, THIS->conf.contact_name);
CHECK_ARG_STRING(module_strings[22] /* "CONTACT_EMAIL" */, THIS->conf.contact_email);
CHECK_ARG_STRING(module_strings[23] /* "CONTACT_TEL" */, THIS->conf.contact_tel);
CHECK_ARG_STRING(module_strings[24] /* "COUNTRY" */, THIS->conf.country);
CHECK_ARG_INT(module_strings[25] /* "CANON_INOPT" */, THIS->conf.canon_inopt);
THIS->conf.ctx->canon_inopt = THIS->conf.canon_inopt;
CHECK_ARG_INT(module_strings[26] /* "CPN_ENA" */, THIS->conf.cpn_ena);
CHECK_ARG_STRING(module_strings[27] /* "DEFAULTQS" */, THIS->conf.defaultqs);
CHECK_ARG_INT(module_strings[28] /* "DUP_A7N_FATAL" */, THIS->conf.dup_a7n_fatal);
CHECK_ARG_INT(module_strings[29] /* "DUP_MSG_FATAL" */, THIS->conf.dup_msg_fatal);
CHECK_ARG_CHAR(module_strings[30] /* "DI_ALLOW_CREATE" */, THIS->conf.di_allow_create);
CHECK_ARG_INT(module_strings[31] /* "DI_NID_FMT" */, THIS->conf.di_nid_fmt);
CHECK_ARG_INT(module_strings[32] /* "DI_A7N_ENC" */, THIS->conf.di_a7n_enc);
CHECK_ARG_INT(module_strings[33] /* "DEBUG" */, errmac_debug);
LOW_CHECK_ARG(module_strings[34] /* "DEBUG_LOG" */,
((TYPEOF(*s) == PIKE_T_STRING) && !s->u.string->size_shift),
zxid_set_opt_cstr(&THIS->conf, 6, s->u.string->str));
CHECK_ARG_INT(module_strings[35] /* "ERR" */, THIS->conf.log_err);
CHECK_ARG_INT(module_strings[36] /* "ERR_IN_ACT" */, THIS->conf.log_err_in_act);
CHECK_ARG_INT(module_strings[37] /* "ENC_TAIL_OPT" */, THIS->conf.enc_tail_opt);
CHECK_ARG_INT(module_strings[38] /* "ENCKEY_OPT" */, THIS->conf.enckey_opt);
CHECK_ARG_STRING(module_strings[39] /* "ERR_PAGE" */, THIS->conf.err_page);
CHECK_ARG_STRING(module_strings[40] /* "ERR_TEMPL_FILE" */, THIS->conf.err_templ_file);
CHECK_ARG_STRING(module_strings[41] /* "ERR_TEMPL" */, THIS->conf.err_templ);
CHECK_ARG_STRING(module_strings[42] /* "FEDUSERNAME_SUFFIX" */,
THIS->conf.fedusername_suffix);
CHECK_ARG_INT(module_strings[43] /* "ISSUE_A7N" */, THIS->conf.log_issue_a7n);
CHECK_ARG_INT(module_strings[44] /* "ISSUE_MSG" */, THIS->conf.log_issue_msg);
CHECK_ARG_STRING(module_strings[45] /* "ISSUE_AUTHNCTX_PW" */,
THIS->conf.issue_authnctx_pw);
CHECK_ARG_STRING(module_strings[46] /* "IDP_SEL_START" */, THIS->conf.idp_sel_start);
CHECK_ARG_STRING(module_strings[47] /* "IDP_SEL_NEW_IDP" */, THIS->conf.idp_sel_new_idp);
CHECK_ARG_STRING(module_strings[48] /* "IDP_SEL_OUR_EID" */, THIS->conf.idp_sel_our_eid);
CHECK_ARG_STRING(module_strings[49] /* "IDP_SEL_TECH_USER" */,
THIS->conf.idp_sel_tech_user);
CHECK_ARG_STRING(module_strings[50] /* "IDP_SEL_TECH_SITE" */,
THIS->conf.idp_sel_tech_site);
CHECK_ARG_STRING(module_strings[51] /* "IDP_SEL_FOOTER" */, THIS->conf.idp_sel_footer);
CHECK_ARG_STRING(module_strings[52] /* "IDP_SEL_END" */, THIS->conf.idp_sel_end);
CHECK_ARG_STRING(module_strings[53] /* "IDP_SEL_PAGE" */, THIS->conf.idp_sel_page);
CHECK_ARG_STRING(module_strings[54] /* "IDP_SEL_TEMPL_FILE" */,
THIS->conf.idp_sel_templ_file);
CHECK_ARG_STRING(module_strings[55] /* "IDP_SEL_TEMPL" */, THIS->conf.idp_sel_templ);
CHECK_ARG_INT(module_strings[56] /* "IDP_ENA" */, THIS->conf.idp_ena);
CHECK_ARG_INT(module_strings[57] /* "IDP_PXY_ENA" */, THIS->conf.idp_pxy_ena);
CHECK_ARG_INT(module_strings[58] /* "IMPS_ENA" */, THIS->conf.imps_ena);
CHECK_ARG_STRING(module_strings[59] /* "IDP_PREF_ACS_BINDING" */,
THIS->conf.idp_pref_acs_binding);
CHECK_ARG_INT(module_strings[60] /* "IDPATOPT" */, THIS->conf.idpatopt);
CHECK_ARG_INT(module_strings[61] /* "IDP_LIST_METH" */, THIS->conf.idp_list_meth);
CHECK_ARG_MAP(module_strings[62] /* "INMAP" */, THIS->conf.inmap);
CHECK_ARG_STRING(module_strings[63] /* "IPPORT" */, THIS->conf.ipport);
CHECK_ARG_INT(module_strings[64] /* "LEVEL" */, THIS->conf.log_level);
CHECK_ARG_INT(module_strings[65] /* "LOGUSER" */, THIS->conf.loguser);
CHECK_ARG_CSTR_LIST(module_strings[66] /* "LOCALPDP_ROLE_PERMIT" */,
THIS->conf.localpdp_role_permit);
CHECK_ARG_CSTR_LIST(module_strings[67] /* "LOCALPDP_ROLE_DENY" */,
THIS->conf.localpdp_role_deny);
CHECK_ARG_CSTR_LIST(module_strings[68] /* "LOCALPDP_IDPNID_PERMIT" */,
THIS->conf.localpdp_idpnid_permit);
CHECK_ARG_CSTR_LIST(module_strings[69] /* "LOCALPDP_IDPNID_DENY" */,
THIS->conf.localpdp_idpnid_deny);
CHECK_ARG_STRING(module_strings[70] /* "LOAD_COT_CACHE" */, THIS->conf.load_cot_cache);
CHECK_ARG_STRING(module_strings[71] /* "LOCALITY" */, THIS->conf.locality);
CHECK_ARG_STRING(module_strings[72] /* "MANDATORY_ATTR" */, THIS->conf.mandatory_attr);
CHECK_ARG_INT(module_strings[73] /* "MD_FETCH" */, THIS->conf.md_fetch);
CHECK_ARG_INT(module_strings[74] /* "MD_POPULATE_CACHE" */,
THIS->conf.md_populate_cache);
CHECK_ARG_INT(module_strings[75] /* "MD_CACHE_FIRST" */, THIS->conf.md_cache_first);
CHECK_ARG_INT(module_strings[76] /* "MD_CACHE_LAST" */, THIS->conf.md_cache_last);
CHECK_ARG_STRING(module_strings[77] /* "MGMT_START" */, THIS->conf.mgmt_start);
CHECK_ARG_STRING(module_strings[78] /* "MGMT_LOGOUT" */, THIS->conf.mgmt_logout);
CHECK_ARG_STRING(module_strings[79] /* "MGMT_DEFED" */, THIS->conf.mgmt_defed);
CHECK_ARG_STRING(module_strings[80] /* "MGMT_FOOTER" */, THIS->conf.mgmt_footer);
CHECK_ARG_STRING(module_strings[81] /* "MGMT_END" */, THIS->conf.mgmt_end);
CHECK_ARG_INT(module_strings[82] /* "MSG_SIG_OK" */, THIS->conf.msg_sig_ok);
CHECK_ARG_INT(module_strings[83] /* "MAX_SOAP_RETRY" */, THIS->conf.max_soap_retry);
CHECK_ARG_STRING(module_strings[84] /* "MOD_SAML_ATTR_PREFIX" */,
THIS->conf.mod_saml_attr_prefix);
CHECK_ARG_INT(module_strings[85] /* "NAMEID_ENC" */, THIS->conf.nameid_enc);
CHECK_ARG_STRING(module_strings[86] /* "NICE_NAME" */, THIS->conf.nice_name);
CHECK_ARG_STRING(module_strings[87] /* "NON_STANDARD_ENTITYID" */,
THIS->conf.non_standard_entityid);
CHECK_ARG_INT(module_strings[88] /* "NOSIG_FATAL" */, THIS->conf.nosig_fatal);
CHECK_ARG_INT(module_strings[89] /* "NOTIMESTAMP_FATAL" */,
THIS->conf.notimestamp_fatal);
CHECK_ARG_NEED(module_strings[90] /* "NEED" */, THIS->conf.need);
CHECK_ARG_STRING(module_strings[91] /* "NEW_USER_PAGE" */, THIS->conf.new_user_page);
CHECK_ARG_MAP(module_strings[92] /* "OUTMAP" */, THIS->conf.outmap);
CHECK_ARG_STRING(module_strings[93] /* "ORG_NAME" */, THIS->conf.org_name);

LOW_CHECK_ARG(module_strings[94] /* "PATH" */,
((TYPEOF(*s) == PIKE_T_STRING) &&
!s->u.string->size_shift),
do {
if (CPATH(THIS->conf)) {
ZX_FREE(THIS->conf.ctx, CPATH(THIS->conf));
}
CPATH(THIS->conf) = strdup(s->u.string->str);
CPATH_LEN(THIS->conf) = s->u.string->len;
} while(0));

CHECK_ARG_INT(module_strings[95] /* "PDP_ENA" */, THIS->conf.pdp_ena);
CHECK_ARG_STRING(module_strings[96] /* "PDP_URL" */, THIS->conf.pdp_url);
CHECK_ARG_STRING(module_strings[97] /* "PDP_CALL_URL" */, THIS->conf.pdp_call_url);
CHECK_ARG_MAP(module_strings[98] /* "PEPMAP" */, THIS->conf.pepmap);
CHECK_ARG_MAP(module_strings[99] /* "PEPMAP_RQOUT" */, THIS->conf.pepmap_rqout);
CHECK_ARG_MAP(module_strings[100] /* "PEPMAP_RQIN" */, THIS->conf.pepmap_rqin);
CHECK_ARG_MAP(module_strings[101] /* "PEPMAP_RSOUT" */, THIS->conf.pepmap_rsout);
CHECK_ARG_MAP(module_strings[102] /* "PEPMAP_RSIN" */, THIS->conf.pepmap_rsin);
CHECK_ARG_INT(module_strings[103] /* "POST_A7N_ENC" */, THIS->conf.post_a7n_enc);
CHECK_ARG_STRING(module_strings[104] /* "POST_TEMPL_FILE" */, THIS->conf.post_templ_file);
CHECK_ARG_STRING(module_strings[105] /* "POST_TEMPL" */, THIS->conf.post_templ);
CHECK_ARG_STRING(module_strings[106] /* "REDIRECT_HACK_IMPOSED_URL" */,
THIS->conf.redirect_hack_imposed_url);
CHECK_ARG_STRING(module_strings[107] /* "REDIRECT_HACK_ZXID_URL" */,
THIS->conf.redirect_hack_zxid_url);
CHECK_ARG_STRING(module_strings[108] /* "REDIRECT_HACK_ZXID_QS" */,
THIS->conf.redirect_hack_zxid_qs);
CHECK_ARG_INT(module_strings[109] /* "REDIR_TO_CONTENT" */, THIS->conf.redir_to_content);
CHECK_ARG_INT(module_strings[110] /* "REMOTE_USER_ENA" */, THIS->conf.remote_user_ena);
CHECK_ARG_INT(module_strings[111] /* "RELY_A7N" */, THIS->conf.log_rely_a7n);
CHECK_ARG_INT(module_strings[112] /* "RELY_MSG" */, THIS->conf.log_rely_msg);
CHECK_ARG_KEEP(module_strings[113] /* "REQUIRED_AUTHNCTX" */,
(TYPEOF(*s) == PIKE_T_ARRAY), do {
int i;
char **p;
if (THIS->conf.required_authnctx) {
ZX_FREE(THIS->conf.ctx, THIS->conf.required_authnctx);
}
THIS->conf.required_authnctx = p =
zx_zalloc(THIS->conf.ctx,
sizeof(char*) * (s->u.array->size + 1));
for (i = 0; i < s->u.array->size; i++) {
struct pike_string *str;
if ((TYPEOF(s->u.array->item[i]) == PIKE_T_STRING) &&
!((str = s->u.array->item[i].u.string)->size_shift))
*(p++) = str->str;
}
*p = NULL;
} while(0));
CHECK_ARG_STRING(module_strings[114] /* "RECOVER_PASSWD" */, THIS->conf.recover_passwd);
CHECK_ARG_INT(module_strings[115] /* "RELTO_FATAL" */, THIS->conf.relto_fatal);
CHECK_ARG_STRING_VOID(module_strings[116] /* "SES_ARCH_DIR" */, THIS->conf.ses_arch_dir);
CHECK_ARG_STRING_VOID(module_strings[117] /* "SES_COOKIE_NAME" */,
THIS->conf.ses_cookie_name);
CHECK_ARG_INT(module_strings[118] /* "SIGFAIL_IS_ERR" */, THIS->conf.log_sigfail_is_err);
CHECK_ARG_INT(module_strings[119] /* "SIG_FATAL" */, THIS->conf.sig_fatal);
CHECK_ARG_INT(module_strings[120] /* "SSO_SIGN" */, THIS->conf.sso_sign);
CHECK_ARG_INT(module_strings[121] /* "SSO_SOAP_SIGN" */, THIS->conf.sso_soap_sign);
CHECK_ARG_INT(module_strings[122] /* "SSO_SOAP_RESP_SIGN" */,
THIS->conf.sso_soap_resp_sign);
CHECK_ARG_INT(module_strings[123] /* "SHOW_CONF" */, THIS->conf.show_conf);
CHECK_ARG_INT(module_strings[124] /* "SHOW_TECH" */, THIS->conf.show_tech);
CHECK_ARG_STRING(module_strings[125] /* "STATE" */, THIS->conf.state);
CHECK_ARG_INT(module_strings[126] /* "TIMEOUT_FATAL" */, THIS->conf.timeout_fatal);
CHECK_ARG_INT(module_strings[127] /* "TIMESKEW" */, THIS->conf.timeskew);
CHECK_ARG_STRING(module_strings[128] /* "TRUSTPDP_URL" */, THIS->conf.trustpdp_url);
CHECK_ARG_KEEP(module_strings[129] /* "URL" */, ((TYPEOF(*s) == PIKE_T_STRING) &&
!s->u.string->size_shift), do {
BURL(THIS->conf) = s->u.string->str;
if (THIS->conf.fedusername_suffix) {
ZX_FREE(THIS->conf.ctx, THIS->conf.fedusername_suffix);
THIS->conf.fedusername_suffix = NULL;
}
THIS->conf.fedusername_suffix =
zxid_grab_domain_name(&THIS->conf, s->u.string->str);
} while(0));
CHECK_ARG_INT(module_strings[130] /* "USER_LOCAL" */, THIS->conf.user_local);
CHECK_ARG_INT(module_strings[131] /* "VALID_OPT" */, THIS->conf.valid_opt);
CHECK_ARG_NEED(module_strings[132] /* "WANT" */, THIS->conf.want);
CHECK_ARG_INT(module_strings[133] /* "WANT_SSO_A7N_SIGNED" */,
THIS->conf.want_sso_a7n_signed);
CHECK_ARG_INT(module_strings[134] /* "WANT_AUTHN_REQ_SIGNED" */,
THIS->conf.want_authn_req_signed);
CHECK_ARG_INT(module_strings[135] /* "WSC_SIGN" */, THIS->conf.wsc_sign);
CHECK_ARG_INT(module_strings[136] /* "WSP_SIGN" */, THIS->conf.wsp_sign);
CHECK_ARG_STRING(module_strings[137] /* "WSPCGICMD" */, THIS->conf.wspcgicmd);
CHECK_ARG_INT(module_strings[138] /* "WSP_NOSIG_FATAL" */, THIS->conf.wsp_nosig_fatal);
CHECK_ARG_STRING(module_strings[139] /* "WSC_LOCALPDP_OBL_PLEDGE" */,
THIS->conf.wsc_localpdp_obl_pledge);
#if 0
 CHECK_ARG_STRING(module_strings[140] /* "WSP_LOCALPDP_OBL_REQ" */,
THIS->conf.wsp_localpdp_obl_req);
#endif
 CHECK_ARG_STRING(module_strings[141] /* "WSP_LOCALPDP_OBL_EMIT" */,
THIS->conf.wsp_localpdp_obl_emit);
#if 0
 CHECK_ARG_STRING(module_strings[142] /* "WSC_LOCALPDP_OBL_ACCEPT" */,
THIS->conf.wsc_localpdp_obl_accept);
#endif
 CHECK_ARG_STRING(module_strings[143] /* "XASP_VERS" */, THIS->conf.xasp_vers);

/* The above does approximately the same as
     *   zxid_conf_to_cf_len(&THIS->conf,
     *                       conf->u.string->len, conf->u.string->str);
     * but avoids the HTTP-transport encoding by using a mapping,
     * and also attempts not to leak...
     */
}

}
/*! @class Session
   *!
   *!   Represents the current session state for a user.
   */

#undef class_ZXID_Configuration_Session_defined
#define class_ZXID_Configuration_Session_defined
DEFAULT_CMOD_STORAGE struct program *ZXID_Configuration_Session_program=NULL;

#ifdef ZXID_Configuration_Session_program_fun_num_used
DEFAULT_CMOD_STORAGE int ZXID_Configuration_Session_program_fun_num=-1;
#endif /* ZXID_Configuration_Session_program_fun_num_used */

#undef var_ses_ZXID_Configuration_Session_defined
#define var_ses_ZXID_Configuration_Session_defined

#undef var_config_ZXID_Configuration_Session_defined
#define var_config_ZXID_Configuration_Session_defined

#undef var_session_lock_ZXID_Configuration_Session_defined
#define var_session_lock_ZXID_Configuration_Session_defined
#line 457 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
/* ZXID isn't fully thread-safe yet. */

/*! @decl string(0..255) session_id
     *!
     *! Session id (if any).
     */

#undef var_session_id_ZXID_Configuration_Session_defined
#define var_session_id_ZXID_Configuration_Session_defined

#undef THIS
#define THIS ((struct ZXID_Configuration_Session_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef THIS_ZXID_CONFIGURATION_SESSION
#define THIS_ZXID_CONFIGURATION_SESSION ((struct ZXID_Configuration_Session_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef OBJ2_ZXID_CONFIGURATION_SESSION
#define OBJ2_ZXID_CONFIGURATION_SESSION(o) ((struct ZXID_Configuration_Session_struct *)(o->storage+ZXID_Configuration_Session_storage_offset))

#undef GET_ZXID_CONFIGURATION_SESSION_STORAGE
#define GET_ZXID_CONFIGURATION_SESSION_STORAGE(o) ((struct ZXID_Configuration_Session_struct *)(o->storage+ZXID_Configuration_Session_storage_offset)
static ptrdiff_t ZXID_Configuration_Session_storage_offset;
struct ZXID_Configuration_Session_struct {

#ifdef var_ses_ZXID_Configuration_Session_defined
#line 455 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
zxid_ses ses;
#endif /* var_ses_ZXID_Configuration_Session_defined */

#ifdef var_config_ZXID_Configuration_Session_defined
#line 456 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
struct ZXID_Configuration_struct *config;
#endif /* var_config_ZXID_Configuration_Session_defined */

#ifdef var_session_lock_ZXID_Configuration_Session_defined
#line 457 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
PIKE_MUTEX_T session_lock;
#endif /* var_session_lock_ZXID_Configuration_Session_defined */

#ifdef var_session_id_ZXID_Configuration_Session_defined
  struct pike_string * session_id;

#endif /* var_session_id_ZXID_Configuration_Session_defined */
};
#ifdef PIKE_DEBUG
/* Ensure the struct is used in a variable declaration, or else gdb might not see it. */
static struct ZXID_Configuration_Session_struct *ZXID_Configuration_Session_gdb_dummy_ptr;
#endif

#undef internal_init_ZXID_Configuration_Session_defined
#define internal_init_ZXID_Configuration_Session_defined

#undef ZXID_Configuration_Session_event_handler_defined
#define ZXID_Configuration_Session_event_handler_defined
static void init_ZXID_Configuration_Session_struct(void)
#line 466 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
{
THIS->config = parent_storage(1, ZXID_Configuration_program);
mt_init(&THIS->session_lock);
}


#undef ZXID_Configuration_Session_gc_live_obj
#define ZXID_Configuration_Session_gc_live_obj

#undef internal_exit_ZXID_Configuration_Session_defined
#define internal_exit_ZXID_Configuration_Session_defined

#undef ZXID_Configuration_Session_event_handler_defined
#define ZXID_Configuration_Session_event_handler_defined
static void exit_ZXID_Configuration_Session_struct(void)
#line 472 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
{
if (THIS->ses.at) {
zxid_free_at(&THIS->config->conf, THIS->ses.at);
THIS->ses.at = NULL;
}
if (THIS->ses.cookie) {
ZX_FREE(THIS->config->conf.ctx, THIS->ses.cookie);
THIS->ses.cookie = NULL;
}
if (THIS->ses.sesix) {
ZX_FREE(THIS->config->conf.ctx, THIS->ses.sesix);
THIS->ses.sesix = NULL;
}
if (THIS->ses.setcookie) {
ZX_FREE(THIS->config->conf.ctx, THIS->ses.setcookie);
THIS->ses.setcookie = NULL;
}
if (THIS->ses.sso_a7n_path) {
ZX_FREE(THIS->config->conf.ctx, THIS->ses.sso_a7n_path);
if (THIS->ses.tgt_a7n_path == THIS->ses.sso_a7n_path) {
/* Often the same pointer. */
THIS->ses.tgt_a7n_path = NULL;
}
THIS->ses.sso_a7n_path = NULL;
}
if (THIS->ses.tgt_a7n_path) {
ZX_FREE(THIS->config->conf.ctx, THIS->ses.tgt_a7n_path);
THIS->ses.tgt_a7n_path = NULL;
}
mt_destroy(&THIS->session_lock);
if (THIS->ses.sesbuf) {
ZX_FREE(THIS->config->conf.ctx, THIS->ses.sesbuf);
THIS->ses.sesbuf = NULL;
}
if (THIS->ses.sid) {
ZX_FREE(THIS->config->conf.ctx, THIS->ses.sid);
THIS->ses.sid = NULL;
}
}

/*! @decl void create(string|void session_id)
     *!
     *!   Create a new or look up an existing session.
     */
#define f_ZXID_Configuration_Session_create_defined

#ifdef f_ZXID_Configuration_Session_create_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_ZXID_Configuration_Session_create_fun_num = 0;

#endif /* f_ZXID_Configuration_Session_create_fun_num_used */
DEFAULT_CMOD_STORAGE void f_ZXID_Configuration_Session_create(INT32 args) {
#line 516 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
struct pike_string * session_id;
#line 516 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
if(args > 1) wrong_number_of_args_error("create",args,1);
#line 516 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
if (args > 0 &&
    (TYPEOF(Pike_sp[0-args]) != PIKE_T_INT ||
     Pike_sp[0-args].u.integer)) {
#line 516 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
if(TYPEOF(Pike_sp[0-args]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("create",1,"string(0..255)|void");
#line 516 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
debug_malloc_pass(session_id=Pike_sp[0-args].u.string);
#line 516 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
} else session_id = NULL;
#line 518 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
{
if (session_id && !session_id->size_shift) {
struct ZXID_Configuration_Session_struct *this = THIS;
if (this->session_id) {
free_string(this->session_id);
}
copy_shared_string(this->session_id, session_id);
THREADS_ALLOW();
mt_lock(&this->session_lock);
if (!zxid_get_ses(&this->config->conf, &this->ses, session_id->str)) {
/* New session. */
if (this->ses.sid) {
ZX_FREE(this->config->conf.ctx, this->ses.sid);
this->ses.sid = NULL;
}
this->ses.sid = zx_dup_cstr(this->config->conf.ctx, session_id->str);
}
mt_unlock(&this->session_lock);
THREADS_DISALLOW();
}
}

}
#line 540 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
/* Same as zxid_simple_cf_ses(), but without environment variables,
     * and uri_path passed as an argument instead.
     */
static char* pike_cf_ses(zxid_conf* cf, char *uri_path,
int qs_len, char* qs,
zxid_ses* ses, int* res_len, int auto_flags)
{
int got, ret;
char* res = 0;
char *sid;
zxid_cgi cgi;
memset(&cgi, 0, sizeof(cgi));

if (auto_flags & ZXID_AUTO_DEBUG) zxid_set_opt(cf, 1, 3);

#ifndef HAVE_ZXID_PARSE_CGI
#error "zxid_parse_cgi() is required."
#elif HAVE_ZXID_PARSE_CGI == 3
 zxid_parse_cgi(cf, &cgi, qs);
#elif HAVE_ZXID_PARSE_CGI == 2
 /* Old zxid library. */
zxid_parse_cgi(&cgi, qs);
#else
#error "Unsupported number of arguments to zxid_parse_cgi()."
#endif

if (!cgi.op && !cf->bare_url_entityid) {
cgi.op = 'M'; /* By default, if no ses, check CDC and offer SSO */
}

#ifdef HAVE_STRUCT_ZXID_CGI_URI_PATH
 cgi.uri_path = uri_path;
cgi.qs = qs;
#endif

if (cgi.sid) {
if (!zxid_get_ses(cf, ses, cgi.sid)) {
D("No session(%s) active op(%c)", cgi.sid, cgi.op);
} else if ((res = zxid_simple_ses_active_cf(cf, &cgi, ses, res_len,
auto_flags)))
return res;
}

if (ses->sesbuf) {
ZX_FREE(cf->ctx, ses->sesbuf);
}
sid = ses->sid; /* Keep the sid (if any), since it might be
			 * used as an object identifier by the caller. */
memset(ses, 0, sizeof(zxid_ses)); /* No session yet! Process login form */
ses->sid = sid;
res = zxid_simple_no_ses_cf(cf, &cgi, ses, res_len, auto_flags);

return res;
}

/*! @decl string(0..255) authenticate(string(0..255) uri_path, @
     *!					  string(0..255) query)
     *!
     *!   Authenticate via SAML given the query-string @[query].
     *!
     *! @param uri_path
     *!   Current URI path (before '?').
     *!
     *! @param query
     *!   Query variables (after '?').
     *!
     *! @returns
     *!   Returns JSON-encoded data on success, and various other
     *!   strings otherwise.
     */
#define f_ZXID_Configuration_Session_authenticate_defined

#ifdef f_ZXID_Configuration_Session_authenticate_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_ZXID_Configuration_Session_authenticate_fun_num = 0;

#endif /* f_ZXID_Configuration_Session_authenticate_fun_num_used */
DEFAULT_CMOD_STORAGE void f_ZXID_Configuration_Session_authenticate(INT32 args) {
#line 610 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
struct pike_string * uri_path;
struct pike_string * query;
#line 610 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
if(args != 2) wrong_number_of_args_error("authenticate",args,2);
#line 610 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
if(TYPEOF(Pike_sp[0-2]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("authenticate",1,"string(0..255)");
#line 610 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
debug_malloc_pass(uri_path=Pike_sp[0-2].u.string);
if(TYPEOF(Pike_sp[1-2]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("authenticate",2,"string(0..255)");
#line 611 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
debug_malloc_pass(query=Pike_sp[1-2].u.string);
{
struct string_builder mutable_query;
char *res;
int res_len = 0;
struct ZXID_Configuration_struct *config =
parent_storage(1, ZXID_Configuration_program);
zxid_ses *ses = &THIS->ses;
int extra = 0;
PIKE_MUTEX_T *session_lock = &THIS->session_lock;

if (THIS->session_id) {
extra = 3 + THIS->session_id->len;
}
init_string_builder_alloc(&mutable_query, query->len + extra,
query->size_shift);
string_builder_shared_strcat(&mutable_query, query);
if (extra) {
string_builder_strcat(&mutable_query, "&s=");
string_builder_shared_strcat(&mutable_query, THIS->session_id);
}

THREADS_ALLOW();
mt_lock(session_lock);

/* Let the library handle metadata. */
res = pike_cf_ses(&config->conf, uri_path->str, mutable_query.s->len,
mutable_query.s->str, ses, &res_len,
ZXID_AUTO_METAC|ZXID_AUTO_FMTJ);

mt_unlock(session_lock);
THREADS_DISALLOW();

free_string_builder(&mutable_query);

push_string(make_shared_binary_string(res, res_len));

ZX_FREE(config->conf.ctx, res);

stack_pop_n_elems_keep_top(args);
}
}

#ifdef ZXID_Configuration_Session_event_handler_defined
static void ZXID_Configuration_Session_event_handler(int ev) {
  switch(ev) {

#ifdef internal_init_ZXID_Configuration_Session_defined
  case PROG_EVENT_INIT: init_ZXID_Configuration_Session_struct(); break;

#endif /* internal_init_ZXID_Configuration_Session_defined */

#ifdef internal_exit_ZXID_Configuration_Session_defined
  case PROG_EVENT_EXIT: exit_ZXID_Configuration_Session_struct(); break;

#endif /* internal_exit_ZXID_Configuration_Session_defined */
  default: break; 
  }
}

#endif /* ZXID_Configuration_Session_event_handler_defined */
/*! @endclass
   */
#line 655 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
#undef THIS
#define THIS THIS_ZXID_CONFIGURATION

/*! @decl mapping(string(0..255):mapping(string(0..255):string(0..255))) idp_list()
   *!
   *!   Return a list of known identity providers.
   *!
   *! @returns
   *!   Returns a mapping from IdP EID to display name (if any).
   */
#define f_ZXID_Configuration_idp_list_defined

#ifdef f_ZXID_Configuration_idp_list_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_ZXID_Configuration_idp_list_fun_num = 0;

#endif /* f_ZXID_Configuration_idp_list_fun_num_used */
DEFAULT_CMOD_STORAGE void f_ZXID_Configuration_idp_list(INT32 args) {
#line 665 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
if(args != 0) wrong_number_of_args_error("idp_list",args,0);
{
zxid_entity *idp = zxid_load_cot_cache(&THIS->conf);
int cnt = 0;
pop_n_elems(args);
check_stack(120);
while(idp) {
int attrs = 0;
/* if (!idp->ed->IDPSSODescriptor) continue; */
push_text(idp->eid);
push_text("eid");
push_text(idp->eid);
attrs++;
if (idp->dpy_name) {
push_text("name");
push_text(idp->dpy_name);
attrs++;
}
if (idp->sha1_name) {
push_text("sha1_name");
push_text(idp->sha1_name);
attrs++;
}
f_aggregate_mapping(attrs*2);
cnt++;

idp = idp->n;
}
f_aggregate_mapping(cnt*2);
}
}

#ifdef ZXID_Configuration_event_handler_defined
static void ZXID_Configuration_event_handler(int ev) {
  switch(ev) {

#ifdef internal_init_ZXID_Configuration_defined
  case PROG_EVENT_INIT: init_ZXID_Configuration_struct(); break;

#endif /* internal_init_ZXID_Configuration_defined */

#ifdef internal_exit_ZXID_Configuration_defined
  case PROG_EVENT_EXIT: exit_ZXID_Configuration_struct(); break;

#endif /* internal_exit_ZXID_Configuration_defined */
  default: break; 
  }
}

#endif /* ZXID_Configuration_event_handler_defined */
/*! @endclass Configuration */

/*! @decl int version()
 *!
 *! Return the numeric version of the zxid library.
 */
#define f_ZXID_version_defined

#ifdef f_ZXID_version_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_ZXID_version_fun_num = 0;

#endif /* f_ZXID_version_fun_num_used */
DEFAULT_CMOD_STORAGE void f_ZXID_version(INT32 args) {
#line 702 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
if(args != 0) wrong_number_of_args_error("version",args,0);
{
do { INT_TYPE ret_=(zxid_version());  push_int(ret_); return; }while(0);
#line 705 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
}

}
#line 707 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
PIKE_MODULE_INIT
{

#ifdef module_strings_declared
module_strings[0] = 
  make_shared_binary_string("AUTO_CERT",
                            CONSTANT_STRLEN("AUTO_CERT"));
module_strings[1] = 
  make_shared_binary_string("AUTHN_REQ_SIGN",
                            CONSTANT_STRLEN("AUTHN_REQ_SIGN"));
module_strings[2] = 
  make_shared_binary_string("ACT",
                            CONSTANT_STRLEN("ACT"));
module_strings[3] = 
  make_shared_binary_string("ACT_IN_ERR",
                            CONSTANT_STRLEN("ACT_IN_ERR"));
module_strings[4] = 
  make_shared_binary_string("AUDIENCE_FATAL",
                            CONSTANT_STRLEN("AUDIENCE_FATAL"));
module_strings[5] = 
  make_shared_binary_string("AFTER_SLOP",
                            CONSTANT_STRLEN("AFTER_SLOP"));
module_strings[6] = 
  make_shared_binary_string("ANON_OK",
                            CONSTANT_STRLEN("ANON_OK"));
module_strings[7] = 
  make_shared_binary_string("AN_PAGE",
                            CONSTANT_STRLEN("AN_PAGE"));
module_strings[8] = 
  make_shared_binary_string("AN_TEMPL_FILE",
                            CONSTANT_STRLEN("AN_TEMPL_FILE"));
module_strings[9] = 
  make_shared_binary_string("AN_TEMPL",
                            CONSTANT_STRLEN("AN_TEMPL"));
module_strings[10] = 
  make_shared_binary_string("ATSEL_PAGE",
                            CONSTANT_STRLEN("ATSEL_PAGE"));
module_strings[11] = 
  make_shared_binary_string("ATTRSRC",
                            CONSTANT_STRLEN("ATTRSRC"));
module_strings[12] = 
  make_shared_binary_string("A7NTTL",
                            CONSTANT_STRLEN("A7NTTL"));
module_strings[13] = 
  make_shared_binary_string("AS_ENA",
                            CONSTANT_STRLEN("AS_ENA"));
module_strings[14] = 
  make_shared_binary_string("AZ_OPT",
                            CONSTANT_STRLEN("AZ_OPT"));
module_strings[15] = 
  make_shared_binary_string("BEFORE_SLOP",
                            CONSTANT_STRLEN("BEFORE_SLOP"));
module_strings[16] = 
  make_shared_binary_string("BOOTSTRAP_LEVEL",
                            CONSTANT_STRLEN("BOOTSTRAP_LEVEL"));
module_strings[17] = 
  make_shared_binary_string("BARE_URL_ENTITYID",
                            CONSTANT_STRLEN("BARE_URL_ENTITYID"));
module_strings[18] = 
  make_shared_binary_string("CDC_URL",
                            CONSTANT_STRLEN("CDC_URL"));
module_strings[19] = 
  make_shared_binary_string("CDC_CHOICE",
                            CONSTANT_STRLEN("CDC_CHOICE"));
module_strings[20] = 
  make_shared_binary_string("CONTACT_ORG",
                            CONSTANT_STRLEN("CONTACT_ORG"));
module_strings[21] = 
  make_shared_binary_string("CONTACT_NAME",
                            CONSTANT_STRLEN("CONTACT_NAME"));
module_strings[22] = 
  make_shared_binary_string("CONTACT_EMAIL",
                            CONSTANT_STRLEN("CONTACT_EMAIL"));
module_strings[23] = 
  make_shared_binary_string("CONTACT_TEL",
                            CONSTANT_STRLEN("CONTACT_TEL"));
module_strings[24] = 
  make_shared_binary_string("COUNTRY",
                            CONSTANT_STRLEN("COUNTRY"));
module_strings[25] = 
  make_shared_binary_string("CANON_INOPT",
                            CONSTANT_STRLEN("CANON_INOPT"));
module_strings[26] = 
  make_shared_binary_string("CPN_ENA",
                            CONSTANT_STRLEN("CPN_ENA"));
module_strings[27] = 
  make_shared_binary_string("DEFAULTQS",
                            CONSTANT_STRLEN("DEFAULTQS"));
module_strings[28] = 
  make_shared_binary_string("DUP_A7N_FATAL",
                            CONSTANT_STRLEN("DUP_A7N_FATAL"));
module_strings[29] = 
  make_shared_binary_string("DUP_MSG_FATAL",
                            CONSTANT_STRLEN("DUP_MSG_FATAL"));
module_strings[30] = 
  make_shared_binary_string("DI_ALLOW_CREATE",
                            CONSTANT_STRLEN("DI_ALLOW_CREATE"));
module_strings[31] = 
  make_shared_binary_string("DI_NID_FMT",
                            CONSTANT_STRLEN("DI_NID_FMT"));
module_strings[32] = 
  make_shared_binary_string("DI_A7N_ENC",
                            CONSTANT_STRLEN("DI_A7N_ENC"));
module_strings[33] = 
  make_shared_binary_string("DEBUG",
                            CONSTANT_STRLEN("DEBUG"));
module_strings[34] = 
  make_shared_binary_string("DEBUG_LOG",
                            CONSTANT_STRLEN("DEBUG_LOG"));
module_strings[35] = 
  make_shared_binary_string("ERR",
                            CONSTANT_STRLEN("ERR"));
module_strings[36] = 
  make_shared_binary_string("ERR_IN_ACT",
                            CONSTANT_STRLEN("ERR_IN_ACT"));
module_strings[37] = 
  make_shared_binary_string("ENC_TAIL_OPT",
                            CONSTANT_STRLEN("ENC_TAIL_OPT"));
module_strings[38] = 
  make_shared_binary_string("ENCKEY_OPT",
                            CONSTANT_STRLEN("ENCKEY_OPT"));
module_strings[39] = 
  make_shared_binary_string("ERR_PAGE",
                            CONSTANT_STRLEN("ERR_PAGE"));
module_strings[40] = 
  make_shared_binary_string("ERR_TEMPL_FILE",
                            CONSTANT_STRLEN("ERR_TEMPL_FILE"));
module_strings[41] = 
  make_shared_binary_string("ERR_TEMPL",
                            CONSTANT_STRLEN("ERR_TEMPL"));
module_strings[42] = 
  make_shared_binary_string("FEDUSERNAME_SUFFIX",
                            CONSTANT_STRLEN("FEDUSERNAME_SUFFIX"));
module_strings[43] = 
  make_shared_binary_string("ISSUE_A7N",
                            CONSTANT_STRLEN("ISSUE_A7N"));
module_strings[44] = 
  make_shared_binary_string("ISSUE_MSG",
                            CONSTANT_STRLEN("ISSUE_MSG"));
module_strings[45] = 
  make_shared_binary_string("ISSUE_AUTHNCTX_PW",
                            CONSTANT_STRLEN("ISSUE_AUTHNCTX_PW"));
module_strings[46] = 
  make_shared_binary_string("IDP_SEL_START",
                            CONSTANT_STRLEN("IDP_SEL_START"));
module_strings[47] = 
  make_shared_binary_string("IDP_SEL_NEW_IDP",
                            CONSTANT_STRLEN("IDP_SEL_NEW_IDP"));
module_strings[48] = 
  make_shared_binary_string("IDP_SEL_OUR_EID",
                            CONSTANT_STRLEN("IDP_SEL_OUR_EID"));
module_strings[49] = 
  make_shared_binary_string("IDP_SEL_TECH_USER",
                            CONSTANT_STRLEN("IDP_SEL_TECH_USER"));
module_strings[50] = 
  make_shared_binary_string("IDP_SEL_TECH_SITE",
                            CONSTANT_STRLEN("IDP_SEL_TECH_SITE"));
module_strings[51] = 
  make_shared_binary_string("IDP_SEL_FOOTER",
                            CONSTANT_STRLEN("IDP_SEL_FOOTER"));
module_strings[52] = 
  make_shared_binary_string("IDP_SEL_END",
                            CONSTANT_STRLEN("IDP_SEL_END"));
module_strings[53] = 
  make_shared_binary_string("IDP_SEL_PAGE",
                            CONSTANT_STRLEN("IDP_SEL_PAGE"));
module_strings[54] = 
  make_shared_binary_string("IDP_SEL_TEMPL_FILE",
                            CONSTANT_STRLEN("IDP_SEL_TEMPL_FILE"));
module_strings[55] = 
  make_shared_binary_string("IDP_SEL_TEMPL",
                            CONSTANT_STRLEN("IDP_SEL_TEMPL"));
module_strings[56] = 
  make_shared_binary_string("IDP_ENA",
                            CONSTANT_STRLEN("IDP_ENA"));
module_strings[57] = 
  make_shared_binary_string("IDP_PXY_ENA",
                            CONSTANT_STRLEN("IDP_PXY_ENA"));
module_strings[58] = 
  make_shared_binary_string("IMPS_ENA",
                            CONSTANT_STRLEN("IMPS_ENA"));
module_strings[59] = 
  make_shared_binary_string("IDP_PREF_ACS_BINDING",
                            CONSTANT_STRLEN("IDP_PREF_ACS_BINDING"));
module_strings[60] = 
  make_shared_binary_string("IDPATOPT",
                            CONSTANT_STRLEN("IDPATOPT"));
module_strings[61] = 
  make_shared_binary_string("IDP_LIST_METH",
                            CONSTANT_STRLEN("IDP_LIST_METH"));
module_strings[62] = 
  make_shared_binary_string("INMAP",
                            CONSTANT_STRLEN("INMAP"));
module_strings[63] = 
  make_shared_binary_string("IPPORT",
                            CONSTANT_STRLEN("IPPORT"));
module_strings[64] = 
  make_shared_binary_string("LEVEL",
                            CONSTANT_STRLEN("LEVEL"));
module_strings[65] = 
  make_shared_binary_string("LOGUSER",
                            CONSTANT_STRLEN("LOGUSER"));
module_strings[66] = 
  make_shared_binary_string("LOCALPDP_ROLE_PERMIT",
                            CONSTANT_STRLEN("LOCALPDP_ROLE_PERMIT"));
module_strings[67] = 
  make_shared_binary_string("LOCALPDP_ROLE_DENY",
                            CONSTANT_STRLEN("LOCALPDP_ROLE_DENY"));
module_strings[68] = 
  make_shared_binary_string("LOCALPDP_IDPNID_PERMIT",
                            CONSTANT_STRLEN("LOCALPDP_IDPNID_PERMIT"));
module_strings[69] = 
  make_shared_binary_string("LOCALPDP_IDPNID_DENY",
                            CONSTANT_STRLEN("LOCALPDP_IDPNID_DENY"));
module_strings[70] = 
  make_shared_binary_string("LOAD_COT_CACHE",
                            CONSTANT_STRLEN("LOAD_COT_CACHE"));
module_strings[71] = 
  make_shared_binary_string("LOCALITY",
                            CONSTANT_STRLEN("LOCALITY"));
module_strings[72] = 
  make_shared_binary_string("MANDATORY_ATTR",
                            CONSTANT_STRLEN("MANDATORY_ATTR"));
module_strings[73] = 
  make_shared_binary_string("MD_FETCH",
                            CONSTANT_STRLEN("MD_FETCH"));
module_strings[74] = 
  make_shared_binary_string("MD_POPULATE_CACHE",
                            CONSTANT_STRLEN("MD_POPULATE_CACHE"));
module_strings[75] = 
  make_shared_binary_string("MD_CACHE_FIRST",
                            CONSTANT_STRLEN("MD_CACHE_FIRST"));
module_strings[76] = 
  make_shared_binary_string("MD_CACHE_LAST",
                            CONSTANT_STRLEN("MD_CACHE_LAST"));
module_strings[77] = 
  make_shared_binary_string("MGMT_START",
                            CONSTANT_STRLEN("MGMT_START"));
module_strings[78] = 
  make_shared_binary_string("MGMT_LOGOUT",
                            CONSTANT_STRLEN("MGMT_LOGOUT"));
module_strings[79] = 
  make_shared_binary_string("MGMT_DEFED",
                            CONSTANT_STRLEN("MGMT_DEFED"));
module_strings[80] = 
  make_shared_binary_string("MGMT_FOOTER",
                            CONSTANT_STRLEN("MGMT_FOOTER"));
module_strings[81] = 
  make_shared_binary_string("MGMT_END",
                            CONSTANT_STRLEN("MGMT_END"));
module_strings[82] = 
  make_shared_binary_string("MSG_SIG_OK",
                            CONSTANT_STRLEN("MSG_SIG_OK"));
module_strings[83] = 
  make_shared_binary_string("MAX_SOAP_RETRY",
                            CONSTANT_STRLEN("MAX_SOAP_RETRY"));
module_strings[84] = 
  make_shared_binary_string("MOD_SAML_ATTR_PREFIX",
                            CONSTANT_STRLEN("MOD_SAML_ATTR_PREFIX"));
module_strings[85] = 
  make_shared_binary_string("NAMEID_ENC",
                            CONSTANT_STRLEN("NAMEID_ENC"));
module_strings[86] = 
  make_shared_binary_string("NICE_NAME",
                            CONSTANT_STRLEN("NICE_NAME"));
module_strings[87] = 
  make_shared_binary_string("NON_STANDARD_ENTITYID",
                            CONSTANT_STRLEN("NON_STANDARD_ENTITYID"));
module_strings[88] = 
  make_shared_binary_string("NOSIG_FATAL",
                            CONSTANT_STRLEN("NOSIG_FATAL"));
module_strings[89] = 
  make_shared_binary_string("NOTIMESTAMP_FATAL",
                            CONSTANT_STRLEN("NOTIMESTAMP_FATAL"));
module_strings[90] = 
  make_shared_binary_string("NEED",
                            CONSTANT_STRLEN("NEED"));
module_strings[91] = 
  make_shared_binary_string("NEW_USER_PAGE",
                            CONSTANT_STRLEN("NEW_USER_PAGE"));
module_strings[92] = 
  make_shared_binary_string("OUTMAP",
                            CONSTANT_STRLEN("OUTMAP"));
module_strings[93] = 
  make_shared_binary_string("ORG_NAME",
                            CONSTANT_STRLEN("ORG_NAME"));
module_strings[94] = 
  make_shared_binary_string("PATH",
                            CONSTANT_STRLEN("PATH"));
module_strings[95] = 
  make_shared_binary_string("PDP_ENA",
                            CONSTANT_STRLEN("PDP_ENA"));
module_strings[96] = 
  make_shared_binary_string("PDP_URL",
                            CONSTANT_STRLEN("PDP_URL"));
module_strings[97] = 
  make_shared_binary_string("PDP_CALL_URL",
                            CONSTANT_STRLEN("PDP_CALL_URL"));
module_strings[98] = 
  make_shared_binary_string("PEPMAP",
                            CONSTANT_STRLEN("PEPMAP"));
module_strings[99] = 
  make_shared_binary_string("PEPMAP_RQOUT",
                            CONSTANT_STRLEN("PEPMAP_RQOUT"));
module_strings[100] = 
  make_shared_binary_string("PEPMAP_RQIN",
                            CONSTANT_STRLEN("PEPMAP_RQIN"));
module_strings[101] = 
  make_shared_binary_string("PEPMAP_RSOUT",
                            CONSTANT_STRLEN("PEPMAP_RSOUT"));
module_strings[102] = 
  make_shared_binary_string("PEPMAP_RSIN",
                            CONSTANT_STRLEN("PEPMAP_RSIN"));
module_strings[103] = 
  make_shared_binary_string("POST_A7N_ENC",
                            CONSTANT_STRLEN("POST_A7N_ENC"));
module_strings[104] = 
  make_shared_binary_string("POST_TEMPL_FILE",
                            CONSTANT_STRLEN("POST_TEMPL_FILE"));
module_strings[105] = 
  make_shared_binary_string("POST_TEMPL",
                            CONSTANT_STRLEN("POST_TEMPL"));
module_strings[106] = 
  make_shared_binary_string("REDIRECT_HACK_IMPOSED_URL",
                            CONSTANT_STRLEN("REDIRECT_HACK_IMPOSED_URL"));
module_strings[107] = 
  make_shared_binary_string("REDIRECT_HACK_ZXID_URL",
                            CONSTANT_STRLEN("REDIRECT_HACK_ZXID_URL"));
module_strings[108] = 
  make_shared_binary_string("REDIRECT_HACK_ZXID_QS",
                            CONSTANT_STRLEN("REDIRECT_HACK_ZXID_QS"));
module_strings[109] = 
  make_shared_binary_string("REDIR_TO_CONTENT",
                            CONSTANT_STRLEN("REDIR_TO_CONTENT"));
module_strings[110] = 
  make_shared_binary_string("REMOTE_USER_ENA",
                            CONSTANT_STRLEN("REMOTE_USER_ENA"));
module_strings[111] = 
  make_shared_binary_string("RELY_A7N",
                            CONSTANT_STRLEN("RELY_A7N"));
module_strings[112] = 
  make_shared_binary_string("RELY_MSG",
                            CONSTANT_STRLEN("RELY_MSG"));
module_strings[113] = 
  make_shared_binary_string("REQUIRED_AUTHNCTX",
                            CONSTANT_STRLEN("REQUIRED_AUTHNCTX"));
module_strings[114] = 
  make_shared_binary_string("RECOVER_PASSWD",
                            CONSTANT_STRLEN("RECOVER_PASSWD"));
module_strings[115] = 
  make_shared_binary_string("RELTO_FATAL",
                            CONSTANT_STRLEN("RELTO_FATAL"));
module_strings[116] = 
  make_shared_binary_string("SES_ARCH_DIR",
                            CONSTANT_STRLEN("SES_ARCH_DIR"));
module_strings[117] = 
  make_shared_binary_string("SES_COOKIE_NAME",
                            CONSTANT_STRLEN("SES_COOKIE_NAME"));
module_strings[118] = 
  make_shared_binary_string("SIGFAIL_IS_ERR",
                            CONSTANT_STRLEN("SIGFAIL_IS_ERR"));
module_strings[119] = 
  make_shared_binary_string("SIG_FATAL",
                            CONSTANT_STRLEN("SIG_FATAL"));
module_strings[120] = 
  make_shared_binary_string("SSO_SIGN",
                            CONSTANT_STRLEN("SSO_SIGN"));
module_strings[121] = 
  make_shared_binary_string("SSO_SOAP_SIGN",
                            CONSTANT_STRLEN("SSO_SOAP_SIGN"));
module_strings[122] = 
  make_shared_binary_string("SSO_SOAP_RESP_SIGN",
                            CONSTANT_STRLEN("SSO_SOAP_RESP_SIGN"));
module_strings[123] = 
  make_shared_binary_string("SHOW_CONF",
                            CONSTANT_STRLEN("SHOW_CONF"));
module_strings[124] = 
  make_shared_binary_string("SHOW_TECH",
                            CONSTANT_STRLEN("SHOW_TECH"));
module_strings[125] = 
  make_shared_binary_string("STATE",
                            CONSTANT_STRLEN("STATE"));
module_strings[126] = 
  make_shared_binary_string("TIMEOUT_FATAL",
                            CONSTANT_STRLEN("TIMEOUT_FATAL"));
module_strings[127] = 
  make_shared_binary_string("TIMESKEW",
                            CONSTANT_STRLEN("TIMESKEW"));
module_strings[128] = 
  make_shared_binary_string("TRUSTPDP_URL",
                            CONSTANT_STRLEN("TRUSTPDP_URL"));
module_strings[129] = 
  make_shared_binary_string("URL",
                            CONSTANT_STRLEN("URL"));
module_strings[130] = 
  make_shared_binary_string("USER_LOCAL",
                            CONSTANT_STRLEN("USER_LOCAL"));
module_strings[131] = 
  make_shared_binary_string("VALID_OPT",
                            CONSTANT_STRLEN("VALID_OPT"));
module_strings[132] = 
  make_shared_binary_string("WANT",
                            CONSTANT_STRLEN("WANT"));
module_strings[133] = 
  make_shared_binary_string("WANT_SSO_A7N_SIGNED",
                            CONSTANT_STRLEN("WANT_SSO_A7N_SIGNED"));
module_strings[134] = 
  make_shared_binary_string("WANT_AUTHN_REQ_SIGNED",
                            CONSTANT_STRLEN("WANT_AUTHN_REQ_SIGNED"));
module_strings[135] = 
  make_shared_binary_string("WSC_SIGN",
                            CONSTANT_STRLEN("WSC_SIGN"));
module_strings[136] = 
  make_shared_binary_string("WSP_SIGN",
                            CONSTANT_STRLEN("WSP_SIGN"));
module_strings[137] = 
  make_shared_binary_string("WSPCGICMD",
                            CONSTANT_STRLEN("WSPCGICMD"));
module_strings[138] = 
  make_shared_binary_string("WSP_NOSIG_FATAL",
                            CONSTANT_STRLEN("WSP_NOSIG_FATAL"));
module_strings[139] = 
  make_shared_binary_string("WSC_LOCALPDP_OBL_PLEDGE",
                            CONSTANT_STRLEN("WSC_LOCALPDP_OBL_PLEDGE"));
module_strings[140] = 
  make_shared_binary_string("WSP_LOCALPDP_OBL_REQ",
                            CONSTANT_STRLEN("WSP_LOCALPDP_OBL_REQ"));
module_strings[141] = 
  make_shared_binary_string("WSP_LOCALPDP_OBL_EMIT",
                            CONSTANT_STRLEN("WSP_LOCALPDP_OBL_EMIT"));
module_strings[142] = 
  make_shared_binary_string("WSC_LOCALPDP_OBL_ACCEPT",
                            CONSTANT_STRLEN("WSC_LOCALPDP_OBL_ACCEPT"));
module_strings[143] = 
  make_shared_binary_string("XASP_VERS",
                            CONSTANT_STRLEN("XASP_VERS"));
#endif

#ifdef CMOD_MAP_PROGRAM_IDS_DEFINED
set_program_id_to_id( ___cmod_map_program_ids );

#endif /* CMOD_MAP_PROGRAM_IDS_DEFINED */

#ifdef class_ZXID_Configuration_defined

#ifdef PROG_ZXID_CONFIGURATION_ID
#line 102 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
  START_NEW_PROGRAM_ID(ZXID_CONFIGURATION);
#else
#line 102 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
  start_new_program();

#endif /* PROG_ZXID_CONFIGURATION_ID */
#line 102 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
  ZXID_Configuration_program = Pike_compiler->new_program;

#ifndef tObjImpl_ZXID_CONFIGURATION

#undef tObjIs_ZXID_CONFIGURATION
#define tObjIs_ZXID_CONFIGURATION "\3\1\177\0\0\2"

#undef tObjImpl_ZXID_CONFIGURATION
#define tObjImpl_ZXID_CONFIGURATION "\3\0\177\0\0\2"

#endif /* tObjImpl_ZXID_CONFIGURATION */

#ifdef THIS_ZXID_CONFIGURATION
  ZXID_Configuration_storage_offset = ADD_STORAGE(struct ZXID_Configuration_struct);
#endif /* THIS_ZXID_CONFIGURATION */

#ifdef var_conf_m_ZXID_Configuration_defined
  PIKE_MAP_VARIABLE("conf_m", ZXID_Configuration_storage_offset + OFFSETOF(ZXID_Configuration_struct, conf_m),
                    tMap(tStr,tMix), PIKE_T_MAPPING, ID_PRIVATE|ID_PROTECTED);
#endif /* var_conf_m_ZXID_Configuration_defined */

#ifdef class_ZXID_Configuration_Session_defined

#ifdef PROG_ZXID_CONFIGURATION_SESSION_ID
#line 452 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
  START_NEW_PROGRAM_ID(ZXID_CONFIGURATION_SESSION);
#else
#line 452 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
  start_new_program();

#endif /* PROG_ZXID_CONFIGURATION_SESSION_ID */
#line 452 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
  ZXID_Configuration_Session_program = Pike_compiler->new_program;

#ifndef tObjImpl_ZXID_CONFIGURATION_SESSION

#undef tObjIs_ZXID_CONFIGURATION_SESSION
#define tObjIs_ZXID_CONFIGURATION_SESSION "\3\1\177\0\0\3"

#undef tObjImpl_ZXID_CONFIGURATION_SESSION
#define tObjImpl_ZXID_CONFIGURATION_SESSION "\3\0\177\0\0\3"

#endif /* tObjImpl_ZXID_CONFIGURATION_SESSION */

#ifdef THIS_ZXID_CONFIGURATION_SESSION
  ZXID_Configuration_Session_storage_offset = ADD_STORAGE(struct ZXID_Configuration_Session_struct);
#endif /* THIS_ZXID_CONFIGURATION_SESSION */

#ifdef var_session_id_ZXID_Configuration_Session_defined
  PIKE_MAP_VARIABLE("session_id", ZXID_Configuration_Session_storage_offset + OFFSETOF(ZXID_Configuration_Session_struct, session_id),
                    tStr, PIKE_T_STRING, 0);
#endif /* var_session_id_ZXID_Configuration_Session_defined */

#ifdef ZXID_Configuration_Session_event_handler_defined
  pike_set_prog_event_callback(ZXID_Configuration_Session_event_handler);

#ifndef ZXID_Configuration_Session_gc_live_obj
  Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;

#endif /* ZXID_Configuration_Session_gc_live_obj */

#endif /* ZXID_Configuration_Session_event_handler_defined */

#ifdef f_ZXID_Configuration_Session_create_defined

#ifdef f_ZXID_Configuration_Session_create_fun_num_used
  f_ZXID_Configuration_Session_create_fun_num =
#endif /* f_ZXID_Configuration_Session_create_fun_num_used */
#line 516 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
    ADD_FUNCTION2("create", f_ZXID_Configuration_Session_create, tFunc(tOr(tStr8,tVoid),tVoid), ID_PROTECTED, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_ZXID_Configuration_Session_create_defined */

#ifdef f_ZXID_Configuration_Session_authenticate_defined

#ifdef f_ZXID_Configuration_Session_authenticate_fun_num_used
  f_ZXID_Configuration_Session_authenticate_fun_num =
#endif /* f_ZXID_Configuration_Session_authenticate_fun_num_used */
#line 610 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
    ADD_FUNCTION2("authenticate", f_ZXID_Configuration_Session_authenticate, tFunc(tStr8 tStr8,tStr8), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_ZXID_Configuration_Session_authenticate_defined */
#line 453 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
  Pike_compiler->new_program->flags |= PROGRAM_USES_PARENT;
#line 452 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
  ZXID_Configuration_Session_program=end_program();
#line 452 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
#ifdef ZXID_Configuration_Session_program_fun_num_used
ZXID_Configuration_Session_program_fun_num=
#endif
 add_program_constant("Session",ZXID_Configuration_Session_program,0);

#endif /* class_ZXID_Configuration_Session_defined */

#ifdef ZXID_Configuration_event_handler_defined
  pike_set_prog_event_callback(ZXID_Configuration_event_handler);

#ifndef ZXID_Configuration_gc_live_obj
  Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;

#endif /* ZXID_Configuration_gc_live_obj */

#endif /* ZXID_Configuration_event_handler_defined */

#ifdef f_ZXID_Configuration_create_defined

#ifdef f_ZXID_Configuration_create_fun_num_used
  f_ZXID_Configuration_create_fun_num =
#endif /* f_ZXID_Configuration_create_fun_num_used */
#line 157 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
    ADD_FUNCTION2("create", f_ZXID_Configuration_create, tFunc(tMap(tStr8,tStr8),tVoid), ID_PROTECTED, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_ZXID_Configuration_create_defined */

#ifdef f_ZXID_Configuration_idp_list_defined

#ifdef f_ZXID_Configuration_idp_list_fun_num_used
  f_ZXID_Configuration_idp_list_fun_num =
#endif /* f_ZXID_Configuration_idp_list_fun_num_used */
#line 665 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
    ADD_FUNCTION2("idp_list", f_ZXID_Configuration_idp_list, tFunc(tNone,tMap(tStr8,tMap(tStr8,tStr8))), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_ZXID_Configuration_idp_list_defined */
#line 102 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
  ZXID_Configuration_program=end_program();
#line 102 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
#ifdef ZXID_Configuration_program_fun_num_used
ZXID_Configuration_program_fun_num=
#endif
 add_program_constant("Configuration",ZXID_Configuration_program,0);

#endif /* class_ZXID_Configuration_defined */

#ifdef f_ZXID_version_defined

#ifdef f_ZXID_version_fun_num_used
  f_ZXID_version_fun_num =
#endif /* f_ZXID_version_fun_num_used */
#line 702 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
    ADD_FUNCTION2("version", f_ZXID_version, tFunc(tNone,"\10\200\0\0\0\177\377\377\377"), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_ZXID_version_defined */

#ifdef CMOD_MAP_PROGRAM_IDS_DEFINED
set_program_id_to_id( 0 );
#endif /* CMOD_MAP_PROGRAM_IDS_DEFINED */
;
}

PIKE_MODULE_EXIT
{

#ifdef class_ZXID_Configuration_defined

#ifdef class_ZXID_Configuration_Session_defined
  if(ZXID_Configuration_Session_program) {
#line 452 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
    free_program(ZXID_Configuration_Session_program);
    ZXID_Configuration_Session_program=0;
  }

#endif /* class_ZXID_Configuration_Session_defined */
  if(ZXID_Configuration_program) {
#line 102 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
    free_program(ZXID_Configuration_program);
    ZXID_Configuration_program=0;
  }

#endif /* class_ZXID_Configuration_defined */

#ifdef module_strings_declared
{
  int i;
  for(i=0; i < 144; i++) {
    if (module_strings[i]) free_string(module_strings[i]);
    module_strings[i] = NULL;
  }
}
#endif
#line 714 "/home/hww3/pike-git/src/post_modules/ZXID/zxid.cmod"
;
}

/*! @endmodule ZXID */

#else /* HAVE_ZXID */

PIKE_MODULE_INIT {
}
PIKE_MODULE_EXIT {
}
#endif /* HAVE_ZXID */


#ifdef CMOD_MAP_PROGRAM_IDS_DEFINED
static int ___cmod_map_program_ids(int id)
{
  int i = 0;
  if( (id&0x7f000000) != 0x7f000000 ) return id;
  id = id&0x00ffffff;
#ifdef class_ZXID_Configuration_defined
if(id==2) return ZXID_Configuration_program->id;
#endif
#ifdef class_ZXID_Configuration_Session_defined
if(id==3) return ZXID_Configuration_Session_program->id;
#endif
  return 0;
}
#endif /* CMOD_MAP_PROGRAM_IDS_DEFINED */
