#include <pwd.h>
#define CUPSD_AUTH_DEFAULT -1
#define CUPSD_AUTH_NONE 0
#define CUPSD_AUTH_BASIC 1
#define CUPSD_AUTH_DIGEST 2
#define CUPSD_AUTH_BASICDIGEST 3
#define CUPSD_AUTH_NEGOTIATE 4
#define CUPSD_AUTH_AUTO 5
#define CUPSD_AUTH_ANON 0
#define CUPSD_AUTH_USER 1
#define CUPSD_AUTH_GROUP 2
#define CUPSD_AUTH_ALLOW 0
#define CUPSD_AUTH_DENY 1
#define CUPSD_AUTH_NAME 0
#define CUPSD_AUTH_IP 1
#define CUPSD_AUTH_INTERFACE 2
#define CUPSD_AUTH_SATISFY_ALL 0
#define CUPSD_AUTH_SATISFY_ANY 1
#define CUPSD_AUTH_LIMIT_DELETE 1
#define CUPSD_AUTH_LIMIT_GET 2
#define CUPSD_AUTH_LIMIT_HEAD 4
#define CUPSD_AUTH_LIMIT_OPTIONS 8
#define CUPSD_AUTH_LIMIT_POST 16
#define CUPSD_AUTH_LIMIT_PUT 32
#define CUPSD_AUTH_LIMIT_TRACE 64
#define CUPSD_AUTH_LIMIT_ALL 127
#define CUPSD_AUTH_LIMIT_IPP 128
#define IPP_ANY_OPERATION (ipp_op_t)0
#define IPP_BAD_OPERATION (ipp_op_t)-1
typedef struct
{
unsigned address[4],
netmask[4];
} cupsd_ipmask_t;
typedef struct
{
int length;
char *name;
} cupsd_namemask_t;
typedef struct
{
int type;
union
{
cupsd_namemask_t name;
cupsd_ipmask_t ip;
} mask;
} cupsd_authmask_t;
typedef struct
{
char *location;
ipp_op_t op;
int limit,
length,
order_type,
type,
level,
satisfy;
cups_array_t *names,
*allow,
*deny;
http_encryption_t encryption;
} cupsd_location_t;
typedef struct cupsd_client_s cupsd_client_t;
VAR cups_array_t *Locations VALUE(NULL);
#ifdef HAVE_SSL
VAR http_encryption_t DefaultEncryption VALUE(HTTP_ENCRYPT_REQUIRED);
#endif
extern int cupsdAddIPMask(cups_array_t **masks,
const unsigned address[4],
const unsigned netmask[4]);
extern void cupsdAddLocation(cupsd_location_t *loc);
extern void cupsdAddName(cupsd_location_t *loc, char *name);
extern int cupsdAddNameMask(cups_array_t **masks, char *name);
extern void cupsdAuthorize(cupsd_client_t *con);
extern int cupsdCheckAccess(unsigned ip[4], char *name,
int namelen, cupsd_location_t *loc);
extern int cupsdCheckAuth(unsigned ip[4], char *name, int namelen,
cups_array_t *masks);
extern int cupsdCheckGroup(const char *username,
struct passwd *user,
const char *groupname);
extern cupsd_location_t *cupsdCopyLocation(cupsd_location_t *loc);
extern void cupsdDeleteAllLocations(void);
extern cupsd_location_t *cupsdFindBest(const char *path, http_state_t state);
extern cupsd_location_t *cupsdFindLocation(const char *location);
extern void cupsdFreeLocation(cupsd_location_t *loc);
extern http_status_t cupsdIsAuthorized(cupsd_client_t *con, const char *owner);
extern cupsd_location_t *cupsdNewLocation(const char *location);