bug fixes & upgraded functionality for 2.0 database release, rr-impl@localhost
- Date: Wed, 14 Aug 1996 19:19:06 +0200 (MET DST)
Dear all,
I have fixed a few small bugs.
I also added functionality for automatically adding the current date to
the last 'changed:' attribute field in your update when no date is
present.
Apply the included patches or get a new distribution from:
ftp://ftp.ripe.net/ripe/dbase/software/ripe-dbase-2.0.2.tar.gz
Kind regards,
David K.
---
*** encmp.old Wed Aug 14 17:38:53 1996
--- encmp.pl Wed Aug 14 17:45:34 1996
***************
*** 1,9 ****
# encmp - compare two associative arrays
#
# $RCSfile: encmp.pl,v $
! # $Revision: 2.0 $
# $Author: ripe-dbm $
! # $Date: 1996/08/08 10:47:30 $
#
# This routine takes two objects and compares them case insensitive
# Returns 1 if objects are equal, else returns 0;
--- 1,11 ----
+
# encmp - compare two associative arrays
+ # 'syntax sugar' is removed before comparing!
#
# $RCSfile: encmp.pl,v $
! # $Revision: 2.1 $
# $Author: ripe-dbm $
! # $Date: 1996/08/14 15:45:19 $
#
# This routine takes two objects and compares them case insensitive
# Returns 1 if objects are equal, else returns 0;
***************
*** 88,103 ****
# we do a compare after the syntactic sugar has been removed.
if ($key eq "ae") {
! $a=~ s/(^|\n)exclude\s+(AS\d+)\s+to\s+/$1$2 /g;
! $b=~ s/(^|\n)exclude\s+(AS\d+)\s+to\s+/$1$2 /g;
}
elsif ($key eq "ai") {
! $a=~ s/(^|\n)from\s+(AS\d+\s+\d+)\s+accept\s+/$1$2 /g;
! $b=~ s/(^|\n)from\s+(AS\d+\s+\d+)\s+accept\s+/$1$2 /g;
}
elsif ($key eq "ao") {
! $a=~ s/(^|\n)to\s+(AS\d+)\s+announce\s+/$1$2 /g;
! $b=~ s/(^|\n)to\s+(AS\d+)\s+announce\s+/$1$2 /g;
}
elsif ($key eq "it") {
$a=~ s/(^|\n)from\s+($match)\s+(\(\s*pref[\=\s\S]+\))?accept\s+/$1$2 $3/go;
--- 90,105 ----
# we do a compare after the syntactic sugar has been removed.
if ($key eq "ae") {
! $a=~ s/(^|\n)exclude\s+(as\d+)\s+to\s+/$1$2 /g;
! $b=~ s/(^|\n)exclude\s+(as\d+)\s+to\s+/$1$2 /g;
}
elsif ($key eq "ai") {
! $a=~ s/(^|\n)from\s+(as\d+\s+\d+)\s+accept\s+/$1$2 /g;
! $b=~ s/(^|\n)from\s+(as\d+\s+\d+)\s+accept\s+/$1$2 /g;
}
elsif ($key eq "ao") {
! $a=~ s/(^|\n)to\s+(as\d+)\s+announce\s+/$1$2 /g;
! $b=~ s/(^|\n)to\s+(as\d+)\s+announce\s+/$1$2 /g;
}
elsif ($key eq "it") {
$a=~ s/(^|\n)from\s+($match)\s+(\(\s*pref[\=\s\S]+\))?accept\s+/$1$2 $3/go;
***************
*** 117,119 ****
--- 119,122 ----
}
1;
+
*** syntax.old Wed Aug 14 17:39:05 1996
--- syntax.pl Wed Aug 14 17:45:59 1996
***************
*** 1,8 ****
! #
# $RCSfile: syntax.pl,v $
! # $Revision: 2.2 $
# $Author: ripe-dbm $
! # $Date: 1996/08/09 12:55:04 $
#
# ARGUMENTS: *ASSOC object
# RETURNS: INTEGER object_status
--- 1,8 ----
!
# $RCSfile: syntax.pl,v $
! # $Revision: 2.3 $
# $Author: ripe-dbm $
! # $Date: 1996/08/14 15:45:49 $
#
# ARGUMENTS: *ASSOC object
# RETURNS: INTEGER object_status
***************
*** 311,317 ****
#
}
else {
! if ($itmp=~ /^ac|ah|tc|zc|cy|mb|ml$/) {
local($val, $msg) = &dosyntax($itmp, $object{$itmp}, *object);
# print STDERR "checksyntax - before attr: $itmp rtcode: $rtcode val: $val msg: $msg\n" if ($opt_V);
if (defined($val)) {
--- 311,317 ----
#
}
else {
! if ($itmp=~ /^ac|ah|ch|tc|zc|cy|mb|ml$/) {
local($val, $msg) = &dosyntax($itmp, $object{$itmp}, *object);
# print STDERR "checksyntax - before attr: $itmp rtcode: $rtcode val: $val msg: $msg\n" if ($opt_V);
if (defined($val)) {
***************
*** 711,759 ****
# Try to do something clever with the changed field
#
# ch - changed
#
! if ($key eq "ch") {
! print STDERR "dosyntax - checking ch\n" if $opt_V;
! local($date)="";
! if ($value=~ / /) {
! $value=~ s/ +(\S+)$//;
! $date=$1;
! }
! # print STDERR "*", $date, "*", $value, "\n";
! if (!(&isemail($value))) {
! return $O_ERROR, "syntax error in e-mail part of \"$ATTL{$key}\"";
}
! if (!$date) {
! return $O_ERROR,
! "No date specified in \"$ATTL{$key}\" attribute";
! }
! if ($date!~ /^(\d\d)(\d\d)(\d\d)$/) {
! return $O_ERROR, "date part of \"$ATTL{$key}\" not in YYMMDD format";
! }
! # 1988 is the start of the world. This is where we test for proper
! # date values of YYMMDD
! if (($1 < 88) || ($2 > 12) || ($3 > 31)) {
! return $O_ERROR, "date part of \"$ATTL{$key}\" is not a valid YYMMDD value";
! }
! if ($date>$DATE) {
! $object{$key} =~ s/$date/$DATE/g;
! return $O_WARNING,
! "date in \"$ATTL{$key}\" ($date) is in the ".
! "future - changed to $DATE";
! }
! $object{$key}=~ s/ +/ /g;
- return $O_OK;
-
}
#
--- 711,804 ----
# Try to do something clever with the changed field
#
# ch - changed
+ # wd - withdrawn
#
! if ($key=~ /^ch|wd$/) {
! print STDERR "dosyntax - checking ch,wd ($key)\n" if $opt_V;
! local($returncode)=$O_OK;
! local($date);
! local(@newchanged)=();
! local(@changedvalues)=split(/\n+/, $value);
! #
! # add current date if needed to last specified attribute
! if ($changedvalues[$#changedvalues]!~ / \d{6,6}$/) {
!
! $changedvalues[$#changedvalues].=" ".$DATE;
!
! &addwarning(*object, "added current date to ".$ATTL{$key}." field");
!
! $returncode=$O_WARNING;
!
}
+
+ #
+ # sort values on date
+
+ @changedvalues=sort sortchangedfield @changedvalues;
+
+ #print STDERR join("\n", "values:", @changedvalues);
+
+ foreach $value (@changedvalues) {
+
+ $date="";
+
+ if ($value=~ / /) {
+ $value=~ s/ +(\S+)$//;
+ $date=$1;
+ }
+
+ # print STDERR "*", $date, "*", $value, "\n";
+
+ if (!(&isemail($value))) {
+ return $O_ERROR, "syntax error in e-mail part of \"$ATTL{$key}\"";
+ }
! if (!$date) {
! return $O_ERROR, "No date specified in \"$ATTL{$key}\" attribute";
! }
!
! if ($date=~ /^(\d\d)(\d\d)(\d\d)$/) {
!
! #
! # 1988 is the start of the world. This is where we test for proper
! # date values of YYMMDD
! if ($1<88) {
! return $O_ERROR, "date ($date) part of \"$ATTL{$key}\" is older then the database itself!";
! }
!
! if (($2<1) || ($2>12) || ($3>31) || ($3<1)) {
! return $O_ERROR, "date ($date) part of \"$ATTL{$key}\" is not a valid YYMMDD value";
! }
!
! }
! else {
!
! return $O_ERROR, "date part of \"$ATTL{$key}\" not in YYMMDD format";
! }
!
! if ($date>$DATE) {
!
! &addwarning(*object, "date in \"$ATTL{$key}\" ($date) is in the future - changed to $DATE");
! $date=$DATE;
! $returncode=$O_WARNING;
!
! }
!
! push(@newchanged, $value." ".$date);
! }
!
! $object{$key}=join("\n", @newchanged);
!
! return $returncode;
}
#
***************
*** 1752,1758 ****
#
# check if the ID is not already used
! return $O_ERROR, "error in \"$ATTL{$key}\", auto NIC handle assignment\nidentification code ($1.$2) already used in other object" if ($NICID{$object{"so"}, $1.$2});
#
# find initials if not already specified
--- 1797,1803 ----
#
# check if the ID is not already used
! return $O_ERROR, "error in \"$ATTL{$key}\", auto NIC handle assignment\nidentification code ($1.$2) already used in other object" if ($NICID{$object{"so"}, $prefix});
#
# find initials if not already specified
***************
*** 1768,1776 ****
$object{$key}=$prefix.$initials;
$prefix=~ /\-(\d+)$/;
- $NICID{$object{"so"}, $1}=1;
return $O_OK;
}
--- 1813,1827 ----
$object{$key}=$prefix.$initials;
+ #
+ # check if the ID is not already used
+
$prefix=~ /\-(\d+)$/;
+ return $O_ERROR, "error in \"$ATTL{$key}\", auto NIC handle assignment identification code ($1) already used in other object\nplease use another number then $1" if ($NICID{$object{"so"}, $prefix});
+
+ $NICID{$object{"so"}, $prefix}=1;
+
return $O_OK;
}
***************
*** 2170,2204 ****
return $O_OK;
}
-
- #
- # wd - withdrawn
- #
- if ($key eq "wd") {
-
- print STDERR "dosyntax - checking wd ($key)\n" if $opt_V;
-
- if ($value !~ /^(\d\d)(\d\d)(\d\d)$/) {
- return $O_ERROR,
- "date part of \"$ATTL{$key}\" not in YYMMDD format";
- }
-
- # 1988 is the start of the world. This is where we test for proper
- # date values of YYMMDD
-
- if (($1 < 88) || ($2 > 12) || ($3 > 31)) {
- return $O_ERROR,
- "date part of \"$ATTL{$key}\" is not a valid YYMMDD value";
- }
-
- if ($value gt $DATE) {
- return $O_ERROR,
- "date in \"$ATTL{$key}\" ($1$2$3) is in the future";
- }
-
- return $O_OK;
- }
-
#
# These are not checked and not used, just in here for clarity
#
--- 2221,2226 ----
*** misc.old Wed Aug 14 17:38:41 1996
--- misc.pl Wed Aug 14 17:46:14 1996
***************
*** 2,13 ****
# misc - miscellaneaous functions
#
# $RCSfile: misc.pl,v $
! # $Revision: 2.0 $
# $Author: ripe-dbm $
! # $Date: 1996/08/08 10:47:30 $
#
require "defines.pl";
sub ReplaceGlobalVars {
local(*text)=@localhost
--- 2,45 ----
# misc - miscellaneaous functions
#
# $RCSfile: misc.pl,v $
! # $Revision: 2.1 $
# $Author: ripe-dbm $
! # $Date: 1996/08/14 15:46:06 $
#
require "defines.pl";
+
+ sub sortchangedfield {
+
+ $a=~ /(\d{6,6})$/;
+ local($date1)=$1;
+
+ $b=~ /(\d{6,6})$/;
+
+ # print STDERR "-$a-$b-$date1-$1-\n";
+
+ if ((!$date1) && (!$1)) {
+
+ return 0;
+
+ }
+ elsif (!$date1) {
+
+ return -1;
+
+ }
+ elsif (!$1) {
+
+ return 1;
+
+ }
+ else {
+
+ return $date1 <=> $1;
+
+ }
+
+ }
sub ReplaceGlobalVars {
local(*text)=@localhost
|