Beispiel #1
0
void SoftSlot::readDB() {
  tokenFlags = CKF_RNG | CKF_LOGIN_REQUIRED | CKF_CLOCK_ON_TOKEN;

  SoftDatabase *db = new SoftDatabase(NULL);
  CK_RV rv = db->init(dbPath);

  if(rv == CKR_TOKEN_NOT_PRESENT) {
    delete db;
    return;
  }

  slotFlags |= CKF_TOKEN_PRESENT;

  if(rv == CKR_OK) {
    FREE_PTR(tokenLabel);
    tokenLabel = db->getTokenLabel();
    FREE_PTR(hashedSOPIN);
    hashedSOPIN = db->getSOPIN();
    if(tokenLabel != NULL_PTR && hashedSOPIN != NULL_PTR) {
      tokenFlags |= CKF_TOKEN_INITIALIZED;
    }

    FREE_PTR(hashedUserPIN);
    hashedUserPIN = db->getUserPIN();
    if(hashedUserPIN != NULL_PTR) {
      tokenFlags |= CKF_USER_PIN_INITIALIZED;
    }
  }

  delete db;
}
Beispiel #2
0
/* Configuration stream handling */
static void
free_url(void *data)
{
	url_t *url = data;
	FREE_PTR(url->path);
	FREE_PTR(url->digest);
	FREE(url);
}
Beispiel #3
0
void DeleteElementSumSection(struct _nbNetPDLElementBase *NetPDLElementBase)
{
struct _nbNetPDLElementShowSumStructure *NetPDLElement= (struct _nbNetPDLElementShowSumStructure *) NetPDLElementBase;

	FREE_PTR(NetPDLElement->Name);
	FREE_PTR(NetPDLElement->LongName);

	free(NetPDLElement);
}
Beispiel #4
0
/* Rule dump/allocation */
void
free_iprule(void *rule_data)
{
	ip_rule_t *rule = rule_data;

	FREE_PTR(rule->from_addr);
	FREE_PTR(rule->to_addr);
	FREE(rule_data);
}
Beispiel #5
0
void DeleteElementAlias(struct _nbNetPDLElementBase *NetPDLElementBase)
{
struct _nbNetPDLElementAlias *NetPDLElement= (struct _nbNetPDLElementAlias *) NetPDLElementBase;

	FREE_PTR(NetPDLElement->Name);
	FREE_PTR(NetPDLElement->ReplaceWith);

	free(NetPDLElement);
}
Beispiel #6
0
void DeleteElementShowTemplate(struct _nbNetPDLElementBase *NetPDLElementBase)
{
struct _nbNetPDLElementShowTemplate *NetPDLElement= (struct _nbNetPDLElementShowTemplate *) NetPDLElementBase;

	FREE_PTR(NetPDLElement->Name);
	FREE_PTR(NetPDLElement->PluginName);
 	FREE_PTR(NetPDLElement->Separator);

	free(NetPDLElement);
}
Beispiel #7
0
void DeleteElementProto(struct _nbNetPDLElementBase *NetPDLElementBase)
{
struct _nbNetPDLElementProto *NetPDLElement= (struct _nbNetPDLElementProto *) NetPDLElementBase;

	FREE_PTR(NetPDLElement->Name);
	FREE_PTR(NetPDLElement->LongName);
	FREE_PTR(NetPDLElement->ShowSumTemplateName);

	free(NetPDLElement);
}
Beispiel #8
0
void DeleteElementShowCodeText(struct _nbNetPDLElementBase *NetPDLElementBase)
{
struct _nbNetPDLElementText *NetPDLElement= (struct _nbNetPDLElementText *) NetPDLElementBase;

	FREE_PTR(NetPDLElement->Value);
	FREE_PTR(NetPDLElement->ExprString);
	if (NetPDLElement->ExprTree)
		FreeExpression(NetPDLElement->ExprTree);
	free(NetPDLElement);
}
Beispiel #9
0
/* Route dump/allocation */
void
free_iproute(void *rt_data)
{
	ip_route_t *route = rt_data;

	FREE_PTR(route->dst);
	FREE_PTR(route->src);
	FREE_PTR(route->gw);
	FREE_PTR(route->gw2);
	FREE(rt_data);
}
Beispiel #10
0
void DeleteElementAssignVariable(struct _nbNetPDLElementBase *NetPDLElementBase)
{
struct _nbNetPDLElementAssignVariable *NetPDLElement= (struct _nbNetPDLElementAssignVariable *) NetPDLElementBase;

	FREE_PTR(NetPDLElement->VariableName);

	FreeExpression(NetPDLElement->ExprTree);
	FREE_PTR(NetPDLElement->ExprString);

	free(NetPDLElement);
}
Beispiel #11
0
static void
free_http_get_check(void *data)
{
	http_checker_t *http_get_chk = CHECKER_DATA(data);
	http_t *http = HTTP_ARG(http_get_chk);
	request_t *req = HTTP_REQ(http);

	free_list(&http_get_chk->url);
	free_http_request(req);
	FREE(http);
	FREE_PTR(http_get_chk);
	FREE_PTR(CHECKER_CO(data));
	FREE(data);
}
Beispiel #12
0
void
free_iproute(void *rt_data)
{
	ip_route_t *route = rt_data;

	FREE_PTR(route->dst);
	FREE_PTR(route->src);
	FREE_PTR(route->pref_src);
	FREE_PTR(route->via);
	free_list(&route->nhs);
#ifdef RTAX_CC_ALGO
	FREE_PTR(route->congctl);
#endif
	FREE(rt_data);
}
Beispiel #13
0
int
om_udp_close(struct filed *f, void *ctx)
{
	struct om_udp_ctx *c;

	c = (struct om_udp_ctx *) ctx;

	FREE_PTR(c->host);
	FREE_PTR(c->port);
	FREE_PTR(c->addr);

	CLOSE_FD(c->fd);

	return (1);
}
Beispiel #14
0
void DeleteElementShowCodeSection(struct _nbNetPDLElementBase *NetPDLElementBase)
{
struct _nbNetPDLElementSection *NetPDLElement= (struct _nbNetPDLElementSection *) NetPDLElementBase;

	FREE_PTR(NetPDLElement->SectionName);
	free(NetPDLElement);
}
Beispiel #15
0
/** ============================================================================
 *  @func   PRCS_Delete
 *
 *  @desc   Frees up resources used by the specified object.
 *
 *  @modif  None
 *  ============================================================================
 */
