]> git.ipfire.org Git - thirdparty/cups.git/blame - scheduler/auth.h
Merge changes from 1.1.x into 1.2 devel.
[thirdparty/cups.git] / scheduler / auth.h
CommitLineData
824bac0b 1/*
753453e4 2 * "$Id: auth.h,v 1.16.2.2 2001/12/26 16:52:50 mike Exp $"
824bac0b 3 *
fd8b1cf8 4 * Authorization definitions for the Common UNIX Printing System (CUPS)
5 * scheduler.
824bac0b 6 *
d2935a0f 7 * Copyright 1997-2001 by Easy Software Products, all rights reserved.
824bac0b 8 *
9 * These coded instructions, statements, and computer programs are the
10 * property of Easy Software Products and are protected by Federal
11 * copyright law. Distribution and use rights are outlined in the file
12 * "LICENSE.txt" which should have been included with this file. If this
13 * file is missing or damaged please contact Easy Software Products
14 * at:
15 *
16 * Attn: CUPS Licensing Information
17 * Easy Software Products
8784b6a6 18 * 44141 Airport View Drive, Suite 204
824bac0b 19 * Hollywood, Maryland 20636-3111 USA
20 *
21 * Voice: (301) 373-9603
22 * EMail: cups-info@cups.org
23 * WWW: http://www.cups.org
824bac0b 24 */
25
26/*
fd8b1cf8 27 * HTTP authorization types and levels...
28 */
29
7ebf3a09 30#define AUTH_NONE 0 /* No authentication */
31#define AUTH_BASIC 1 /* Basic authentication */
32#define AUTH_DIGEST 2 /* Digest authentication */
753453e4 33#define AUTH_BASICDIGEST 3 /* Basic authentication w/passwd.md5 */
7ebf3a09 34
fd8b1cf8 35#define AUTH_ANON 0 /* Anonymous access */
36#define AUTH_USER 1 /* Must have a valid username/password */
37#define AUTH_GROUP 2 /* Must also be in a named group */
38
39#define AUTH_ALLOW 0 /* Allow access */
40#define AUTH_DENY 1 /* Deny access */
41
42#define AUTH_NAME 0 /* Authorize host by name */
43#define AUTH_IP 1 /* Authorize host by IP */
44
89db771d 45#define AUTH_SATISFY_ALL 0 /* Satisfy both address and auth */
46490d9d 46#define AUTH_SATISFY_ANY 1 /* Satisfy either address or auth */
46490d9d 47
48#define AUTH_LIMIT_DELETE 1 /* Limit DELETE requests */
49#define AUTH_LIMIT_GET 2 /* Limit GET requests */
50#define AUTH_LIMIT_HEAD 4 /* Limit HEAD requests */
51#define AUTH_LIMIT_OPTIONS 8 /* Limit OPTIONS requests */
52#define AUTH_LIMIT_POST 16 /* Limit POST requests */
53#define AUTH_LIMIT_PUT 32 /* Limit PUT requests */
54#define AUTH_LIMIT_TRACE 64 /* Limit TRACE requests */
55#define AUTH_LIMIT_ALL 127 /* Limit all requests */
56
fd8b1cf8 57
58/*
03081fd2 59 * HTTP access control structures...
fd8b1cf8 60 */
61
62typedef struct
63{
99de6da0 64 unsigned address[4], /* IP address */
65 netmask[4]; /* IP netmask */
fd8b1cf8 66} ipmask_t;
67
68typedef struct
69{
70 int length; /* Length of name */
71 char *name; /* Name string */
72} namemask_t;
73
74typedef struct
75{
76 int type; /* Mask type */
77 union
78 {
79 namemask_t name; /* Host/Domain name */
80 ipmask_t ip; /* IP address/network */
81 } mask; /* Mask data */
42d48bd2 82} authmask_t;
fd8b1cf8 83
84typedef struct
85{
a74b005d 86 char location[HTTP_MAX_URI]; /* Location of resource */
46490d9d 87 int limit, /* Limit for these types of requests */
88 length, /* Length of location string */
fd8b1cf8 89 order_type, /* Allow or Deny */
7ebf3a09 90 type, /* Type of authentication */
46490d9d 91 level, /* Access level required */
92 satisfy; /* Satisfy any or all limits? */
93 int num_names; /* Number of names */
94 char **names; /* User or group names */
fd8b1cf8 95 int num_allow; /* Number of Allow lines */
42d48bd2 96 authmask_t *allow; /* Allow lines */
fd8b1cf8 97 int num_deny; /* Number of Deny lines */
42d48bd2 98 authmask_t *deny; /* Deny lines */
a75c006a 99 http_encryption_t encryption; /* To encrypt or not to encrypt... */
fd8b1cf8 100} location_t;
101
102
103/*
104 * Globals...
105 */
106
107VAR int NumLocations VALUE(0);
108 /* Number of authorization locations */
109VAR location_t *Locations VALUE(NULL);
110 /* Authorization locations */
111
112
113/*
114 * Prototypes...
824bac0b 115 */
116
e4f4eb8e 117extern location_t *AddLocation(const char *location);
46490d9d 118extern void AddName(location_t *loc, char *name);
fd8b1cf8 119extern void AllowHost(location_t *loc, char *name);
99de6da0 120extern void AllowIP(location_t *loc, unsigned address[4],
121 unsigned netmask[4]);
122extern int CheckAuth(unsigned ip[4], char *name, int namelen,
e5ebb675 123 int num_masks, authmask_t *masks);
89db771d 124extern location_t *CopyLocation(location_t **loc);
fd8b1cf8 125extern void DeleteAllLocations(void);
126extern void DenyHost(location_t *loc, char *name);
99de6da0 127extern void DenyIP(location_t *loc, unsigned address[4],
128 unsigned netmask[4]);
753453e4 129extern location_t *FindBest(client_t *con, http_state_t state);
e4f4eb8e 130extern location_t *FindLocation(const char *location);
a74b005d 131extern http_status_t IsAuthorized(client_t *con);
824bac0b 132
133
134/*
753453e4 135 * End of "$Id: auth.h,v 1.16.2.2 2001/12/26 16:52:50 mike Exp $".
824bac0b 136 */