#include <stdio.h>
#include <ac/time.h>
-int
+size_t
lutil_csnstr(char *buf, size_t len, unsigned int replica, unsigned int mod)
{
static time_t csntime;
ltm->tm_year + 1900, ltm->tm_mon, ltm->tm_mday, ltm->tm_hour,
ltm->tm_min, ltm->tm_sec, op, replica, mod );
- return ( n < len ) ? 1 : 0;
+ return ( n < len ) ? n : 0;
}
#ifdef TEST
uuid_t uu = {0};
unsigned rc;
char *s;
+ size_t l;
uuid_create( &uu, &rc );
if ( rc != uuid_s_ok ) {
if ( rc != uuid_s_ok ) {
return 0;
}
- if ( strlen( s ) >= len ) {
+
+ l = strlen( s );
+ if ( l >= len ) {
free( s );
return 0;
}
- strncpy( buf, s, len );
+ strncpy( buf, s, l );
free( s );
- return 1;
+ return l;
#else
struct timeval tv;
(unsigned) nl[2], (unsigned) nl[3],
(unsigned) nl[4], (unsigned) nl[5] );
- return (t1 < len) ? 1 : 0;
+ return (t1 < len) ? t1 : 0;
#endif
}
Modifications **modtail,
const char **text )
{
- struct berval name, timestamp;
+ struct berval name, timestamp, csn;
time_t now = slap_get_time();
char timebuf[22];
+ char csnbuf[128];
struct tm *ltm;
Modifications *mod;
ldap_pvt_thread_mutex_lock( &gmtime_mutex );
ltm = gmtime( &now );
strftime( timebuf, sizeof(timebuf), "%Y%m%d%H%M%SZ", ltm );
+
+ csn.bv_len = lutil_csnstr( csnbuf, sizeof( csnbuf ), 0, 0 );
ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
+ csn.bv_val = csnbuf;
+
timestamp.bv_val = timebuf;
timestamp.bv_len = strlen(timebuf);
}
if( op->o_tag == LDAP_REQ_ADD ) {
+ struct berval uuid;
+ char uuidbuf[64];
+
+ uuid.bv_len = lutil_uuidstr( uuidbuf, sizeof( uuidbuf ) );
+ uuid.bv_val = uuidbuf;
+
+ mod = (Modifications *) ch_calloc( 1, sizeof( Modifications ) );
+ mod->sml_op = mop;
+ mod->sml_desc = slap_schema.si_ad_entryUUID;
+ mod->sml_bvalues = (struct berval **) malloc( 2 * sizeof( struct berval * ) );
+ mod->sml_bvalues[0] = ber_bvdup( &uuid );
+ mod->sml_bvalues[1] = NULL;
+ assert( mod->sml_bvalues[0] );
+ *modtail = mod;
+ modtail = &mod->sml_next;
+
mod = (Modifications *) ch_calloc( 1, sizeof( Modifications ) );
mod->sml_op = mop;
mod->sml_desc = slap_schema.si_ad_creatorsName;
modtail = &mod->sml_next;
}
+ mod = (Modifications *) ch_calloc( 1, sizeof( Modifications ) );
+ mod->sml_op = mop;
+ mod->sml_desc = slap_schema.si_ad_entryCSN;
+ mod->sml_bvalues = (struct berval **) malloc( 2 * sizeof(struct berval *) );
+ mod->sml_bvalues[0] = ber_bvdup( &csn );
+ mod->sml_bvalues[1] = NULL;
+ assert( mod->sml_bvalues[0] );
+ *modtail = mod;
+ modtail = &mod->sml_next;
+
mod = (Modifications *) ch_calloc( 1, sizeof( Modifications ) );
mod->sml_op = mop;
mod->sml_desc = slap_schema.si_ad_modifiersName;
- mod->sml_bvalues = (struct berval **) malloc( 2 * sizeof( struct berval * ) );
+ mod->sml_bvalues = (struct berval **) malloc( 2 * sizeof(struct berval *) );
mod->sml_bvalues[0] = ber_bvdup( &name );
mod->sml_bvalues[1] = NULL;
assert( mod->sml_bvalues[0] );
mod = (Modifications *) ch_calloc( 1, sizeof( Modifications ) );
mod->sml_op = mop;
mod->sml_desc = slap_schema.si_ad_modifyTimestamp;
- mod->sml_bvalues = (struct berval **) malloc( 2 * sizeof( struct berval * ) );
+ mod->sml_bvalues = (struct berval **) malloc( 2 * sizeof(struct berval *) );
mod->sml_bvalues[0] = ber_bvdup( ×tamp );
mod->sml_bvalues[1] = NULL;
assert( mod->sml_bvalues[0] );
MAY authPassword
AUXILIARY )
+#
+# LDUP/LCUP attributes
+# Experimental!
+#
+attributetype ( 1.3.6.1.4.1.4203.666.1.6 NAME 'entryUUID'
+ DESC 'LCUP/LDUP: universally unique identifier'
+ EQUALITY octetStringMatch
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.40{64}
+ SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )
+
+attributetype ( 1.3.6.1.4.1.4203.666.1.7 NAME 'entryCSN'
+ DESC 'LCUP/LDUP: change sequence number'
+ EQUALITY octetStringMatch
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.40{64}
+ SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )
+
#
# OpenLDAP specific schema items
#
offsetof(struct slap_internal_schema, si_ad_structuralObjectClass) },
/* user entry operational attributes */
+ { "entryUUID", NULL, NULL, NULL,
+ offsetof(struct slap_internal_schema, si_ad_entryUUID) },
+ { "entryCSN", NULL, NULL, NULL,
+ offsetof(struct slap_internal_schema, si_ad_entryCSN) },
{ "creatorsName", NULL, NULL, NULL,
offsetof(struct slap_internal_schema, si_ad_creatorsName) },
{ "createTimestamp", NULL, NULL, NULL,
/* operational attribute descriptions */
AttributeDescription *si_ad_structuralObjectClass;
+ AttributeDescription *si_ad_entryUUID;
+ AttributeDescription *si_ad_entryCSN;
AttributeDescription *si_ad_creatorsName;
AttributeDescription *si_ad_createTimestamp;
AttributeDescription *si_ad_modifiersName;
struct berval *ma_value; /* required */
} MatchingRuleAssertion;
-
/*
* represents a search filter
*/
#define SLAPD_FILTER_DN_ONE ((ber_tag_t) -2)
#define SLAPD_FILTER_DN_SUBTREE ((ber_tag_t) -3)
-
union f_un_u {
/* precomputed result */
ber_int_t f_un_result;