EXPORT_API
DSP_STATUS
PRCS_Delete (IN PrcsObject * prcsObj)
{
    DSP_STATUS  status = DSP_SOK ;

    TRC_1ENTER ("PRCS_Delete", prcsObj) ;

    DBC_Require (PRCS_IsInitialized == TRUE) ;
    DBC_Require (prcsObj != NULL) ;
    DBC_Require (IS_OBJECT_VALID (prcsObj, SIGN_PRCS)) ;

    if (IS_OBJECT_VALID (prcsObj, SIGN_PRCS)) {
        prcsObj->signature = SIGN_NULL ;
        status = FREE_PTR (prcsObj) ;
        if (DSP_FAILED (status)) {
            SET_FAILURE_REASON ;
        }
    }
    else {
        status = DSP_EPOINTER ;
        SET_FAILURE_REASON ;
    }

    TRC_1LEAVE ("PRCS_Delete", status) ;

    return status ;
}
Beispiel #16
0
void DeleteElementShowCodeProtoField(struct _nbNetPDLElementBase *NetPDLElementBase)
{
struct _nbNetPDLElementProtoField *NetPDLElement= (struct _nbNetPDLElementProtoField *) NetPDLElementBase;

	FREE_PTR(NetPDLElement->FieldName);
	free(NetPDLElement);
}
BdMaster::~BdMaster()
{
	FREE_PTR(si_);
	FREE_ARRAY_PTR(obj_aux_);
	FREE_ARRAY_PTR(clbd_aux_);
	FREE_ARRAY_PTR(cubd_aux_);
}
Beispiel #18
0
void DeleteElementFieldVariable(struct _nbNetPDLElementBase *NetPDLElementBase)
{
struct _nbNetPDLElementFieldVariable *NetPDLElement= (struct _nbNetPDLElementFieldVariable *) NetPDLElementBase;

	FreeExpression(NetPDLElement->ExprTree);
	FREE_PTR(NetPDLElement->ExprString);
}
Beispiel #19
0
void
free_multipath (struct multipath * mpp, int free_paths)
{
	if (!mpp)
		return;

	free_multipath_attributes(mpp);

	if (mpp->alias &&
	    (!mpp->mpe || (mpp->mpe && mpp->alias != mpp->mpe->alias)) &&
	    (mpp->wwid && mpp->alias != mpp->wwid)) {
		FREE(mpp->alias);
		mpp->alias = NULL;
	}

	if (mpp->dmi) {
		FREE(mpp->dmi);
		mpp->dmi = NULL;
	}

	/*
	 * better own vecs->lock here
	 */
	if (mpp->waiter)
		((struct event_thread *)mpp->waiter)->mpp = NULL;

	free_pathvec(mpp->paths, free_paths);
	free_pgvec(mpp->pg, free_paths);
	FREE_PTR(mpp->mpcontext);
	FREE(mpp);
}
Beispiel #20
0
/** ============================================================================
 *  @func   LIST_Delete
 *
 *  @desc   Removes a list by freeing its control structure's memory space.
 *
 *  @modif  None
 *  ============================================================================
 */
