certsonlyOptions.recipients[i]);
certsonlyOptions->recipients[i]);
signed_data_certsonly(struct certsonlyOptionsStr certsonlyOptions){    NSSCMSMessage *cmsg = NULL;    NSSCMSContentInfo *cinfo;    NSSCMSSignedData *sigd;    CERTCertificate **certs;    CERTCertDBHandle *dbhandle;    PLArenaPool *tmppoolp = NULL;    int i, cnt;    dbhandle = certsonlyOptions.options->certHandle;    if ((cnt = nss_CMSArray_Count(certsonlyOptions.recipients)) == 0) {	fprintf(stderr,         "ERROR: please indicate the nickname of a certificate to sign with.\n");	goto loser;    }    if ((tmppoolp = PORT_NewArena (1024)) == NULL) {	fprintf(stderr, "ERROR: out of memory.\n");	goto loser;    }    if ((certs =          (CERTCertificate **)PORT_ArenaZAlloc(tmppoolp, 					     (cnt+1)*sizeof(CERTCertificate*)))            == NULL) {	fprintf(stderr, "ERROR: out of memory.\n");	goto loser;    }    for (i=0; certsonlyOptions.recipients[i] != NULL; i++) {	if ((certs[i] = 	      CERT_FindCertByNicknameOrEmailAddr(dbhandle,	                                        certsonlyOptions.recipients[i]))	        == NULL) {	    SECU_PrintError(progName, "cannot find certificate for \"%s\"", 	                    certsonlyOptions.recipients[i]);	    goto loser;	}    }    certs[i] = NULL;    /*     * create the message object     */    cmsg = NSS_CMSMessage_Create(NULL);    if (cmsg == NULL) {	fprintf(stderr, "ERROR: cannot create CMS message.\n");	goto loser;    }    /*     * build chain of objects: message->signedData->data     */    if ((sigd = NSS_CMSSignedData_CreateCertsOnly(cmsg, certs[0], PR_TRUE))          == NULL) {	fprintf(stderr, "ERROR: cannot create CMS signedData object.\n");	goto loser;    }    for (i=1; i<cnt; i++) {	if (NSS_CMSSignedData_AddCertChain(sigd, certs[i])) {	    fprintf(stderr, "ERROR: cannot add cert chain for \"%s\".\n",	            certsonlyOptions.recipients[i]);	    goto loser;	}    }    cinfo = NSS_CMSMessage_GetContentInfo(cmsg);    if (NSS_CMSContentInfo_SetContent_SignedData(cmsg, cinfo, sigd)           != SECSuccess) {	fprintf(stderr, "ERROR: cannot attach CMS signedData object.\n");	goto loser;    }    cinfo = NSS_CMSSignedData_GetContentInfo(sigd);    if (NSS_CMSContentInfo_SetContent_Data(cmsg, cinfo, NULL, PR_FALSE) 	   != SECSuccess) {	fprintf(stderr, "ERROR: cannot attach CMS data object.\n");	goto loser;    }    if (tmppoolp)	PORT_FreeArena(tmppoolp, PR_FALSE);    return cmsg;loser:    if (cmsg)	NSS_CMSMessage_Destroy(cmsg);    if (tmppoolp)	PORT_FreeArena(tmppoolp, PR_FALSE);    return NULL;}