]> git.sur5r.net Git - openldap/commitdiff
allow pretty time form in quarantine string
authorPierangelo Masarati <ando@openldap.org>
Mon, 29 May 2006 23:36:12 +0000 (23:36 +0000)
committerPierangelo Masarati <ando@openldap.org>
Mon, 29 May 2006 23:36:12 +0000 (23:36 +0000)
servers/slapd/back-ldap/config.c

index d0ebdaa530b7401d2c2b1b06b621f95be85fda6d..4088a982f21627b99bc5cf32cdd1a5a640cc1c19 100644 (file)
@@ -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 ) {