EXPORT_API
DSP_STATUS
LIST_Delete (IN List * list)
{
    DSP_STATUS status = DSP_SOK ;

    TRC_1ENTER ("LIST_Delete", list) ;

    DBC_Require (list != NULL) ;

    if (list == NULL) {
        status = DSP_EINVALIDARG ;
        SET_FAILURE_REASON ;
    }
    else {
        status = FREE_PTR (list) ;
        if (DSP_FAILED (status)) {
            SET_FAILURE_REASON ;
        }
    }

    TRC_1LEAVE ("LIST_Delete", status) ;

    return status ;
}
int WXBizMsgCrypt::AES_CBCDecrypt( const char * sSource, const uint32_t iSize,
        const char * sKey, uint32_t iKeySize, std::string * poResult )
{
    if ( !sSource || !sKey || iSize < kAesKeySize || iSize % kAesKeySize != 0 || !poResult)
    {
        return -1;
    }
    
    poResult->clear();

    unsigned char * out = (unsigned char*)malloc( iSize );
    if(NULL == out)
    {
        return -1;
    }

    unsigned char key[ kAesKeySize ] = { 0 };
    unsigned char iv[ kAesIVSize ] = {0} ;
    memcpy( key, sKey, iKeySize > kAesKeySize ? kAesKeySize : iKeySize );
    memcpy(iv, key, sizeof(iv) < sizeof(key) ? sizeof(iv) : sizeof(key));

    int iReturnValue = 0;
    AES_KEY aesKey;
    AES_set_decrypt_key( key, 8 * kAesKeySize, &aesKey );
    AES_cbc_encrypt( (unsigned char *)sSource, out, iSize, &aesKey, iv ,AES_DECRYPT);
    if( out[iSize-1] > 0 && out[iSize-1] <= kAesKeySize && (iSize - out[iSize-1]) > 0 )
    {
        poResult->append( (char *)out , iSize - out[iSize-1] );
    } else {
        iReturnValue = -1;
    }

    FREE_PTR(out);
    return iReturnValue;
}
int WXBizMsgCrypt::EncodeBase64(const std::string sSrc, std::string & sTarget)
{
    if(0 == sSrc.size() || kMaxBase64Size < sSrc.size())
    {
        return -1;
    }
    
    uint32_t iBlockNum = sSrc.size() / 3;
    if (iBlockNum * 3 != sSrc.size())
    {
        iBlockNum++;
    }
    uint32_t iOutBufSize = iBlockNum * 4 + 1;
    
    char * pcOutBuf = (char*)malloc( iOutBufSize);
    if(NULL == pcOutBuf)
    {
        return -1;
    }
    int iReturn = 0;
    int ret = EVP_EncodeBlock((unsigned char*)pcOutBuf, (const unsigned char*)sSrc.c_str(), sSrc.size());
    if (ret > 0 && ret < (int)iOutBufSize)
    {
        sTarget.assign(pcOutBuf,ret);
    }
    else
    {
        iReturn = -1;
    }
    
    FREE_PTR(pcOutBuf);
    return iReturn;
}
Beispiel #23
0
/** ============================================================================
 *  @func   KFILEDEF_Close
 *
 *  @desc   Closes a file handle.
 *
 *  @modif  None
 *  ============================================================================
 */
