zxid
view release on metacpan or search on metacpan
zxencdectest.c view on Meta::CPAN
for (aa = 1970; aa < 2028; ++aa) {
snprintf(buf, sizeof(buf), "%d-02-28T11:30:19Z", aa); if (!timegm_tester(cf, buf)) exit(1);
snprintf(buf, sizeof(buf), "%d-03-01T11:30:19Z", aa); if (!timegm_tester(cf, buf)) exit(1);
snprintf(buf, sizeof(buf), "%d-03-02T11:30:19Z", aa); if (!timegm_tester(cf, buf)) exit(1);
snprintf(buf, sizeof(buf), "%d-03-03T11:30:19Z", aa); if (!timegm_tester(cf, buf)) exit(1);
snprintf(buf, sizeof(buf), "%d-03-04T11:30:19Z", aa); if (!timegm_tester(cf, buf)) exit(1);
snprintf(buf, sizeof(buf), "%d-03-31T11:30:19Z", aa); if (!timegm_tester(cf, buf)) exit(1);
snprintf(buf, sizeof(buf), "%d-04-01T11:30:19Z", aa); if (!timegm_tester(cf, buf)) exit(1);
snprintf(buf, sizeof(buf), "%d-04-02T11:30:19Z", aa); if (!timegm_tester(cf, buf)) exit(1);
}
}
const char foobar[] = "foobar";
const char goobar[] = "goo\r\n~[]";
int zxid_wsc_valid_re_env(zxid_conf* cf, zxid_ses* ses, const char* az_cred, struct zx_e_Envelope_s* env, const char* enve);
/* Called by: opt */
void covimp_test() /* -r 5 */
{
char buf[256];
int outlen;
char* out;
char* sigval;
char* sigmsg;
struct zx_str* ss;
struct zx_e_Envelope_s* env;
zxid_fault* flt;
zxid_tas3_status* st;
zxid_entity* meta;
zxid_conf* cf;
zxid_cgi cgi;
zxid_ses sess;
memset(&cgi, 0, sizeof(cgi));
memset(&sess, 0, sizeof(sess));
printf("version(%x)\n", zxid_version());
cf = zxid_new_conf("/var/zxid/");
printf("urlenc(%s)\n", zx_url_encode(cf->ctx, sizeof("test1://foo?a=b&c=d e")-1, "test1://foo?a=b&c=d e", &outlen));
zx_hexdec(buf, "313233", 6, hex_trans);
printf("hexdec(%.3s)\n", buf);
hexdmp("test2: ", (char*)foobar, sizeof(foobar), 1000);
hexdmp("test2b: ", (char*)goobar, sizeof(goobar), 1000);
copy_file("t/XML1.out","tmp/foo3","test3",0);
copy_file("t/XML1.out","tmp/foo4","test4",1);
copy_file("t/XML1.out","tmp/foo5","test5",2);
copy_file("/impossible","tmp/foo5a","test5a",0);
copy_file("t/XML1.out","tmp/impossiblefoo5b","test5b",0);
read_all(sizeof(buf), buf, "test5c", 1, "/impossible");
read_all_alloc(cf->ctx, "test5d", 1, &outlen, "/impossible");
zx_prepare_dec_ctx(cf->ctx, zx_ns_tab, zx__NS_MAX, foobar, foobar+sizeof(foobar));
zx_format_parse_error(cf->ctx, buf, sizeof(buf), "test6");
printf("parse err(%s)\n", buf);
zx_xml_parse_err(cf->ctx, '?', __FUNCTION__, "test7");
printf("memmem(%s)\n", zx_memmem("foobar", 6, "oba", 3));
ss = zx_ref_str(cf->ctx, "abc");
zx_str_conv(ss, &outlen, &out);
zxid_wsp_decorate(cf, &sess, 0, "<foo/>");
#ifndef MINGW
setenv("HTTP_COOKIE", "_liberty_idp=\"test8\"", 1);
zxid_cdc_read(cf, &cgi);
#endif
cgi.cdc = "test9";
zxid_cdc_check(cf, &cgi);
zxid_new_cgi(cf, "=test10&ok=1&okx=2&s=S123&c=test11&e=abc&d=def&&l=x&l1=y&l1foo=z&inv=qwe&fg=1&fh=7&fr=RS&gu=1&gn=asa&ge=1&an=&aw=&at=&SAMLart=artti&SAMLResponse=respis");
printf("n=%s\n", zxid_saml2_map_nid_fmt("n"));
printf("p=%s\n", zxid_saml2_map_nid_fmt("p"));
printf("t=%s\n", zxid_saml2_map_nid_fmt("t"));
printf("u=%s\n", zxid_saml2_map_nid_fmt("u"));
printf("e=%s\n", zxid_saml2_map_nid_fmt("e"));
printf("x=%s\n", zxid_saml2_map_nid_fmt("x"));
printf("w=%s\n", zxid_saml2_map_nid_fmt("w"));
printf("k=%s\n", zxid_saml2_map_nid_fmt("k"));
printf("s=%s\n", zxid_saml2_map_nid_fmt("s"));
printf("X=%s\n", zxid_saml2_map_nid_fmt("X"));
printf("r=%s\n", zxid_saml2_map_protocol_binding("r"));
printf("a=%s\n", zxid_saml2_map_protocol_binding("a"));
printf("p=%s\n", zxid_saml2_map_protocol_binding("p"));
printf("q=%s\n", zxid_saml2_map_protocol_binding("q"));
printf("s=%s\n", zxid_saml2_map_protocol_binding("s"));
printf("e=%s\n", zxid_saml2_map_protocol_binding("e"));
printf("X=%s\n", zxid_saml2_map_protocol_binding("X"));
printf("NULL=%d\n", zxid_protocol_binding_map_saml2(0));
printf("SAML2_REDIR=%d\n", zxid_protocol_binding_map_saml2(zx_ref_str(cf->ctx, SAML2_REDIR)));
printf("SAML2_ART=%d\n", zxid_protocol_binding_map_saml2(zx_ref_str(cf->ctx, SAML2_ART)));
printf("SAML2_POST=%d\n", zxid_protocol_binding_map_saml2(zx_ref_str(cf->ctx, SAML2_POST)));
printf("SAML2_POST_SIMPLE_SIGN=%d\n", zxid_protocol_binding_map_saml2(zx_ref_str(cf->ctx, SAML2_POST_SIMPLE_SIGN)));
printf("SAML2_SOAP=%d\n", zxid_protocol_binding_map_saml2(zx_ref_str(cf->ctx, SAML2_SOAP)));
printf("SAML2_PAOS=%d\n", zxid_protocol_binding_map_saml2(zx_ref_str(cf->ctx, SAML2_PAOS)));
printf("unknown=%d\n", zxid_protocol_binding_map_saml2(zx_ref_str(cf->ctx, "unknown")));
printf("n=%s\n", zxid_saml2_map_authn_ctx("n"));
printf("pwp=%s\n", zxid_saml2_map_authn_ctx("pwp"));
printf("pw=%s\n", zxid_saml2_map_authn_ctx("pw"));
printf("prvses=%s\n", zxid_saml2_map_authn_ctx("prvses"));
printf("clicert=%s\n", zxid_saml2_map_authn_ctx("clicert"));
printf("unspcf=%s\n", zxid_saml2_map_authn_ctx("unspcf"));
printf("ip=%s\n", zxid_saml2_map_authn_ctx("ip"));
printf("X=%s\n", zxid_saml2_map_authn_ctx("X"));
zxid_sigres_map(ZXSIG_OK, &sigval, &sigmsg); printf("%s %s\n", sigval, sigmsg);
zxid_sigres_map(ZXSIG_BAD_DALGO, &sigval, &sigmsg); printf("%s %s\n", sigval, sigmsg);
zxid_sigres_map(ZXSIG_DIGEST_LEN, &sigval, &sigmsg); printf("%s %s\n", sigval, sigmsg);
zxid_sigres_map(ZXSIG_BAD_DIGEST, &sigval, &sigmsg); printf("%s %s\n", sigval, sigmsg);
zxid_sigres_map(ZXSIG_BAD_SALGO, &sigval, &sigmsg); printf("%s %s\n", sigval, sigmsg);
zxid_sigres_map(ZXSIG_BAD_CERT, &sigval, &sigmsg); printf("%s %s\n", sigval, sigmsg);
zxid_sigres_map(ZXSIG_VFY_FAIL, &sigval, &sigmsg); printf("%s %s\n", sigval, sigmsg);
zxid_sigres_map(ZXSIG_NO_SIG, &sigval, &sigmsg); printf("%s %s\n", sigval, sigmsg);
zxid_sigres_map(ZXSIG_TIMEOUT, &sigval, &sigmsg); printf("%s %s\n", sigval, sigmsg);
zxid_sigres_map(ZXSIG_AUDIENCE, &sigval, &sigmsg); printf("%s %s\n", sigval, sigmsg);
zxid_sigres_map(99, &sigval, &sigmsg); printf("%s %s (other)\n", sigval, sigmsg);
printf("fake_sso=%d\n", zxid_sp_anon_finalize(cf, &cgi, &sess));
#ifndef MINGW
setenv("HTTP_PAOS", SAML2_SSO_ECP, 1);
zxid_lecp_check(cf, &cgi); /* *** should test in realistic context */
#endif
meta = zxid_get_ent_file(cf, "N9zsU-AwbI1O-U3mvjLmOALtbtU", "covimp"); /* IBMIdP */
zxid_mk_art_deref(cf, 0, meta, "ART124121"); /* *** should test in realistic context */
zxid_mk_lu_Status(cf, 0, 0, "SC2-dummy", "MSG-dummy", "REF-dummy");
st = zxid_mk_tas3_status(cf, 0, 0, 0, "SC2-dummy", "MSG-dummy", "REF-dummy");
zxid_get_fault(cf, &sess);
zxid_get_tas3_status(cf, &sess);
zxid_get_tas3_fault_sc1(cf, 0);
zxid_get_tas3_fault_sc2(cf, 0);
zxid_get_tas3_fault_comment(cf, 0);
zxid_get_tas3_fault_ref(cf, 0);
zxid_get_tas3_fault_actor(cf, 0);
zxid_get_tas3_status_sc1(cf, 0);
zxid_get_tas3_status_sc2(cf, 0);
zxid_get_tas3_status_comment(cf, 0);
zxid_get_tas3_status_ref(cf, 0);
zxid_get_tas3_status_ctlpt(cf, 0);
flt = zxid_mk_fault(cf, 0, "actor", "fc1", "fault string", "SC1", "SC2", "MSG", "REF");
zxid_get_tas3_fault_sc1(cf, flt);
zxid_get_tas3_fault_sc2(cf, flt);
zxid_get_tas3_fault_comment(cf, flt);
zxid_get_tas3_fault_ref(cf, flt);
zxid_get_tas3_fault_actor(cf, flt);
zxid_get_tas3_status_sc1(cf, st);
zxid_get_tas3_status_sc2(cf, st);
zxid_get_tas3_status_comment(cf, st);
zxid_get_tas3_status_ref(cf, st);
zxid_get_tas3_status_ctlpt(cf, st);
/* *** should test in realistic context */
zxid_mk_dap_query(cf, 0,
zxid_mk_dap_test_item(cf, 0,
zxid_mk_dap_testop(cf, 0, 0, 0, 0, 1, 2, 3, 4, 5),
0, 0),
zxid_mk_dap_query_item(cf, 0,
zxid_mk_dap_select(cf, 0, 0, 0, 0, 0, 1, 0, 0, 0),
0, 0, 0, 0, 1, 2, 3, 0, 0, 0),
zxid_mk_dap_subscription(cf, 0, "SUBSID", "#ITEMID",
zxid_mk_dap_resquery(cf, 0,
zxid_mk_dap_select(cf, 0, 0, 0, 0, 0, 1, 0, 0, 0),
0, 0, 0, 0, 1, 0),
0, 0, 0, 0, 1, 0, 0));
zxid_wsf_decor(cf,0,0,0,0);
zxid_map_sec_mech(0);
zxid_wsc_valid_re_env(cf,0,0,0,0);
env = zx_NEW_e_Envelope(cf->ctx, 0);
zxid_wsc_valid_re_env(cf,0,0,env,0);
zxid_wsf_decor(cf,0,env,0,0);
zxid_wsc_valid_re_env(cf,0,0,env,0);
printf("covimp ok\n");
}
( run in 2.364 seconds using v1.01-cache-2.11-cpan-98e64b0badf )