defensive-coding-guide/pot/Features/snippets/TLS-Client-NSS-Connect.pot

103 lines
3 KiB
Text

#
# AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: 0\n"
"POT-Creation-Date: 2013-08-13T01:54:52\n"
"PO-Revision-Date: 2013-08-13T01:54:52\n"
"Last-Translator: Automatically generated\n"
"Language-Team: None\n"
"MIME-Version: 1.0\n"
"Content-Type: application/x-publican; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#. Tag: programlisting
#, no-c-format
msgid "\n"
"// Wrap the POSIX file descriptor. This is an internal NSPR\n"
"// function, but it is very unlikely to change.\n"
"PRFileDesc* nspr = PR_ImportTCPSocket(sockfd);\n"
"sockfd = -1; // Has been taken over by NSPR.\n"
"\n"
"// Add the SSL layer.\n"
"{\n"
" PRFileDesc *model = PR_NewTCPSocket();\n"
" PRFileDesc *newfd = SSL_ImportFD(NULL, model);\n"
" if (newfd == NULL) {\n"
" const PRErrorCode err = PR_GetError();\n"
" fprintf(stderr, \"error: NSPR error code %d: %s\n"
"\",\n"
" err, PR_ErrorToName(err));\n"
" exit(1);\n"
" }\n"
" model = newfd;\n"
" newfd = NULL;\n"
" if (SSL_OptionSet(model, SSL_ENABLE_SSL2, PR_FALSE) != SECSuccess) {\n"
" const PRErrorCode err = PR_GetError();\n"
" fprintf(stderr, \"error: set SSL_ENABLE_SSL2 error %d: %s\n"
"\",\n"
" err, PR_ErrorToName(err));\n"
" exit(1);\n"
" }\n"
" if (SSL_OptionSet(model, SSL_V2_COMPATIBLE_HELLO, PR_FALSE) != SECSuccess) {\n"
" const PRErrorCode err = PR_GetError();\n"
" fprintf(stderr, \"error: set SSL_V2_COMPATIBLE_HELLO error %d: %s\n"
"\",\n"
" err, PR_ErrorToName(err));\n"
" exit(1);\n"
" }\n"
" if (SSL_OptionSet(model, SSL_ENABLE_DEFLATE, PR_FALSE) != SECSuccess) {\n"
" const PRErrorCode err = PR_GetError();\n"
" fprintf(stderr, \"error: set SSL_ENABLE_DEFLATE error %d: %s\n"
"\",\n"
" err, PR_ErrorToName(err));\n"
" exit(1);\n"
" }\n"
"\n"
" // Allow overriding invalid certificate.\n"
" if (SSL_BadCertHook(model, bad_certificate, (char *)host) != SECSuccess) {\n"
" const PRErrorCode err = PR_GetError();\n"
" fprintf(stderr, \"error: SSL_BadCertHook error %d: %s\n"
"\",\n"
" err, PR_ErrorToName(err));\n"
" exit(1);\n"
" }\n"
"\n"
" newfd = SSL_ImportFD(model, nspr);\n"
" if (newfd == NULL) {\n"
" const PRErrorCode err = PR_GetError();\n"
" fprintf(stderr, \"error: SSL_ImportFD error %d: %s\n"
"\",\n"
" err, PR_ErrorToName(err));\n"
" exit(1);\n"
" }\n"
" nspr = newfd;\n"
" PR_Close(model);\n"
"}\n"
"\n"
"// Perform the handshake.\n"
"if (SSL_ResetHandshake(nspr, PR_FALSE) != SECSuccess) {\n"
" const PRErrorCode err = PR_GetError();\n"
" fprintf(stderr, \"error: SSL_ResetHandshake error %d: %s\n"
"\",\n"
" err, PR_ErrorToName(err));\n"
" exit(1);\n"
"}\n"
"if (SSL_SetURL(nspr, host) != SECSuccess) {\n"
" const PRErrorCode err = PR_GetError();\n"
" fprintf(stderr, \"error: SSL_SetURL error %d: %s\n"
"\",\n"
" err, PR_ErrorToName(err));\n"
" exit(1);\n"
"}\n"
"if (SSL_ForceHandshake(nspr) != SECSuccess) {\n"
" const PRErrorCode err = PR_GetError();\n"
" fprintf(stderr, \"error: SSL_ForceHandshake error %d: %s\n"
"\",\n"
" err, PR_ErrorToName(err));\n"
" exit(1);\n"
"}\n"
""
msgstr ""