]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
import fix to ITS#5168
authorPierangelo Masarati <ando@openldap.org>
Thu, 4 Oct 2007 22:02:08 +0000 (22:02 +0000)
committerPierangelo Masarati <ando@openldap.org>
Thu, 4 Oct 2007 22:02:08 +0000 (22:02 +0000)
CHANGES
include/lutil.h
libraries/liblutil/uuid.c
servers/slapd/overlays/rwmmap.c

diff --git a/CHANGES b/CHANGES
index 5c3cad3ddb26e976351424b66fa058fb9060a155..ee915c3f5618a4010d1848e19ce653f76277fba1 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -15,6 +15,7 @@ OpenLDAP 2.3.39 Engineering
        Fixed slapo-pcache and -rwm interaction fix (ITS#4991) 
        Fixed slapo-pcache non-null terminated array crasher (ITS#5163)
        Fixed slapo-rwm modlist handling (ITS#5124)
+       Fixed slapo-rwm UUID in filter (ITS#5168)
        Fixed liblber Windows x64 portability (ITS#5105)
        Fixed libldap ppolicy control creation (ITS#5103)
        Build Environment
index 6b2bf76beface0d086256eeb03d310d7aaf82516..5ca432539c0665182ea6aa5fdb9a121ef8e26516 100644 (file)
@@ -212,6 +212,13 @@ lutil_pair( ber_socket_t sd[2] );
 LDAP_LUTIL_F( size_t )
 lutil_uuidstr( char *buf, size_t len );
 
+LDAP_LUTIL_F( int )
+lutil_uuidstr_from_normalized(
+       char            *uuid,
+       size_t          uuidlen,
+       char            *buf,
+       size_t          buflen );
+
 /* csn.c */
 /* use this macro to allocate buffer for lutil_csnstr */
 #define LDAP_LUTIL_CSNSTR_BUFSIZE      64
index e2bbe74ad6410577e49bc94e2e9e5e956d5c1f3b..61b03b6bce15b43e9a04c008c478854948f79957 100644 (file)
@@ -371,6 +371,47 @@ lutil_uuidstr( char *buf, size_t len )
 #endif
 }
 
+int
+lutil_uuidstr_from_normalized(
+       char            *uuid,
+       size_t          uuidlen,
+       char            *buf,
+       size_t          buflen )
+{
+       unsigned char nibble;
+       int i, d = 0;
+
+       assert( uuid != NULL );
+       assert( buf != NULL );
+
+       if ( uuidlen != 16 ) return -1;
+       if ( buflen < 36 ) return -1;
+
+       for ( i = 0; i < 16; i++ ) {
+               if ( i == 4 || i == 6 || i == 8 || i == 10 ) {
+                       buf[(i<<1)+d] = '-';
+                       d += 1;
+               }
+
+               nibble = (uuid[i] >> 4) & 0xF;
+               if ( nibble < 10 ) {
+                       buf[(i<<1)+d] = nibble + '0';
+               } else {
+                       buf[(i<<1)+d] = nibble - 10 + 'a';
+               }
+
+               nibble = (uuid[i]) & 0xF;
+               if ( nibble < 10 ) {
+                       buf[(i<<1)+d+1] = nibble + '0';
+               } else {
+                       buf[(i<<1)+d+1] = nibble - 10 + 'a';
+               }
+       }
+
+       if ( buflen > 36 ) buf[36] = '\0';
+       return 36;
+}
+
 #ifdef TEST
 int
 main(int argc, char **argv)
index 36d8165ee3dd15ec2d3955fb5b53aaab67dee9b9..e0cc157683f84f0fa7d1455728343b804c99f4c6 100644 (file)
@@ -32,6 +32,7 @@
 
 #include "slap.h"
 #include "rwm.h"
+#include "lutil.h"
 
 #undef ldap_debug      /* silence a warning in ldap-int.h */
 #include "../../../libraries/libldap/ldap-int.h"
@@ -382,6 +383,7 @@ map_attr_value(
 {
        struct berval           vtmp = BER_BVNULL;
        int                     freeval = 0;
+       char                    uuid[ LDAP_LUTIL_UUIDSTR_BUFSIZE ];
        AttributeDescription    *ad = *adp;
        struct ldapmapping      *mapping = NULL;
 
@@ -425,6 +427,14 @@ map_attr_value(
                                return -1;
                        }
 
+               } else if ( ad->ad_type->sat_syntax == slap_schema.si_ad_entryUUID->ad_type->sat_syntax ) {
+                       vtmp.bv_len = lutil_uuidstr_from_normalized( value->bv_val,
+                               value->bv_len, uuid, LDAP_LUTIL_UUIDSTR_BUFSIZE );
+                       if ( vtmp.bv_len < 0 ) {
+                               return -1;
+                       }
+                       vtmp.bv_val = uuid;
+
                } else if ( ad == slap_schema.si_ad_objectClass
                                || ad == slap_schema.si_ad_structuralObjectClass )
                {