コード例 #1
0
ファイル: UserManager.cpp プロジェクト: JoeAltmaier/Odyssey
bool 
UserManager::Logout( User *pUser, SsapiResponder *pResponder ){
	
	pUser->BuildYourselfFromYourValueSet();

	DesignatorId		id =  pUser->GetDesignatorId();
	User				*pManagedObject = (User *)GetManagedObject( &id );
	U32					rc;
	ValueSet			*pReturnSet = new ValueSet;

	if( pManagedObject ){
		rc = SSAPI_RC_SUCCESS;
		pManagedObject->DeleteOpenSession( pResponder->GetSessionID() );
		//TBDGAI if we want to show who is present, we need an event here
	}
	else
		rc = SSAPI_EXCEPTION_SECURITY;

	ValueSet	*pRc = new ValueSet;
	pRc->AddInt(rc, SSAPI_RETURN_STATUS );
	if( rc != SSAPI_RC_SUCCESS )
		pRc->AddInt( CTS_SSAPI_USER_WAS_NOT_LOGGED_IN, SSAPI_EXCEPTION_STRING_ID );
	pReturnSet->AddValue( pRc, SSAPI_RETURN_STATUS_SET );

	pResponder->Respond( pReturnSet, TRUE );

	// username as a parameter
	LogEvent( CTS_SSAPI_EVENT_USER_LOGGED_OUT, pManagedObject->GetUserName() );

	delete pReturnSet;
	delete pRc;
	return true;
}
コード例 #2
0
void FPInferredTargetsAnalysis::findAllFunctionPointersInValue(Value* V, ValueContextPairList& worklist, ValueSet& visited) {
  if (!visited.count(V)) {
    visited.insert(V);
    if (GlobalVariable* G = dyn_cast<GlobalVariable>(V)) {
      SDEBUG("soaap.analysis.infoflow.fp.infer", 3, dbgs() << INDENT_1 << "Global var: " << G->getName() << "\n");
      // don't look in the llvm.global.annotations array
      if (G->getName() != "llvm.global.annotations" && G->hasInitializer()) {
        findAllFunctionPointersInValue(G->getInitializer(), worklist, visited);
      }
    }
    else if (ConstantArray* CA = dyn_cast<ConstantArray>(V)) {
      SDEBUG("soaap.analysis.infoflow.fp.infer", 3, dbgs() << INDENT_1 << "Constant array, num of operands: " << CA->getNumOperands() << "\n");
      for (int i=0; i<CA->getNumOperands(); i++) {
        Value* V2 = CA->getOperand(i)->stripInBoundsOffsets();
        findAllFunctionPointersInValue(V2, worklist, visited);
      }
    }
    else if (Function* F = dyn_cast<Function>(V)) {
      fpTargetsUniv.insert(F);
      SDEBUG("soaap.analysis.infoflow.fp.infer", 3, dbgs() << INDENT_1 << "Func: " << F->getName() << "\n");
      setBitVector(state[ContextUtils::NO_CONTEXT][V], F);
      addToWorklist(V, ContextUtils::NO_CONTEXT, worklist);
    }
    else if (ConstantStruct* S = dyn_cast<ConstantStruct>(V)) {
      SDEBUG("soaap.analysis.infoflow.fp.infer", 3, dbgs() << INDENT_1 << "Struct, num of fields: " << S->getNumOperands() << "\n");
      for (int j=0; j<S->getNumOperands(); j++) {
        Value* V2 = S->getOperand(j)->stripInBoundsOffsets();
        findAllFunctionPointersInValue(V2, worklist, visited);
      }
    }
  }
}
コード例 #3
0
ファイル: sets_testcase.cpp プロジェクト: ericcapricorn/ardb
void test_set_diff(Ardb& db)
{
	DBID dbid = 0;
	db.SClear(dbid, "myset1");
	db.SClear(dbid, "myset2");
	db.SClear(dbid, "myset3");
	db.SAdd(dbid, "myset1", "a");
	db.SAdd(dbid, "myset1", "b");
	db.SAdd(dbid, "myset1", "c");
	db.SAdd(dbid, "myset1", "d");
	db.SAdd(dbid, "myset2", "c");
	db.SAdd(dbid, "myset3", "a");
	db.SAdd(dbid, "myset3", "c");
	db.SAdd(dbid, "myset3", "e");

	std::string str;
	SliceArray keys;
	keys.push_back("myset1");
	keys.push_back("myset2");
	keys.push_back("myset3");
	ValueSet values;
	db.SDiff(dbid, keys, values);
	CHECK_FATAL(values.size() != 2, "Sdiff failed:");
	CHECK_FATAL(values.begin()->ToString(str) != "b", "Sdiff store failed:");
	//CHECK_FATAL(FATAL, values[1] != "d") << "Sdiff store failed:";
	int len = db.SDiffStore(dbid, "myset2", keys);
	CHECK_FATAL(len != 2, "SDiffStore myset2 failed:%d", len);
	len = db.SCard(dbid, "myset2");
	CHECK_FATAL(len != 2, "SDiffStore myset2 failed:%d", len);
}
コード例 #4
0
ファイル: sets_testcase.cpp プロジェクト: ericcapricorn/ardb
void test_set_inter(Ardb& db)
{
	DBID dbid = 0;
	db.SClear(dbid, "myset1");
	db.SClear(dbid, "myset2");
	db.SClear(dbid, "myset3");
	db.SAdd(dbid, "myset1", "a");
	db.SAdd(dbid, "myset1", "b");
	db.SAdd(dbid, "myset1", "c");
	db.SAdd(dbid, "myset1", "d");
	db.SAdd(dbid, "myset2", "c");
	db.SAdd(dbid, "myset3", "a");
	db.SAdd(dbid, "myset3", "c");
	db.SAdd(dbid, "myset3", "e");

	SliceArray keys;
	keys.push_back("myset1");
	keys.push_back("myset2");
	keys.push_back("myset3");
	ValueSet values;
	db.SInter(dbid, keys, values);
	std::string str;
	CHECK_FATAL( values.size() != 1, "Sinter failed:");
	CHECK_FATAL(values.begin()->ToString(str) != "c", "Sinter store failed:");
	db.SInterStore(dbid, "myset2", keys);
	CHECK_FATAL( db.SCard(dbid, "myset2") != 1, "SInterStore myset2 failed:");
}
コード例 #5
0
ファイル: MHI.cpp プロジェクト: fjean/vipers
/*! TODO:
*/
MHIModule::MHIModule()
	:Module(MODULE_NAME, MODULE_DISPLAY_NAME, MHIMODULE_VERSION),
	mParamUnits(PARAMETER_NAME_UNITS, Variable::eVariableTypeString, "Duration units", "Units are either seconds or frames", false),
	mParamDuration(PARAMETER_NAME_DURATION, Variable::eVariableTypeDouble, "Duration", "Duration parameter for MHI, in seconds or in frames", true)
{
	mShortDescription = "Module for computing motion history image";
	mLongDescription = "This module computes a motion history image from binary images";

	ValueSet lUnitsValues;
	lUnitsValues.insert(Value("frames", "Frames", "Elapsed time is counted in frames"));
	lUnitsValues.insert(Value("seconds", "Seconds", "Elapsed time is counted in seconds"));

	mParamUnits.setPossibleValues(lUnitsValues);

	mParamUnits.setValueStr("frames");
	mParamDuration.setValue(100);
	mParamDuration.setMinValue("0");
	mParamDuration.setMaxValue("10000");

	newParameter(mParamUnits);
	newParameter(mParamDuration);

	mInputSlotMask = newSlot(new ModuleSlot(this, INPUT_SLOT_NAME_MASK, INPUT_SLOT_DISPLAYNAME_MASK, "Input mask image used to compute MHI"));
	mOutputSlotMHI = newSlot(new ModuleSlot(this, OUTPUT_SLOT_NAME_MHI, OUTPUT_SLOT_DISPLAYNAME_MHI, "Output MHI image (floating point)", &mOutputMHI));
	mOutputSlotMHIGray = newSlot(new ModuleSlot(this, OUTPUT_SLOT_NAME_MHI_GRAY, OUTPUT_SLOT_DISPLAYNAME_MHI_GRAY, "Output MHI image (gray scale image)", &mOutputMHIGray));

  mOutputMHIIpl = NULL;
  mOutputMHIGrayIpl = NULL;
	mOutputMHI = NULL;
	mOutputMHIGray = NULL;
	mEllapsedTime = 0;
}
コード例 #6
0
ファイル: UserManager.cpp プロジェクト: JoeAltmaier/Odyssey
bool 
UserManager::ChangePassword( ValueSet &requestParms, SsapiResponder *pResponder ){

	DesignatorId				id;
	UnicodeString				oldPassword, newPassword, password;
	bool						rc = true;
	ManagedObject				*pManagedObject;
	
	if( !requestParms.GetGenericValue( (char *)&id, sizeof(id), SSAPI_USER_MANAGER_CHANGE_PASSWORD_OBJECT_ID ) )
		rc = false;
	else if( !requestParms.GetString( SSAPI_USER_MANAGER_CHANGE_PASSWORD_OLD_PASSWORD, &oldPassword ) )
		rc = false;
	else if(!requestParms.GetString( SSAPI_USER_MANAGER_CHANGE_PASSWORD_NEW_PASSWORD, &newPassword ) )
		rc = false;

	if( !rc )
		return pResponder->RespondToRequest( SSAPI_EXCEPTION_INVALID_PARAMETER, CTS_SSAPI_INVALID_PARAM_EXCEPTION );

	if( !( pManagedObject = GetManagedObject( &id ) ) )
		return pResponder->RespondToRequest( SSAPI_EXCEPTION_INVALID_PARAMETER, CTS_SSAPI_OBJECT_DOES_NOT_EXIST_EXCEPTION );
	
	pManagedObject->BuildYourValueSet();
	pManagedObject->GetString( SSAPI_USER_FID_PASSWORD, &password );
	pManagedObject->Clear();
	if( (password == oldPassword) == false )
		return pResponder->RespondToRequest( SSAPI_EXCEPTION_SECURITY, CTS_SSAPI_SECURITY_INVALID_PASSWORD );

	User *pUser = new User(0);
	pUser->AddString( &newPassword, SSAPI_USER_FID_PASSWORD );
	pUser->AddGenericValue( (char *)&id, sizeof(id), SSAPI_OBJECT_FID_ID );
	rc = ModifyUser( pUser, pResponder );
	delete pUser;

	return rc;
}
コード例 #7
0
ファイル: UserManager.cpp プロジェクト: JoeAltmaier/Odyssey
STATUS 
UserManager::UpdateWrongLoginCountCallback( void *pContext, STATUS status ){

	UPDATE_INVALID_LOGIN_CELL	*pCell = (UPDATE_INVALID_LOGIN_CELL *)pContext;
	User						*pUser = (User *)GetManagedObject( &pCell->userId );
	ValueSet					*pRc = new ValueSet, *pReturnSet = new ValueSet;

	if( pUser ){
		if( !pCell->numberOfWrongLogins ){
			pUser->AddOpenSession( pCell->pResponder->GetSessionID() );
			pUser->BuildYourValueSet();
			pRc->AddInt( SSAPI_RC_SUCCESS, SSAPI_RETURN_STATUS );
			pReturnSet->AddValue( pUser, SSAPI_USER_MANAGER_LOGIN_USER_OBJECT );
			pReturnSet->AddValue( pRc, SSAPI_RETURN_STATUS_SET );
			pCell->pResponder->Respond( pReturnSet, TRUE );
		}
		else
			pCell->pResponder->RespondToRequest( SSAPI_EXCEPTION_SECURITY, CTS_SSAPI_USERNAME_PASSWORD_INVALID );
		
		pUser->SetNumberOfWrongLogins( pCell->numberOfWrongLogins );

		delete pRc;
		delete pReturnSet;
	}

	SetIsReadyToServiceRequests( true );
	delete pCell;
	return OK;
}
PointerAnalysis::ValueSet PointerAnalysis::join(PointerAnalysis::ValueSet a, PointerAnalysis::ValueSet b)
{
	ValueSet r;
	for (auto i : a)
		if (b.count(i))
			r.insert(i);
	return r;
}
PointerAnalysis::ValueSet PointerAnalysis::merge(PointerAnalysis::ValueSet a, PointerAnalysis::ValueSet b)
{
	ValueSet r;
	for (auto i : a)
		r.insert(i);
	for (auto i : b)
		r.insert(i);
	return r;
}
bool PointerAnalysis::unEqual (const ValueSet &a, const ValueSet &b) {
	if (a.size() != b.size())
		return true;

	for (auto const& e : a)
		if (b.count(e) == 0)
			return true;

	return false;
}
コード例 #11
0
bool 
StatusReporterInterface::BuildYourselfFromYourValueSet( ValueSet &vs ){

	int		rc = 1;

	rc &= vs.GetInt( SSAPI_OBJECT_FID_STATE, &m_state );
	rc &= vs.GetU32( SSAPI_OBJECT_FID_STATE_STRING, &m_stateString );

	return rc? true : false;
}
コード例 #12
0
bool 
StatusReporterInterface::BuildYourValueSet( ValueSet &vs ){

	int		rc = 1;

	rc &= vs.AddInt( m_state, SSAPI_OBJECT_FID_STATE );
	rc &= vs.AddU32( m_stateString, SSAPI_OBJECT_FID_STATE_STRING );

	return rc? true : false;
}
コード例 #13
0
bool
SetObject::construct(JSContext* cx, unsigned argc, Value* vp)
{
    CallArgs args = CallArgsFromVp(argc, vp);

    if (!ThrowIfNotConstructing(cx, args, "Set"))
        return false;

    RootedObject proto(cx);
    RootedObject newTarget(cx, &args.newTarget().toObject());
    if (!GetPrototypeFromConstructor(cx, newTarget, &proto))
        return false;

    Rooted<SetObject*> obj(cx, SetObject::create(cx, proto));
    if (!obj)
        return false;

    if (!args.get(0).isNullOrUndefined()) {
        RootedValue iterable(cx, args[0]);
        bool optimized = false;
        if (!IsOptimizableInitForSet<GlobalObject::getOrCreateSetPrototype, isBuiltinAdd>(cx, obj, iterable, &optimized))
            return false;

        if (optimized) {
            RootedValue keyVal(cx);
            Rooted<HashableValue> key(cx);
            ValueSet* set = obj->getData();
            ArrayObject* array = &iterable.toObject().as<ArrayObject>();
            for (uint32_t index = 0; index < array->getDenseInitializedLength(); ++index) {
                keyVal.set(array->getDenseElement(index));
                MOZ_ASSERT(!keyVal.isMagic(JS_ELEMENTS_HOLE));

                if (!key.setValue(cx, keyVal))
                    return false;
                if (!WriteBarrierPost(cx->runtime(), obj, keyVal) ||
                    !set->put(key))
                {
                    ReportOutOfMemory(cx);
                    return false;
                }
            }
        } else {
            FixedInvokeArgs<1> args2(cx);
            args2[0].set(args[0]);

            RootedValue thisv(cx, ObjectValue(*obj));
            if (!CallSelfHostedFunction(cx, cx->names().SetConstructorInit, thisv, args2, args2.rval()))
                return false;
        }
    }

    args.rval().setObject(*obj);
    return true;
}
コード例 #14
0
ファイル: MapObject.cpp プロジェクト: cstipkovic/gecko-dev
bool
SetObject::keys(JSContext* cx, HandleObject obj, JS::MutableHandle<GCVector<JS::Value>> keys)
{
    ValueSet* set = obj->as<SetObject>().getData();
    if (!set)
        return false;

    for (ValueSet::Range r = set->all(); !r.empty(); r.popFront()) {
        if (!keys.append(r.front().get()))
            return false;
    }

    return true;
}
コード例 #15
0
ファイル: Preparer.cpp プロジェクト: alias-checker/dyn-aa
void Preparer::replaceUndefsWithNull(User *I, ValueSet &Replaced) {
  if (Replaced.count(I))
    return;
  Replaced.insert(I);
  for (User::op_iterator OI = I->op_begin(); OI != I->op_end(); ++OI) {
    Value *V = OI->get();
    if (isa<UndefValue>(V) && V->getType()->isPointerTy()) {
      OI->set(ConstantPointerNull::get(cast<PointerType>(V->getType())));
    }
    if (User *I2 = dyn_cast<User>(V)) {
      replaceUndefsWithNull(I2, Replaced);
    }
  }
}
コード例 #16
0
ファイル: MapObject.cpp プロジェクト: paulmadore/luckyde
SetObject*
SetObject::create(JSContext* cx)
{
    SetObject* obj = NewBuiltinClassInstance<SetObject>(cx);
    if (!obj)
        return nullptr;

    ValueSet* set = cx->new_<ValueSet>(cx->runtime());
    if (!set || !set->init()) {
        js_delete(set);
        ReportOutOfMemory(cx);
        return nullptr;
    }
    obj->setPrivate(set);
    return obj;
}
bool PointerAnalysis::test(Value *v, ValueSet &set)
{
	if (set.count(v) == 0) {
		return false;
	}

	return true;
}
コード例 #18
0
ファイル: MapObject.cpp プロジェクト: cstipkovic/gecko-dev
bool
SetObject::add(JSContext* cx, HandleObject obj, HandleValue k)
{
    ValueSet* set = obj->as<SetObject>().getData();
    if (!set)
        return false;

    Rooted<HashableValue> key(cx);
    if (!key.setValue(cx, k))
        return false;

    if (!set->put(key)) {
        ReportOutOfMemory(cx);
        return false;
    }
    WriteBarrierPost(cx->runtime(), set, key.value());
    return true;
}
コード例 #19
0
ファイル: Translucency.cpp プロジェクト: fjean/vipers
/*! TODO:
*/
TranslucencyModule::TranslucencyModule()
	:Module(MODULE_NAME, MODULE_DISPLAY_NAME, TRANSLUCENCYMODULE_VERSION),
	mParamMode(PARAMETER_NAME_MODE, Variable::eVariableTypeString, "Translucency mode", "The type of translucency to perform", false),
	mParamAlpha(PARAMETER_NAME_ALPHA, Variable::eVariableTypeDouble, "Translucency alpha", "Percentage of translucency (0=opaque, 1=invisible)", true),
	mParamInvert(PARAMETER_NAME_INVERT, Variable::eVariableTypeBool, "Invert mask", "Invert plain or alpha mask", true)
{
	mShortDescription = "Module for embedding a color image in another one with translucency effect";
	mLongDescription = "This module embeds an image into another one using an alpha mask (translucency)";

	ValueSet lModeName;
	lModeName.insert(Value("image", "Whole Image", "Whole image is made translucent using the specified alpha value"));
	lModeName.insert(Value("plainmask", "Plain Mask", "Only the image pixels where the provided mask is non zero are made translucent using the specified alpha value"));
	lModeName.insert(Value("alphamask", "Alpha Mask", "Each pixel of the mask specify the alpha value to apply to the corresponding image pixel"));
	mParamMode.setPossibleValues(lModeName);

  NameSet lDependentParameterSet;
  lDependentParameterSet.insert(PARAMETER_NAME_ALPHA);
  lDependentParameterSet.insert(PARAMETER_NAME_INVERT);
  mParamMode.setDependentParameterNameSet(lDependentParameterSet);

	mParamMode.setValueStr("plainmask");
	mParamAlpha.setValue(0.5);
	mParamAlpha.setMinValue("0");
	mParamAlpha.setMaxValue("1");
	mParamInvert.setValue(false);

	newParameter(mParamMode);
	newParameter(mParamAlpha);
	newParameter(mParamInvert);

	mInputSlotBackgroundColorImage  = newSlot(new ModuleSlot(this, INPUT_SLOT_NAME_BGIMAGE, INPUT_SLOT_DISPLAYNAME_BGIMAGE, "Background image on which embedding with be performed"));
	mInputSlotTranslucencyColorImage  = newSlot(new ModuleSlot(this, INPUT_SLOT_NAME_TRANSIMAGE, INPUT_SLOT_DISPLAYNAME_TRANSIMAGE, "Image that is going to be made translucent"));
	mInputSlotTranslucencyMaskImage  = newSlot(new ModuleSlot(this, INPUT_SLOT_NAME_ALPHAMASK, INPUT_SLOT_DISPLAYNAME_ALPHAMASK, "Alpha mask used to make translucent image"));

	mOutputSlot = newSlot(new ModuleSlot(this, OUTPUT_SLOT_NAME_IMAGE, OUTPUT_SLOT_DISPLAYNAME_IMAGE, "Output image", &mOutputFrame));

	mOutputFrameIpl = NULL;
	mOutputFrame = NULL;
	mTmpFrame1 = NULL;
	mTmpFrame2 = NULL;
	mTmpFrame3 = NULL;
	mTmpFrame4 = NULL;
	mTmpFrame5 = NULL;
}
コード例 #20
0
ファイル: CodeExtractor.cpp プロジェクト: CSI-LLVM/llvm
void CodeExtractor::findInputsOutputs(ValueSet &Inputs,
                                      ValueSet &Outputs) const {
  for (BasicBlock *BB : Blocks) {
    // If a used value is defined outside the region, it's an input.  If an
    // instruction is used outside the region, it's an output.
    for (Instruction &II : *BB) {
      for (User::op_iterator OI = II.op_begin(), OE = II.op_end(); OI != OE;
           ++OI)
        if (definedInCaller(Blocks, *OI))
          Inputs.insert(*OI);

      for (User *U : II.users())
        if (!definedInRegion(Blocks, U)) {
          Outputs.insert(&II);
          break;
        }
    }
  }
}
void PointerAnalysis::printX(ValueSet &set) {
	int cnt = 0;
	outs() << "\tcnt=" << set.size() << " { ";
	for (auto v: set) {
		outs() << v->getName() << " ";
		if (!globals.count(v))
			cnt++;
	}
	outs() << "} local=" << cnt << "\n";
}
コード例 #22
0
void ConditionEncoder::TransformINsOnLookup()
{
	MEASURE_FET("ConditionEncoder::TransformINsOnLookup(...)");
	static MIIterator mid(0);
	ValueSet valset;
    RCBString s;
    for(int i = 0; i < attr->dic->CountOfUniqueValues(); i++) {
        s = attr->dic->GetRealValue(i);
        if((static_cast<MultiValColumn*>(desc->val1.vc))->Contains(mid, s) == true)
			valset.Add64(i);
    }
    in_type = ColumnType(RC_NUM);
	desc->val1.vc = new InSetColumn(in_type, NULL, valset);
	desc->val1.vc_id = desc->table->AddVirtColumn(desc->val1.vc);
	if(static_cast<InSetColumn&>(*desc->val1.vc).IsEmpty(mid)) {
		if(desc->op == O_IN)
			desc->op = O_FALSE;
		else
			desc->op = O_NOT_NULL;
	}
}
コード例 #23
0
bool
ProcessRaidUtility::ModifyObject( ValueSet &objectValues, SsapiResponder *pResponder ) {

    U32			priority;

    if( !objectValues.GetU32( SSAPI_PROCESS_FID_PRIORITY, &priority ) ) {
        pResponder->RespondToRequest( SSAPI_EXCEPTION_INVALID_PARAMETER, CTS_SSAPI_INVALIDPARM_EXCEPTION_NO_PRIORITY );
        return true;
    }

    return ChangePriority( priority, pResponder );
}
コード例 #24
0
void ConditionEncoder::LookupExpressionTransformation()
{
	MEASURE_FET("ConditionEncoder::LookupExpressionTransformation(...)");
	ExpressionColumn* vcec = dynamic_cast<ExpressionColumn*>(desc->attr.vc);
	VirtualColumnBase::VarMap col_desc = vcec->GetLookupCoordinates();
	MILookupIterator mit;
	mit.Set(NULL_VALUE_64);
	desc->encoded = false;
	bool null_positive = desc->CheckCondition(mit);
	ValueSet valset;
	in_type = ColumnType(RC_NUM);
	int code = 0;
	do {
		mit.Set(code);
		if(desc->CheckCondition(mit)) {
			if(mit.IsValid())
				valset.Add64(code);
		}
		code++;
	} while(mit.IsValid());

	if(!null_positive) {
		PhysicalColumn* col = col_desc.GetTabPtr()->GetColumn(col_desc.col_ndx);
		desc->attr.vc = new SingleColumn(col, vcec->GetMultiIndex(), col_desc.var.tab, col_desc.col_ndx, col_desc.GetTabPtr().get(), vcec->GetDim());
		desc->attr.vc_id = desc->table->AddVirtColumn(desc->attr.vc);
		desc->op = O_IN;
		desc->val1.vc = new InSetColumn(in_type, NULL, valset);
		desc->val1.vc_id = desc->table->AddVirtColumn(desc->val1.vc);
		desc->encoded = true;
	} else if(valset.IsEmpty()) {
		PhysicalColumn* col = col_desc.GetTabPtr()->GetColumn(col_desc.col_ndx);
		desc->attr.vc = new SingleColumn(col, vcec->GetMultiIndex(), col_desc.var.tab, col_desc.col_ndx, col_desc.GetTabPtr().get(), vcec->GetDim());
		desc->attr.vc_id = desc->table->AddVirtColumn(desc->attr.vc);
		desc->op = O_IS_NULL;
		desc->encoded = true;
	} else {	// both nulls and not-nulls are positive - no single operator possible
		// do not encode
		desc->encoded = false;
	}
}
コード例 #25
0
ファイル: UserManager.cpp プロジェクト: JoeAltmaier/Odyssey
void 
UserManager::CheckAndAddWellknownAccount( StringClass &chassisSerialNumber  ){

	User			*pUser, *pNewUser = NULL;
	U32				i;

	for( i = 0; i < GetManagedObjectCount(); i++ ){
		pUser = (User *)GetManagedObject( i );
		if( pUser->GetUserName() == StringClass(DEFAULT_SECURE_USER_NAME) ){
			pNewUser = pUser;
			break;
		}
	}

	if( pNewUser && (pNewUser->GetPassword() != chassisSerialNumber ) ){
		ValueSet		*pVs = new ValueSet();
		DesignatorId	id = pNewUser->GetDesignatorId();
		UnicodeString	s = pNewUser->GetPassword();
		
		pVs->AddGenericValue( (char *)&id, sizeof(id), SSAPI_USER_MANAGER_CHANGE_PASSWORD_OBJECT_ID );
		pVs->AddString( &s, SSAPI_USER_MANAGER_CHANGE_PASSWORD_OLD_PASSWORD );
		s = UnicodeString(StringClass(chassisSerialNumber));
		pVs->AddString( &s,SSAPI_USER_MANAGER_CHANGE_PASSWORD_NEW_PASSWORD );
		ChangePassword(	*pVs,
						new SsapiLocalResponder(this,
												(LOCAL_EVENT_CALLBACK)METHOD_ADDRESS(UserManager, DummyCallback) ) );
		delete pVs;
	}
	else if( !pNewUser ){
		// create a new dude
		pNewUser = new User( GetListenManager() );
		pNewUser->SetUserName( UnicodeString(StringClass(DEFAULT_SECURE_USER_NAME))  );
		pNewUser->SetPassword( UnicodeString(StringClass(chassisSerialNumber))  );
		AddUser(pNewUser,
				new SsapiLocalResponder(this,
										(LOCAL_EVENT_CALLBACK)METHOD_ADDRESS(UserManager, DummyCallback) ) );
		delete pNewUser;
	}
}
コード例 #26
0
bool 
StorageElementArray0::WriteYourselfIntoCreateArrayDefinition(ValueSet &values, 
															 RMSTR_CREATE_ARRAY_DEFINITION *pDef,
															 U32 , 
															 ManagedObject	*  ){

	ValueSet		*pSelf, *pMembers, *pSpares;
	U32				memberIndex, i;
	DesignatorId	id;

	pSelf		= (ValueSet *)values.GetValue(SSAPI_STORAGE_MANAGER_ADD_ARRAY_ARRAY_OBJECT);
	pMembers	= (ValueSet *)values.GetValue(SSAPI_STORAGE_MANAGER_ADD_ARRAY_MEMBER_ID_VECTOR);
	pSpares		= (ValueSet *)values.GetValue(SSAPI_STORAGE_MANAGER_ADD_ARRAY_SPARE_ID_VECTOR);

	*((ValueSet *)this) = *pSelf;
	BuildYourselfFromYourValueSet();
	memset( pDef, 0, sizeof(RMSTR_CREATE_ARRAY_DEFINITION) );

	pDef->raidLevel		= RAID0;
	pDef->totalCapacity	= ( m_memberCapacity * pMembers->GetCount() ) / BLOCK_SIZE;
	pDef->memberCapacity= m_memberCapacity / BLOCK_SIZE;
	pDef->peckingOrder	= (RAID_PECKING_ORDER)m_peckingOrder;
	pDef->numberMembers	= pMembers->GetCount();
	pDef->numberSpares	= pSpares? pSpares->GetCount() : 0;
	pDef->dataBlockSize	= m_dataBlockSize / BLOCK_SIZE;

	for( i = memberIndex = 0; i < pMembers->GetCount(); i++, memberIndex++ ){
		pMembers->GetGenericValue( (char *)&id, sizeof(id), i );
		pDef->arrayMembers[memberIndex] = id.GetRowId().GetRowID();
	}

	for( i = 0; pSpares && (i < pSpares->GetCount()); i++, memberIndex++ ){
		pSpares->GetGenericValue( (char *)&id, sizeof(id), i );
		pDef->arrayMembers[memberIndex] = id.GetRowId().GetRowID();
	}

	return true;
}
コード例 #27
0
Filter::FILTER_RC
IntVectorFilter::DoesApply( ValueSet &valueSet ) {

    U32			index;
    I64			*pValue;
    ValueSet	*pVector;

    if( !m_pValueVector )
        return NO_MORE_ITEMS_WILL_APPLY;

    pVector = (ValueSet *)valueSet.GetValue( m_fieldId );
    if( !pVector->GetCount() && !m_pValueVector->Count() )
        return APPLIES;

    for( index = 0; index < m_pValueVector->Count(); index++ ) {
        if( !m_pValueVector->GetAt( (CONTAINER_ELEMENT &)pValue, index ) )
            return DOES_NOT_APPLY;

        if( m_pComparator->DoesApply( &valueSet, m_fieldId, *pValue ) )
            return APPLIES;
    }

    return DOES_NOT_APPLY;
}
コード例 #28
0
void ConditionEncoder::TransformLIKEsIntoINsOnLookup()
{
	MEASURE_FET("ConditionEncoder::TransformLIKEsIntoINsOnLookup(...)");
	BHASSERT_WITH_NO_PERFORMANCE_IMPACT(attr->Type().IsLookup());

	if(desc->op == O_LIKE)
		desc->op = O_IN;
	else
		desc->op = O_NOT_IN;

	ValueSet valset;
	static MIIterator mid(0);
	in_type = ColumnType(RC_NUM);
	RCBString pattern;
	desc->val1.vc->GetValueString(pattern, mid);
	for(int i = 0; i < attr->dic->CountOfUniqueValues(); i++) {
		int res;
		if(RequiresUTFConversions(desc->GetCollation())) {
			RCBString s = attr->dic->GetRealValue(i);
			res = ! wildcmp(desc->GetCollation(), s.val, s.val + s.len,
					pattern.val, pattern.val + pattern.len,
					desc->like_esc, '_', '%');
		} else
			res = attr->dic->GetRealValue(i).Like(pattern, desc->like_esc);
		if(res)
			valset.Add64(i);
	}
	desc->val1.vc = new InSetColumn(in_type, NULL, valset);
	desc->val1.vc_id = desc->table->AddVirtColumn(desc->val1.vc);
	if(static_cast<InSetColumn&>(*desc->val1.vc).IsEmpty(mid)) {
		if(desc->op == O_IN)
			desc->op = O_FALSE;
		else
			desc->op = O_NOT_NULL;
	}
}
コード例 #29
0
bool 
ConfigIdManager::VerifyConfigIdForRequest( ValueSet &objectValues, SsapiResponder *pResponder ){

	U32		configId;
	bool	passedTheTest = false;

	if( objectValues.GetU32( 0, &configId ) ){
		if( *m_pConfigId == configId )
			passedTheTest = true;
	}

	if( !passedTheTest )
		pResponder->RespondToRequest( SSAPI_EXCEPTION_INVALID_CONFIG_ID, CTS_SSAPI_CONFIG_ID_INVALID );


	return passedTheTest? true : false;
}
コード例 #30
0
bool
IntVectorFilter::BuildYourselfFromAValueSet( ValueSet &valueSet ) {

    int			comparatorType, index;
    ValueSet	*pValueVector;
    bool		rc;
    I64			*pValue, value;

    rc = Filter::BuildYourselfFromAValueSet( valueSet );

    ClearValueVector();
    delete m_pComparator;

    valueSet.GetInt( SSAPI_INT_FLOAT_VECTOR_FILTER_FID_FIELD_ID, &m_fieldId );
    valueSet.GetInt( SSAPI_INT_FLOAT_VECTOR_FILTER_FID_COMPARATOR_TYPE, &comparatorType );
    m_pComparator = new Comparator( (Comparator::COMPARATOR_TYPE)comparatorType );

    pValueVector	= (ValueSet *)valueSet.GetValue( SSAPI_INT_FLOAT_VECTOR_FILTER_FID_VALUE_VECTOR );

    if( !pValueVector )
        return false;

    for( index = 0; index < pValueVector->GetCount(); index++ ) {
        if( !pValueVector->GetInt64( index, &value ) ) {
            int i;
            if( !pValueVector->GetInt( index, (int *)&i) )
                return false;
            else
                value = i;
        }

        pValue = new I64;
        *pValue = value;
        m_pValueVector->AddAt( (CONTAINER_ELEMENT)pValue, index );
    }

    return rc;
}