Commit 72f2c2ca authored by Per Cederqvist's avatar Per Cederqvist

Pass the new argument wanted_access to access_perm(). Use

access_perm() instead of fast_access_perm().
(access_perm): Proof-of-concept implementation using
	plain_ol_access_perm and plain_ol_fast_access_perm.  This needs
	lots of clever speedups.
parent 062f68af
/*
* $Id: membership.c,v 0.50 1999/06/26 08:53:13 byers Exp $
* $Id: membership.c,v 0.51 1999/07/01 21:24:31 ceder Exp $
* Copyright (C) 1991-1999 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -38,7 +38,7 @@
#define DEBUG_MARK_AS_READ
static const char *
rcsid = "$Id: membership.c,v 0.50 1999/06/26 08:53:13 byers Exp $";
rcsid = "$Id: membership.c,v 0.51 1999/07/01 21:24:31 ceder Exp $";
#include "rcs.h"
USE(rcsid);
......@@ -124,7 +124,7 @@ copy_public_confs (Connection * conn, /* The connection for which we copy */
is_super = is_supervisor(orig_m->conf_no, NULL,
conn->pers_no, conn->person);
if ( fast_access_perm (orig_m->conf_no, conn) > none &&
if ( access_perm(orig_m->conf_no, NULL, conn, read_protected) > none &&
(copy_secret ||
!orig_m->type.secret ||
is_super ||
......@@ -716,7 +716,9 @@ do_sub_member(Conf_no conf_no, /* Conf to delete member from. */
* error: see kom_errno
*/
static
Access
plain_ol_\
access_perm(Conf_no victim,
Conference * victim_c, /* May be NULL */
Connection * conn)
......@@ -766,7 +768,9 @@ access_perm(Conf_no victim,
* Check if viewer is allowed to look at victiom. viewer_p, if
* supplied, should be a pointer to the pers-stat of viewer.
*/
static
Access
plain_ol_\
fast_access_perm(Conf_no victim,
Connection *viewer_conn)
{
......@@ -810,11 +814,36 @@ fast_access_perm(Conf_no victim,
/* Only read in conference struct when really necessary. */
conf_type = cached_get_conf_type (victim);
if ( conf_type.secret || conf_type.rd_prot )
return access_perm(victim, NULL, viewer_conn);
return plain_ol_access_perm(victim, NULL, viewer_conn);
return limited;
}
Access
access_perm(Conf_no victim,
Conference *victim_c,
Connection *viewer_conn,
Access wanted_access)
{
Access result;
/* FIXME: implement something faster than this! This is just a quick
implementation to check if all edits outside this function are
performed correctly. */
if (wanted_access == unlimited)
result = plain_ol_access_perm(victim, victim_c, viewer_conn);
else
result = plain_ol_fast_access_perm(victim, viewer_conn);
if (wanted_access < result)
return wanted_access;
else
return result;
}
/*
* Locate the Member struct in CONF_C for person PERS_NO
*/
......@@ -969,7 +998,7 @@ add_member_common(Conf_no conf_no,
}
/* Check access to the conference. We need limited access or more */
if ( access_perm(conf_no, conf_c, active_connection) < limited
if (access_perm(conf_no, conf_c, active_connection, limited) < limited
&& !ENA(wheel, 8) ) /* OK -- Guarded */
{
err_stat = conf_no;
......@@ -1299,7 +1328,7 @@ do_get_membership (Pers_no pers_no,
GET_P_STAT (p_orig, pers_no, FAILURE);
GET_C_STAT (pers_c, pers_no, FAILURE);
acc = access_perm (pers_no, pers_c, active_connection);
acc = access_perm(pers_no, pers_c, active_connection, unlimited);
if (acc == error)
return FAILURE;
......@@ -1431,7 +1460,7 @@ do_get_members (Conf_no conf_no,
CHK_CONNECTION(FAILURE);
GET_C_STAT(conf_c, conf_no, FAILURE);
acc = access_perm (conf_no, conf_c, active_connection);
acc = access_perm(conf_no, conf_c, active_connection, read_protected);
if ( acc == error )
return FAILURE;
......@@ -1547,7 +1576,7 @@ get_unread_confs(Pers_no pers_no,
if ((confs->type.passive == 0) &&
(confs->last_text_read <
cached_get_highest_local_no(confs->conf_no)) &&
(fast_access_perm(confs->conf_no, active_connection) >
(access_perm(confs->conf_no, NULL, active_connection, limited) >
read_protected))
{
result->conf_nos[ result->no_of_confs++ ] = confs->conf_no;
......@@ -1648,7 +1677,7 @@ extern Success set_membership_type(Pers_no pers_no,
/* Find the conference and person in question */
GET_C_STAT(conf_c, conf_no, FAILURE);
/* Make sure that ACTPERS may know about conf */
acc = access_perm(conf_no, conf_c, active_connection);
acc = access_perm(conf_no, conf_c, active_connection, read_protected);
if (acc == error)
{
return FAILURE;
......@@ -1664,7 +1693,7 @@ extern Success set_membership_type(Pers_no pers_no,
GET_C_STAT(pers_c, pers_no, FAILURE);
GET_P_STAT(pers_p, pers_no, FAILURE);
/* Check that ACTPERS may modify memberships of person */
acc = access_perm(pers_no, pers_c, active_connection);
acc = access_perm(pers_no, pers_c, active_connection, unlimited);
if (acc != unlimited &&
!ENA(wheel, 8) && /* OK -- In an RPC call */
!ENA(admin, 6)) /* OK -- In an RPC call */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment