38 #include "testament.h" 119 vsnprintf(header,
sizeof header, fmt, ap);
143 slen = vsnprintf(buffer,
sizeof(buffer), fmt, ap);
147 if (slen < (
int)
sizeof(buffer)) {
159 dbuff = malloc(slen + 1);
166 slen = vsnprintf(dbuff, slen + 1, fmt, ap);
220 const char buffer[2] = {
' ',
'\0' };
227 goto fetch_about_blank_handler_aborted;
234 goto fetch_about_blank_handler_aborted;
242 fetch_about_blank_handler_aborted:
305 unsigned int cent_loop = 0;
315 goto fetch_about_imagecache_handler_aborted;
320 "<title>Image Cache Status</title>\n" 321 "<link rel=\"stylesheet\" type=\"text/css\" " 322 "href=\"resource:internal.css\">\n" 324 "<body id =\"cachelist\" class=\"ns-even-bg ns-even-fg ns-border\">\n" 325 "<h1 class=\"ns-border\">Image Cache Status</h1>\n");
327 goto fetch_about_imagecache_handler_aborted;
332 "<p>Configured limit of %a hysteresis of %b</p>\n" 333 "<p>Total bitmap size in use %c (in %d)</p>\n" 335 "<p>Peak size %f (in %g)</p>\n" 336 "<p>Peak image count %h (size %i)</p>\n" 337 "<p>Cache total/hit/miss/fail (counts) %j/%k/%l/%m " 338 "(%pj%%/%pk%%/%pl%%/%pm%%)</p>\n" 339 "<p>Cache total/hit/miss/fail (size) %n/%o/%q/%r " 340 "(%pn%%/%po%%/%pq%%/%pr%%)</p>\n" 341 "<p>Total images never rendered: %s " 342 "(includes %t that were converted)</p>\n" 343 "<p>Total number of excessive conversions: %u " 344 "(from %v images converted more than once)" 346 "<p>Bitmap of size %w had most (%x) conversions</p>\n" 347 "<h2 class=\"ns-border\">Current contents</h2>\n");
348 if (slen >= (
int) (
sizeof(buffer))) {
349 goto fetch_about_imagecache_handler_aborted;
357 goto fetch_about_imagecache_handler_aborted;
361 res =
ssenddataf(ctx,
"<p class=\"imagecachelist\">\n" 364 "<span>Content Key</span>" 365 "<span>Redraw Count</span>" 366 "<span>Conversion Count</span>" 367 "<span>Last Redraw</span>" 368 "<span>Bitmap Age</span>" 369 "<span>Bitmap Size</span>" 370 "<span>Source</span>" 373 goto fetch_about_imagecache_handler_aborted;
380 sizeof buffer - slen,
383 "<span class=\"ns-border\">%e</span>" 384 "<span class=\"ns-border\">%k</span>" 385 "<span class=\"ns-border\">%r</span>" 386 "<span class=\"ns-border\">%c</span>" 387 "<span class=\"ns-border\">%a</span>" 388 "<span class=\"ns-border\">%g</span>" 389 "<span class=\"ns-border\">%s</span>" 390 "<span class=\"ns-border\">%o</span>" 394 sizeof buffer - slen,
396 "<a class=\"ns-odd-bg\" href=\"%U\">" 397 "<span class=\"ns-border\">%e</span>" 398 "<span class=\"ns-border\">%k</span>" 399 "<span class=\"ns-border\">%r</span>" 400 "<span class=\"ns-border\">%c</span>" 401 "<span class=\"ns-border\">%a</span>" 402 "<span class=\"ns-border\">%g</span>" 403 "<span class=\"ns-border\">%s</span>" 404 "<span class=\"ns-border\">%o</span>" 410 if (elen >= (
int) (
sizeof buffer - slen)) {
414 goto fetch_about_imagecache_handler_aborted;
424 slen += snprintf(buffer + slen,
sizeof buffer - slen,
425 "</p>\n</body>\n</html>\n");
429 goto fetch_about_imagecache_handler_aborted;
435 fetch_about_imagecache_handler_aborted:
521 while (san != NULL) {
535 #include <openssl/ssl.h> 536 #include <openssl/x509v3.h> 541 #if (defined(LIBRESSL_VERSION_NUMBER) || (OPENSSL_VERSION_NUMBER < 0x1010000fL)) 544 #if (defined(LIBRESSL_VERSION_NUMBER) || (OPENSSL_VERSION_NUMBER < 0x1000200fL)) 546 static int ns_X509_get_signature_nid(
X509 *cert)
548 return OBJ_obj2nid(cert->cert_info->key->algor->algorithm);
551 #define ns_X509_get_signature_nid X509_get_signature_nid 554 static const unsigned char *ns_ASN1_STRING_get0_data(ASN1_STRING *asn1str)
556 return (
const unsigned char *)ASN1_STRING_data(asn1str);
559 static const BIGNUM *ns_RSA_get0_n(
const RSA *d)
564 static const BIGNUM *ns_RSA_get0_e(
const RSA *d)
569 static int ns_RSA_bits(
const RSA *rsa)
571 return RSA_size(rsa) * 8;
574 static int ns_DSA_bits(
const DSA *dsa)
576 return DSA_size(dsa) * 8;
579 static int ns_DH_bits(
const DH *dh)
581 return DH_size(dh) * 8;
584 #elif (OPENSSL_VERSION_NUMBER < 0x1010100fL) 586 #define ns_X509_get_signature_nid X509_get_signature_nid 587 #define ns_ASN1_STRING_get0_data ASN1_STRING_get0_data 589 static const BIGNUM *ns_RSA_get0_n(
const RSA *r)
594 RSA_get0_key(r, &n, &e, &d);
598 static const BIGNUM *ns_RSA_get0_e(
const RSA *r)
603 RSA_get0_key(r, &n, &e, &d);
607 #define ns_RSA_bits RSA_bits 608 #define ns_DSA_bits DSA_bits 609 #define ns_DH_bits DH_bits 613 #define ns_X509_get_signature_nid X509_get_signature_nid 614 #define ns_ASN1_STRING_get0_data ASN1_STRING_get0_data 615 #define ns_RSA_get0_n RSA_get0_n 616 #define ns_RSA_get0_e RSA_get0_e 617 #define ns_RSA_bits RSA_bits 618 #define ns_DSA_bits DSA_bits 619 #define ns_DH_bits DH_bits 630 xname_to_info(X509_NAME *xname,
struct ns_cert_name *iname)
634 X509_NAME_ENTRY *entry;
636 const unsigned char *value_str;
641 entrycnt = X509_NAME_entry_count(xname);
643 for (entryidx = 0; entryidx < entrycnt; entryidx++) {
644 entry = X509_NAME_get_entry(xname, entryidx);
645 name = X509_NAME_ENTRY_get_object(entry);
646 name_nid = OBJ_obj2nid(name);
647 value = X509_NAME_ENTRY_get_data(entry);
648 value_str = ns_ASN1_STRING_get0_data(value);
653 case NID_countryName:
656 case NID_localityName:
659 case NID_stateOrProvinceName:
662 case NID_organizationName:
665 case NID_organizationalUnitName:
673 *field = strdup((
const char *)value_str);
674 NSLOG(netsurf, DEEPDEBUG,
675 "NID:%d value: %s", name_nid, *field);
677 NSLOG(netsurf, DEEPDEBUG,
"NID:%d", name_nid);
700 static char *hexdup(
const char *hex)
707 hexlen = strlen(hex);
709 dst = malloc(((hexlen * 7) + 6) / 2);
712 for (out = dst; *hex != 0; hex++) {
736 static char *bindup(
unsigned char *bin,
unsigned int binlen)
741 const char hex[] = {
'0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
742 '8',
'9',
'A',
'B',
'C',
'D',
'E',
'F' };
745 dst = malloc(binlen * 7);
749 for (idx = 0; idx < binlen; idx++) {
750 *out++ = hex[(bin[idx] & 0xf0) >> 4];
751 *out++ = hex[bin[idx] & 0xf];
782 ikey->
algor = strdup(
"RSA");
784 ikey->
size = ns_RSA_bits(rsa);
786 tmp = BN_bn2hex(ns_RSA_get0_n(rsa));
792 tmp = BN_bn2dec(ns_RSA_get0_e(rsa));
818 ikey->
algor = strdup(
"DSA");
820 ikey->
size = ns_DSA_bits(dsa);
842 ikey->
algor = strdup(
"Diffie Hellman");
844 ikey->
size = ns_DH_bits(dh);
862 const EC_GROUP *ecgroup;
863 const EC_POINT *ecpoint;
871 ikey->
algor = strdup(
"Elliptic Curve");
873 ecgroup = EC_KEY_get0_group(ec);
875 if (ecgroup != NULL) {
876 ikey->
size = EC_GROUP_get_degree(ecgroup);
878 ikey->
curve = strdup(OBJ_nid2ln(EC_GROUP_get_curve_name(ecgroup)));
880 ecpoint = EC_KEY_get0_public_key(ec);
881 if (ecpoint != NULL) {
882 bnctx = BN_CTX_new();
883 ecpoint_hex = EC_POINT_point2hex(ecgroup,
885 POINT_CONVERSION_UNCOMPRESSED,
887 ikey->
public = hexdup(ecpoint_hex);
888 OPENSSL_free(ecpoint_hex);
914 switch (EVP_PKEY_base_id(pkey)) {
916 res = rsa_to_info(EVP_PKEY_get1_RSA(pkey), ikey);
920 res = dsa_to_info(EVP_PKEY_get1_DSA(pkey), ikey);
924 res = dh_to_info(EVP_PKEY_get1_DH(pkey), ikey);
928 res = ec_to_info(EVP_PKEY_get1_EC_KEY(pkey), ikey);
944 int san_names_nb = -1;
945 const GENERAL_NAME *current_name;
946 const unsigned char *dns_name;
949 STACK_OF(GENERAL_NAME) *san_names = NULL;
951 san_names = X509_get_ext_d2i(cert, NID_subject_alt_name, NULL, NULL);
952 if (san_names == NULL) {
956 san_names_nb = sk_GENERAL_NAME_num(san_names);
959 for (idx = 0; idx < san_names_nb; idx++) {
960 current_name = sk_GENERAL_NAME_value(san_names, idx);
962 if (current_name->type == GEN_DNS) {
964 dns_name = ns_ASN1_STRING_get0_data(current_name->d.dNSName);
968 isan->
name = strdup((
const char *)dns_name);
971 prev_next = &isan->
next;
981 for (idx = 0; idx < san_names_nb; idx++) {
982 GENERAL_NAME *entry = sk_GENERAL_NAME_pop(san_names);
983 GENERAL_NAME_free(entry);
985 sk_GENERAL_NAME_free(san_names);
991 der_to_certinfo(
const uint8_t *der,
997 const ASN1_INTEGER *asn1_num;
1005 cert = d2i_X509(NULL, &der, der_length);
1016 info->
version = X509_get_version(cert) + 1;
1019 mem = BIO_new(BIO_s_mem());
1020 ASN1_TIME_print(mem, X509_get_notBefore(cert));
1021 BIO_get_mem_ptr(mem, &buf);
1022 (void) BIO_set_close(mem, BIO_NOCLOSE);
1024 info->
not_before = calloc(1, buf->length + 1);
1026 memcpy(info->
not_before, buf->data, (
unsigned)buf->length);
1031 mem = BIO_new(BIO_s_mem());
1032 ASN1_TIME_print(mem,
1033 X509_get_notAfter(cert));
1034 BIO_get_mem_ptr(mem, &buf);
1035 (void) BIO_set_close(mem, BIO_NOCLOSE);
1037 info->
not_after = calloc(1, buf->length + 1);
1039 memcpy(info->
not_after, buf->data, (
unsigned)buf->length);
1044 info->
sig_type = X509_get_signature_type(cert);
1047 int pkey_nid = ns_X509_get_signature_nid(cert);
1048 if (pkey_nid != NID_undef) {
1049 const char* sslbuf = OBJ_nid2ln(pkey_nid);
1050 if (sslbuf != NULL) {
1056 asn1_num = X509_get_serialNumber(cert);
1057 if (asn1_num != NULL) {
1058 bignum = ASN1_INTEGER_to_BN(asn1_num, NULL);
1059 if (bignum != NULL) {
1060 char *tmp = BN_bn2hex(bignum);
1071 const EVP_MD *digest;
1072 unsigned int dig_len;
1073 unsigned char *buff;
1076 digest = EVP_sha1();
1077 buff = malloc(EVP_MD_size(digest));
1079 rc = X509_digest(cert, digest, buff, &dig_len);
1080 if ((rc == 1) && (dig_len == (
unsigned int)EVP_MD_size(digest))) {
1086 digest = EVP_sha256();
1087 buff = malloc(EVP_MD_size(digest));
1089 rc = X509_digest(cert, digest, buff, &dig_len);
1090 if ((rc == 1) && (dig_len == (
unsigned int)EVP_MD_size(digest))) {
1097 san_to_info(cert, &info->
san);
1100 xname_to_info(X509_get_issuer_name(cert), &info->
issuer_name);
1103 xname_to_info(X509_get_subject_name(cert), &info->
subject_name);
1106 pkey_to_info(X509_get_pubkey(cert), &info->
public_key);
1123 if (certs == NULL) {
1127 for (depth = 0; depth < chain->
depth;depth++) {
1128 res = der_to_certinfo(chain->
certs[depth].
der,
1138 *cert_info_out = certs;
1158 "<tr><th>Common Name</th><td>%s</td></tr>\n",
1166 "<tr><th>Organisation</th><td>%s</td></tr>\n",
1175 "<tr><th>Organisation Unit</th><td>%s</td></tr>\n",
1184 "<tr><th>Locality</th><td>%s</td></tr>\n",
1193 "<tr><th>Privince</th><td>%s</td></tr>\n",
1200 if (cert_name->
country != NULL) {
1202 "<tr><th>Country</th><td>%s</td></tr>\n",
1226 "<table class=\"info\">\n" 1227 "<tr><th>Alternative Names</th><td><hr></td></tr>\n");
1232 while (san != NULL) {
1234 "<tr><th>DNS Name</th><td>%s</td></tr>\n",
1256 if (public_key->
algor == NULL) {
1262 "<table class=\"info\">\n" 1263 "<tr><th>Public Key</th><td><hr></td></tr>\n" 1264 "<tr><th>Algorithm</th><td>%s</td></tr>\n" 1265 "<tr><th>Key Size</th><td>%d</td></tr>\n",
1273 if (public_key->
exponent != NULL) {
1275 "<tr><th>Exponent</th><td>%s</td></tr>\n",
1282 if (public_key->
modulus != NULL) {
1284 "<tr><th>Modulus</th><td class=\"data\">%s</td></tr>\n",
1291 if (public_key->
curve != NULL) {
1293 "<tr><th>Curve</th><td>%s</td></tr>\n",
1300 if (public_key->
public != NULL) {
1302 "<tr><th>Public Value</th><td>%s</td></tr>\n",
1328 "<table class=\"info\">\n" 1329 "<tr><th>Fingerprints</th><td><hr></td></tr>\n");
1336 "<tr><th>SHA-256</th><td class=\"data\">%s</td></tr>\n",
1345 "<tr><th>SHA-1</th><td class=\"data\">%s</td></tr>\n",
1365 "<h2 id=\"%"PRIsizet"\" class=\"ns-border\">%s</h2>\n",
1373 "<table class=\"info\">\n" 1374 "<tr class=\"ns-even-fg-bad\">" 1386 "<table class=\"info\">\n" 1387 "<tr><th>Issued To</th><td><hr></td></tr>\n");
1404 "<table class=\"info\">\n" 1405 "<tr><th>Issued By</th><td><hr></td></tr>\n");
1422 "<table class=\"info\">\n" 1423 "<tr><th>Validity</th><td><hr></td></tr>\n" 1424 "<tr><th>Valid From</th><td>%s</td></tr>\n" 1425 "<tr><th>Valid Until</th><td>%s</td></tr>\n" 1444 "<table class=\"info\">\n" 1445 "<tr><th>Miscellaneous</th><td><hr></td></tr>\n");
1452 "<tr><th>Serial Number</th><td>%s</td></tr>\n",
1461 "<tr><th>Signature Algorithm</th>" 1462 "<td>%s</td></tr>\n",
1470 "<tr><th>Version</th><td>%ld</td></tr>\n" 1504 goto fetch_about_certificate_handler_aborted;
1509 "<title>NetSurf Browser Certificate Viewer</title>\n" 1510 "<link rel=\"stylesheet\" type=\"text/css\" " 1511 "href=\"resource:internal.css\">\n" 1513 "<body id=\"certificate\" class=\"ns-even-bg ns-even-fg ns-border\">\n" 1514 "<h1 class=\"ns-border\">Certificate</h1>\n");
1516 goto fetch_about_certificate_handler_aborted;
1521 res =
ssenddataf(ctx,
"<p>Could not process that</p>\n");
1523 goto fetch_about_certificate_handler_aborted;
1533 goto fetch_about_certificate_handler_aborted;
1536 for (depth = 0; depth < chain->
depth; depth++) {
1538 depth, (cert_info + depth)
1543 goto fetch_about_certificate_handler_aborted;
1551 goto fetch_about_certificate_handler_aborted;
1554 for (depth = 0; depth < chain->
depth; depth++) {
1559 goto fetch_about_certificate_handler_aborted;
1567 "<p>Invalid certificate data</p>\n");
1569 goto fetch_about_certificate_handler_aborted;
1578 goto fetch_about_certificate_handler_aborted;
1587 fetch_about_certificate_handler_aborted:
1604 unsigned int opt_loop = 0;
1614 goto fetch_about_config_handler_aborted;
1619 "<title>NetSurf Browser Config</title>\n" 1620 "<link rel=\"stylesheet\" type=\"text/css\" " 1621 "href=\"resource:internal.css\">\n" 1624 "id =\"configlist\" " 1625 "class=\"ns-even-bg ns-even-fg ns-border\" " 1626 "style=\"overflow: hidden;\">\n" 1627 "<h1 class=\"ns-border\">NetSurf Browser Config</h1>\n" 1628 "<table class=\"config\">\n" 1629 "<tr><th>Option</th>" 1631 "<th>Provenance</th>" 1632 "<th>Setting</th></tr>\n");
1634 goto fetch_about_config_handler_aborted;
1643 sizeof buffer - slen,
1645 "<tr class=\"ns-even-bg\">" 1646 "<th class=\"ns-border\">%k</th>" 1647 "<td class=\"ns-border\">%t</td>" 1648 "<td class=\"ns-border\">%p</td>" 1649 "<td class=\"ns-border\">%V</td>" 1653 sizeof buffer - slen,
1655 "<tr class=\"ns-odd-bg\">" 1656 "<th class=\"ns-border\">%k</th>" 1657 "<td class=\"ns-border\">%t</td>" 1658 "<td class=\"ns-border\">%p</td>" 1659 "<td class=\"ns-border\">%V</td>" 1665 if (elen >= (
int) (
sizeof buffer - slen)) {
1669 goto fetch_about_config_handler_aborted;
1679 slen += snprintf(buffer + slen,
sizeof buffer - slen,
1680 "</table>\n</body>\n</html>\n");
1684 goto fetch_about_config_handler_aborted;
1690 fetch_about_config_handler_aborted:
1704 const char *stylesheet;
1721 "\tbackground-color: #%06x;\n" 1753 unsigned int opt_loop = 0;
1761 goto fetch_about_choices_handler_aborted;
1766 slen = snprintf(buffer,
sizeof buffer,
1767 "# Automatically generated current NetSurf browser Choices\n");
1771 sizeof buffer - slen,
1777 if (res >= (
int) (
sizeof buffer - slen)) {
1781 goto fetch_about_choices_handler_aborted;
1792 goto fetch_about_choices_handler_aborted;
1798 fetch_about_choices_handler_aborted:
1826 goto fetch_about_testament_handler_aborted;
1829 "# Automatically generated by NetSurf build system\n\n");
1831 goto fetch_about_testament_handler_aborted;
1835 #
if defined(WT_BRANCHISTRUNK) || defined(WT_BRANCHISMASTER)
1836 "# This is a *DEVELOPMENT* build from the main line.\n\n" 1837 #elif defined(WT_BRANCHISTAG) && (WT_MODIFIED == 0)
1838 "# This is a tagged build of NetSurf\n" 1840 "# The tag used was '" WT_TAGIS
"'\n\n" 1844 #elif defined(WT_NO_SVN) || defined(WT_NO_GIT)
1845 "# This NetSurf was built outside of our revision " 1846 "control environment.\n" 1847 "# This testament is therefore not very useful.\n\n" 1849 "# This NetSurf was built from a branch (" WT_BRANCHPATH
").\n\n" 1851 #
if defined(CI_BUILD)
1852 "# This build carries the CI build number '" CI_BUILD
"'\n\n" 1856 goto fetch_about_testament_handler_aborted;
1860 "Built by %s (%s) from %s at revision %s on %s\n\n",
1861 GECOS, USERNAME, WT_BRANCHPATH, WT_REVID, WT_COMPILEDATE);
1863 goto fetch_about_testament_handler_aborted;
1866 res =
ssenddataf(ctx,
"Built on %s in %s\n\n", WT_HOSTNAME, WT_ROOT);
1868 goto fetch_about_testament_handler_aborted;
1871 if (WT_MODIFIED > 0) {
1873 "Working tree has %d modification%s\n\n",
1874 WT_MODIFIED, WT_MODIFIED == 1 ?
"" :
"s");
1876 res =
ssenddataf(ctx,
"Working tree is not modified.\n");
1879 goto fetch_about_testament_handler_aborted;
1882 for (modidx = 0; modidx < WT_MODIFIED; ++modidx) {
1885 modifications[modidx].modtype,
1886 modifications[modidx].leaf);
1888 goto fetch_about_testament_handler_aborted;
1896 fetch_about_testament_handler_aborted:
1951 const char *username,
1952 const char *password,
1966 if ((*username == 0) && (*password == 0)) {
1967 key =
"LoginDescription";
1974 NSLOG(netsurf, INFO,
1975 "key:%s url:%s realm:%s str:%s",
1976 key, url_s, realm, str);
2032 const char *realm =
"";
2033 const char *username =
"";
2034 const char *password =
"";
2036 char *description = NULL;
2037 struct nsurl *siteurl = NULL;
2042 while (curmd != NULL) {
2043 if (strcmp(curmd->
name,
"siteurl") == 0) {
2048 }
else if (strcmp(curmd->
name,
"realm") == 0) {
2049 realm = curmd->
value;
2050 }
else if (strcmp(curmd->
name,
"username") == 0) {
2051 username = curmd->
value;
2052 }
else if (strcmp(curmd->
name,
"password") == 0) {
2053 password = curmd->
value;
2055 curmd = curmd->
next;
2058 if (siteurl == NULL) {
2067 goto fetch_about_query_auth_handler_aborted;
2073 "<title>%s</title>\n" 2074 "<link rel=\"stylesheet\" type=\"text/css\" " 2075 "href=\"resource:internal.css\">\n" 2077 "<body class=\"ns-even-bg ns-even-fg ns-border\" id =\"authentication\">\n" 2078 "<h1 class=\"ns-border\">%s</h1>\n",
2081 goto fetch_about_query_auth_handler_aborted;
2085 "<form method=\"post\"" 2086 " enctype=\"multipart/form-data\">");
2088 goto fetch_about_query_auth_handler_aborted;
2097 res =
ssenddataf(ctx,
"<p>%s</p>", description);
2100 goto fetch_about_query_auth_handler_aborted;
2106 goto fetch_about_query_auth_handler_aborted;
2111 "<th><label for=\"name\">%s:</label></th>" 2112 "<td><input type=\"text\" id=\"username\" " 2113 "name=\"username\" value=\"%s\"></td>" 2117 goto fetch_about_query_auth_handler_aborted;
2122 "<th><label for=\"password\">%s:</label></th>" 2123 "<td><input type=\"password\" id=\"password\" " 2124 "name=\"password\" value=\"%s\"></td>" 2128 goto fetch_about_query_auth_handler_aborted;
2133 goto fetch_about_query_auth_handler_aborted;
2137 "<div id=\"buttons\">" 2138 "<input type=\"submit\" id=\"login\" name=\"login\" " 2139 "value=\"%s\" class=\"default-action\">" 2140 "<input type=\"submit\" id=\"cancel\" name=\"cancel\" " 2146 goto fetch_about_query_auth_handler_aborted;
2154 "<input type=\"hidden\" name=\"siteurl\" value=\"%s\">",
2158 goto fetch_about_query_auth_handler_aborted;
2162 "<input type=\"hidden\" name=\"realm\" value=\"%s\">",
2165 goto fetch_about_query_auth_handler_aborted;
2168 res =
ssenddataf(ctx,
"</form></body>\n</html>\n");
2170 goto fetch_about_query_auth_handler_aborted;
2179 fetch_about_query_auth_handler_aborted:
2198 const char *reason =
"";
2200 struct nsurl *siteurl = NULL;
2201 char *description = NULL;
2202 const char *chainurl = NULL;
2207 while (curmd != NULL) {
2208 if (strcmp(curmd->
name,
"siteurl") == 0) {
2213 }
else if (strcmp(curmd->
name,
"reason") == 0) {
2214 reason = curmd->
value;
2215 }
else if (strcmp(curmd->
name,
"chainurl") == 0) {
2216 chainurl = curmd->
value;
2218 curmd = curmd->
next;
2221 if (siteurl == NULL) {
2230 goto fetch_about_query_ssl_handler_aborted;
2236 "<title>%s</title>\n" 2237 "<link rel=\"stylesheet\" type=\"text/css\" " 2238 "href=\"resource:internal.css\">\n" 2240 "<body class=\"ns-even-bg ns-even-fg ns-border\" id =\"privacy\">\n" 2241 "<h1 class=\"ns-border ns-odd-fg-bad\">%s</h1>\n",
2244 goto fetch_about_query_ssl_handler_aborted;
2248 "<form method=\"post\"" 2249 " enctype=\"multipart/form-data\">");
2251 goto fetch_about_query_ssl_handler_aborted;
2255 "PrivacyDescription",
2258 res =
ssenddataf(ctx,
"<div><p>%s</p></div>", description);
2261 goto fetch_about_query_ssl_handler_aborted;
2265 if (chainurl == NULL) {
2267 "<div><p>%s</p></div>" 2268 "<div><p>%s</p></div>",
2273 "<div><p>%s</p></div>" 2274 "<div><p><a href=\"%s\" target=\"_blank\">%s</a></p></div>",
2280 goto fetch_about_query_ssl_handler_aborted;
2283 "<div id=\"buttons\">" 2284 "<input type=\"submit\" id=\"back\" name=\"back\" " 2285 "value=\"%s\" class=\"default-action\">" 2286 "<input type=\"submit\" id=\"proceed\" name=\"proceed\" " 2292 goto fetch_about_query_ssl_handler_aborted;
2300 "<input type=\"hidden\" name=\"siteurl\" value=\"%s\">",
2304 goto fetch_about_query_ssl_handler_aborted;
2307 res =
ssenddataf(ctx,
"</form></body>\n</html>\n");
2309 goto fetch_about_query_ssl_handler_aborted;
2318 fetch_about_query_ssl_handler_aborted:
2336 const char *reason =
"";
2338 struct nsurl *siteurl = NULL;
2339 char *description = NULL;
2344 while (curmd != NULL) {
2345 if (strcmp(curmd->
name,
"siteurl") == 0) {
2350 }
else if (strcmp(curmd->
name,
"reason") == 0) {
2351 reason = curmd->
value;
2353 curmd = curmd->
next;
2356 if (siteurl == NULL) {
2365 goto fetch_about_query_timeout_handler_aborted;
2371 "<title>%s</title>\n" 2372 "<link rel=\"stylesheet\" type=\"text/css\" " 2373 "href=\"resource:internal.css\">\n" 2375 "<body class=\"ns-even-bg ns-even-fg ns-border\" id =\"timeout\">\n" 2376 "<h1 class=\"ns-border ns-odd-fg-bad\">%s</h1>\n",
2379 goto fetch_about_query_timeout_handler_aborted;
2383 "<form method=\"post\"" 2384 " enctype=\"multipart/form-data\">");
2386 goto fetch_about_query_timeout_handler_aborted;
2390 "TimeoutDescription",
2393 res =
ssenddataf(ctx,
"<div><p>%s</p></div>", description);
2396 goto fetch_about_query_timeout_handler_aborted;
2399 res =
ssenddataf(ctx,
"<div><p>%s</p></div>", reason);
2401 goto fetch_about_query_timeout_handler_aborted;
2405 "<div id=\"buttons\">" 2406 "<input type=\"submit\" id=\"back\" name=\"back\" " 2407 "value=\"%s\" class=\"default-action\">" 2408 "<input type=\"submit\" id=\"retry\" name=\"retry\" " 2414 goto fetch_about_query_timeout_handler_aborted;
2422 "<input type=\"hidden\" name=\"siteurl\" value=\"%s\">",
2426 goto fetch_about_query_timeout_handler_aborted;
2429 res =
ssenddataf(ctx,
"</form></body>\n</html>\n");
2431 goto fetch_about_query_timeout_handler_aborted;
2440 fetch_about_query_timeout_handler_aborted:
2459 const char *reason =
"";
2461 struct nsurl *siteurl = NULL;
2462 char *description = NULL;
2467 while (curmd != NULL) {
2468 if (strcmp(curmd->
name,
"siteurl") == 0) {
2473 }
else if (strcmp(curmd->
name,
"reason") == 0) {
2474 reason = curmd->
value;
2476 curmd = curmd->
next;
2479 if (siteurl == NULL) {
2488 goto fetch_about_query_fetcherror_handler_aborted;
2494 "<title>%s</title>\n" 2495 "<link rel=\"stylesheet\" type=\"text/css\" " 2496 "href=\"resource:internal.css\">\n" 2498 "<body class=\"ns-even-bg ns-even-fg ns-border\" id =\"fetcherror\">\n" 2499 "<h1 class=\"ns-border ns-odd-fg-bad\">%s</h1>\n",
2502 goto fetch_about_query_fetcherror_handler_aborted;
2506 "<form method=\"post\"" 2507 " enctype=\"multipart/form-data\">");
2509 goto fetch_about_query_fetcherror_handler_aborted;
2513 "FetchErrorDescription",
2516 res =
ssenddataf(ctx,
"<div><p>%s</p></div>", description);
2519 goto fetch_about_query_fetcherror_handler_aborted;
2522 res =
ssenddataf(ctx,
"<div><p>%s</p></div>", reason);
2524 goto fetch_about_query_fetcherror_handler_aborted;
2528 "<div id=\"buttons\">" 2529 "<input type=\"submit\" id=\"back\" name=\"back\" " 2530 "value=\"%s\" class=\"default-action\">" 2531 "<input type=\"submit\" id=\"retry\" name=\"retry\" " 2537 goto fetch_about_query_fetcherror_handler_aborted;
2545 "<input type=\"hidden\" name=\"siteurl\" value=\"%s\">",
2549 goto fetch_about_query_fetcherror_handler_aborted;
2552 res =
ssenddataf(ctx,
"</form></body>\n</html>\n");
2554 goto fetch_about_query_fetcherror_handler_aborted;
2563 fetch_about_query_fetcherror_handler_aborted:
2635 SLEN(
"nscolours.css"),
2666 SLEN(
"certificate"),
2687 SLEN(
"query/timeout"),
2694 SLEN(
"query/fetcherror"),
2701 #define about_handler_list_len \ 2702 (sizeof(about_handler_list) / sizeof(struct about_handlers)) 2713 unsigned int abt_loop = 0;
2720 goto fetch_about_config_handler_aborted;
2724 "<title>List of NetSurf pages</title>\n" 2725 "<link rel=\"stylesheet\" type=\"text/css\" " 2726 "href=\"resource:internal.css\">\n" 2728 "<body class=\"ns-even-bg ns-even-fg ns-border\">\n" 2729 "<h1 class =\"ns-border\">List of NetSurf pages</h1>\n" 2732 goto fetch_about_config_handler_aborted;
2738 if (about_handler_list[abt_loop].
hidden)
2742 "<li><a href=\"about:%s\">about:%s</a></li>\n",
2743 about_handler_list[abt_loop].
name,
2744 about_handler_list[abt_loop].name);
2746 goto fetch_about_config_handler_aborted;
2750 res =
ssenddataf(ctx,
"</ul>\n</body>\n</html>\n");
2752 goto fetch_about_config_handler_aborted;
2759 fetch_about_config_handler_aborted:
2791 unsigned int abt_loop = 0;
2795 error = lwc_intern_string(about_handler_list[abt_loop].
name,
2796 about_handler_list[abt_loop].
name_len,
2797 &about_handler_list[abt_loop].
lname);
2798 if (error != lwc_error_ok) {
2799 while (abt_loop-- != 0) {
2800 lwc_string_unref(about_handler_list[abt_loop].lname);
2815 unsigned int abt_loop = 0;
2817 lwc_string_unref(about_handler_list[abt_loop].
lname);
2841 const char *post_urlenc,
2843 const char **headers)
2846 unsigned int handler_loop;
2850 ctx = calloc(1,
sizeof(*ctx));
2856 for (handler_loop = 0;
2859 if (lwc_string_isequal(path,
2860 about_handler_list[handler_loop].lname,
2861 &match) == lwc_error_ok && match) {
2868 lwc_string_unref(path);
2923 while (ring != NULL) {
2963 lwc_string *scheme = lwc_string_ref(corestring_lwc_about);
static bool fetch_about_testament_handler(struct fetch_about_context *ctx)
Generate the text of an svn testament which represents the current build-tree status.
nserror fetcher_add(lwc_string *scheme, const struct fetcher_operation_table *ops)
Register a fetcher for a scheme.
struct fetch_multipart_data * next
Next in linked list.
struct cert_chain::@57 certs[MAX_CERT_DEPTH]
static void fetch_about_free(void *ctx)
callback to free a about scheme fetch
static bool fetch_about_start(void *ctx)
callback to start an about scheme fetch
static void fetch_about_abort(void *ctx)
callback to abort a about fetch
static nserror get_authentication_description(struct nsurl *url, const char *realm, const char *username, const char *password, char **out_str)
generate the description of the login query
static void fetch_about_finalise(lwc_string *scheme)
callback to finalise the about scheme fetcher.
bool hidden
If entry should be hidden in listing.
Interface to utility string handling.
Functionality is not implemented.
Localised message support (interface).
Certificate public key parameters.
lwc_string * lname
Interned name.
char * not_after
Valid to date.
certificate information for certificate chain
nserror nsurl_get(const nsurl *url, nsurl_component parts, char **url_s, size_t *url_l)
Get URL (section) as a string, from a NetSurf URL object.
size_t depth
the number of certificates in the chain
Fetch POST multipart data.
static bool fetch_about_logo_handler(struct fetch_about_context *ctx)
Handler to generate about scheme logo page.
#define RING_INSERT(ring, element)
Insert the given item into the specified ring.
static bool fetch_about_imagecache_handler(struct fetch_about_context *ctx)
Handler to generate about:imagecache page.
Option reading and saving interface.
const char * messages_get_sslcode(ssl_cert_err code)
lookup of a message by SSL error code from the standard Messages hash.
static bool fetch_about_welcome_handler(struct fetch_about_context *ctx)
Handler to generate about scheme welcome page.
#define SLEN(x)
Calculate length of constant C string.
plotter style interfaces, generic styles and style colour helpers.
nserror
Enumeration of error codes.
static bool fetch_about_srverror(struct fetch_about_context *ctx)
Generate a 500 server error respnse.
void fetch_remove_from_queues(struct fetch *fetch)
remove a queued fetch
static nserror ssenddataf(struct fetch_about_context *ctx, const char *fmt,...)
send formatted data on a fetch
static bool fetch_about_send_header(struct fetch_about_context *ctx, const char *fmt,...)
long version
Certificate version.
nserror nsurl_create(const char *const url_s, nsurl **url)
Create a NetSurf URL object from a URL string.
Useful interned string pointers (interface).
const struct fetch_multipart_data * multipart
post data
static nserror format_certificate_san(struct fetch_about_context *ctx, struct ns_cert_san *san)
output formatted certificate subject alternate names
struct ns_cert_san * next
fetch_about_handler handler
handler for the url
static nserror format_certificate_name(struct fetch_about_context *ctx, struct ns_cert_name *cert_name)
#define colour_rb_swap(c)
static bool fetch_about_send_finished(struct fetch_about_context *ctx)
char * sha256fingerprint
fingerprint shar256 encoded
int image_cache_snentryf(char *string, size_t size, unsigned int entryn, const char *fmt)
Fill a buffer with information about a cache entry using a format.
#define PRIsizet
c99 standard printf formatting for size_t type
struct fetch_about_context * r_prev
bool(* initialise)(lwc_string *scheme)
The initialiser for the fetcher.
#define NSLOG(catname, level, logmsg, args...)
uint8_t * der
data in Distinguished Encoding Rules (DER) format
#define RING_REMOVE(ring, element)
Remove the given element from the specified ring.
fetch_about_handler handler
union fetch_msg::@118 data
void fetch_set_http_code(struct fetch *fetch, long http_code)
set the http code of a fetch
struct about_handlers about_handler_list[]
List of about paths and their handlers.
void fetch_free(struct fetch *f)
Free a fetch structure and associated resources.
struct ns_cert_pkey public_key
public key details
bool locked
Flag indicating entry is already entered.
static nserror free_ns_cert_info(struct ns_cert_info *cinfo)
free all resources associated with a certificate information structure
static struct fetch_about_context * ring
lwc_string * nsurl_get_component(const nsurl *url, nsurl_component part)
Get part of a URL as a lwc_string, from a NetSurf URL object.
bool aborted
Flag indicating fetch has been aborted.
static osspriteop_area * buffer
The buffer characteristics.
static nserror format_certificate(struct fetch_about_context *ctx, struct ns_cert_info *cert_info, size_t depth)
static bool fetch_about_query_fetcherror_handler(struct fetch_about_context *ctx)
Handler to generate about scheme fetch error query page.
struct ns_cert_name issuer_name
Issuer details.
int image_cache_snsummaryf(char *string, size_t size, const char *fmt)
Fill a buffer with information about the image cache using a format.
struct ns_cert_san * san
subject alternative names
char * serialnum
Serial number.
static bool fetch_about_certificate_handler(struct fetch_about_context *ctx)
Handler to generate about:certificate page.
static bool fetch_about_choices_handler(struct fetch_about_context *ctx)
Generate the text of a Choices file which represents the current in use options.
static bool fetch_about_credits_handler(struct fetch_about_context *ctx)
Handler to generate about scheme credits page.
handler info for about scheme
static bool fetch_about_query_auth_handler(struct fetch_about_context *ctx)
Handler to generate about scheme authentication query page.
const char * messages_get(const char *key)
Fast lookup of a message by key from the standard Messages hash.
static nserror format_certificate_fingerprint(struct fetch_about_context *ctx, struct ns_cert_info *cert_info)
char * not_before
Valid from date.
Netsurf additional integer type formatting macros.
bool(* fetch_about_handler)(struct fetch_about_context *)
ssl_cert_err err
Whatever is wrong with this certificate.
static bool fetch_about_licence_handler(struct fetch_about_context *ctx)
Handler to generate about scheme licence page.
nserror cert_chain_free(struct cert_chain *chain)
free a certificate chain
ssl_cert_err err
Whatever is wrong with this certificate.
colour nscolours[NSCOLOUR__COUNT]
NetSurf UI colour table.
static nserror get_query_description(struct nsurl *url, const char *key, char **out_str)
generate a generic query description
ssl_cert_err
ssl certificate error status
int sig_type
Signature type.
Interface to system colour values.
static bool fetch_about_404_handler(struct fetch_about_context *ctx)
nsurl * url
The full url the fetch refers to.
static bool fetch_about_nscolours_handler(struct fetch_about_context *ctx)
Handler to generate the nscolours stylesheet.
static bool fetch_about_initialise(lwc_string *scheme)
callback to initialise the about scheme fetcher.
Interface for fetchers factory.
nsurl * nsurl_ref(nsurl *url)
Increment the reference count to a NetSurf URL object.
size_t der_length
DER length.
Context for an about fetch.
static nserror format_certificate_public_key(struct fetch_about_context *ctx, struct ns_cert_pkey *public_key)
static nserror path(const struct redraw_context *ctx, const plot_style_t *pstyle, const float *p, unsigned int n, const float transform[6])
Plots a path.
Certificate subject alternative name.
nserror fetch_about_register(void)
Register about scheme handler.
static nserror convert_chain_to_cert_info(const struct cert_chain *chain, struct ns_cert_info **cert_info_out)
struct fetch_about_context * r_next
Interface to a number of general purpose functionality.
char * sha1fingerprint
fingerprint shar1 encoded
nserror nscolour_get_stylesheet(const char **stylesheet_out)
Get a pointer to a stylesheet for nscolours.
Information for a single fetch.
char * sig_algor
Signature Algorithm.
const char * nsurl_access(const nsurl *url)
Access a NetSurf URL object as a string.
Fetching of data from a URL (interface).
static bool fetch_about_blank_handler(struct fetch_about_context *ctx)
Handler to generate about scheme cache page.
static bool fetch_about_can_fetch(const nsurl *url)
about: URL method handler
void fetch_send_callback(const fetch_msg *msg, struct fetch *fetch)
send message to fetch
struct fetch * fetchh
Handle for this fetch.
char * messages_get_buff(const char *key,...)
Formatted message from a key in the global message hash.
struct ns_cert_name subject_name
Subject details.
#define about_handler_list_len
static void * fetch_about_setup(struct fetch *fetchh, nsurl *url, bool only_2xx, bool downgrade_tls, const char *post_urlenc, const struct fetch_multipart_data *post_multipart, const char **headers)
callback to set up a about scheme fetch.
static bool fetch_about_query_timeout_handler(struct fetch_about_context *ctx)
Handler to generate about scheme timeout query page.
struct fetch_msg::@118::@119 header_or_data
Nothing wrong with this certificate.
nserror cert_chain_from_query(struct nsurl *url, struct cert_chain **chain_out)
create a certificate chain from a fetch query string
certificate name parameters
int nsoption_snoptionf(char *string, size_t size, enum nsoption_e option_idx, const char *fmt)
Fill a buffer with an option using a format.
struct nsurl nsurl
NetSurf URL object.
static bool fetch_about_query_privacy_handler(struct fetch_about_context *ctx)
Handler to generate about scheme privacy query page.
void nsurl_unref(nsurl *url)
Drop a reference to a NetSurf URL object.
NetSurf UI colours (interface).
static bool fetch_about_config_handler(struct fetch_about_context *ctx)
Handler to generate about scheme config page.
The image content handler intermediate image cache.
static void fetch_about_poll(lwc_string *scheme)
callback to poll for additional about fetch contents
static bool fetch_about_send_callback(const fetch_msg *msg, struct fetch_about_context *ctx)
issue fetch callbacks with locking
static bool fetch_about_about_handler(struct fetch_about_context *ctx)
List all the valid about: paths available.
const char * name
name to match in url