]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-meta/back-meta.h
Fix prev commit, return generated passwd
[openldap] / servers / slapd / back-meta / back-meta.h
index 212425e546628282b58b37ce19b8bcf96da03766..cfa95ea1f7b2f291245f14fe1bbc2377611eac0a 100644 (file)
@@ -1,7 +1,24 @@
-/*
- * Copyright 1998-2001 The OpenLDAP Foundation, All Rights Reserved.
- * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+/* $OpenLDAP$ */
+/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
+ *
+ * Copyright 1999-2003 The OpenLDAP Foundation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted only as authorized by the OpenLDAP
+ * Public License.
  *
+ * A copy of this license is available in the file LICENSE in the
+ * top-level directory of the distribution or, alternatively, at
+ * <http://www.OpenLDAP.org/license.html>.
+ */
+/* ACKNOWLEDGEMENTS:
+ * This work was initially developed by the Howard Chu for inclusion
+ * in OpenLDAP Software and subsequently enhanced by Pierangelo
+ * Masarati.
+ */
+/* This is an altered version */
+/*
  * Copyright 1999, Howard Chu, All rights reserved. <hyc@highlandsun.com>
  *
  * Copyright 2001, Pierangelo Masarati, All rights reserved. <ando@sys-net.it>
@@ -77,7 +94,7 @@
 
 /* String rewrite library */
 #include "rewrite.h"
-
+#include "cache.h"
 LDAP_BEGIN_DECL
 
 struct slap_conn;
@@ -87,15 +104,19 @@ struct metasingleconn {
        int                     candidate;
 #define        META_NOT_CANDIDATE      0
 #define        META_CANDIDATE          1
+#define        META_LAST_CONN          -1
        
        LDAP                    *ld;
-       char                    *bound_dn;
+       struct berval           bound_dn;
+       struct berval           cred;
        int                     bound;
 #define META_UNBOUND           0
 #define META_BOUND             1
 #define META_ANONYMOUS         2
 };
 
+#define META_LAST(lsc)         ((lsc)->candidate == META_LAST_CONN)
+
 struct metaconn {
        struct slap_conn        *conn;
        struct rewrite_info     *rwinfo;
@@ -108,22 +129,26 @@ struct metaconn {
 #define META_BOUND_NONE                -1
 #define META_BOUND_ALL         -2
        /* supersedes the connection stuff */
-       struct metasingleconn **conns;
+       struct metasingleconn *conns;
 };
 
 struct metatarget {
        char                    *uri;
-       char                    *suffix;/* normalized suffix */
-       char                    *binddn;
-       char                    *bindpw;
+       struct berval           psuffix;        /* pretty suffix */
+       struct berval           suffix;         /* normalized suffix */
+       struct berval           binddn;
+       struct berval           bindpw;
 
-       char                    *pseudorootdn;
-       char                    *pseudorootpw;
+       struct berval           pseudorootdn;
+       struct berval           pseudorootpw;
 
+#if 0
        struct rewrite_info     *rwinfo;
 
        struct ldapmap          oc_map;
        struct ldapmap          at_map;
+#endif
+       struct ldaprwmap        rwmap;
 };
 
 struct metadncache {
@@ -138,37 +163,31 @@ struct metadncache {
 struct metainfo {
        int                     ntargets;
        int                     defaulttarget;
+       int                     network_timeout;
 #define META_DEFAULT_TARGET_NONE       -1
        struct metatarget       **targets;
 
+       struct rewrite_info     *rwinfo;
+       cache_manager           *cm; 
+       Backend                 *glue_be; 
+
        struct metadncache      cache;
        
        ldap_pvt_thread_mutex_t conn_mutex;
        Avlnode                 *conntree;
-};
-
-extern int
-meta_back_do_single_bind(
-               struct metainfo         *li,
-               struct metaconn         *lc,
-               const char              *dn,
-               const char              *ndn,
-               const char              *cred,
-               int                     method,
-               int                     candidate
-);
 
+       int                     savecred;
+};
 
 #define META_OP_ALLOW_MULTIPLE         0x00
 #define META_OP_REQUIRE_SINGLE         0x01
 #define META_OP_REQUIRE_ALL            0x02
 extern struct metaconn *
 meta_back_getconn(
-               struct                  metainfo *li,
-               struct                  slap_conn *conn,
-               struct                  slap_op *op,
+               Operation               *op,
+               SlapReply               *rs,
                int                     op_type,
-               const                   char *dn,
+               struct berval           *dn,
                int                     *candidate
 );
 
@@ -178,10 +197,17 @@ meta_back_dobind(
                Operation               *op
 );
 
+extern int
+meta_back_is_valid(
+               struct metaconn         *lc, 
+               int                     candidate 
+);
+
 extern int
 meta_back_op_result(
                struct metaconn         *lc,
-               Operation               *op
+               Operation               *op,
+               SlapReply               *rs
 );
 
 extern int
@@ -207,27 +233,26 @@ meta_back_conn_dup(
  */
 extern int
 meta_back_is_candidate(
-               const char              *nsuffix,
-               const char              *ndn,
-               int                     ndnlen
+               struct berval           *nsuffix,
+               struct berval           *ndn
 );
 
 extern int
 meta_back_count_candidates(
                struct metainfo         *li,
-               const char              *ndn
+               struct berval           *ndn
 );
 
 extern int
 meta_back_is_candidate_unique(
                struct metainfo         *li,
-               const char              *ndn
+               struct berval           *ndn
 );
 
 extern int
 meta_back_select_unique_candidate(
                struct metainfo         *li,
-               const char              *ndn
+               struct berval           *ndn
 );
 
 extern int
@@ -262,20 +287,20 @@ meta_dncache_dup(
 extern int
 meta_dncache_get_target(
                struct metadncache      *cache,
-               const char              *ndn
+               struct berval           *ndn
 );
 
 extern int
 meta_dncache_update_entry(
                struct metadncache      *cache,
-               const char              *ndn,
+               struct berval           *ndn,
                int                     target
 );
 
 extern int
 meta_dncache_delete_entry(
                struct metadncache      *cache,
-               const char              *ndn
+               struct berval           *ndn
 );
 
 extern void