]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-sql/operational.c
Merge remote-tracking branch 'origin/mdb.master'
[openldap] / servers / slapd / back-sql / operational.c
index 7071fcd8ea0801b599514091d9f6b1eaeb96217f..a1e8c7d9c5356162366043a3e5a1846fcafa5ab4 100644 (file)
@@ -1,7 +1,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1999-2009 The OpenLDAP Foundation.
+ * Copyright 1999-2012 The OpenLDAP Foundation.
  * Portions Copyright 1999 Dmitry Kovalev.
  * Portions Copyright 2002 Pierangelo Masarati.
  * All rights reserved.
@@ -70,7 +70,7 @@ backsql_operational_entryUUID( backsql_info *bi, backsql_entryID *id )
 Attribute *
 backsql_operational_entryCSN( Operation *op )
 {
-       char            csnbuf[ LDAP_LUTIL_CSNSTR_BUFSIZE ];
+       char            csnbuf[ LDAP_PVT_CSNSTR_BUFSIZE ];
        struct berval   entryCSN;
        Attribute       *a;
 
@@ -123,7 +123,7 @@ backsql_operational(
        Debug( LDAP_DEBUG_TRACE, "==>backsql_operational(): entry \"%s\"\n",
                        rs->sr_entry->e_nname.bv_val, 0, 0 );
 
-       for ( ap = &rs->sr_operational_attrs; *ap; ap = &(*ap)->a_next ) {
+       for ( ap = &rs->sr_entry->e_attrs; *ap; ap = &(*ap)->a_next ) {
                if ( (*ap)->a_desc == slap_schema.si_ad_hasSubordinates ) {
                        get_conn--;
                        got[ BACKSQL_OP_HASSUBORDINATES ] = 1;
@@ -138,6 +138,27 @@ backsql_operational(
                }
        }
 
+       for ( ap = &rs->sr_operational_attrs; *ap; ap = &(*ap)->a_next ) {
+               if ( !got[ BACKSQL_OP_HASSUBORDINATES ] &&
+                       (*ap)->a_desc == slap_schema.si_ad_hasSubordinates )
+               {
+                       get_conn--;
+                       got[ BACKSQL_OP_HASSUBORDINATES ] = 1;
+
+               } else if ( !got[ BACKSQL_OP_ENTRYUUID ] && 
+                       (*ap)->a_desc == slap_schema.si_ad_entryUUID )
+               {
+                       get_conn--;
+                       got[ BACKSQL_OP_ENTRYUUID ] = 1;
+
+               } else if ( !got[ BACKSQL_OP_ENTRYCSN ] &&
+                       (*ap)->a_desc == slap_schema.si_ad_entryCSN )
+               {
+                       get_conn--;
+                       got[ BACKSQL_OP_ENTRYCSN ] = 1;
+               }
+       }
+
        if ( !get_conn ) {
                return 0;
        }