EXPORT_API
DSP_STATUS
KFILEDEF_Close (IN Void * fileHandle)
{
    DSP_STATUS   status = DSP_SOK ;
    mm_segment_t fs               ;
    KFILEDEF_Object * fileObj = NULL ;

    TRC_1ENTER ("KFILEDEF_Close", fileHandle) ;

    DBC_Require (fileHandle != NULL);

    if (fileHandle == NULL) {
        status = DSP_EFILE ;
        SET_FAILURE_REASON ;
    }
    else {
        fileObj = (KFILEDEF_Object *) fileHandle ;
        fs = get_fs () ;
        set_fs (KERNEL_DS) ;
        filp_close (fileObj->fileDesc, NULL) ;
        set_fs (fs) ;
        FREE_PTR (fileObj) ;

    }

    DBC_Ensure (   (DSP_SUCCEEDED (status) && (fileObj == NULL))
                   || (DSP_FAILED (status))) ;

    TRC_1LEAVE ("KFILEDEF_Close", status) ;

    return status ;
}
Beispiel #24
0
void
free_encap(void *rt_data)
{
	encap_t *encap = rt_data;

	if (encap->type == LWTUNNEL_ENCAP_IP) {
		FREE_PTR(encap->ip.dst);
		FREE_PTR(encap->ip.src);
	}
	else if (encap->type == LWTUNNEL_ENCAP_IP6) {
		FREE_PTR(encap->ip6.dst);
		FREE_PTR(encap->ip6.src);
	}

	FREE(rt_data);
}
Beispiel #25
0
void DeleteElementShowSumTemplate(struct _nbNetPDLElementBase *NetPDLElementBase)
{
struct _nbNetPDLElementShowSumTemplate *NetPDLElement= (struct _nbNetPDLElementShowSumTemplate *) NetPDLElementBase;

	FREE_PTR(NetPDLElement->Name);

	free(NetPDLElement);
}
Beispiel #26
0
/* IP address dump/allocation */
void
free_ipaddress(void *if_data)
{
	ip_address_t *ipaddr = if_data;

	FREE_PTR(ipaddr->label);
	FREE(ipaddr);
}
DspDriver::~DspDriver()
{
	par_ = NULL;
	model_ = NULL;
	FREE_PTR(message_);
	FREE_ARRAY_PTR(primsol_);
	FREE_ARRAY_PTR(dualsol_);
}
Beispiel #28
0
void DeleteElementDefault(struct _nbNetPDLElementBase *NetPDLElementBase)
{
struct _nbNetPDLElementCase *NetPDLElement= (struct _nbNetPDLElementCase *) NetPDLElementBase;

	FREE_PTR(NetPDLElement->ShowString);

	free(NetPDLElement);
}
Beispiel #29
0
void
free_parent_mallocs_exit(void)
{
#if HAVE_DECL_CLONE_NEWNET
	FREE_PTR(network_namespace);
#endif

#ifdef _WITH_VRRP_
	if (free_vrrp_pidfile)
		FREE_PTR(vrrp_pidfile);
#endif
#ifdef _WITH_LVS_
	if (free_checkers_pidfile)
		FREE_PTR(checkers_pidfile);
#endif

	FREE_PTR(instance_name);
}
Beispiel #30
0
void DeleteElementNextProto(struct _nbNetPDLElementBase *NetPDLElementBase)
{
struct _nbNetPDLElementNextProto *NetPDLElement= (struct _nbNetPDLElementNextProto *) NetPDLElementBase;

	FreeExpression(NetPDLElement->ExprTree);
	FREE_PTR(NetPDLElement->ExprString);

	free(NetPDLElement);
}