summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbustico2008-02-14 16:09:21 +0000
committerbustico2008-02-14 16:09:21 +0000
commit32487942418408309d991722bc5f1ee20a6fdf01 (patch)
treed863b975eba2c1480ab8bf74a8e1b4fc0e7f1c5c
parent6d04e813f3a5f3073a952b692961fd27337175cb (diff)
downloadivy-perl-32487942418408309d991722bc5f1ee20a6fdf01.zip
ivy-perl-32487942418408309d991722bc5f1ee20a6fdf01.tar.gz
ivy-perl-32487942418408309d991722bc5f1ee20a6fdf01.tar.bz2
ivy-perl-32487942418408309d991722bc5f1ee20a6fdf01.tar.xz
ivy-perl (4.25-5) unstable; urgency=low
* New upstream version: * verify validity callback arg in bindRegexp instead of verifiying it whell actually calling the callback -- Alexandre Bustico <bustico@cena.fr> Wed, 14 Fev 2008 16:43:00 +0200
-rw-r--r--Ivy.pm21
-rw-r--r--debian/changelog7
2 files changed, 24 insertions, 4 deletions
diff --git a/Ivy.pm b/Ivy.pm
index 7d96e63..60efc5c 100644
--- a/Ivy.pm
+++ b/Ivy.pm
@@ -881,6 +881,16 @@ sub bindRegexp ($$$;$$)
# on rajoute le couple $regexp, $cb dans la liste des messages
# qu'on prend
+ # on teste la validité de l'argument
+ if (ref ($cb) ne 'ARRAY') {
+ carp ("Warning binRegexp on $regexp :\nargument 3 (callback) is not correct and will be ignored\n");
+ return ();
+ }
+ if (ref ($cb->[0]) ne 'CODE') {
+ carp ("Warning binRegexp on $regexp :\nargument 3 (callback) is not correct and will be ignored\n");
+ return ();
+ }
+
# on commence par tester si on a un id libere dans le tableau
for ($id=0; $id <= ($#{$self->[recCbList]}+1); $id++) {
last unless (defined $self->[recCbList][$id]) && @{$self->[recCbList][$id]->[1]};
@@ -891,7 +901,6 @@ sub bindRegexp ($$$;$$)
_sendLastRegexpToAllreadyConnected ($self, $id) ;
}
else {
-
# on vire le callback, et on se desabonne de cette regexp
for (my $id=0; $id <= $#{$self->[recCbList]}; $id++) {
@@ -1519,10 +1528,14 @@ sub _getMessages ($$)
# on recupere le couple call back, regexp correspondant
# a l'identifiant et on appelle la fonction avec les parametres
# traites par la regexp
- if (ref ($self->[recCbList][$id]) eq 'ARRAY') {
- my @cb = @{$self->[recCbList][$id]->[1]};
- my $cb = shift @cb;
+# if ((ref ($self->[recCbList][$id]) eq 'ARRAY') &&
+# (my @cb = @{$self->[recCbList][$id]->[1]})) {
+
+
+ if (my @cb = @{$self->[recCbList][$id]->[1]}) {
+ my $cb = shift @cb;
+
# cleaning $sendername with previous \004 used for connection status
# bindRegexp avancé : on envoie une liste nom adresse port au lieu du nom
$senderName = [$senderName, _getHostByAddr ($addr), $peerPort]
diff --git a/debian/changelog b/debian/changelog
index 3de3cf6..503fb3b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+ivy-perl (4.25-5) unstable; urgency=low
+
+ * New upstream version: * verify validity callback arg in bindRegexp
+ instead of verifiying it whell actually calling the callback
+
+ -- Alexandre Bustico <bustico@cena.fr> Wed, 14 Fev 2008 16:43:00 +0200
+
ivy-perl (4.25-4) unstable; urgency=low
* New upstream version: * verify validity of data structure before using it