#include "../sccshead/sfile.h"
#include "../sccshead/sint.h"

char permss__[] "~|^`permiss.c:	3.1";
/*
	Checks for floor, ceiling and locked release,
	and also for real user on list of users authorized to
	make deltas.
*/

permiss(pkt)
register struct Packet *pkt;
{
	register int i, uid;

	if(pkt->Prel < pkt->Phdr.Hfloor)
		fatal(stringf("release %d < %d (floor) (218)",
		  pkt->Prel,pkt->Phdr.Hfloor));
	if(pkt->Phdr.Hceil && pkt->Prel > pkt->Phdr.Hceil)
		fatal(stringf("release %d > %d (ceiling) (219)",
		  pkt->Prel,pkt->Phdr.Hceil));
	for(i=0; i<5; i++) if(pkt->Prel == pkt->Phdr.Hsw[i])
		fatal(stringf("release %d locked (220)",pkt->Prel));

	uid = getuid()&0377;
	for(i=0; i<32; i++)
		if(pkt->Phdr.Hulist[i] != 0)
			if((pkt->Phdr.Hulist[uid>>3]&(1<<(uid&7)))==0)
				fatal("not authorized to make deltas (399)");
			else return;
}
