summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornelson%bolyard.com <devnull@localhost>2006-04-24 04:58:06 +0000
committernelson%bolyard.com <devnull@localhost>2006-04-24 04:58:06 +0000
commitfe1c852ab2c8b69681f4df14f86fd4fb1ce9fa0e (patch)
treeb0a3eb1520fe9564b7f2ec3f29fafedc84579359
parent12cbc9aa5314d74153da130fffa2e139d48ac458 (diff)
downloadnss-hg-fe1c852ab2c8b69681f4df14f86fd4fb1ce9fa0e.tar.gz
Backport fixes for bug 332348 from trunk to NSS_3_11_BRANCH.
Patch by nelson, r=julien. Patch by Julien, r=wtchang
-rw-r--r--security/nss/cmd/tstclnt/tstclnt.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/security/nss/cmd/tstclnt/tstclnt.c b/security/nss/cmd/tstclnt/tstclnt.c
index dc2b025d1..5fabe7da7 100644
--- a/security/nss/cmd/tstclnt/tstclnt.c
+++ b/security/nss/cmd/tstclnt/tstclnt.c
@@ -77,6 +77,8 @@
#define MAX_WAIT_FOR_SERVER 600
#define WAIT_INTERVAL 100
+PRIntervalTime maxInterval = PR_INTERVAL_NO_TIMEOUT;
+
int ssl2CipherSuites[] = {
SSL_EN_RC4_128_WITH_MD5, /* A */
SSL_EN_RC4_128_EXPORT40_WITH_MD5, /* B */
@@ -374,7 +376,7 @@ thread_main(void * arg)
rc = PR_Read(std_in, buf, sizeof buf);
if (rc <= 0)
break;
- wc = PR_Write(ps, buf, rc);
+ wc = PR_Send(ps, buf, rc, 0, maxInterval);
} while (wc == rc);
PR_Close(ps);
}
@@ -419,6 +421,7 @@ int main(int argc, char **argv)
char * certDir = NULL;
char * nickname = NULL;
char * cipherString = NULL;
+ char * tmp;
int multiplier = 0;
SECStatus rv;
PRStatus status;
@@ -448,6 +451,14 @@ int main(int argc, char **argv)
progName = strrchr(argv[0], '\\');
progName = progName ? progName+1 : argv[0];
+ tmp = PR_GetEnv("NSS_DEBUG_TIMEOUT");
+ if (tmp && tmp[0]) {
+ int sec = PORT_Atoi(tmp);
+ if (sec > 0) {
+ maxInterval = PR_SecondsToInterval(sec);
+ }
+ }
+
optstate = PL_CreateOptState(argc, argv, "23BTfc:h:p:d:m:n:oqsvw:x");
while ((optstatus = PL_GetNextOpt(optstate)) == PL_OPT_OK) {
switch (optstate->option) {
@@ -786,7 +797,8 @@ int main(int argc, char **argv)
}
pollset[SSOCK_FD].fd = s;
- pollset[SSOCK_FD].in_flags = clientSpeaksFirst ? 0 : PR_POLL_READ;
+ pollset[SSOCK_FD].in_flags = PR_POLL_EXCEPT |
+ (clientSpeaksFirst ? 0 : PR_POLL_READ);
pollset[STDIN_FD].fd = PR_GetSpecialFD(PR_StandardInput);
pollset[STDIN_FD].in_flags = PR_POLL_READ;
npds = 2;
@@ -875,7 +887,7 @@ int main(int argc, char **argv)
FPRINTF(stderr, "%s: Writing %d bytes to server\n",
progName, nb);
do {
- PRInt32 cc = PR_Write(s, bufp, nb);
+ PRInt32 cc = PR_Send(s, bufp, nb, 0, maxInterval);
if (cc < 0) {
PRErrorCode err = PR_GetError();
if (err != PR_WOULD_BLOCK_ERROR) {
@@ -916,7 +928,7 @@ int main(int argc, char **argv)
#endif
) {
/* Read from socket and write to stdout */
- nb = PR_Read(pollset[SSOCK_FD].fd, buf, sizeof(buf));
+ nb = PR_Recv(pollset[SSOCK_FD].fd, buf, sizeof buf, 0, maxInterval);
FPRINTF(stderr, "%s: Read from server %d bytes\n", progName, nb);
if (nb < 0) {
if (PR_GetError() != PR_WOULD_BLOCK_ERROR) {