[Date Prev][Date Next] [Chronological] [Thread] [Top]

(ITS#6773) Per-connection extra stuff



Full_Name: Pierangelo Masarati
Version: HEAD
OS: irrelevant
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (188.153.18.39)
Submitted by: ando


I need to add extra stuff to the Connection structure, to save persistent data
across operations.  Right now, I'm planning to use it to support RFC 3829
authzid control.

<http://www.openldap.org/lists/openldap-devel/201101/msg00005.html>

Probably, this can collect other specific stuff like Paged Results
c_pagedresults_state, Netscape plugin c_extensions, transactions c_txn_* and
more.

The patch is straightforward (I'm reproducing it here only for illustrative
purposes):

--
diff -u -r1.899 slap.h
--- servers/slapd/slap.h        31 Dec 2010 19:02:41 -0000      1.899
+++ servers/slapd/slap.h        4 Jan 2011 13:15:07 -0000
@@ -2811,6 +2811,16 @@
 /*
  * represents a connection from an ldap client
  */
+
+/* This is only a header. Actual users should define their own
+ * structs with the ce_next / ce_key fields at the top and
+ * whatever else they need following.
+ */
+typedef struct ConnExtra {
+       LDAP_SLIST_ENTRY(ConnExtra) ce_next;
+       void *ce_key;
+} ConnExtra;
+
 /* structure state (protected by connections_mutex) */
 enum sc_struct_state {
        SLAP_C_UNINITIALIZED = 0,       /* MUST BE ZERO (0) */
@@ -2927,6 +2937,8 @@

        void    *c_extensions;          /* Netscape plugin */

+       LDAP_SLIST_HEAD(c_e, ConnExtra) c_extra;        /* anything the backend
needs */
+
        /*
         * Client connection handling
         */
--

Unless there are objections, I'd commit it.

p.