~clint-fewbar/ubuntu/precise/squid3/ignore-sighup-early

« back to all changes in this revision

Viewing changes to src/auth/User.h

  • Committer: Bazaar Package Importer
  • Author(s): Luigi Gangitano
  • Date: 2010-05-04 11:15:49 UTC
  • mfrom: (1.3.1 upstream)
  • mto: (20.3.1 squeeze) (21.2.1 sid)
  • mto: This revision was merged to the branch mainline in revision 21.
  • Revision ID: james.westby@ubuntu.com-20100504111549-1apjh2g5sndki4te
Tags: upstream-3.1.3
ImportĀ upstreamĀ versionĀ 3.1.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * $Id$
 
3
 *
 
4
 *
 
5
 * SQUID Web Proxy Cache          http://www.squid-cache.org/
 
6
 * ----------------------------------------------------------
 
7
 *
 
8
 *  Squid is the result of efforts by numerous individuals from
 
9
 *  the Internet community; see the CONTRIBUTORS file for full
 
10
 *  details.   Many organizations have provided support for Squid's
 
11
 *  development; see the SPONSORS file for full details.  Squid is
 
12
 *  Copyrighted (C) 2001 by the Regents of the University of
 
13
 *  California; see the COPYRIGHT file for full details.  Squid
 
14
 *  incorporates software developed and/or copyrighted by other
 
15
 *  sources; see the CREDITS file for full details.
 
16
 *
 
17
 *  This program is free software; you can redistribute it and/or modify
 
18
 *  it under the terms of the GNU General Public License as published by
 
19
 *  the Free Software Foundation; either version 2 of the License, or
 
20
 *  (at your option) any later version.
 
21
 *
 
22
 *  This program is distributed in the hope that it will be useful,
 
23
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
24
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
25
 *  GNU General Public License for more details.
 
26
 *
 
27
 *  You should have received a copy of the GNU General Public License
 
28
 *  along with this program; if not, write to the Free Software
 
29
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
 
30
 *
 
31
 * Copyright (c) 2003, Robert Collins <robertc@squid-cache.org>
 
32
 */
 
33
 
 
34
#ifndef SQUID_AUTHUSER_H
 
35
#define SQUID_AUTHUSER_H
 
36
 
 
37
class AuthUserRequest;
 
38
class AuthConfig;
 
39
class AuthUserHashPointer;
 
40
 
 
41
/* for auth_type_t */
 
42
#include "enums.h"
 
43
 
 
44
#include "ip/IpAddress.h"
 
45
#include "dlink.h"
 
46
 
 
47
/**
 
48
 *  \ingroup AuthAPI
 
49
 * This is the main user related structure. It stores user-related data,
 
50
 * and is persistent across requests. It can even persist across
 
51
 * multiple external authentications. One major benefit of preserving this
 
52
 * structure is the cached ACL match results. This structure, is private to
 
53
 * the authentication framework.
 
54
 */
 
55
class AuthUser
 
56
{
 
57
 
 
58
public:
 
59
    /* extra fields for proxy_auth */
 
60
    /* auth_type and auth_module are deprecated. Do Not add new users of these fields.
 
61
     * Aim to remove shortly
 
62
     */
 
63
    /** \deprecated this determines what scheme owns the user data. */
 
64
    auth_type_t auth_type;
 
65
    /** the config for this user */
 
66
    AuthConfig *config;
 
67
    /** we only have one username associated with a given auth_user struct */
 
68
    AuthUserHashPointer *usernamehash;
 
69
    /** we may have many proxy-authenticate strings that decode to the same user */
 
70
    dlink_list proxy_auth_list;
 
71
    dlink_list proxy_match_cache;
 
72
    size_t ipcount;
 
73
    long expiretime;
 
74
    /** how many references are outstanding to this instance */
 
75
    size_t references;
 
76
    /** the auth_user_request structures that link to this. Yes it could be a splaytree
 
77
     * but how many requests will a single username have in parallel? */
 
78
    dlink_list requests;
 
79
 
 
80
    static void cacheInit();
 
81
    static void CachedACLsReset();
 
82
 
 
83
    void absorb(AuthUser *from);
 
84
    virtual ~AuthUser();
 
85
    _SQUID_INLINE_ char const *username() const;
 
86
    _SQUID_INLINE_ void username(char const *);
 
87
    void clearIp();
 
88
    void removeIp(IpAddress);
 
89
    void addIp(IpAddress);
 
90
    _SQUID_INLINE_ void addRequest(AuthUserRequest *);
 
91
 
 
92
    void lock();
 
93
    void unlock();
 
94
 
 
95
    void addToNameCache();
 
96
 
 
97
protected:
 
98
    AuthUser (AuthConfig *);
 
99
 
 
100
private:
 
101
    static void cacheCleanup (void *unused);
 
102
 
 
103
    /**
 
104
     * DPW 2007-05-08
 
105
     * The username_ memory will be allocated via
 
106
     * xstrdup().  It is our responsibility.
 
107
     */
 
108
    char const *username_;
 
109
 
 
110
    /** what ip addresses has this user been seen at?, plus a list length cache */
 
111
    dlink_list ip_list;
 
112
};
 
113
 
 
114
#ifdef _USE_INLINE_
 
115
#include "auth/User.cci"
 
116
#endif
 
117
 
 
118
#endif /* SQUID_AUTHUSER_H */