summaryrefslogtreecommitdiffstats
path: root/stap-client-connect.c
diff options
context:
space:
mode:
Diffstat (limited to 'stap-client-connect.c')
-rw-r--r--stap-client-connect.c47
1 files changed, 5 insertions, 42 deletions
diff --git a/stap-client-connect.c b/stap-client-connect.c
index fd3b950c..8d48225d 100644
--- a/stap-client-connect.c
+++ b/stap-client-connect.c
@@ -29,6 +29,8 @@
#include <secerr.h>
#include <sslerr.h>
+#include "nsscommon.h"
+
#define READ_BUFFER_SIZE (60 * 1024)
static char *hostName = NULL;
static unsigned short port = 0;
@@ -46,50 +48,11 @@ Usage(const char *progName)
static void
errWarn(char *function)
{
- PRErrorCode errorNumber;
- PRInt32 errorTextLength;
- PRInt32 rc;
- char *errorText;
-
- errorNumber = PR_GetError();
- fprintf(stderr, "Error in function %s: %d: ", function, errorNumber);
-
- /* See if PR_GetErrorText can tell us what the error is. */
- if (errorNumber >= PR_NSPR_ERROR_BASE && errorNumber <= PR_MAX_ERROR)
- {
- errorTextLength = PR_GetErrorTextLength ();
- if (errorTextLength != 0) {
- errorText = PORT_Alloc(errorTextLength);
- rc = PR_GetErrorText (errorText);
- if (rc != 0)
- fprintf (stderr, "%s\n", errorText);
- PR_Free (errorText);
- if (rc != 0)
- return;
- }
- }
-
- /* Otherwise handle common errors ourselves. */
- switch (errorNumber)
- {
- case SEC_ERROR_CA_CERT_INVALID:
- fputs ("The issuer's certificate is invalid\n", stderr);
- break;
- case SEC_ERROR_BAD_DATABASE:
- fputs ("The specified certificate database does not exist or is not valid\n", stderr);
- break;
- case SSL_ERROR_BAD_CERT_DOMAIN:
- fputs ("The requested domain name does not match the server's certificate\n", stderr);
- break;
- case PR_CONNECT_RESET_ERROR:
- fputs ("Connection reset by peer\n", stderr);
- break;
- default:
- fputs ("Unknown error\n", stderr);
- break;
- }
+ fprintf(stderr, "Error in function %s: ", function);
+ nssError();
}
+
static void
exitErr(char *function)
{