|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T a
Length: 3732 (0xe94)
Types: TextFile
Names: »auth_ut.c«
└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0
└─⟦dc59850a2⟧ »EurOpenD22/pp5.0/pp-5.tar.Z«
└─⟦e5a54fb17⟧
└─⟦this⟧ »pp-5.0/Src/submit/auth_ut.c«
/* auth_ut.c: authorisation utilities */
# ifndef lint
static char Rcsid[] = "@(#)$Header: /cs/research/pp/hubris/pp-beta/Src/submit/RCS/auth_ut.c,v 5.0 90/09/20 16:22:46 pp Exp Locker: pp $";
# endif
/*
* $Header: /cs/research/pp/hubris/pp-beta/Src/submit/RCS/auth_ut.c,v 5.0 90/09/20 16:22:46 pp Exp Locker: pp $
*
* $Log: auth_ut.c,v $
* Revision 5.0 90/09/20 16:22:46 pp
* rcsforce : 5.0 public release
*
*/
#include "util.h"
#include "q.h"
#include <varargs.h>
extern Q_struct Qstruct;
extern char auth2submit_msg[];
/* -- local routines -- */
void authchan_add();
void authmta_add();
void do_reason();
AUTH *auth_new();
AUTH_USER *authusr_new();
LIST_AUTH_CHAN *authchan_new();
LIST_AUTH_MTA *authmta_new();
static LIST_AUTH_CHAN *authchan_malloc();
static LIST_AUTH_MTA *authmta_malloc();
/* ------------------------ Begin Routines ------------------------------- */
#ifdef lint
/*VARARGS2*/
void do_reason (au, str)
AUTH *au;
char *str;
{
do_reason (au, str);
}
#else
void do_reason (va_alist)
va_dcl
{
va_list ap;
AUTH *au;
va_start (ap);
au = va_arg (ap, AUTH *);
_asprintf (auth2submit_msg, NULLCP, ap);
au -> reason = strdup (auth2submit_msg);
va_end (ap);
}
#endif
LIST_AUTH_CHAN *authchan_new (value, def)
CHAN *value;
LIST_AUTH_CHAN *def;
{
LIST_AUTH_CHAN *list;
PP_TRACE (("authchan_new (%x)", value));
list = authchan_malloc();
if (def)
*list = *def; /* --- structure copy --- */
if (value)
list -> li_chan = value;
return (list);
}
void authchan_add (list, item)
LIST_AUTH_CHAN **list;
LIST_AUTH_CHAN *item;
{
LIST_AUTH_CHAN *lp = *list;
PP_TRACE (("authchan_add()"));
if (lp == NULLIST_AUTHCHAN) {
*list = item;
return;
}
while (lp -> li_next != NULLIST_AUTHCHAN)
lp = lp -> li_next;
lp -> li_next = item;
}
void authmta_add (list, item)
LIST_AUTH_MTA **list;
LIST_AUTH_MTA *item;
{
LIST_AUTH_MTA *lp = *list;
PP_TRACE (("authmta_add()"));
if (lp == NULLIST_AUTHMTA) {
*list = item;
return;
}
while (lp -> li_next != NULLIST_AUTHMTA)
lp = lp -> li_next;
lp -> li_next = item;
}
LIST_AUTH_MTA *authmta_new (value)
char *value;
{
LIST_AUTH_MTA *list;
if (value == NULLCP)
return (NULLIST_AUTHMTA);
PP_TRACE (("authmta_new ('%s')", value));
list = authmta_malloc();
list -> li_mta = value;
return (list);
}
AUTH_USER *authusr_new()
{
AUTH_USER *new;
PP_TRACE (("authusr_new()"));
new = (AUTH_USER *) malloc (sizeof *new);
bzero ((char *)new, sizeof *new);
new -> found = FALSE;
new -> rights = AUTH_RIGHTS_UNSET;
return (new);
}
AUTH *auth_new()
{
AUTH *new;
PP_TRACE (("auth_new()"));
new = (AUTH *) malloc (sizeof *new);
bzero ((char *)new, sizeof *new);
if (Qstruct.msgtype == MT_DMPDU)
new -> status = AUTH_DR_OK;
else
new -> status = AUTH_OK;
new -> stage = AUTH_STAGE_1;
new -> warnings = AUTH_NOTWARNED;
new -> mta_inrights = AUTH_RIGHTS_UNSET;
new -> mta_outrights = AUTH_RIGHTS_UNSET;
new -> user_inrights = AUTH_RIGHTS_UNSET;
new -> user_outrights = AUTH_RIGHTS_UNSET;
return (new);
}
/* ------------------------ Static Routines ------------------------------- */
static LIST_AUTH_CHAN *authchan_malloc()
{
LIST_AUTH_CHAN *new;
PP_TRACE (("authchan_malloc()"));
new = (LIST_AUTH_CHAN *) malloc (sizeof *new);
bzero ((char *)new, sizeof *new);
new -> li_found = FALSE;
new -> policy = AUTH_CHAN_FREE;
return (new);
}
static LIST_AUTH_MTA *authmta_malloc()
{
LIST_AUTH_MTA *new;
PP_TRACE (("authmta_malloc()"));
new = (LIST_AUTH_MTA *) malloc (sizeof *new);
bzero ((char *)new, sizeof *new);
new -> li_found = FALSE;
new -> rights = AUTH_RIGHTS_UNSET;
return (new);
}