]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
Make features global
authorOndřej Kuzník <ondra@mistotebe.net>
Tue, 4 Apr 2017 14:09:45 +0000 (15:09 +0100)
committerOndřej Kuzník <okuznik@symas.com>
Tue, 17 Nov 2020 17:55:46 +0000 (17:55 +0000)
servers/lloadd/bind.c
servers/lloadd/config.c
servers/lloadd/proto-slap.h
servers/lloadd/slap.h

index c0061f9f40f3fb2e143ac01eae30192aa45bbee8..1006e010da6393a2ecb42fb3427d12fa708e5f89 100644 (file)
@@ -255,7 +255,7 @@ client_bind( void *ctx, void *arg )
     }
 
     op->o_upstream = upstream;
-    if ( upstream->c_features & SLAP_C_VC ) {
+    if ( lload_features & LLOAD_FEATURE_VC ) {
         rc = request_bind_as_vc( op );
     } else {
         rc = request_bind( op );
index 8537d786c2ddd3b6eb63e5be644805b29d78edd7..241c7220a1395c9393f15da0e4a082806e3dc245 100644 (file)
@@ -69,6 +69,8 @@ char *global_host = NULL;
 static FILE *logfile;
 static char *logfileName;
 
+lload_features_t lload_features;
+
 ber_len_t sockbuf_max_incoming = SLAP_SB_MAX_INCOMING_DEFAULT;
 ber_len_t sockbuf_max_incoming_auth = SLAP_SB_MAX_INCOMING_AUTH;
 
@@ -104,6 +106,7 @@ static ConfigDriver config_tcp_buffer;
 static ConfigDriver config_restrict;
 static ConfigDriver config_loglevel;
 static ConfigDriver config_include;
+static ConfigDriver config_feature;
 #ifdef HAVE_TLS
 static ConfigDriver config_tls_option;
 static ConfigDriver config_tls_config;
@@ -227,6 +230,10 @@ static ConfigTable config_back_cf_table[] = {
         ARG_INT|ARG_MAGIC|CFG_RESCOUNT,
         &config_generic,
     },
+    { "feature", "name", 2, 0, 0,
+        ARG_MAGIC,
+        &config_feature,
+    },
     { "TLSCACertificate", NULL, 2, 2, 0,
 #ifdef HAVE_TLS
         CFG_TLS_CACERT|ARG_BINARY|ARG_MAGIC,
@@ -1014,6 +1021,27 @@ config_include( ConfigArgs *c )
     return rc;
 }
 
+static int
+config_feature( ConfigArgs *c )
+{
+    slap_verbmasks features[] = {
+        { BER_BVC("vc"), LLOAD_FEATURE_VC },
+        { BER_BVC("proxyauthz"), LLOAD_FEATURE_PROXYAUTHZ },
+        { BER_BVNULL, 0 }
+    };
+    slap_mask_t mask = 0;
+    int i;
+
+    i = verbs_to_mask( c->argc, c->argv, features, &mask );
+    if ( i ) {
+        Debug( LDAP_DEBUG_ANY, "%s: <%s> unknown feature %s\n", c->log,
+                c->argv[0], c->argv[i] );
+        return 1;
+    }
+    lload_features |= mask;
+    return 0;
+}
+
 #ifdef HAVE_TLS
 static int
 config_tls_cleanup( ConfigArgs *c )
index 4643f00900fe7ba95fc96fb94da436a615ca19c2..d5c3dfbaa836fd9bb29d2bd4c3a3af96e35447aa 100644 (file)
@@ -219,6 +219,8 @@ LDAP_SLAPD_V (ber_len_t) sockbuf_max_incoming;
 LDAP_SLAPD_V (ber_len_t) sockbuf_max_incoming_auth;
 LDAP_SLAPD_V (int) slap_conn_max_pdus_per_cycle;
 
+LDAP_SLAPD_V (lload_features_t) lload_features;
+
 LDAP_SLAPD_V (slap_mask_t) global_allows;
 LDAP_SLAPD_V (slap_mask_t) global_disallows;
 
index 01250e5c3b35819ab4d2ffc601a2805632ef3d15..39e97a046760078d6dc843551efd06ae7d5d518e 100644 (file)
@@ -227,6 +227,11 @@ typedef struct config_reply_s ConfigReply; /* config.h */
 
 typedef struct Listener Listener;
 
+typedef enum {
+    LLOAD_FEATURE_VC = 1 << 0,
+    LLOAD_FEATURE_PROXYAUTHZ = 1 << 1,
+} lload_features_t;
+
 enum lload_tls_type {
     LLOAD_CLEARTEXT = 0,
     LLOAD_LDAPS,
@@ -279,13 +284,12 @@ struct Connection {
     struct event *c_read_event, *c_write_event;
 
     /* can only be changed by binding thread */
-    int c_features;
-#define SLAP_C_VC 1
-
     struct berval c_sasl_bind_mech; /* mech in progress */
     struct berval c_auth;           /* authcDN (possibly in progress) */
 
+#ifdef LDAP_API_FEATURE_VERIFY_CREDENTIALS
     struct berval c_vc_cookie;
+#endif /* LDAP_API_FEATURE_VERIFY_CREDENTIALS */
 
     /* Can be held while acquiring c_mutex to inject things into c_ops or
      * destroy the connection */