]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
SourceLayout: Shuffle ident files into libident.la
authorAmos Jeffries <squid3@treenet.co.nz>
Mon, 1 Jun 2009 12:31:43 +0000 (00:31 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 1 Jun 2009 12:31:43 +0000 (00:31 +1200)
 * Moves files into ident/ for library
 * Adds Ident:: namespace for interface.
 * Moves ident config to Ident::TheConfig
 * reduces one avenue of memory leak on double-Init of ident objects.
 * Makes ident ACL only relevant when ident is available
 * Wraps Ident code in USE_IDENT for monolithic or empty library build
 * Adds documentation for ident API

TODO: Async and Object'ify the ident internals.

17 files changed:
configure.in
src/AclRegs.cc
src/Makefile.am
src/acl/Makefile.am
src/cache_cf.cc
src/cf.data.pre
src/client_side.cc
src/external_acl.cc
src/ident.h [deleted file]
src/ident/AclIdent.cc [moved from src/acl/Ident.cc with 85% similarity]
src/ident/AclIdent.h [moved from src/acl/AclIdent.h with 94% similarity]
src/ident/Config.h [new file with mode: 0644]
src/ident/Ident.cc [moved from src/ident.cc with 77% similarity]
src/ident/Ident.h [new file with mode: 0644]
src/ident/Makefile.am [new file with mode: 0644]
src/main.cc
src/structs.h

index 948c6f4bcb45b5ec7533002032adcb95a3f10717..b40af699474189861b00a51944df245369e4c82b 100644 (file)
@@ -1520,10 +1520,8 @@ AC_ARG_ENABLE(ident-lookups,
 ])
 if test $use_ident = 1; then
     AC_DEFINE(USE_IDENT, 1,[Compile in support for Ident (RFC 931) lookups?  Enabled by default.])
-    AM_CONDITIONAL(ENABLE_IDENT, true)
 else
     AC_DEFINE(USE_IDENT, 0)
-    AM_CONDITIONAL(ENABLE_IDENT, false)
 fi
 
 AM_CONDITIONAL(USE_DNSSERVER, false)
