]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/backend.c
cleanup bind
[openldap] / servers / slapd / backend.c
index 4ebc6839eb2f5dbf3a0ecfe258a39cfcb47525f7..637a1dfc31559ca78458fdecac31221459512ff0 100644 (file)
 #include <sys/stat.h>
 
 #include "slap.h"
-#include "slapi.h"
 #include "lutil.h"
 #include "lber_pvt.h"
 
+#ifdef LDAP_SLAPI
+#include "slapi.h"
+#endif
+
 /*
  * If a module is configured as dynamic, its header should not
  * get included into slapd. While this is a general rule and does
@@ -533,7 +536,7 @@ select_backend(
                for ( j = 0; backends[i].be_nsuffix != NULL &&
                    backends[i].be_nsuffix[j].bv_val != NULL; j++ )
                {
-                       if (( backends[i].be_flags & SLAP_BFLAG_GLUE_SUBORDINATE )
+                       if ( ( SLAP_GLUE_SUBORDINATE( &backends[i] ) )
                                && noSubs )
                        {
                                continue;
@@ -853,8 +856,7 @@ backend_check_restrictions(
                }
 
                {
-                       struct berval bv = BER_BVC( LDAP_EXOP_START_TLS );
-                       if( bvmatch( opdata, &bv ) ) {
+                       if( bvmatch( opdata, &slap_EXOP_START_TLS ) ) {
                                session++;
                                starttls++;
                                break;
@@ -862,18 +864,18 @@ backend_check_restrictions(
                }
 
                {
-                       struct berval bv = BER_BVC( LDAP_EXOP_X_WHO_AM_I );
-                       if( bvmatch( opdata, &bv ) ) {
+                       if( bvmatch( opdata, &slap_EXOP_WHOAMI ) ) {
                                break;
                        }
                }
 
+#ifdef LDAP_EXOP_X_CANCEL
                {
-                       struct berval bv = BER_BVC( LDAP_EXOP_X_CANCEL );
-                       if ( bvmatch( opdata, &bv ) ) {
+                       if ( bvmatch( opdata, &slap_EXOP_CANCEL ) ) {
                                break;
                        }
                }
+#endif
 
                /* treat everything else as a modify */
                opflag = SLAP_RESTRICT_OP_MODIFY;
@@ -965,7 +967,7 @@ backend_check_restrictions(
                        }
 
 #ifdef SLAP_X_LISTENER_MOD
-                       if ( ! ( conn->c_listener->sl_perms & S_IWUSR ) ) {
+                       if ( conn->c_listener && ! ( conn->c_listener->sl_perms & S_IWUSR ) ) {
                                /* no "w" mode means readonly */
                                *text = "modifications not allowed on this listener";
                                return LDAP_UNWILLING_TO_PERFORM;
@@ -1024,7 +1026,7 @@ backend_check_restrictions(
 
 #ifdef SLAP_X_LISTENER_MOD
                if ( !starttls && op->o_dn.bv_len == 0 ) {
-                       if ( ! ( conn->c_listener->sl_perms & S_IXUSR ) ) {
+                       if ( conn->c_listener && ! ( conn->c_listener->sl_perms & S_IXUSR ) ) {
                                /* no "x" mode means bind required */
                                *text = "bind required on this listener";
                                return LDAP_STRONG_AUTH_REQUIRED;
@@ -1032,7 +1034,7 @@ backend_check_restrictions(
                }
 
                if ( !starttls && !updateop ) {
-                       if ( ! ( conn->c_listener->sl_perms & S_IRUSR ) ) {
+                       if ( conn->c_listener && ! ( conn->c_listener->sl_perms & S_IRUSR ) ) {
                                /* no "r" mode means no read */
                                *text = "read not allowed on this listener";
                                return LDAP_UNWILLING_TO_PERFORM;