~ubuntu-branches/ubuntu/maverick/openldap/maverick-proposed

« back to all changes in this revision

Viewing changes to servers/slapd/overlays/dds.c

  • Committer: Bazaar Package Importer
  • Author(s): Mathias Gug
  • Date: 2009-09-07 13:41:10 UTC
  • mto: This revision was merged to the branch mainline in revision 19.
  • Revision ID: james.westby@ubuntu.com-20090907134110-jsdrvn0atu1fex4m
Tags: upstream-2.4.18
ImportĀ upstreamĀ versionĀ 2.4.18

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $OpenLDAP: pkg/ldap/servers/slapd/overlays/dds.c,v 1.7.2.12 2009/06/11 18:21:52 quanah Exp $ */
 
1
/* $OpenLDAP: pkg/ldap/servers/slapd/overlays/dds.c,v 1.7.2.13 2009/08/13 00:47:41 quanah Exp $ */
2
2
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
3
3
 *
4
4
 * Copyright 2005-2009 The OpenLDAP Foundation.
581
581
                        }
582
582
 
583
583
                } else if ( mod->sml_desc == slap_schema.si_ad_entryTtl ) {
584
 
                        unsigned long   ttl;
 
584
                        unsigned long   uttl;
 
585
                        time_t          ttl;
585
586
                        int             rc;
586
587
 
587
588
                        switch ( mod->sml_op ) {
628
629
                                        goto done;
629
630
                                }
630
631
 
631
 
                                rc = lutil_atoul( &ttl, mod->sml_values[ 0 ].bv_val );
 
632
                                rc = lutil_atoul( &uttl, mod->sml_values[ 0 ].bv_val );
 
633
                                ttl = (time_t)uttl;
632
634
                                assert( rc == 0 );
633
635
                                if ( ttl > DDS_RF2589_MAX_TTL ) {
634
636
                                        rs->sr_err = LDAP_PROTOCOL_ERROR;
645
647
                                        goto done;
646
648
                                }
647
649
 
648
 
                                entryTtl = (time_t)ttl;
 
650
                                entryTtl = ttl;
649
651
                                bv_entryTtl.bv_len = mod->sml_values[ 0 ].bv_len;
650
652
                                AC_MEMCPY( bv_entryTtl.bv_val, mod->sml_values[ 0 ].bv_val, bv_entryTtl.bv_len );
651
653
                                bv_entryTtl.bv_val[ bv_entryTtl.bv_len ] = '\0';
1120
1122
                        BerElementBuffer        berbuf;
1121
1123
                        BerElement              *ber = (BerElement *)&berbuf;
1122
1124
 
1123
 
                        if ( rs->sr_err == LDAP_SUCCESS ) {
1124
 
                                ber_init_w_nullc( ber, LBER_USE_DER );
1125
 
 
1126
 
                                rc = ber_printf( ber, "{tiN}", LDAP_TAG_EXOP_REFRESH_RES_TTL, (int)ttl );
1127
 
 
1128
 
                                if ( rc < 0 ) {
1129
 
                                        rs->sr_err = LDAP_OTHER;
1130
 
                                        rs->sr_text = "internal error";
1131
 
 
1132
 
                                } else {
1133
 
                                        (void)ber_flatten( ber, &rs->sr_rspdata );
1134
 
                                        rs->sr_rspoid = ch_strdup( slap_EXOP_REFRESH.bv_val );
1135
 
 
1136
 
                                        Log3( LDAP_DEBUG_TRACE, LDAP_LEVEL_INFO,
1137
 
                                                "%s REFRESH dn=\"%s\" TTL=%ld\n",
1138
 
                                                op->o_log_prefix, op->o_req_ndn.bv_val, ttl );
1139
 
                                }
1140
 
 
1141
 
                                ber_free_buf( ber );
 
1125
                        ber_init_w_nullc( ber, LBER_USE_DER );
 
1126
 
 
1127
                        rc = ber_printf( ber, "{tiN}", LDAP_TAG_EXOP_REFRESH_RES_TTL, (int)ttl );
 
1128
 
 
1129
                        if ( rc < 0 ) {
 
1130
                                rs->sr_err = LDAP_OTHER;
 
1131
                                rs->sr_text = "internal error";
 
1132
 
 
1133
                        } else {
 
1134
                                (void)ber_flatten( ber, &rs->sr_rspdata );
 
1135
                                rs->sr_rspoid = ch_strdup( slap_EXOP_REFRESH.bv_val );
 
1136
 
 
1137
                                Log3( LDAP_DEBUG_TRACE, LDAP_LEVEL_INFO,
 
1138
                                        "%s REFRESH dn=\"%s\" TTL=%ld\n",
 
1139
                                        op->o_log_prefix, op->o_req_ndn.bv_val, ttl );
1142
1140
                        }
 
1141
 
 
1142
                        ber_free_buf( ber );
1143
1143
                }
1144
1144
 
1145
1145
                return rs->sr_err;
1390
1390
 
1391
1391
                if ( t < DDS_RF2589_DEFAULT_TTL || t > DDS_RF2589_MAX_TTL ) {
1392
1392
                        snprintf( c->cr_msg, sizeof( c->cr_msg ),
1393
 
                                "DDS invalid dds-max-ttl=%ld; must be between %d and %d",
 
1393
                                "DDS invalid dds-max-ttl=%lu; must be between %d and %d",
1394
1394
                                t, DDS_RF2589_DEFAULT_TTL, DDS_RF2589_MAX_TTL );
1395
1395
                        Log2( LDAP_DEBUG_ANY, LDAP_LEVEL_ERR,
1396
1396
                                "%s: %s.\n", c->log, c->cr_msg );
1410
1410
                        return 1;
1411
1411
                }
1412
1412
 
1413
 
                if ( t < 0 || t > DDS_RF2589_MAX_TTL ) {
 
1413
                if ( t > DDS_RF2589_MAX_TTL ) {
1414
1414
                        snprintf( c->cr_msg, sizeof( c->cr_msg ),
1415
 
                                "DDS invalid dds-min-ttl=%ld",
 
1415
                                "DDS invalid dds-min-ttl=%lu",
1416
1416
                                t );
1417
1417
                        Log2( LDAP_DEBUG_ANY, LDAP_LEVEL_ERR,
1418
1418
                                "%s: %s.\n", c->log, c->cr_msg );
1437
1437
                        return 1;
1438
1438
                }
1439
1439
 
1440
 
                if ( t < 0 || t > DDS_RF2589_MAX_TTL ) {
 
1440
                if ( t > DDS_RF2589_MAX_TTL ) {
1441
1441
                        snprintf( c->cr_msg, sizeof( c->cr_msg ),
1442
 
                                "DDS invalid dds-default-ttl=%ld",
 
1442
                                "DDS invalid dds-default-ttl=%lu",
1443
1443
                                t );
1444
1444
                        Log2( LDAP_DEBUG_ANY, LDAP_LEVEL_ERR,
1445
1445
                                "%s: %s.\n", c->log, c->cr_msg );
1466
1466
 
1467
1467
                if ( t <= 0 ) {
1468
1468
                        snprintf( c->cr_msg, sizeof( c->cr_msg ),
1469
 
                                "DDS invalid dds-interval=%ld",
 
1469
                                "DDS invalid dds-interval=%lu",
1470
1470
                                t );
1471
1471
                        Log2( LDAP_DEBUG_ANY, LDAP_LEVEL_ERR,
1472
1472
                                "%s: %s.\n", c->log, c->cr_msg );
1501
1501
                        return 1;
1502
1502
                }
1503
1503
 
1504
 
                if ( t < 0 || t > DDS_RF2589_MAX_TTL ) {
 
1504
                if ( t > DDS_RF2589_MAX_TTL ) {
1505
1505
                        snprintf( c->cr_msg, sizeof( c->cr_msg ),
1506
 
                                "DDS invalid dds-tolerance=%ld",
 
1506
                                "DDS invalid dds-tolerance=%lu",
1507
1507
                                t );
1508
1508
                        Log2( LDAP_DEBUG_ANY, LDAP_LEVEL_ERR,
1509
1509
                                "%s: %s.\n", c->log, c->cr_msg );