@@ -3823,6 +3821,7 @@ AC_CONFIG_FILES([\
        src/adaptation/ecap/Makefile \
        src/esi/Makefile \
        src/icmp/Makefile \
+       src/ident/Makefile \
        src/ip/Makefile \
        contrib/Makefile \
        snmplib/Makefile \
index e2136861b61294a60705cf336da06edfedfaffcf..3101d97248bab28da68a561bfd1ab46d4ffadfe2 100644 (file)
@@ -24,9 +24,6 @@
 #include "acl/HttpRepHeader.h"
 #include "acl/HttpReqHeader.h"
 #include "acl/HttpStatus.h"
-#if USE_IDENT
-#include "acl/AclIdent.h"
-#endif
 #include "acl/IntRange.h"
 #include "acl/Ip.h"
 #include "acl/MaxConnection.h"
@@ -65,6 +62,9 @@
 #include "acl/UserData.h"
 #include "auth/AclProxyAuth.h"
 #include "auth/AclMaxUserIp.h"
+#if USE_IDENT
+#include "ident/AclIdent.h"
+#endif
 
 
 ACL::Prototype ACLBrowser::RegistryProtoype(&ACLBrowser::RegistryEntry_, "browser");
index 70d06f3e62875264cb16efd125f743111d4c266b..3b474eb13f9b193d60fdb3e1e383ac6dce94e3b8 100644 (file)
@@ -30,7 +30,7 @@ LOADABLE_MODULES_SOURCES = \
        LoadableModules.h \
        LoadableModules.cc
 
-SUBDIRS        = base acl fs repl auth ip icmp
+SUBDIRS        = base acl fs repl auth ip icmp ident
 
 if USE_ADAPTATION
 SUBDIRS += adaptation
@@ -143,13 +143,6 @@ else
 AIOPS_SOURCE = DiskIO/DiskThreads/aiops.cc
 endif
 
-IDENT_ALL_SOURCE = ident.cc ident.h
-if ENABLE_IDENT
-IDENT_SOURCE = $(IDENT_ALL_SOURCE)
-else
-IDENT_SOURCE =
-endif
-
 EXTRA_LIBRARIES = libAIO.a libBlocking.a libDiskDaemon.a libDiskThreads.a
 noinst_LIBRARIES = @DISK_LIBS@
 noinst_LTLIBRARIES = libsquid.la
@@ -158,6 +151,7 @@ noinst_LTLIBRARIES = libsquid.la
 COMMON_LIBS = \
        libsquid.la \
        auth/libacls.la \
+       ident/libident.la \
        acl/libacls.la \
        acl/libstate.la \
        auth/libauth.la \
@@ -243,7 +237,6 @@ EXTRA_squid_SOURCES = \
        htcp.h \
        ipc.cc \
        ipc_win32.cc \
-       $(IDENT_ALL_SOURCE) \
        ProfStats.cc \
        LeakFinder.cc \
        LeakFinder.h \
@@ -387,7 +380,6 @@ squid_SOURCES = \
        ICP.h \
        icp_v2.cc \
        icp_v3.cc \
-       $(IDENT_SOURCE) \
        int.cc \
        internal.cc \
        $(IPC_SOURCE) \
@@ -1038,7 +1030,6 @@ tests_testCacheManager_SOURCES = \
        HttpStatusLine.cc \
        icp_v2.cc \
        icp_v3.cc \
-       $(IDENT_SOURCE) \
        $(IPC_SOURCE) \
        ipcache.cc \
        int.cc \
@@ -1208,7 +1199,6 @@ tests_testEvent_SOURCES = \
        HttpStatusLine.cc \
        icp_v2.cc \
        icp_v3.cc \
-       $(IDENT_SOURCE) \
        $(IPC_SOURCE) \
        ipcache.cc \
        int.cc \
@@ -1356,7 +1346,6 @@ tests_testEventLoop_SOURCES = \
        HttpStatusLine.cc \
        icp_v2.cc \
        icp_v3.cc \
-       $(IDENT_SOURCE) \
        $(IPC_SOURCE) \
        ipcache.cc \
        int.cc \
@@ -1495,7 +1484,6 @@ tests_test_http_range_SOURCES = \
        HttpStatusLine.cc \
        icp_v2.cc \
        icp_v3.cc \
-       $(IDENT_SOURCE) \
        int.cc \
        internal.cc \
        $(IPC_SOURCE) \
@@ -1646,7 +1634,6 @@ tests_testHttpRequest_SOURCES = \
        HttpStatusLine.cc \
        icp_v2.cc \
        icp_v3.cc \
-       $(IDENT_SOURCE) \
        $(IPC_SOURCE) \
        ipcache.cc \
        int.cc \
@@ -1998,7 +1985,6 @@ tests_testURL_SOURCES = \
        HttpStatusLine.cc \
        icp_v2.cc \
        icp_v3.cc \
-       $(IDENT_SOURCE) \
        $(IPC_SOURCE) \
        ipcache.cc \
        int.cc \
index 4c71e9d72c7b46c29dad65e43f580264b4fa82ef..f98c937549f61ce72dd88cb991b135452e258a0c 100644 (file)
@@ -131,14 +131,3 @@ libacls_la_SOURCES += $(ARP_ACLS)
 endif
 
 EXTRA_libacls_la_SOURCES += $(ARP_ACLS)
-
-
-IDENT_ACLS = Ident.cc AclIdent.h
-
-if ENABLE_IDENT
-libacls_la_SOURCES += $(IDENT_ACLS)
-endif
-
-EXTRA_libacls_la_SOURCES += $(IDENT_ACLS)
-
-
index 86d2b4c63c2e6feb01368139268fca0db00f7c89..cb6767d9b7e8743d4355cabe918eef3c7bf9fb43 100644 (file)
@@ -47,6 +47,7 @@
 #include "Parsing.h"
 #include "MemBuf.h"
 #include "wordlist.h"
+#include "ident/Config.h"
 #include "ip/IpIntercept.h"
 
 #if HAVE_GLOB_H
index 30b9421046fecbe5ab51409d4a40d25c1067c72a..8fedb2d25a1115bd2e46e7774e142fbcfd175bef 100644 (file)
@@ -933,7 +933,7 @@ TYPE: acl_access
 IFDEF: USE_IDENT
 DEFAULT: none
 DEFAULT_IF_NONE: deny all
-LOC: Config.accessList.identLookup
+LOC: Ident::TheConfig.identLookup
 DOC_START
        A list of ACL elements which, if matched, cause an ident
        (RFC 931) lookup to be performed for this request.  For
@@ -945,11 +945,11 @@ DOC_START
        To enable ident lookups for specific client addresses, you
        can follow this example:
 
-       acl ident_aware_hosts src 198.168.1.0/255.255.255.0
+       acl ident_aware_hosts src 198.168.1.0/24
        ident_lookup_access allow ident_aware_hosts
        ident_lookup_access deny all
 
-       Only src type ACL checks are fully supported.  A src_domain
+       Only src type ACL checks are fully supported.  A srcdomain
        ACL might work at times, but it will not always provide
        the correct result.
 DOC_END
@@ -3643,7 +3643,7 @@ DOC_END
 NAME: ident_timeout
 TYPE: time_t
 IFDEF: USE_IDENT
-LOC: Config.Timeout.ident
+LOC: Ident::TheConfig.timeout
 DEFAULT: 10 seconds
 DOC_START
        Maximum time to wait for IDENT lookups to complete.
index 0d212f52db2e36945109d475b0f812f3ae448b51..bfad70968defe00adf57aecca8b70c1e18c238fd 100644 (file)
@@ -91,7 +91,8 @@
 #include "HttpHdrContRange.h"
 #include "HttpReply.h"
 #include "HttpRequest.h"
-#include "ident.h"
+#include "ident/Config.h"
+#include "ident/Ident.h"
 #include "ip/IpIntercept.h"
 #include "MemObject.h"
 #include "fde.h"
@@ -316,7 +317,6 @@ clientIdentDone(const char *ident, void *data)
     ConnStateData *conn = (ConnStateData *)data;
     xstrncpy(conn->rfc931, ident ? ident : dash_str, USER_IDENT_SZ);
 }
-
 #endif
 
 void
@@ -2872,13 +2872,12 @@ httpAccept(int sock, int newfd, ConnectionDetail *details,
     commSetTimeout(newfd, Config.Timeout.read, timeoutCall);
 
 #if USE_IDENT
-
-    if (Config.accessList.identLookup) {
-        ACLFilledChecklist identChecklist(Config.accessList.identLookup, NULL, NULL);
+    if (Ident::TheConfig.identLookup) {
+        ACLFilledChecklist identChecklist(Ident::TheConfig.identLookup, NULL, NULL);
         identChecklist.src_addr = details->peer;
         identChecklist.my_addr = details->me;
         if (identChecklist.fastCheck())
-            identStart(details->me, details->peer, clientIdentDone, connState);
+            Ident::Start(details->me, details->peer, clientIdentDone, connState);
     }
 #endif
 
@@ -3084,13 +3083,12 @@ httpsAccept(int sock, int newfd, ConnectionDetail *details,
     commSetTimeout(newfd, Config.Timeout.request, timeoutCall);
 
 #if USE_IDENT
-
-    if (Config.accessList.identLookup) {
-        ACLFilledChecklist identChecklist(Config.accessList.identLookup, NULL, NULL);
+    if (Ident::TheConfig.identLookup) {
+        ACLFilledChecklist identChecklist(Ident::TheConfig.identLookup, NULL, NULL);
         identChecklist.src_addr = details->peer;
         identChecklist.my_addr = details->me;
         if (identChecklist.fastCheck())
-            identStart(details->me, details->peer, clientIdentDone, connState);
+            Ident::Start(details->me, details->peer, clientIdentDone, connState);
     }
 
 #endif
index 72835d0e15b1b398946d9f040feb6d36f5f35b42..9097ebdbd78b4119d6f4953626868e519a0ecffb 100644 (file)
@@ -51,7 +51,7 @@
 #include "acl/FilledChecklist.h"
 #include "acl/Acl.h"
 #if USE_IDENT
-#include "acl/AclIdent.h"
+#include "ident/AclIdent.h"
 #endif
 #include "client_side.h"
 #include "HttpRequest.h"
diff --git a/src/ident.h b/src/ident.h
deleted file mode 100644 (file)
index 0c9f9bd..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * $Id$
- */
-#ifndef SQUID_IDENT_H
-#define SQUID_IDENT_H
-
-/*
- \defgroup IdentAPI Ident Lookup API
- \ingroup SquidComponents
- *
- */
-
-#include "config.h"
-
-#if USE_IDENT
-
-#include "cbdata.h"
-
-class IpAddress;
-
-/// \ingroup IdentAPI
-SQUIDCEXTERN void identStart(IpAddress &me, IpAddress &my_peer, IDCB * callback, void *cbdata);
-
-/// \ingroup IdentAPI
-SQUIDCEXTERN void identInit(void);
-
-#endif /* USE_IDENT */
-#endif /* SQUID_IDENT_H */
similarity index 85%
rename from src/acl/Ident.cc
rename to src/ident/AclIdent.cc
index bda9cc1ae0941fbcefcfd3f5b05ee1e546fd558d..7529dfd65dda3249f50bc27747034876766b7fa8 100644 (file)
  * Copyright (c) 2003, Robert Collins <robertc@squid-cache.org>
  */
 
-#include "squid.h"
-#include "acl/AclIdent.h"
+#include "config.h"
+
+#if USE_IDENT
+
 #include "acl/FilledChecklist.h"
 #include "acl/RegexData.h"
 #include "acl/UserData.h"
 #include "client_side.h"
-#include "ident.h"
+#include "ident/AclIdent.h"
+#include "ident/Ident.h"
 
 ACLIdent::~ACLIdent()
 {
@@ -70,7 +73,7 @@ void
 ACLIdent::parse()
 {
     if (!data) {
-        debugs(28, 3, "aclParseUserList: current is null. Creating");
+        debugs(28, 3, HERE << "current is null. Creating");
         data = new ACLUserData;
     }
 
@@ -86,7 +89,7 @@ ACLIdent::match(ACLChecklist *cl)
     } else if (checklist->conn() != NULL && checklist->conn()->rfc931[0]) {
         return data->match(checklist->conn()->rfc931);
     } else {
-        debugs(28, 3, "ACLIdent::match() - switching to ident lookup state");
+        debugs(28, 3, HERE << "switching to ident lookup state");
         checklist->changeState(IdentLookup::Instance());
         return 0;
     }
@@ -124,12 +127,11 @@ IdentLookup::checkForAsync(ACLChecklist *cl)const
 {
     ACLFilledChecklist *checklist = Filled(cl);
     if (checklist->conn() != NULL) {
-        debugs(28, 3, "IdentLookup::checkForAsync: Doing ident lookup" );
+        debugs(28, 3, HERE << "Doing ident lookup" );
         checklist->asyncInProgress(true);
-        identStart(checklist->conn()->me, checklist->conn()->peer,
-                   LookupDone, checklist);
+        Ident::Start(checklist->conn()->me, checklist->conn()->peer, LookupDone, checklist);
     } else {
-        debugs(28, 1, "IdentLookup::checkForAsync: Can't start ident lookup. No client connection" );
+        debugs(28, DBG_IMPORTANT, "IdentLookup::checkForAsync: Can't start ident lookup. No client connection" );
         checklist->currentAnswer(ACCESS_DENIED);
         checklist->markFinished();
     }
@@ -139,7 +141,7 @@ void
 IdentLookup::LookupDone(const char *ident, void *data)
 {
     ACLFilledChecklist *checklist = Filled(static_cast<ACLChecklist*>(data));
-    assert (checklist->asyncState() == IdentLookup::Instance());
+    assert(checklist->asyncState() == IdentLookup::Instance());
 
     if (ident) {
         xstrncpy(checklist->rfc931, ident, USER_IDENT_SZ);
@@ -155,8 +157,8 @@ IdentLookup::LookupDone(const char *ident, void *data)
         xstrncpy(checklist->conn()->rfc931, checklist->rfc931, USER_IDENT_SZ);
 
     checklist->asyncInProgress(false);
-
-    checklist->changeState (ACLChecklist::NullState::Instance());
-
+    checklist->changeState(ACLChecklist::NullState::Instance());
     checklist->check();
 }
+
+#endif /* USE_IDENT */
similarity index 94%
rename from src/acl/AclIdent.h
rename to src/ident/AclIdent.h
index edbdf5a10fbe61669ebd44474a6fc9afb48c9c4e..5c4c54d993dc44605e22c51e01dec03ba5adc58d 100644 (file)
  * Copyright (c) 2003, Robert Collins <robertc@squid-cache.org>
  */
 
-#ifndef SQUID_ACLIDENT_H
-#define SQUID_ACLIDENT_H
+#ifndef SQUID_IDENT_ACLIDENT_H
+#define SQUID_IDENT_ACLIDENT_H
+
+#include "config.h"
+
+#if USE_IDENT
 
 #include "acl/Checklist.h"
 
@@ -86,4 +90,5 @@ private:
 
 MEMPROXY_CLASS_INLINE(ACLIdent);
 
-#endif /* SQUID_ACLIDENT_H */
+#endif /* USE_IDENT */
+#endif /* SQUID_IDENT_ACLIDENT_H */
diff --git a/src/ident/Config.h b/src/ident/Config.h
new file mode 100644 (file)
index 0000000..2b44022
--- /dev/null
@@ -0,0 +1,23 @@
+#ifndef SQUID_IDENT_CONFIG_H
+#define SQUID_IDENT_CONFIG_H
+
+#include "config.h"
+
+#if USE_IDENT
+
+#include "acl/Acl.h"
+
+namespace Ident {
+
+class IdentConfig {
+public:
+    acl_access *identLookup;
+    time_t timeout;
+};
+
+extern IdentConfig TheConfig;
+
+}; // namespace Ident
+
+#endif /* USE_IDENT */
+#endif /* SQUID_IDENT_CONFIG_H */
similarity index 77%
rename from src/ident.cc
rename to src/ident/Ident.cc
index 061cb6b20a95501551b7c714a90276d102633b1c..a6c84974ff6018086af6af18353f1ff72851a0fd 100644 (file)
  */
 
 #include "squid.h"
-#include "ident.h"
+
+#if USE_IDENT
+
 #include "comm.h"
+#include "ident/Config.h"
+#include "ident/Ident.h"
 #include "MemBuf.h"
 
+namespace Ident {
+
 #define IDENT_PORT 113
 #define IDENT_KEY_SZ 50
 
@@ -58,17 +64,23 @@ typedef struct _IdentStateData {
     char buf[4096];
 } IdentStateData;
 
-static IOCB identReadReply;
-static PF identClose;
-static PF identTimeout;
-static CNCB identConnectDone;
+// TODO: make these all a series of Async jobs. They are self-contained callbacks now.
+static IOCB ReadReply;
+static PF Close;
+static PF Timeout;
+static CNCB ConnectDone;
 static hash_table *ident_hash = NULL;
-static void identClientAdd(IdentStateData *, IDCB *, void *);
+static void ClientAdd(IdentStateData * state, IDCB * callback, void *callback_data);
+static void identCallback(IdentStateData * state, char *result);
+
+}; // namespace Ident
+
+Ident::IdentConfig Ident::TheConfig;
 
 /**** PRIVATE FUNCTIONS ****/
 
 static void
-identCallback(IdentStateData * state, char *result)
+Ident::identCallback(IdentStateData * state, char *result)
 {
     IdentClient *client;
 
@@ -87,7 +99,7 @@ identCallback(IdentStateData * state, char *result)
 }
 
 static void
-identClose(int fdnotused, void *data)
+Ident::Close(int fdnotused, void *data)
 {
     IdentStateData *state = (IdentStateData *)data;
     identCallback(state, NULL);
@@ -98,7 +110,7 @@ identClose(int fdnotused, void *data)
 }
 
 static void
-identTimeout(int fd, void *data)
+Ident::Timeout(int fd, void *data)
 {
     IdentStateData *state = (IdentStateData *)data;
     debugs(30, 3, "identTimeout: FD " << fd << ", " << state->my_peer);
@@ -107,7 +119,7 @@ identTimeout(int fd, void *data)
 }
 
 static void
-identConnectDone(int fd, comm_err_t status, int xerrno, void *data)
+Ident::ConnectDone(int fd, comm_err_t status, int xerrno, void *data)
 {
     IdentStateData *state = (IdentStateData *)data;
     IdentClient *c;
@@ -138,12 +150,12 @@ identConnectDone(int fd, comm_err_t status, int xerrno, void *data)
               state->my_peer.GetPort(),
               state->me.GetPort());
     comm_write_mbuf(fd, &mb, NULL, state);
-    comm_read(fd, state->buf, BUFSIZ, identReadReply, state);
-    commSetTimeout(fd, Config.Timeout.ident, identTimeout, state);
+    comm_read(fd, state->buf, BUFSIZ, Ident::ReadReply, state);
+    commSetTimeout(fd, Ident::TheConfig.timeout, Ident::Timeout, state);
 }
 
 static void
-identReadReply(int fd, char *buf, size_t len, comm_err_t flag, int xerrno, void *data)
+Ident::ReadReply(int fd, char *buf, size_t len, comm_err_t flag, int xerrno, void *data)
 {
     IdentStateData *state = (IdentStateData *)data;
     char *ident = NULL;
@@ -174,16 +186,15 @@ identReadReply(int fd, char *buf, size_t len, comm_err_t flag, int xerrno, void
     if (strstr(buf, "USERID")) {
         if ((ident = strrchr(buf, ':'))) {
             while (xisspace(*++ident));
-            identCallback(state, ident);
+            Ident::identCallback(state, ident);
         }
     }
 
     comm_close(fd);
 }
 
-
 static void
-identClientAdd(IdentStateData * state, IDCB * callback, void *callback_data)
+Ident::ClientAdd(IdentStateData * state, IDCB * callback, void *callback_data)
 {
     IdentClient *c = (IdentClient *)xcalloc(1, sizeof(*c));
     IdentClient **C;
@@ -202,7 +213,7 @@ CBDATA_TYPE(IdentStateData);
  * start a TCP connection to the peer host on port 113
  */
 void
-identStart(IpAddress &me, IpAddress &my_peer, IDCB * callback, void *data)
+Ident::Start(IpAddress &me, IpAddress &my_peer, IDCB * callback, void *data)
 {
     IdentStateData *state;
     int fd;
@@ -215,8 +226,11 @@ identStart(IpAddress &me, IpAddress &my_peer, IDCB * callback, void *data)
     my_peer.ToURL(key2, IDENT_KEY_SZ);
     snprintf(key, IDENT_KEY_SZ, "%s,%s", key1, key2);
 
+    if (!ident_hash) {
+        Init();
+    }
     if ((state = (IdentStateData *)hash_lookup(ident_hash, key)) != NULL) {
-        identClientAdd(state, callback, data);
+        ClientAdd(state, callback, data);
         return;
     }
 
@@ -241,23 +255,25 @@ identStart(IpAddress &me, IpAddress &my_peer, IDCB * callback, void *data)
     state->fd = fd;
     state->me = me;
     state->my_peer = my_peer;
-    identClientAdd(state, callback, data);
+    ClientAdd(state, callback, data);
     hash_join(ident_hash, &state->hash);
-    comm_add_close_handler(fd,
-                           identClose,
-                           state);
-    commSetTimeout(fd, Config.Timeout.ident, identTimeout, state);
-    commConnectStart(fd,
-                     state->my_peer.NtoA(ntoabuf,MAX_IPSTRLEN),
-                     IDENT_PORT,
-                     identConnectDone,
-                     state);
+    comm_add_close_handler(fd, Ident::Close, state);
+    commSetTimeout(fd, Ident::TheConfig.timeout, Ident::Timeout, state);
+    state->my_peer.NtoA(ntoabuf,MAX_IPSTRLEN);
+    commConnectStart(fd, ntoabuf, IDENT_PORT, Ident::ConnectDone, state);
 }
 
 void
-identInit(void)
+Ident::Init(void)
 {
+    if(ident_hash) {
+        debugs(30, DBG_CRITICAL, "WARNING: Ident already initialized.");
+        return;
+    }
+
     ident_hash = hash_create((HASHCMP *) strcmp,
                              hashPrime(Squid_MaxFD / 8),
                              hash4);
 }
+
+#endif /* USE_IDENT */
diff --git a/src/ident/Ident.h b/src/ident/Ident.h
new file mode 100644 (file)
index 0000000..f632b10
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * $Id$
+ */
+#ifndef SQUID_IDENT_H
+#define SQUID_IDENT_H
+
+/**
+ \defgroup IdentAPI Ident Lookup API
+ \ingroup SquidComponents
+ */
+
+#include "config.h"
+
+#if USE_IDENT
+
+#include "cbdata.h"
+
+class IpAddress;
+
+namespace Ident {
+
+/**
+  \ingroup IdentAPI
+ *
+ * Open a connection and request IDENT information from a peer machine.
+ * Callack will be called whan the lookup is completed.
+ * Self-registers with a global ident lookup manager,
+ * will call Ident::Init() itself if the manager has not been initialized already.
+ */
+void Start(IpAddress &me, IpAddress &my_peer, IDCB * callback, void *cbdata);
+
+/**
+ \ingroup IdentAPI
+ *
+ * Initialize IDENT lookup manager.
+ * Currently a hash list of open ident requests.
+ * \bug Will leak the hash list if called twice.
+ */
+void Init(void);
+
+}
+
+#endif /* USE_IDENT */
+#endif /* SQUID_IDENT_H */
diff --git a/src/ident/Makefile.am b/src/ident/Makefile.am
new file mode 100644 (file)
index 0000000..85f4235
--- /dev/null
@@ -0,0 +1,11 @@
+include $(top_srcdir)/src/Common.am
+include $(top_srcdir)/src/TestHeaders.am
+
+noinst_LTLIBRARIES = libident.la
+
+libident_la_SOURCES = \
+       AclIdent.h \
+       AclIdent.cc \
+       Config.h \
+       Ident.cc \
+       Ident.h
index 7aac0a18c700ee2333da06f1b55036355b349270..5a57f25ee95068bfd59a9091e3a89937c6ed22d6 100644 (file)
@@ -42,7 +42,7 @@
 #include "ExternalACL.h"
 #include "Store.h"
 #include "ICP.h"
-#include "ident.h"
+#include "ident/Ident.h"
 #include "HttpReply.h"
 #include "pconn.h"
 #include "Mem.h"
@@ -946,10 +946,9 @@ mainInitialize(void)
     accessLogInit();
 
 #if USE_IDENT
-
-    identInit();
-
+    Ident::Init();
 #endif
+
 #ifdef SQUID_SNMP
 
     snmpInit();
index e81dfdcfe46cbbf6224525f8ed501f0815262916..23bf0c36f7f93ee72812aa5b083391d3a8e16f5e 100644 (file)
@@ -173,10 +173,7 @@ struct SquidConfig {
         int icp_query_max;     /* msec */
         int icp_query_min;     /* msec */
         int mcast_icp_query;   /* msec */
-#if USE_IDENT
 
-        time_t ident;
-#endif
 #if !USE_DNSSERVERS
 
         time_t idns_retransmit;
@@ -464,11 +461,6 @@ struct SquidConfig {
 #if HTTP_VIOLATIONS
         acl_access *brokenPosts;
 #endif
-#if USE_IDENT
-
-        acl_access *identLookup;
-#endif
-
         acl_access *redirector;
         acl_access *reply;
         acl_address *outgoing_address;