]> git.sur5r.net Git - openldap/commitdiff
silence warnings; misc cleanup; test refresh as non-allowed user
authorPierangelo Masarati <ando@openldap.org>
Mon, 3 Aug 2009 22:49:30 +0000 (22:49 +0000)
committerPierangelo Masarati <ando@openldap.org>
Mon, 3 Aug 2009 22:49:30 +0000 (22:49 +0000)
servers/slapd/overlays/dds.c
tests/scripts/test046-dds

index fda9d70edb4dc4a7a38727bb6713b357a95a55af..a6c8db976d08b27a45c34c41c2b971308b60254c 100644 (file)
@@ -581,7 +581,8 @@ dds_op_modify( Operation *op, SlapReply *rs )
                        }
 
                } else if ( mod->sml_desc == slap_schema.si_ad_entryTtl ) {
-                       unsigned long   ttl;
+                       unsigned long   uttl;
+                       time_t          ttl;
                        int             rc;
 
                        switch ( mod->sml_op ) {
@@ -628,7 +629,8 @@ dds_op_modify( Operation *op, SlapReply *rs )
                                        goto done;
                                }
 
-                               rc = lutil_atoul( &ttl, mod->sml_values[ 0 ].bv_val );
+                               rc = lutil_atoul( &uttl, mod->sml_values[ 0 ].bv_val );
+                               ttl = (time_t)uttl;
                                assert( rc == 0 );
                                if ( ttl > DDS_RF2589_MAX_TTL ) {
                                        rs->sr_err = LDAP_PROTOCOL_ERROR;
@@ -645,7 +647,7 @@ dds_op_modify( Operation *op, SlapReply *rs )
                                        goto done;
                                }
 
-                               entryTtl = (time_t)ttl;
+                               entryTtl = ttl;
                                bv_entryTtl.bv_len = mod->sml_values[ 0 ].bv_len;
                                AC_MEMCPY( bv_entryTtl.bv_val, mod->sml_values[ 0 ].bv_val, bv_entryTtl.bv_len );
                                bv_entryTtl.bv_val[ bv_entryTtl.bv_len ] = '\0';
@@ -1120,26 +1122,24 @@ dds_op_extended( Operation *op, SlapReply *rs )
                        BerElementBuffer        berbuf;
                        BerElement              *ber = (BerElement *)&berbuf;
 
-                       if ( rs->sr_err == LDAP_SUCCESS ) {
-                               ber_init_w_nullc( ber, LBER_USE_DER );
-
-                               rc = ber_printf( ber, "{tiN}", LDAP_TAG_EXOP_REFRESH_RES_TTL, (int)ttl );
+                       ber_init_w_nullc( ber, LBER_USE_DER );
 
-                               if ( rc < 0 ) {
-                                       rs->sr_err = LDAP_OTHER;
-                                       rs->sr_text = "internal error";
+                       rc = ber_printf( ber, "{tiN}", LDAP_TAG_EXOP_REFRESH_RES_TTL, (int)ttl );
 
-                               } else {
-                                       (void)ber_flatten( ber, &rs->sr_rspdata );
-                                       rs->sr_rspoid = ch_strdup( slap_EXOP_REFRESH.bv_val );
+                       if ( rc < 0 ) {
+                               rs->sr_err = LDAP_OTHER;
+                               rs->sr_text = "internal error";
 
-                                       Log3( LDAP_DEBUG_TRACE, LDAP_LEVEL_INFO,
-                                               "%s REFRESH dn=\"%s\" TTL=%ld\n",
-                                               op->o_log_prefix, op->o_req_ndn.bv_val, ttl );
-                               }
+                       } else {
+                               (void)ber_flatten( ber, &rs->sr_rspdata );
+                               rs->sr_rspoid = ch_strdup( slap_EXOP_REFRESH.bv_val );
 
-                               ber_free_buf( ber );
+                               Log3( LDAP_DEBUG_TRACE, LDAP_LEVEL_INFO,
+                                       "%s REFRESH dn=\"%s\" TTL=%ld\n",
+                                       op->o_log_prefix, op->o_req_ndn.bv_val, ttl );
                        }
+
+                       ber_free_buf( ber );
                }
 
                return rs->sr_err;
@@ -1390,7 +1390,7 @@ dds_cfgen( ConfigArgs *c )
 
                if ( t < DDS_RF2589_DEFAULT_TTL || t > DDS_RF2589_MAX_TTL ) {
                        snprintf( c->cr_msg, sizeof( c->cr_msg ),
-                               "DDS invalid dds-max-ttl=%ld; must be between %d and %d",
+                               "DDS invalid dds-max-ttl=%lu; must be between %d and %d",
                                t, DDS_RF2589_DEFAULT_TTL, DDS_RF2589_MAX_TTL );
                        Log2( LDAP_DEBUG_ANY, LDAP_LEVEL_ERR,
                                "%s: %s.\n", c->log, c->cr_msg );
@@ -1410,9 +1410,9 @@ dds_cfgen( ConfigArgs *c )
                        return 1;
                }
 
-               if ( t < 0 || t > DDS_RF2589_MAX_TTL ) {
+               if ( t > DDS_RF2589_MAX_TTL ) {
                        snprintf( c->cr_msg, sizeof( c->cr_msg ),
-                               "DDS invalid dds-min-ttl=%ld",
+                               "DDS invalid dds-min-ttl=%lu",
                                t );
                        Log2( LDAP_DEBUG_ANY, LDAP_LEVEL_ERR,
                                "%s: %s.\n", c->log, c->cr_msg );
@@ -1437,9 +1437,9 @@ dds_cfgen( ConfigArgs *c )
                        return 1;
                }
 
-               if ( t < 0 || t > DDS_RF2589_MAX_TTL ) {
+               if ( t > DDS_RF2589_MAX_TTL ) {
                        snprintf( c->cr_msg, sizeof( c->cr_msg ),
-                               "DDS invalid dds-default-ttl=%ld",
+                               "DDS invalid dds-default-ttl=%lu",
                                t );
                        Log2( LDAP_DEBUG_ANY, LDAP_LEVEL_ERR,
                                "%s: %s.\n", c->log, c->cr_msg );
@@ -1466,7 +1466,7 @@ dds_cfgen( ConfigArgs *c )
 
                if ( t <= 0 ) {
                        snprintf( c->cr_msg, sizeof( c->cr_msg ),
-                               "DDS invalid dds-interval=%ld",
+                               "DDS invalid dds-interval=%lu",
                                t );
                        Log2( LDAP_DEBUG_ANY, LDAP_LEVEL_ERR,
                                "%s: %s.\n", c->log, c->cr_msg );
@@ -1501,9 +1501,9 @@ dds_cfgen( ConfigArgs *c )
                        return 1;
                }
 
-               if ( t < 0 || t > DDS_RF2589_MAX_TTL ) {
+               if ( t > DDS_RF2589_MAX_TTL ) {
                        snprintf( c->cr_msg, sizeof( c->cr_msg ),
-                               "DDS invalid dds-tolerance=%ld",
+                               "DDS invalid dds-tolerance=%lu",
                                t );
                        Log2( LDAP_DEBUG_ANY, LDAP_LEVEL_ERR,
                                "%s: %s.\n", c->log, c->cr_msg );
index 3a4c90226285e7df5c939cf2976125dc30eeace2..bd74150fd08a71d7daaf8492d35818122c2f01ae 100755 (executable)
@@ -396,7 +396,7 @@ member: $BJORNSDN
 dn: $MEETINGDN
 changetype: modify
 add: member
-member: $JAJDN
+member: $JOHNDDN
 EOMODS
 RC=$?
 if test $RC != 0 ; then
@@ -478,6 +478,17 @@ if test $RC = 0 ; then
        exit $RC
 fi
 
+echo "Trying to refresh the meeting as $JAJDN (should fail)..."
+$LDAPEXOP -D "$JAJDN" -w "jaj" -h $LOCALHOST -p $PORT1 \
+       "refresh" "$MEETINGDN" "240" \
+       >> $TESTOUT 2>&1
+RC=$?
+if test $RC = 0 ; then
+       echo "ldapexop should have failed ($RC)!"
+       test $KILLSERVERS != no && kill -HUP $KILLPIDS
+       exit $RC
+fi
+
 echo "Trying to delete the meeting as $BABSDN (should fail)..."
 $LDAPMODIFY -D "$BABSDN" -w bjensen -h $LOCALHOST -p $PORT1 \
        >> $TESTOUT 2>&1 << EOMODS