Ejemplo n.º 1
0
Code_t
class_setup_restricted(char *class_name,
		       Acl *acl)
{
    Triplet *triplet;
    String *d;
    unsigned long hashval;

    d = make_string(class_name,1);
    hashval = HASHVAL(d, empty, empty);
    for (triplet = triplet_bucket[hashval]; triplet; triplet = triplet->next) {
	if (triplet->dest.classname == d && triplet->dest.inst == empty &&
	    triplet->dest.recip == d) {
	    free_string(d);
	    return ZSRV_CLASSXISTS;
	}
    }

    /* Triplet not present in hash table, insert it. */
    triplet = triplet_alloc(d, empty, empty);
    free_string(d);
    if (!triplet)
	return ENOMEM;
    triplet->acl = acl;
    Triplet_insert(&triplet_bucket[hashval], triplet);
    return ZERR_NONE;
}
Ejemplo n.º 2
0
static bool
_intbig_contains(GISTTYPE *a, ArrayType *b)
{
	int			num=ARRNELEMS(b);
	int4 *ptr=ARRPTR(b);

	while(num--) {
		if (!GETBIT(GETSIGN(a),HASHVAL(*ptr)))
			return false;
		ptr++;
	}

	return true;
}
Ejemplo n.º 3
0
Acl *
class_get_acl(String *class_name)
{
    Triplet *triplet;
    unsigned long hashval;

    hashval = HASHVAL(class_name, empty, empty);
    for (triplet = triplet_bucket[hashval]; triplet; triplet = triplet->next) {
	if (triplet->dest.classname == class_name &&
	    triplet->dest.inst == empty && triplet->dest.recip == empty)
	    return triplet->acl;
    }

    /* No acl found, not restricted. */
    return NULL;
}
Ejemplo n.º 4
0
/*********************************************************************
** intbig functions
*********************************************************************/
static bool
_intbig_overlap(GISTTYPE *a, ArrayType *b)
{
	int			num = ARRNELEMS(b);
	int32	   *ptr = ARRPTR(b);

	CHECKARRVALID(b);

	while (num--)
	{
		if (GETBIT(GETSIGN(a), HASHVAL(*ptr)))
			return true;
		ptr++;
	}

	return false;
}
Ejemplo n.º 5
0
Code_t
class_restrict(char *class_name,
	       Acl *acl)
{
    Triplet *triplet;
    String *d;
    unsigned long hashval;

    d = make_string(class_name,1);
    hashval = HASHVAL(d, empty, empty);
    for (triplet = triplet_bucket[hashval]; triplet; triplet = triplet->next) {
	if (triplet->dest.classname == d && triplet->dest.inst == empty &&
	    triplet->dest.recip == empty) {
	    if (triplet->acl)
		return ZSRV_CLASSRESTRICTED;
	    triplet->acl = acl;
	    free_string(d);
	    return ZERR_NONE;
	}
    }

    free_string(d);
    return ZSRV_NOCLASS;
}
Ejemplo n.º 6
0
static bool
checkcondition_bit(void *checkval, ITEM *item)
{
	return GETBIT(checkval, HASHVAL(item->val));
}
Ejemplo n.º 7
0
static bool
checkcondition_bit(void *checkval, int4 val)
{
	return GETBIT(checkval, HASHVAL(val));
}