From 5854464be27b1d76b0b59d5e810cd4ff2676fc97 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Mon, 29 May 2006 23:36:12 +0000 Subject: [PATCH] allow pretty time form in quarantine string --- servers/slapd/back-ldap/config.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/servers/slapd/back-ldap/config.c b/servers/slapd/back-ldap/config.c index d0ebdaa530..4088a982f2 100644 --- a/servers/slapd/back-ldap/config.c +++ b/servers/slapd/back-ldap/config.c @@ -382,7 +382,8 @@ slap_retry_info_parse( ri->ri_num = ch_calloc( sizeof( int ), i + 1 ); for ( i = 0; retrylist[ i ] != NULL; i++ ) { - char *sep = strchr( retrylist[ i ], ',' ); + unsigned long t; + char *sep = strchr( retrylist[ i ], ',' ); if ( sep == NULL ) { snprintf( buf, buflen, @@ -394,13 +395,14 @@ slap_retry_info_parse( *sep++ = '\0'; - if ( lutil_atol( &ri->ri_interval[ i ], retrylist[ i ] ) ) { + if ( lutil_parse_time( retrylist[ i ], &t ) ) { snprintf( buf, buflen, "unable to parse interval #%d \"%s\"", i, retrylist[ i ] ); rc = 1; goto done; } + ri->ri_interval[ i ] = (time_t)t; if ( strcmp( sep, "+" ) == 0 ) { if ( retrylist[ i + 1 ] != NULL ) { @@ -463,10 +465,15 @@ slap_retry_info_unparse( *ptr++ = ';'; } - ptr += snprintf( ptr, WHATSLEFT, "%ld,", (long)ri->ri_interval[i] ); - if ( WHATSLEFT <= 0 ) { + if ( lutil_unparse_time( ptr, WHATSLEFT, (long)ri->ri_interval[i] ) ) { + return 1; + } + ptr += strlen( ptr ); + + if ( WHATSLEFT <= 1 ) { return 1; } + *ptr++ = ','; if ( ri->ri_num[i] == SLAP_RETRYNUM_FOREVER ) { if ( WHATSLEFT <= 1 ) { -- 2.39.5