]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/extended.c
Set peeraddr also for IPv6, fixes ITS#1918
[openldap] / servers / slapd / extended.c
index ec49fe5c58c99a21c130593c8cd16557378b6cc0..ace5cb55f14e863a1701bec478e1368f63c54d4d 100644 (file)
@@ -32,6 +32,7 @@
 #include <ac/string.h>
 
 #include "slap.h"
+#include "lber_pvt.h"
 
 static struct extop_list {
        struct extop_list *next;
@@ -107,6 +108,7 @@ do_extended(
 #else
        Debug( LDAP_DEBUG_TRACE, "do_extended\n", 0, 0, 0 );
 #endif
+
        if( op->o_protocol < LDAP_VERSION3 ) {
 #ifdef NEW_LOGGING
                LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
@@ -200,7 +202,7 @@ do_extended(
        refs = NULL;
 
        rc = (ext->ext_main)( conn, op,
-               reqoid.bv_val, &reqdata,
+               reqoid.bv_val, reqdata.bv_val ? &reqdata : NULL,
                &rspoid, &rspdata, &rspctrls, &text, &refs );
 
        if( rc != SLAPD_ABANDON ) {
@@ -294,7 +296,7 @@ find_extop( struct extop_list *list, struct berval *oid )
 }
 
 
-int
+static int
 whoami_extop (
        Connection *conn,
        Operation *op,
@@ -306,6 +308,7 @@ whoami_extop (
        const char ** text,
        BerVarray * refs )
 {
+       int rc;
        struct berval *bv;
 
        if ( reqdata != NULL ) {
@@ -314,6 +317,16 @@ whoami_extop (
                return LDAP_PROTOCOL_ERROR;
        }
 
+       {
+               int rc;
+               struct berval whoami = BER_BVC( LDAP_EXOP_X_WHO_AM_I );
+
+               rc = backend_check_restrictions( conn->c_authz_backend,
+                       conn, op, &whoami, text );
+
+               if( rc != LDAP_SUCCESS ) return rc;
+       }
+
        bv = (struct berval *) ch_malloc( sizeof(struct berval) );
        if( op->o_dn.bv_len ) {
                bv->bv_len = op->o_dn.bv_len + sizeof("dn:")-1;