1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154
|
/********************************************************************
* $Author: lindner $
* $Revision: 3.9 $
* $Date: 1995/09/26 05:16:22 $
* $Source: /home/arcwelder/GopherSrc/CVS/gopher+/gopherd/AUTH.h,v $
*
* Paul Lindner, University of Minnesota DCS.
*
* Copyright 1991, 92, 93, 94 by the Regents of the University of Minnesota
* see the file "Copyright" in the distribution for conditions of use.
*********************************************************************
* MODULE: AUTH.c
* Routines to verify authentication
*********************************************************************
* Revision History:
* $Log: AUTH.h,v $
* Revision 3.9 1995/09/26 05:16:22 lindner
* more fixes...
*
* Revision 3.8 1995/09/25 05:02:29 lindner
* Convert to ANSI C
*
* Revision 3.7 1995/06/30 20:33:10 lindner
* Add group authentication
*
* Revision 3.6 1995/06/02 17:24:37 lindner
* Add the ability to specify alternate password files for unixfile auth.
*
* Revision 3.5 1995/02/13 19:10:34 lindner
* next compile
*
* Revision 3.4 1995/02/06 21:24:58 lindner
* Add stuff for unix pw file
*
* Revision 3.3 1994/12/12 16:58:13 lindner
* Add new AUTHresult code, AUTHRES_SYSERR
*
* Revision 3.2 1994/07/22 22:27:44 lindner
* NO_AUTHENTICATION mods
*
* Revision 3.1 1994/06/29 05:34:20 lindner
* New authentication routines
*
*
*********************************************************************/
/*
* Platform independent authentication routines go here...
*
* AUTH object --> contains auth type name and script/fcn to call
* AUTHA object --> dynamic array of AUTH objects.
*
* AUTHITEM object --> contains directory, authtype, link to dns sites
*/
#include "boolean.h"
#include "STAarray.h"
typedef enum {AUTH_UNINITED, AUTH_INTERNAL, AUTH_SCRIPT} AUTHtype;
typedef enum {AUTHRES_OK, AUTHRES_BADPW, AUTHRES_EXPIRED,
AUTHRES_NOUSER, AUTHRES_SYSERR, AUTHRES_NOGROUP} AUTHresult;
struct AUTHstruct {
AUTHtype type;
String *name;
AUTHresult (*authfcn)(); /* The authentication test */
char **(*authfcnask)(); /* The authentication askblock fcn */
String *scriptname;
};
typedef struct AUTHstruct AUTH;
/*
* Member functions
*/
#define AUTHgetType(a) (a->type)
#define AUTHgetName(a) (STRget(a->name))
#define AUTHgetScriptName(a) (STRget(a->scriptname))
#define AUTHgetFcn(a) (a->authfcn)
#define AUTHgetAskFcn(a) (a->authfcnask)
#define AUTHsetType(a,b) (a->type=(b))
#define AUTHsetName(a,b) (STRset(a->name,(b)))
#define AUTHsetScriptName(a,b) (STRset(a->scriptname,b))
#define AUTHsetFcn(a,b) (a->authfcn=(b))
#define AUTHsetAskFcn(a,b) (a->authfcnask=(b))
/*
* Prototypes
*/
AUTH *AUTHnew();
void AUTHdestroy();
void AUTHinit();
AUTH *AUTHcpy();
AUTHresult AUTHunix();
AUTHresult AUTHident();
char **AUTHgenericAsk();
/******************************************************************
* Array of auth stuff...
*/
#include "DAarray.h"
typedef DynArray AUTHarray;
#define AUTHAgetEntry(a,b) (AUTH*)(DAgetEntry((DynArray*)a,b))
#define AUTHAdestroy(a) (DAdestroy(a))
#define AUTHApush(a,b) (DApush((a),(char*)(b)))
#define AUTHAgetTop(a) (DAgetTop(a))
AUTHarray *AUTHAnew();
AUTHresult AUTHAvalidate();
AUTH* AUTHAlocate();
/******************************************************************
* List of items and authentication types.
*
*/
struct AUTHITEMS_struct {
StrArray *regexps;
StrArray *authtypes;
StrArray *extra_args; /* Used for Unix PW files for now.. */
};
typedef struct AUTHITEMS_struct AUTHITEMS;
#define AUTHITEMSgetRegexp(a,i) (STRget(STAgetEntry((a)->regexps,i)))
#define AUTHITEMSgetAuthtype(a,i) (STRget(STAgetEntry((a)->authtypes,i)))
#define AUTHITEMSgetPwFile(a,i) (STRget(STAgetEntry((a)->extra_args,i)))
#ifndef NO_AUTHENTICATION
AUTHITEMS *AUTHITEMSnew();
void AUTHITEMSdestroy(AUTHITEMS *);
void AUTHITEMSpush(AUTHITEMS *, char *, char *, char *);
AUTH *AUTHITEMSfindAUTH(AUTHITEMS *ai, AUTHarray *aa, char *fname);
char *AUTHITEMSfindType(AUTHITEMS *ai, char *fname);
char *AUTHITEMSfindExtraArgs(AUTHITEMS *ai, char *fname);
#else
# define AUTHAvalidate(a,b,c,d,e,f) (AUTHRES_OK)
# define AUTHITEMSdestroy(a)
# define AUTHAnew(a) (NULL)
# define AUTHAprocessLine(a,b) (1)
# define AUTHITEMSfindType(a,b) (NULL)
# define AUTHITEMSprocessLine(a,b) (1)
# define AUTHITEMSnew(a) (NULL)
# define AUTHITEMSfindAUTH(a,b,c) (NULL)
#endif
|