Ejemplo n.º 1
0
/* On successful return, ECPS defines a newly-created data structure,
   corresponding to the external CPS of Id. Return 0  on success; -1 if Id is
   not a valid user or group id. */
int AL_GetExternalCPS(IN int Id, OUT PRS_ExternalCPS *ECPS){
	PRS_InternalCPS *ICPS;
	register char *s;
	register int i;

	LogMsg(1,AL_DebugLevel,stdout,"in AL_GetExternalCPS(%d, 0x%x)",
	       Id,ECPS);

	if (AL_GetInternalCPS(Id, &ICPS) != 0)
		return(-1);
	AL_NewExternalCPS(ICPS->InclEntries, ECPS);
	s = *ECPS;
	sprintf(s, "%d\n", ICPS->InclEntries);
	s += strlen(s);
	for (i = 0; i < ICPS->InclEntries; i++){
		if (AL_IdToName(ICPS->IdList[i], s) != 0)
			sprintf(s, "%d", ICPS->IdList[i]);
		s += strlen(s);
		if(i < ICPS->InclEntries){
			s[0] = ' ';
			s[1] = '\0';
			s++;
		}
	}
	AL_FreeCPS(&ICPS);
	return(0);
}
Ejemplo n.º 2
0
/* Converts the access list defined by Alist into the newly-created external
   access list in ExternalRep. Non-translatable Ids are coverted to their Ascii
   integer representations. Returns  0 on success. Returns -1 if total number
   of entries > AL_MaxExtEntries. */
int AL_Externalize(IN AL_AccessList *Alist, OUT AL_ExternalAccessList *Elist){
	register int i;
	register char *nextc;

	if (Alist->PlusEntriesInUse + Alist->MinusEntriesInUse >
	    AL_MaxExtEntries) return(-1);
	AL_NewExternalAlist(Alist->PlusEntriesInUse +
			    Alist->MinusEntriesInUse, Elist);
	nextc = *Elist;

	sprintf(nextc, "%d\n%d\n", Alist->PlusEntriesInUse,
		Alist->MinusEntriesInUse);
	nextc += strlen(nextc);
	for (i = 0; i < Alist->PlusEntriesInUse + Alist->MinusEntriesInUse; i++){
		if (AL_IdToName(Alist->ActualEntries[i].Id, nextc) < 0)
			sprintf(nextc, "%d", Alist->ActualEntries[i].Id);
		nextc += strlen(nextc);
		sprintf(nextc, "\t%d\n", Alist->ActualEntries[i].Rights);
		nextc += strlen(nextc);
	}
	return (0);
}
Ejemplo n.º 3
0
/* given an id, get a name */
char *GetVname(int id, char *s)
{
    if (AL_IdToName(id, s) < 0)
        sprintf(s, "%d (unknown Vice id)", id);
    return (s);
}