Whomp the tip onto SECURITY_CLIENT_BRANCH

git-svn-id: svn://10.0.0.236/branches/SECURITY_CLIENT_BRANCH@77889 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
javi%netscape.com
2000-09-01 18:10:07 +00:00
parent 6b83e59fa0
commit d259c1cdf7
3 changed files with 36 additions and 5 deletions

View File

@@ -202,6 +202,9 @@ CMTStatus CMT_PKCS7DecoderFinish(PCMT_CONTROL control, CMUint32 connectionID,
long nbytes;
char buf[128];
CMTSocket sock, ctrlsock, selSock, sockArr[2];
#ifndef XP_MAC
int numTries = 0;
#endif
/* Do some parameter checking */
if (!control) {
@@ -223,8 +226,12 @@ CMTStatus CMT_PKCS7DecoderFinish(PCMT_CONTROL control, CMUint32 connectionID,
sockArr[1] = ctrlsock;
/* Let's see if doing a poll first gets rid of a weird bug where we
* lock up the client.
* There are some cases where the server doesn't put up data fast
* enough, so we should loop on this poll instead of just trying it
* once.
*/
#ifndef XP_MAC
poll_sockets:
if (control->sockFuncs.select(sockArr,2,1) != NULL)
#endif
{
@@ -239,10 +246,28 @@ CMTStatus CMT_PKCS7DecoderFinish(PCMT_CONTROL control, CMUint32 connectionID,
} else if (nbytes == 0) {
break;
}
priv->cb(priv->cb_arg, buf, nbytes);
if (priv->cb)
priv->cb(priv->cb_arg, buf, nbytes);
}
}
}
#ifndef XP_MAC
else {
#ifdef WIN32
if (numTries < 20) {
Sleep(100);
numTries++;
goto poll_sockets;
}
#endif
#ifdef XP_UNIX
if (numTries < 25) {
numTries += sleep(1);
goto poll_sockets;
}
#endif
}
#endif
if (CMT_CloseDataConnection(control, connectionID) == CMTFailure) {
goto loser;
@@ -343,9 +368,10 @@ CMTStatus CMT_CreateSigned(PCMT_CONTROL control, CMUint32 scertRID,
CMTItem message;
CreateSignedRequest request;
CreateContentInfoReply reply;
char checkMessageForError = 0;
/* Do some parameter checking */
if (!control || !scertRID || !ecertRID || !digest || !ciRID) {
if (!control || !scertRID || !digest || !ciRID) {
goto loser;
}
@@ -367,7 +393,7 @@ CMTStatus CMT_CreateSigned(PCMT_CONTROL control, CMUint32 scertRID,
if (CMT_SendMessage(control, &message) == CMTFailure) {
goto loser;
}
checkMessageForError = 1;
/* Validate the message reply type */
if (message.type != (SSM_REPLY_OK_MESSAGE | SSM_OBJECT_SIGNING | SSM_CREATE_SIGNED)) {
goto loser;
@@ -384,7 +410,9 @@ CMTStatus CMT_CreateSigned(PCMT_CONTROL control, CMUint32 scertRID,
}
loser:
if (CMT_DecodeMessage(CreateContentInfoReplyTemplate, &reply, &message) == CMTSuccess) {
if (checkMessageForError &&
CMT_DecodeMessage(SingleNumMessageTemplate,
&reply, &message) == CMTSuccess) {
*errCode = reply.errorCode;
} else {
*errCode = 0;

View File

@@ -55,7 +55,7 @@
#include "newproto.h"
char SSMVersionString[] = "1.2";
char SSMVersionString[] = "1.3";
CMT_Alloc_fn cmt_alloc = malloc;
CMT_Free_fn cmt_free = free;

View File

@@ -64,6 +64,9 @@ typedef enum
SSM_RESTYPE_SECADVISOR_CONTEXT,
SSM_RESTYPE_SIGNTEXT,
SSM_RESTYPE_PKCS12_CONTEXT,
SSM_RESTYPE_SDR_CONTEXT, /* Internal - Not used by client protocol */
SSM_RESTYPE_MAX
} SSMResourceType;