]> git.sur5r.net Git - openldap/commitdiff
More entry level access control for back-shell
authorKurt Zeilenga <kurt@openldap.org>
Mon, 7 Oct 2002 21:56:43 +0000 (21:56 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Mon, 7 Oct 2002 21:56:43 +0000 (21:56 +0000)
(should be applied to back-perl and other programmable backends)

servers/slapd/back-shell/bind.c
servers/slapd/back-shell/compare.c
servers/slapd/back-shell/modify.c

index 6c4ec9ab48f0d20e37c1864164cdf686b56ab671..ad1b9c80c1c9aebe7f63db18023c6a6851d48c6f 100644 (file)
@@ -28,6 +28,8 @@ shell_back_bind(
 )
 {
        struct shellinfo        *si = (struct shellinfo *) be->be_private;
+       AttributeDescription *entry = slap_schema.si_ad_entry;
+       Entry e;
        FILE                    *rfp, *wfp;
        int                     rc;
 
@@ -37,6 +39,23 @@ shell_back_bind(
                return( -1 );
        }
 
+       e.e_id = NOID;
+       e.e_name = *dn;
+       e.e_nname = *ndn;
+       e.e_attrs = NULL;
+       e.e_ocflags = 0;
+       e.e_bv.bv_len = 0;
+       e.e_bv.bv_val = NULL;
+       e.e_private = NULL;
+
+       if ( ! access_allowed( be, conn, op, &e,
+               entry, NULL, ACL_AUTH, NULL ) )
+       {
+               send_ldap_result( conn, op, LDAP_INSUFFICIENT_ACCESS,
+                       NULL, NULL, NULL, NULL );
+               return -1;
+       }
+
        if ( (op->o_private = (void *) forkandexec( si->si_bind, &rfp, &wfp ))
            == (void *) -1 ) {
                send_ldap_result( conn, op, LDAP_OTHER, NULL,
index 19a3498c96e4cfaf08a6ec5b48018f56eb19073c..c70edd530db478f09b72d2632014b0457171ce9a 100644 (file)
@@ -26,6 +26,8 @@ shell_back_compare(
 )
 {
        struct shellinfo        *si = (struct shellinfo *) be->be_private;
+       AttributeDescription *entry = slap_schema.si_ad_entry;
+       Entry e;
        FILE                    *rfp, *wfp;
 
        if ( IS_NULLCMD( si->si_compare ) ) {
@@ -34,6 +36,23 @@ shell_back_compare(
                return( -1 );
        }
 
+       e.e_id = NOID;
+       e.e_name = *dn;
+       e.e_nname = *ndn;
+       e.e_attrs = NULL;
+       e.e_ocflags = 0;
+       e.e_bv.bv_len = 0;
+       e.e_bv.bv_val = NULL;
+       e.e_private = NULL;
+
+       if ( ! access_allowed( be, conn, op, &e,
+               entry, NULL, ACL_READ, NULL ) )
+       {
+               send_ldap_result( conn, op, LDAP_INSUFFICIENT_ACCESS,
+                       NULL, NULL, NULL, NULL );
+               return -1;
+       }
+
        if ( (op->o_private = (void *) forkandexec( si->si_compare, &rfp, &wfp ))
            == (void *) -1 ) {
                send_ldap_result( conn, op, LDAP_OTHER, NULL,
index 69ad41d740ab6d5f9939ecd017e081d77e11e9b6..9b82f70be4b7b8de9106b2eb695dd0f8f227666e 100644 (file)
@@ -27,6 +27,8 @@ shell_back_modify(
 {
        Modification *mod;
        struct shellinfo        *si = (struct shellinfo *) be->be_private;
+       AttributeDescription *entry = slap_schema.si_ad_entry;
+       Entry e;
        FILE                    *rfp, *wfp;
        int                     i;
 
@@ -36,6 +38,23 @@ shell_back_modify(
                return( -1 );
        }
 
+       e.e_id = NOID;
+       e.e_name = *dn;
+       e.e_nname = *ndn;
+       e.e_attrs = NULL;
+       e.e_ocflags = 0;
+       e.e_bv.bv_len = 0;
+       e.e_bv.bv_val = NULL;
+       e.e_private = NULL;
+
+       if ( ! access_allowed( be, conn, op, &e,
+               entry, NULL, ACL_WRITE, NULL ) )
+       {
+               send_ldap_result( conn, op, LDAP_INSUFFICIENT_ACCESS,
+                       NULL, NULL, NULL, NULL );
+               return -1;
+       }
+
        if ( (op->o_private = (void *) forkandexec( si->si_modify, &rfp, &wfp ))
            == (void *) -1 ) {
                send_ldap_result( conn, op, LDAP_OTHER, NULL,