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
/* Returns TRUE iff the CPS corr to pU is that of a system administrator.
   Obtains the CPS for pU if necessary */
int IsAdministrator(struct UserInfo *pU)
{
    if (pU->UserCPS == NULL)
        if (AL_GetInternalCPS(pU->ViceId, &pU->UserCPS) != 0)
            return (FALSE);
    return (AL_IsAMember(AdminID, pU->UserCPS) ? TRUE : FALSE);
}