2 * "$Id: auth.h 6361 2007-03-19 16:01:28Z mike $"
4 * Authorization definitions for the Common UNIX Printing System (CUPS)
7 * Copyright 1997-2006 by Easy Software Products, all rights reserved.
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
16 * Attn: CUPS Licensing Information
17 * Easy Software Products
18 * 44141 Airport View Drive, Suite 204
19 * Hollywood, Maryland 20636 USA
21 * Voice: (301) 373-9600
22 * EMail: cups-info@cups.org
23 * WWW: http://www.cups.org
27 * Include necessary headers...
34 * HTTP authorization types and levels...
37 #define AUTH_NONE 0 /* No authentication */
38 #define AUTH_BASIC 1 /* Basic authentication */
39 #define AUTH_DIGEST 2 /* Digest authentication */
40 #define AUTH_BASICDIGEST 3 /* Basic authentication w/passwd.md5 */
41 #define AUTH_NEGOTIATE 4 /* Kerberos authentication */
43 #define AUTH_ANON 0 /* Anonymous access */
44 #define AUTH_USER 1 /* Must have a valid username/password */
45 #define AUTH_GROUP 2 /* Must also be in a named group */
47 #define AUTH_ALLOW 0 /* Allow access */
48 #define AUTH_DENY 1 /* Deny access */
50 #define AUTH_NAME 0 /* Authorize host by name */
51 #define AUTH_IP 1 /* Authorize host by IP */
52 #define AUTH_INTERFACE 2 /* Authorize host by interface */
54 #define AUTH_SATISFY_ALL 0 /* Satisfy both address and auth */
55 #define AUTH_SATISFY_ANY 1 /* Satisfy either address or auth */
57 #define AUTH_LIMIT_DELETE 1 /* Limit DELETE requests */
58 #define AUTH_LIMIT_GET 2 /* Limit GET requests */
59 #define AUTH_LIMIT_HEAD 4 /* Limit HEAD requests */
60 #define AUTH_LIMIT_OPTIONS 8 /* Limit OPTIONS requests */
61 #define AUTH_LIMIT_POST 16 /* Limit POST requests */
62 #define AUTH_LIMIT_PUT 32 /* Limit PUT requests */
63 #define AUTH_LIMIT_TRACE 64 /* Limit TRACE requests */
64 #define AUTH_LIMIT_ALL 127 /* Limit all requests */
65 #define AUTH_LIMIT_IPP 128 /* Limit IPP requests */
67 #define IPP_ANY_OPERATION (ipp_op_t)0
68 /* Any IPP operation */
69 #define IPP_BAD_OPERATION (ipp_op_t)-1
70 /* No IPP operation */
74 * HTTP access control structures...
79 unsigned address
[4], /* IP address */
80 netmask
[4]; /* IP netmask */
85 int length
; /* Length of name */
86 char *name
; /* Name string */
91 int type
; /* Mask type */
94 cupsd_namemask_t name
; /* Host/Domain name */
95 cupsd_ipmask_t ip
; /* IP address/network */
96 } mask
; /* Mask data */
101 char *location
; /* Location of resource */
102 ipp_op_t op
; /* IPP operation */
103 int limit
, /* Limit for these types of requests */
104 length
, /* Length of location string */
105 order_type
, /* Allow or Deny */
106 type
, /* Type of authentication */
107 level
, /* Access level required */
108 satisfy
; /* Satisfy any or all limits? */
109 int num_names
; /* Number of names */
110 char **names
; /* User or group names */
111 int num_allow
; /* Number of Allow lines */
112 cupsd_authmask_t
*allow
; /* Allow lines */
113 int num_deny
; /* Number of Deny lines */
114 cupsd_authmask_t
*deny
; /* Deny lines */
115 http_encryption_t encryption
; /* To encrypt or not to encrypt... */
118 typedef struct cupsd_client_s cupsd_client_t
;
125 VAR cups_array_t
*Locations
VALUE(NULL
);
126 /* Authorization locations */
127 VAR
int DefaultAuthType
VALUE(AUTH_BASIC
);
128 /* Default AuthType, if not specified */
130 VAR http_encryption_t DefaultEncryption
VALUE(HTTP_ENCRYPT_REQUIRED
);
131 /* Default encryption for authentication */
132 #endif /* HAVE_SSL */
139 extern cupsd_location_t
*cupsdAddLocation(const char *location
);
140 extern void cupsdAddName(cupsd_location_t
*loc
, char *name
);
141 extern void cupsdAllowHost(cupsd_location_t
*loc
, char *name
);
142 extern void cupsdAllowIP(cupsd_location_t
*loc
, unsigned address
[4],
143 unsigned netmask
[4]);
144 extern void cupsdAuthorize(cupsd_client_t
*con
);
145 extern int cupsdCheckAuth(unsigned ip
[4], char *name
, int namelen
,
146 int num_masks
, cupsd_authmask_t
*masks
);
147 extern int cupsdCheckGroup(const char *username
,
149 const char *groupname
);
150 extern cupsd_location_t
*cupsdCopyLocation(cupsd_location_t
**loc
);
151 extern void cupsdDeleteAllLocations(void);
152 extern void cupsdDeleteLocation(cupsd_location_t
*loc
);
153 extern void cupsdDenyHost(cupsd_location_t
*loc
, char *name
);
154 extern void cupsdDenyIP(cupsd_location_t
*loc
, unsigned address
[4],
155 unsigned netmask
[4]);
156 extern cupsd_location_t
*cupsdFindBest(const char *path
, http_state_t state
);
157 extern cupsd_location_t
*cupsdFindLocation(const char *location
);
158 extern http_status_t
cupsdIsAuthorized(cupsd_client_t
*con
, const char *owner
);
162 * End of "$Id: auth.h 6361 2007-03-19 16:01:28Z mike $".