summaryrefslogtreecommitdiffstats
path: root/stap-client-connect.c
diff options
context:
space:
mode:
authorDave Brolley <brolley@redhat.com>2009-01-28 15:45:14 -0500
committerDave Brolley <brolley@redhat.com>2009-01-28 15:45:14 -0500
commit078198eb01e89d1b79ae96203525d59945f68067 (patch)
treeee762b9f24d87ac123f66106b27c6918ebc7c92a /stap-client-connect.c
parent69aa1bdbbcc270d55f879c3a167dfee9baa03f61 (diff)
downloadsystemtap-steved-078198eb01e89d1b79ae96203525d59945f68067.tar.gz
systemtap-steved-078198eb01e89d1b79ae96203525d59945f68067.tar.xz
systemtap-steved-078198eb01e89d1b79ae96203525d59945f68067.zip
Implement the --server option for stap-client for control over which server is
used and for using non-local servers.
Diffstat (limited to 'stap-client-connect.c')
-rw-r--r--stap-client-connect.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/stap-client-connect.c b/stap-client-connect.c
index 9466b566..fd64f6c7 100644
--- a/stap-client-connect.c
+++ b/stap-client-connect.c
@@ -27,6 +27,7 @@
#include <nss.h>
#include <prerror.h>
#include <secerr.h>
+#include <sslerr.h>
#define READ_BUFFER_SIZE (60 * 1024)
static char *hostName = NULL;
@@ -74,6 +75,12 @@ errWarn(char *function)
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;
@@ -307,10 +314,12 @@ static SECStatus
do_connect(PRNetAddr *addr)
{
PRFileDesc *sslSocket;
+ PRStatus prStatus;
+#if 0
PRHostEnt hostEntry;
char buffer[PR_NETDB_BUF_SIZE];
- PRStatus prStatus;
PRIntn hostenum;
+#endif
SECStatus secStatus;
secStatus = SECSuccess;
@@ -338,7 +347,7 @@ do_connect(PRNetAddr *addr)
errWarn("SSL_SetURL");
goto done;
}
-
+#if 0 /* Already done? */
/* Prepare and setup network connection. */
prStatus = PR_GetHostByName(hostName, buffer, sizeof(buffer), &hostEntry);
if (prStatus != PR_SUCCESS)
@@ -355,7 +364,7 @@ do_connect(PRNetAddr *addr)
secStatus = SECFailure;
goto done;
}
-
+#endif
prStatus = PR_Connect(sslSocket, addr, PR_INTERVAL_NO_TIMEOUT);
if (prStatus != PR_SUCCESS)
{
@@ -397,7 +406,7 @@ do_connect(PRNetAddr *addr)
}
static void
-client_main(unsigned short port, const char *hostName)
+client_main(unsigned short port)
{
SECStatus secStatus;
PRStatus prStatus;
@@ -479,7 +488,7 @@ main(int argc, char **argv)
/* All cipher suites except RSA_NULL_MD5 are enabled by Domestic Policy. */
NSS_SetDomesticPolicy();
- client_main(port, hostName);
+ client_main(port);
NSS_Shutdown();
PR_Cleanup();