示例#1
0
afs_int32
AddToOwnerChain(struct ubik_trans *at, afs_int32 gid, afs_int32 oid)
{
    /* add entry designated by gid to owner chain of entry designated by oid */
    afs_int32 code;
    afs_int32 loc;
    struct prentry tentry;
    struct prentry gentry;
    afs_int32 gloc;

    loc = FindByID(at, oid);
    if (!loc)
	return PRNOENT;
    code = pr_ReadEntry(at, 0, loc, &tentry);
    if (code != 0)
	return PRDBFAIL;
    if (oid == gid) {		/* added it to its own chain */
	tentry.nextOwned = tentry.owned;
	tentry.owned = loc;
    } else {
	gloc = FindByID(at, gid);
	code = pr_ReadEntry(at, 0, gloc, &gentry);
	if (code != 0)
	    return PRDBFAIL;
	gentry.nextOwned = tentry.owned;
	tentry.owned = gloc;
	code = pr_WriteEntry(at, 0, gloc, &gentry);
	if (code != 0)
	    return PRDBFAIL;
    }
    code = pr_WriteEntry(at, 0, loc, &tentry);
    if (code != 0)
	return PRDBFAIL;
    return PRSUCCESS;
}
示例#2
0
文件: utils.c 项目: adeason/openafs
afs_int32
AllocID(struct ubik_trans *at, afs_int32 flag, afs_int32 *aid)
{
    /* allocs an id from the proper area of address space, based on flag */
    afs_int32 code = 1;
    afs_int32 i = 0;
    int maxcount = 50;	/* to prevent infinite loops */

    if (flag & PRGRP) {
	*aid = ntohl(cheader.maxGroup);
	/* Check for PRBADID to avoid wrap-around. */
	while (code && i < maxcount && *aid != PRBADID) {
	    --(*aid);
	    code = FindByID(at, *aid);
	    i++;
	}
	if (code)
	    return PRNOIDS;
	cheader.maxGroup = htonl(*aid);
	code =
	    pr_Write(at, 0, 16, (char *)&cheader.maxGroup,
		     sizeof(cheader.maxGroup));
	if (code)
	    return PRDBFAIL;
	return PRSUCCESS;
    } else if (flag & PRFOREIGN) {
	*aid = ntohl(cheader.maxForeign);
	while (code && i < maxcount) {
	    ++(*aid);
	    code = FindByID(at, *aid);
	    i++;
	}
	if (code)
	    return PRNOIDS;
	cheader.maxForeign = htonl(*aid);
	code =
	    pr_Write(at, 0, 24, (char *)&cheader.maxForeign,
		     sizeof(cheader.maxForeign));
	if (code)
	    return PRDBFAIL;
	return PRSUCCESS;
    } else {
	*aid = ntohl(cheader.maxID);
	while (code && i < maxcount && *aid != 0x7fffffff) {
	    ++(*aid);
	    code = FindByID(at, *aid);
	    i++;
	}
	if (code)
	    return PRNOIDS;
	cheader.maxID = htonl(*aid);
	code =
	    pr_Write(at, 0, 20, (char *)&cheader.maxID,
		     sizeof(cheader.maxID));
	if (code)
	    return PRDBFAIL;
	return PRSUCCESS;
    }
}
CShopItemPtr CShop::FindShopItemDefByClassName( const idStr &className ) {
	CShopItemPtr found = FindByID( _itemDefs, className );
	if( found != NULL ) {
		return found;
	}
	// Check if we should run another search
	if( idStr::Cmpn( className.c_str(), "atdm:", 5 ) == 0 ) {
		return CShopItemPtr(); // atdm is already prepended, return empty
	}
	// Try again with "atdm:" prepended
	return FindByID( _itemDefs, "atdm:" + className );
}
示例#4
0
afs_int32
IsAMemberOf(struct ubik_trans *at, afs_int32 aid, afs_int32 gid)
{
    /* returns true if aid is a member of gid */
#if !defined(SUPERGROUPS)
    struct prentry tentry;
    struct contentry centry;
    afs_int32 code;
    afs_int32 i;
    afs_int32 loc;
#endif

    /* special case anyuser and authuser */
    if (gid == ANYUSERID)
	return 1;
    if (gid == AUTHUSERID && aid != ANONYMOUSID)
	return 1;
    /* check -localauth case */
    if (gid == SYSADMINID && aid == SYSADMINID)
        return 1;
    if ((gid == 0) || (aid == 0))
	return 0;
#if defined(SUPERGROUPS)
    return IsAMemberOfSG(at, aid, gid, depthsg);
#else
    loc = FindByID(at, gid);
    if (!loc)
	return 0;
    memset(&tentry, 0, sizeof(tentry));
    code = pr_ReadEntry(at, 0, loc, &tentry);
    if (code)
	return 0;
    if (!(tentry.flags & PRGRP))
	return 0;
    for (i = 0; i < PRSIZE; i++) {
	if (tentry.entries[i] == 0)
	    return 0;
	if (tentry.entries[i] == aid)
	    return 1;
    }
    if (tentry.next) {
	loc = tentry.next;
	while (loc) {
	    memset(&centry, 0, sizeof(centry));
	    code = pr_ReadCoEntry(at, 0, loc, &centry);
	    if (code)
		return 0;
	    for (i = 0; i < COSIZE; i++) {
		if (centry.entries[i] == aid)
		    return 1;
		if (centry.entries[i] == 0)
		    return 0;
	    }
	    loc = centry.next;
	}
    }
    return 0;			/* actually, should never get here */
#endif
}
示例#5
0
afs_int32
RemoveFromOwnerChain(struct ubik_trans *at, afs_int32 gid, afs_int32 oid)
{
    afs_int32 code;
    afs_int32 nptr;
    struct prentry thisEntry;
    struct prentry thatEntry;
    struct prentry *te;		/* pointer to current (this) entry */
    struct prentry *le;		/* pointer to previous (last) entry */
    afs_int32 loc, lastLoc;

    loc = FindByID(at, oid);
    if (!loc)
	return PRNOENT;
    code = pr_ReadEntry(at, 0, loc, &thisEntry);
    if (code != 0)
	return PRDBFAIL;
    le = &thisEntry;
    lastLoc = 0;
    nptr = thisEntry.owned;
    while (nptr != 0) {
	if (nptr == lastLoc)
	    te = le;
	else {
	    if (&thisEntry == le)
		te = &thatEntry;
	    else
		te = &thisEntry;
	    code = pr_ReadEntry(at, 0, nptr, te);
	    if (code != 0)
		return PRDBFAIL;
	}
	if (te->id == gid) {
	    /* found it */
	    if (lastLoc == 0) {	/* modifying first of chain */
		le->owned = te->nextOwned;
		lastLoc = loc;	/* so we write to correct location */
	    } else
		le->nextOwned = te->nextOwned;
	    te->nextOwned = 0;
	    if (te != le) {
		code = pr_WriteEntry(at, 0, nptr, te);
		if (code != 0)
		    return PRDBFAIL;
	    }
	    code = pr_WriteEntry(at, 0, lastLoc, le);
	    if (code != 0)
		return PRDBFAIL;
	    return PRSUCCESS;
	}
	lastLoc = nptr;
	le = te;
	nptr = te->nextOwned;
    }
    return PRSUCCESS;		/* already removed? */
}
示例#6
0
afs_int32
RemoveFromOrphan(struct ubik_trans *at, afs_int32 gid)
{
    /* remove gid from the orphan list */
    afs_int32 code;
    afs_int32 loc;
    afs_int32 nptr;
    struct prentry tentry;
    struct prentry bentry;

    loc = FindByID(at, gid);
    if (!loc)
	return PRNOENT;
    code = pr_ReadEntry(at, 0, loc, &tentry);
    if (code != 0)
	return PRDBFAIL;
    if (cheader.orphan == htonl(loc)) {
	cheader.orphan = htonl(tentry.nextOwned);
	tentry.nextOwned = 0;
	code =
	    pr_Write(at, 0, 32, (char *)&cheader.orphan,
		     sizeof(cheader.orphan));
	if (code != 0)
	    return PRDBFAIL;
	code = pr_WriteEntry(at, 0, loc, &tentry);
	if (code != 0)
	    return PRDBFAIL;
	return PRSUCCESS;
    }
    nptr = ntohl(cheader.orphan);
    memset(&bentry, 0, sizeof(bentry));
    loc = 0;
    while (nptr != 0) {
	code = pr_ReadEntry(at, 0, nptr, &tentry);
	if (code != 0)
	    return PRDBFAIL;
	if (gid == tentry.id) {
	    /* found it */
	    bentry.nextOwned = tentry.nextOwned;
	    tentry.nextOwned = 0;
	    code = pr_WriteEntry(at, 0, loc, &bentry);
	    if (code != 0)
		return PRDBFAIL;
	    code = pr_WriteEntry(at, 0, nptr, &tentry);
	    if (code != 0)
		return PRDBFAIL;
	    return PRSUCCESS;
	}
	loc = nptr;
	nptr = tentry.nextOwned;
	memcpy(&bentry, &tentry, sizeof(tentry));
    }
    return PRSUCCESS;
}
示例#7
0
inline WifiListWidget::NetworkInfo *
WifiListWidget::Find(const WifiConfiguredNetworkInfo &c)
{
  auto found = FindByID(c.id);
  if (found != nullptr)
    return found;

  return c.bssid == "any"
    ? FindVisibleBySSID(c.ssid)
    : FindByBSSID(c.bssid);
}
示例#8
0
void CMyRibbonBar::testUpdate()
{
	CMFCRibbonComboBox* pFormatSelCombo = DYNAMIC_DOWNCAST(CMFCRibbonComboBox, FindByID(WM_CHART_FORMAT_SEL_COMBO));
	if (pFormatSelCombo == NULL)
	{
		return;
	}
	pFormatSelCombo->SelectItem(2);
	return;
	int i=pFormatSelCombo->GetCurSel();
}
示例#9
0
afs_int32
OwnerOf(struct ubik_trans *at, afs_int32 gid)
{
    /* returns the owner of gid */
    afs_int32 code;
    afs_int32 loc;
    struct prentry tentry;

    loc = FindByID(at, gid);
    if (!loc)
	return 0;
    code = pr_ReadEntry(at, 0, loc, &tentry);
    if (code != 0)
	return 0;
    return tentry.owner;
}
示例#10
0
afs_int32
IDToName(struct ubik_trans *at, afs_int32 aid, char aname[PR_MAXNAMELEN])
{
    afs_int32 temp;
    struct prentry tentry;
    afs_int32 code;

    temp = FindByID(at, aid);
    if (temp == 0)
	return PRNOENT;
    code = pr_Read(at, 0, temp, (char *)&tentry, sizeof(tentry));
    if (code)
	return code;
    strncpy(aname, tentry.name, PR_MAXNAMELEN);
    return PRSUCCESS;
}
示例#11
0
afs_int32
IsOwnerOf(struct ubik_trans *at, afs_int32 aid, afs_int32 gid)
{
    /* returns 1 if aid is the owner of gid, 0 otherwise */
    afs_int32 code;
    struct prentry tentry;
    afs_int32 loc;

    loc = FindByID(at, gid);
    if (!loc)
	return 0;
    code = pr_ReadEntry(at, 0, loc, &tentry);
    if (code != 0)
	return 0;
    if (tentry.owner == aid)
	return 1;
    return 0;
}
VTextureWeightmapChannelResource *VTextureWeightmapChannelResourceCollection::CreateDetailTexture(const VTextureWeightmapChannelResource::DetailTextureProperties_t &props)
{
  VTextureWeightmapChannelResource *pFound = FindByID(props.m_iTextureID);
  if (pFound)
  {
    if (pFound->m_Properties==props)
      return pFound;

    // update properties in existing channel:
    pFound->m_Properties = props;
    return pFound;
  }


  // create a new one
  VTextureWeightmapChannelResource *pNew = new VTextureWeightmapChannelResource(props);
  pNew->m_iSortingKey = Count(); // do not re-enum all others
  Add(pNew);
  return pNew;
}
示例#13
0
afs_int32
AddToOrphan(struct ubik_trans *at, afs_int32 gid)
{
    afs_int32 code;
    afs_int32 loc;
    struct prentry tentry;

    loc = FindByID(at, gid);
    if (!loc)
	return PRNOENT;
    code = pr_ReadEntry(at, 0, loc, &tentry);
    if (code != 0)
	return PRDBFAIL;
    tentry.nextOwned = ntohl(cheader.orphan);
    code = set_header_word(at, orphan, htonl(loc));
    if (code != 0)
	return PRDBFAIL;
    tentry.owner = 0;		/* so there's no confusion later */
    code = pr_WriteEntry(at, 0, loc, &tentry);
    if (code != 0)
	return PRDBFAIL;
    return PRSUCCESS;
}
示例#14
0
void ZSList::SOPZoneBootup(const char* adminname, uint32 ZoneServerID, const char* zonename, bool iMakeStatic) {
	ZoneServer* zs = 0;
	ZoneServer* zs2 = 0;
	uint32 zoneid;
	if (!(zoneid = database.GetZoneID(zonename)))
		SendEmoteMessage(adminname, 0, 0, 0, "Error: SOP_ZoneBootup: zone '%s' not found in 'zone' table. Typo protection=ON.", zonename);
	else {
		if (ZoneServerID != 0)
			zs = FindByID(ZoneServerID);
		else
			SendEmoteMessage(adminname, 0, 0, 0, "Error: SOP_ZoneBootup: ServerID must be specified");

		if (zs == 0)
			SendEmoteMessage(adminname, 0, 0, 0, "Error: SOP_ZoneBootup: zoneserver not found");
		else {
			zs2 = FindByName(zonename);
			if (zs2 != 0)
				SendEmoteMessage(adminname, 0, 0, 0, "Error: SOP_ZoneBootup: zone '%s' already being hosted by ZoneServer #%i", zonename, zs2->GetID());
			else {
				zs->TriggerBootup(zoneid, 0, adminname, iMakeStatic);
			}
		}
	}
}
示例#15
0
CShopItemPtr CShop::FindStartingItemByID(const char *id)
{
	return FindByID(_startingItems, id);
}
示例#16
0
文件: pt_util.c 项目: bagdxk/openafs
static int
CommandProc(struct cmd_syndesc *a_as, void *arock)
{
    int i;
    long code = 0;
    long upos;
    long gpos = 0;
    struct prentry uentry, gentry;
    struct ubik_hdr *uh;
    char *dfile = 0;
    const char *pbase = AFSDIR_SERVER_PRDB_FILEPATH;
    char *pfile = NULL;
    char pbuffer[1028];
    struct cmd_parmdesc *tparm;

    tparm = a_as->parms;

    if (tparm[0].items) {
	wflag++;
	/* so we are treated as admin and can create "mis"owned
	   groups */
	pr_noAuth = 1;
    }
    if (tparm[1].items) {
	flags |= DO_USR;
    }
    if (tparm[2].items) {
	flags |= DO_GRP;
    }
    if (tparm[3].items) {
	flags |= (DO_GRP | DO_MEM);
    }
    if (tparm[4].items) {
	nflag++;
    }
    if (tparm[5].items) {
	flags |= DO_SYS;
    }
    if (tparm[6].items) {
	flags |= DO_OTR;
    }
    if (tparm[7].items) {
	pfile = tparm[7].items->data;
    }
    if (tparm[8].items) {
	dfile = tparm[8].items->data;
    }

    if (pfile == NULL) {
        snprintf(pbuffer, sizeof(pbuffer), "%s.DB0", pbase);
        pfile = pbuffer;
    }
    if ((dbase_fd = open(pfile, (wflag ? O_RDWR : O_RDONLY) | O_CREAT, 0600))
	< 0) {
	fprintf(stderr, "pt_util: cannot open %s: %s\n", pfile,
		strerror(errno));
	exit(1);
    }
    if (read(dbase_fd, buffer, HDRSIZE) < 0) {
	fprintf(stderr, "pt_util: error reading %s: %s\n", pfile,
		strerror(errno));
	exit(1);
    }

    if (dfile) {
	if ((dfp = fopen(dfile, wflag ? "r" : "w")) == 0) {
	    fprintf(stderr, "pt_util: error opening %s: %s\n", dfile,
		    strerror(errno));
	    exit(1);
	}
    } else
	dfp = (wflag ? stdin : stdout);

    uh = (struct ubik_hdr *)buffer;
    if (ntohl(uh->magic) != UBIK_MAGIC)
	fprintf(stderr, "pt_util: %s: Bad UBIK_MAGIC. Is %x should be %x\n",
		pfile, ntohl(uh->magic), UBIK_MAGIC);
    memcpy(&uv, &uh->version, sizeof(struct ubik_version));

    if (wflag && ntohl(uv.epoch) == 0 && ntohl(uv.counter) == 0) {
	uv.epoch = htonl(2); /* a ubik version of 0 or 1 has special meaning */
	memcpy(&uh->version, &uv, sizeof(struct ubik_version));
	lseek(dbase_fd, 0, SEEK_SET);
	if (write(dbase_fd, buffer, HDRSIZE) < 0) {
	    fprintf(stderr, "pt_util: error writing ubik version to %s: %s\n",
		    pfile, strerror(errno));
	    exit(1);
	}
    }

    /* Now that any writeback is done, swap these */
    uv.epoch = ntohl(uv.epoch);
    uv.counter = ntohl(uv.counter);

    fprintf(stderr, "Ubik Version is: %d.%d\n", uv.epoch, uv.counter);
    if (read(dbase_fd, &prh, sizeof(struct prheader)) < 0) {
	fprintf(stderr, "pt_util: error reading %s: %s\n", pfile,
		strerror(errno));
	exit(1);
    }

    Initdb();
    initialize_PT_error_table();

    if (wflag) {
	struct usr_list *u;
	int seenGroup = 0, id = 0, flags = 0;

	while (fgets(buffer, sizeof(buffer), dfp)) {
	    int oid, cid, quota, uid;
	    char name[PR_MAXNAMELEN], mem[PR_MAXNAMELEN];

	    if (isspace(*buffer)) {
		code = sscanf(buffer, "%s %d", mem, &uid);
		if (code != 2) {
		    fprintf(stderr,
			    "Insuffient data provided for group membership\n");
		    exit(1);
		}

		if (!seenGroup) {
		    fprintf(stderr,
			    "Group member %s listed outside of group\n",
			    mem);
		    exit(1);
		}

		for (u = usr_head; u; u = u->next)
		    if (u->uid && u->uid == uid)
			break;
		if (u) {
		    /* Add user - deferred because it is probably foreign */
		    u->uid = 0;
		    if (FindByID(0, uid))
			code = PRIDEXIST;
		    else {
			if (!code
			    && (flags & (PRGRP | PRQUOTA)) ==
			    (PRGRP | PRQUOTA)) {
			    gentry.ngroups++;
			    code = pr_WriteEntry(0, 0, gpos, &gentry);
			    if (code)
				fprintf(stderr,
					"Error setting group count on %s: %s\n",
					name, afs_error_message(code));
			}
			code = CreateEntry(0, u->name, &uid, 1 /*idflag */ ,
					   1 /*gflag */ ,
					   SYSADMINID /*oid */ ,
					   SYSADMINID /*cid */ );
		    }
		    if (code)
			fprintf(stderr, "Error while creating %s: %s\n",
				u->name, afs_error_message(code));
		    continue;
		}
		/* Add user to group */
		if (id == ANYUSERID || id == AUTHUSERID || uid == ANONYMOUSID) {
		    code = PRPERM;
		} else if ((upos = FindByID(0, uid))
			   && (gpos = FindByID(0, id))) {
		    code = pr_ReadEntry(0, 0, upos, &uentry);
		    if (!code)
			code = pr_ReadEntry(0, 0, gpos, &gentry);
		    if (!code)
			code = AddToEntry(0, &gentry, gpos, uid);
		    if (!code)
			code = AddToEntry(0, &uentry, upos, id);
		} else
		    code = PRNOENT;

		if (code)
		    fprintf(stderr, "Error while adding %s to %s: %s\n", mem,
			    name, afs_error_message(code));
	    } else {
		code = sscanf(buffer, "%s %d/%d %d %d %d", name, &flags, &quota, &id,
			      &oid, &cid);
		if (code != 6) {
		    fprintf(stderr,
			    "Insufficient data provided for user/group\n");
		    exit(1);
		}

		seenGroup = 1;

		if (FindByID(0, id))
		    code = PRIDEXIST;
		else
		    code = CreateEntry(0, name, &id, 1 /*idflag */ ,
				       flags & PRGRP, oid, cid);
		if (code == PRBADNAM) {
		    u = malloc(sizeof(struct usr_list));
		    u->next = usr_head;
		    u->uid = id;
		    strcpy(u->name, name);
		    usr_head = u;
		} else if (code) {
		    fprintf(stderr, "Error while creating %s: %s\n", name,
			    afs_error_message(code));
		} else if ((flags & PRACCESS)
			   || (flags & (PRGRP | PRQUOTA)) ==
			   (PRGRP | PRQUOTA)) {
		    gpos = FindByID(0, id);
		    code = pr_ReadEntry(0, 0, gpos, &gentry);
		    if (!code) {
			gentry.flags = flags;
			gentry.ngroups = quota;
			code = pr_WriteEntry(0, 0, gpos, &gentry);
		    }
		    if (code)
			fprintf(stderr,
				"Error while setting flags on %s: %s\n", name,
				afs_error_message(code));
		}
	    }
	}
	for (u = usr_head; u; u = u->next)
	    if (u->uid)
		fprintf(stderr, "Error while creating %s: %s\n", u->name,
			afs_error_message(PRBADNAM));
    } else {
	for (i = 0; i < HASHSIZE; i++) {
	    upos = nflag ? ntohl(prh.nameHash[i]) : ntohl(prh.idHash[i]);
	    while (upos) {
		long newpos;
		newpos = display_entry(upos);
		if (newpos == upos) {
		    fprintf(stderr, "pt_util: hash error in %s chain %d\n",
			    nflag ? "name":"id", i);
		    exit(1);
		} else
		    upos = newpos;
	    }
	}
	if (flags & DO_GRP)
	    display_groups();
    }

    lseek(dbase_fd, 0, L_SET);	/* rewind to beginning of file */
    if (read(dbase_fd, buffer, HDRSIZE) < 0) {
	fprintf(stderr, "pt_util: error reading %s: %s\n", pfile,
		strerror(errno));
	exit(1);
    }
    uh = (struct ubik_hdr *)buffer;

    uh->version.epoch = ntohl(uh->version.epoch);
    uh->version.counter = ntohl(uh->version.counter);

    if ((uh->version.epoch != uv.epoch)
	|| (uh->version.counter != uv.counter)) {
	fprintf(stderr,
		"pt_util: Ubik Version number changed during execution.\n");
	fprintf(stderr, "Old Version = %d.%d, new version = %d.%d\n",
		uv.epoch, uv.counter, uh->version.epoch, uh->version.counter);
    }
    close(dbase_fd);
    exit(0);
}
示例#17
0
//! \brief Model にメッセージがあればこれで。解析は Model の仕事
//! \param[in]  ID_         Model の ID。
//                          管理する時点で必要になりそうなものは各自継承先で
//                          ID をメンバとして保存しておくこと。
//! \param[in]  message_    伝えるメッセージ。解析は Model の仕事。
//! \retval     true        メッセージを正常に伝えた
//! \retval     false       ID_ が見つからなかった
bool ControlerInterface::sendMessageToModel(unsigned int ID_, std::string message_) {
	bool result = true;
	ModelerInterfaceContainer::iterator model = std::find_if(this->modelContainer.begin(), this->modelContainer.end(), FindByID(ID_));
	if (model != this->modelContainer.end()) {
		result = false;
	} else {
		(*model)->setMessage(message_);
	}

	return result;
}
示例#18
0
CShopItemPtr CShop::FindForSaleByID(const char *id)
{
	return FindByID(_itemsForSale, id);
}
示例#19
0
afs_int32
IsAMemberOfSG(struct ubik_trans *at, afs_int32 aid, afs_int32 gid, afs_int32 depth)
{
    /* returns true if aid is a member of gid */
    struct prentry tentry;
    struct contentry centry;
    afs_int32 code;
    afs_int32 i;
    afs_int32 loc;

    if (depth < 1)
	return 0;
    loc = FindByID(at, gid);
    if (!loc)
	return 0;
    memset(&tentry, 0, sizeof(tentry));
    code = pr_ReadEntry(at, 0, loc, &tentry);
    if (code)
	return 0;
    if (!(tentry.flags & PRGRP))
	return 0;
    for (i = 0; i < PRSIZE; i++) {
	gid = tentry.entries[i];
	if (gid == 0)
	    return 0;
	if (gid == aid)
	    return 1;
	if (gid == ANYUSERID)
	    return 1;
	if (gid == AUTHUSERID && aid != ANONYMOUSID)
	    return 1;
	if (gid < 0) {
#ifndef AFS_PTHREAD_ENV
	    IOMGR_Poll();
#endif
	    if (IsAMemberOfSG(at, aid, gid, depth - 1))
		return 1;
	}
    }
    if (tentry.next) {
	loc = tentry.next;
	while (loc) {
	    memset(&centry, 0, sizeof(centry));
	    code = pr_ReadCoEntry(at, 0, loc, &centry);
	    if (code)
		return 0;
	    for (i = 0; i < COSIZE; i++) {
		gid = centry.entries[i];
		if (gid == 0)
		    return 0;
		if (gid == aid)
		    return 1;
		if (gid == ANYUSERID)
		    return 1;
		if (gid == AUTHUSERID && aid != ANONYMOUSID)
		    return 1;
		if (gid < 0) {
#ifndef AFS_PTHREAD_ENV
		    IOMGR_Poll();
#endif
		    if (IsAMemberOfSG(at, aid, gid, depth - 1))
			return 1;
		}
	    }
	    loc = centry.next;
	}
    }
    return 0;			/* actually, should never get here */
}
示例#20
0
CShopItemPtr CShop::FindPurchasedByID(const char *id)
{
	return FindByID(_itemsPurchased, id);
}