[Bps-public-commit] djabberd branch, master, updated. 68d1b031df9d004869808d85b3e5825ede737d5a

Alex Vandiver alexmv at bestpractical.com
Wed Sep 8 12:19:25 EDT 2010


The branch, master has been updated
       via  68d1b031df9d004869808d85b3e5825ede737d5a (commit)
       via  dadcef6715900d8583430165bc9fe479bf235921 (commit)
       via  d6772d6480d5312af9b2367f66d478ad4966306d (commit)
       via  992449ce1155f917e63867dbe709d7346f587e29 (commit)
       via  b1cd8c279cfe6ef82b8830286dcd696f02232747 (commit)
       via  e036ba041fd0d5ceec73a4086e2c718ccd692c50 (commit)
       via  acb8bd6fd1c30034046a2354abb7b3bfabe3ece7 (commit)
       via  c5578e48de4b4c8c73b998f5f19f6567156cd674 (commit)
       via  e353bc52d2e96daee8316141db362b162558f240 (commit)
       via  16602df38328b33ac89ddddea44d24a282b33481 (commit)
       via  8bcf8b63f59a283623dc47ee4a6fbb5cc64359b0 (commit)
       via  e5fe7344bfadac4f03ab65aab508b59d73ef02d0 (commit)
       via  2e3d51369f74f09693a8b9635a171d924ae4354d (commit)
       via  40c9567ca706177d99a36e75bcb2c9a1b5b685af (commit)
       via  52e5f1b1e647f7dbca7fc6514a2e062b26c2b1d8 (commit)
       via  9d7420b617985985d90a48aa100c8f4fbabdd51a (commit)
       via  2a64f01d933438b8d6241b93db4e657292700c47 (commit)
       via  411e716562c54f48336b3cd6c18a62ca118820fc (commit)
       via  71eb7f6d58acace427e13b756ce716b71c775142 (commit)
       via  8d3bf275ec142dc8c9f251fe72e861ffa3dc1390 (commit)
      from  4bc24fc6db831e108e89d39b95eab79004db484e (commit)

Summary of changes:
 CHANGES                    |   10 +++
 README                     |   11 +--
 lib/DJabberd.pm            |    5 +
 lib/DJabberd/Config.pod    |   11 +++
 lib/DJabberd/DNS.pm        |  183 +++++++++++++++++++++++++++++---------------
 lib/DJabberd/SAXHandler.pm |    4 +-
 lib/DJabberd/XMLElement.pm |   99 +++++++++++++++++++-----
 t/features-hook.t          |   14 ++--
 t/handle-stanza-hook.t     |    2 +-
 t/lib/djabberd-test.pl     |   29 +++++--
 t/sasl-login.t             |    5 +-
 t/xmlnamespace.t           |   28 +++++++
 12 files changed, 295 insertions(+), 106 deletions(-)
 create mode 100644 t/xmlnamespace.t

- Log -----------------------------------------------------------------
commit 52e5f1b1e647f7dbca7fc6514a2e062b26c2b1d8
Author: Yann Kerherve <yann at cyberion.net>
Date:   Tue Jun 1 11:36:58 2010 -0700

    Actually Authen::SASL 2.14 is required
    
    Issue #1

diff --git a/t/features-hook.t b/t/features-hook.t
index 18f2f62..72a8975 100644
--- a/t/features-hook.t
+++ b/t/features-hook.t
@@ -5,7 +5,7 @@ use lib 't/lib';
 require 'djabberd-test.pl';
 
 my $HAS_SASL;
-eval "use Authen::SASL 2.13";
+eval "use Authen::SASL 2.1402";
 $HAS_SASL = 1 unless $@;
 
 sub connect_and_get_features{
diff --git a/t/lib/djabberd-test.pl b/t/lib/djabberd-test.pl
index 8265789..9615090 100644
--- a/t/lib/djabberd-test.pl
+++ b/t/lib/djabberd-test.pl
@@ -13,7 +13,7 @@ use DJabberd::Util;
 use IO::Socket::UNIX;
 
 my $HAS_SASL;
-eval "use Authen::SASL 2.13";
+eval "use Authen::SASL 2.1402";
 unless ($@) {
     require DJabberd::SASL::AuthenSASL;
     $HAS_SASL = 1;
diff --git a/t/sasl-login.t b/t/sasl-login.t
index c0b091c..a0b32e6 100644
--- a/t/sasl-login.t
+++ b/t/sasl-login.t
@@ -7,9 +7,9 @@ use lib 't/lib';
 require 'djabberd-test.pl';
 
 BEGIN {
-    eval "use Authen::SASL 2.13";
+    eval "use Authen::SASL 2.1402";
     if ($@) {
-        plan skip_all => 'Tests require Authen::SASL 2.13+';
+        plan skip_all => 'Tests require Authen::SASL 2.1402+';
     }
     else {
         plan tests => 46;

commit 40c9567ca706177d99a36e75bcb2c9a1b5b685af
Author: Yann Kerherve <yann at cyberion.net>
Date:   Tue Jun 1 12:05:50 2010 -0700

    better debugging message

diff --git a/t/lib/djabberd-test.pl b/t/lib/djabberd-test.pl
index 9615090..e3da16a 100644
--- a/t/lib/djabberd-test.pl
+++ b/t/lib/djabberd-test.pl
@@ -576,10 +576,10 @@ sub sasl_login {
     my $res  = shift;
     my $sec  = shift;
 
-    warn "connecting for login..\n" if $ENV{TESTDEBUG};
+    warn "connecting for sasl login..\n" if $ENV{TESTDEBUG};
     $self->connect or die "Failed to connect";
 
-    warn ".. connected after login.\n" if $ENV{TESTDEBUG};
+    warn ".. connected after sasl login.\n" if $ENV{TESTDEBUG};
 
     my $ss = $self->{ss};
     my $sock = $self->{sock};

commit 2e3d51369f74f09693a8b9635a171d924ae4354d
Author: Yann Kerherve <yann at cyberion.net>
Date:   Tue Jun 1 14:37:45 2010 -0700

    Fixes a timing issue in the test
    
    Closes #1

diff --git a/t/sasl-login.t b/t/sasl-login.t
index a0b32e6..2b9a858 100644
--- a/t/sasl-login.t
+++ b/t/sasl-login.t
@@ -25,6 +25,7 @@ my $login_and_be = sub {
     $pa->send_xml("<presence/>");
     $pb->send_xml("<presence/>");
 
+    select(undef,undef,undef,0.25); # doh
     $pa->send_xml("<iq type='get' id='pa1' to='$pb'><x/></iq>");
     like($pb->recv_xml, qr/id=.pa./, "pb got pa's iq");
     $pb->send_xml("<iq type='get' id='pb1' to='$pa'><x/></iq>");

commit e5fe7344bfadac4f03ab65aab508b59d73ef02d0
Author: Ask Bjørn Hansen <ask at develooper.com>
Date:   Mon May 24 16:29:25 2010 -0700

    Add default server-key.pem/server-cert.pem names

diff --git a/lib/DJabberd.pm b/lib/DJabberd.pm
index a168fdb..8c72d86 100644
--- a/lib/DJabberd.pm
+++ b/lib/DJabberd.pm
@@ -118,8 +118,8 @@ sub set_config_sslcertificatefile {
     $self->{ssl_cert_file} = as_abs_path($val);
 }
 
-sub ssl_private_key_file { return $_[0]{ssl_private_key_file} }
-sub ssl_cert_file        { return $_[0]{ssl_cert_file}        }
+sub ssl_private_key_file { return $_[0]{ssl_private_key_file} || 'server-key.pem' }
+sub ssl_cert_file        { return $_[0]{ssl_cert_file}  || 'server-cert.pem'      }
 
 sub set_config_oldssl {
     my ($self, $val) = @_;

commit 8bcf8b63f59a283623dc47ee4a6fbb5cc64359b0
Author: Ask Bjørn Hansen <ask at develooper.com>
Date:   Mon May 24 16:36:06 2010 -0700

    Describe examples/ in README file

diff --git a/README b/README
index 013ba4a..ef55d50 100644
--- a/README
+++ b/README
@@ -75,9 +75,8 @@ by setting the following environment variable:
 
   set LOGLEVEL=DEBUG
   
-  
-  
-  
-  
-  
-  
+
+In the examples/ directory there's an example djabberd.conf
+configuration file and the 'sixatalk' program.  'sixatalk' is an
+example djabberd based server integrating with an LDAP directory.
+

commit 16602df38328b33ac89ddddea44d24a282b33481
Author: Yann Kerherve <yann at cyberion.net>
Date:   Tue Jun 1 16:28:54 2010 -0700

    Revert "Add default server-key.pem/server-cert.pem names"
    
    This reverts commit e5fe7344bfadac4f03ab65aab508b59d73ef02d0.
    
    Actually this is a bad idea since it makes DJabberd advertises
    for SSL even if we don't have a valid cert.

diff --git a/lib/DJabberd.pm b/lib/DJabberd.pm
index 8c72d86..a168fdb 100644
--- a/lib/DJabberd.pm
+++ b/lib/DJabberd.pm
@@ -118,8 +118,8 @@ sub set_config_sslcertificatefile {
     $self->{ssl_cert_file} = as_abs_path($val);
 }
 
-sub ssl_private_key_file { return $_[0]{ssl_private_key_file} || 'server-key.pem' }
-sub ssl_cert_file        { return $_[0]{ssl_cert_file}  || 'server-cert.pem'      }
+sub ssl_private_key_file { return $_[0]{ssl_private_key_file} }
+sub ssl_cert_file        { return $_[0]{ssl_cert_file}        }
 
 sub set_config_oldssl {
     my ($self, $val) = @_;

commit e353bc52d2e96daee8316141db362b162558f240
Author: Daniel Ruoso <daniel at ruoso.com>
Date:   Fri May 28 14:21:47 2010 -0300

    Implements proper support for XML namespace prefixes

diff --git a/lib/DJabberd/SAXHandler.pm b/lib/DJabberd/SAXHandler.pm
index faa5fcb..4a571d7 100644
--- a/lib/DJabberd/SAXHandler.pm
+++ b/lib/DJabberd/SAXHandler.pm
@@ -188,7 +188,9 @@ sub _nodes_from_events {
             push @$nodelist, DJabberd::XMLElement->new($ev->[1]{NamespaceURI},
                                                        $ev->[1]{LocalName},
                                                        $attr,
-                                                       _nodes_from_events($evlist, $start_idx, $end_idx));
+                                                       _nodes_from_events($evlist, $start_idx, $end_idx),
+                                                       undef,
+                                                       $ev->[1]{Prefix});
             next;
         }
 
diff --git a/lib/DJabberd/XMLElement.pm b/lib/DJabberd/XMLElement.pm
index 94f1b12..0a0b041 100644
--- a/lib/DJabberd/XMLElement.pm
+++ b/lib/DJabberd/XMLElement.pm
@@ -7,6 +7,7 @@ use fields (
             'children',  # arrayref of child elements of this same type, or scalars for text nodes
             'raw',       # in some cases we have the raw xml and we have to create a fake XMLElement object
                          # business logic is that as_xml returns the raw stuff if it is exists, children has to be empty -- sky
+            'prefix',    # namepace prefix in use in this element
             );
 
 use DJabberd::Util;
@@ -23,7 +24,9 @@ sub new {
     ($self->{ns},
      $self->{element},
      $self->{attrs},
-     $self->{children}) = @_;
+     $self->{children},
+     $self->{raw},
+     $self->{prefix}) = @_;
     #my ($ns, $elementname, $attrs, $children) = @_;
     #Carp::confess("children isn't an arrayref, is: $children") unless ref $children eq "ARRAY";
 
@@ -107,35 +110,94 @@ sub namespace {
     return $self->{ns};
 }
 
+sub _resolve_prefix {
+    my ($self, $nsmap, $def_ns, $uri, $attr) = @_;
+    if ($def_ns && $def_ns eq $uri) {
+        return '';
+    } elsif ($uri eq '') {
+        return '';
+    } elsif ($nsmap->{$uri}) {
+        $nsmap->{$uri} . ':';
+    } else {
+        $nsmap->{___prefix_count} ||= 0;
+        my $count = $nsmap->{___prefix_count}++;
+        my $prefix = "nsp$count";
+        $nsmap->{$uri} = $prefix;
+        $nsmap->{$prefix} = $uri;
+        $attr->{'{http://www.w3.org/2000/xmlns}' . $prefix} = $uri;
+        return $prefix . ':';
+    }
+}
+
 sub as_xml {
     my DJabberd::XMLElement $self = shift;
-    my $nsmap = shift || {};  # localname -> uri, uri -> localname
-    my $def_ns = shift;
+
+    my $nsmap = shift || { }; # localname -> uri, uri -> localname
+
+    # tons of places call as_xml, but nobody seems to care about
+    # the default namespace. It seems, however, that it is a common
+    # usage for "jabber:client" to be this default ns.
+    my $def_ns = shift || 'jabber:client';
 
     my ($ns, $el) = ($self->{ns}, $self->{element});
+    if ($self->{prefix}) {
+        $nsmap->{ $self->{prefix} } = $ns;
+        $nsmap->{$ns} = $self->{prefix};
+    }
 
     my $attr_str = "";
     my $attr = $self->{attrs};
+
+    $nsmap->{xmlns} = 'http://www.w3.org/2000/xmlns';
+    $nsmap->{'http://www.w3.org/2000/xmlns'} = 'xmlns';
+
+    # let's feed the nsmap...
+    foreach my $k (keys %$attr) {
+        if ($k =~ /^\{(.*)\}(.+)$/) {
+            my ($nsuri, $name) = ($1, $2);
+            if ($nsuri eq 'xmlns' ||
+                $nsuri eq 'http://www.w3.org/2000/xmlns/') {
+                $nsmap->{$name} = $attr->{$k};
+                $nsmap->{ $attr->{$k} } = $name;
+            } elsif ($k eq '{}xmlns') {
+                $def_ns = $attr->{$k};
+            }
+        } elsif ($k eq 'xmlns') {
+            $def_ns = $attr->{$k};
+        }
+    }
+
+    my $nsprefix = $self->_resolve_prefix($nsmap, $def_ns, $ns, $attr);
+
     foreach my $k (keys %$attr) {
-        next if $k eq "{}xmlns";
         my $value = $attr->{$k};
-        # FIXME: ignoring all namespaces on attributes
-        $k =~ s!^\{(.*)\}!!;
-        my $ns = $1;
-        $attr_str .= " $k='" . DJabberd::Util::exml($value) . "'";
+        if ($k =~ /^\{(.*)\}(.+)$/) {
+            my ($nsuri, $name) = ($1, $2);
+            if ($nsuri eq 'xmlns' ||
+                $nsuri eq 'http://www.w3.org/2000/xmlns/') {
+                $attr_str .= " xmlns:$name=\"" . DJabberd::Util::exml($value)
+                          . "\"";
+            } elsif ($k eq '{}xmlns') {
+                $attr_str .= " xmlns=\"" . DJabberd::Util::exml($value) . "\"";
+            } else {
+                my $nsprefix = $self->_resolve_prefix($nsmap, $def_ns, $nsuri);
+                $attr_str .= " $nsprefix$name=\"" . DJabberd::Util::exml($value)
+                          ."\"";
+            }
+        } else {
+            $attr_str .= " $k=\"" . DJabberd::Util::exml($value) . "\"";
+        }
     }
 
-    my $xmlns = (!$ns ||
-                 ($def_ns && $ns eq $def_ns) ||
-                 $ns eq "jabber:server" ||
-                 $ns eq "jabber:component:accept" ||
-                 $ns eq "jabber:client") ?
-                 "" : " xmlns='$ns'";
-    my $innards = $self->innards_as_xml($nsmap, $ns, $def_ns);
+    my $innards = $self->innards_as_xml($nsmap, $def_ns);
     $innards = "..." if $DJabberd::ASXML_NO_INNARDS && $innards;
-    return length $innards ?
-        "<$el$xmlns$attr_str>$innards</$el>" :
-        "<$el$xmlns$attr_str/>";
+
+    my $result = length $innards ?
+        "<$nsprefix$el$attr_str>$innards</$nsprefix$el>" :
+        "<$nsprefix$el$attr_str/>";
+
+    return $result;
+
 }
 
 sub innards_as_xml {
@@ -170,6 +232,7 @@ sub clone {
     $clone->{attrs}    = { %{ $self->{attrs} } };
     $clone->{children} = [ map { ref($_) ? $_->clone : $_ } @{ $self->{children} } ];
     $clone->{raw}      = $self->{raw};
+    $clone->{prefix}   = $self->{prefix};
     return $clone;
 }
 
diff --git a/t/disco.t b/t/disco.t
index 67a488d..702fb4d 100644
--- a/t/disco.t
+++ b/t/disco.t
@@ -17,7 +17,7 @@ once_logged_in(sub {
   <query xmlns='http://jabber.org/protocol/disco#info'/>
 </iq>");
 
-    like($pa->recv_xml, qr{<identity type='im' category='server' name='djabberd'/>}, "Say we are a server");
+    like($pa->recv_xml, qr{<identity type="im" category="server" name="djabberd"/>}, "Say we are a server");
 
     $pa->send_xml(qq{<iq type='get'
                          from='$pa/$res'
@@ -26,6 +26,6 @@ once_logged_in(sub {
                          <query xmlns='http://jabber.org/protocol/disco#items'/>
                          </iq>});
 
-    like($pa->recv_xml, qr{<query xmlns='http://jabber.org/protocol/disco#items'/>}, "We dont currently return anything");
+    like($pa->recv_xml, qr{<query xmlns="http://jabber.org/protocol/disco#items"/>}, "We dont currently return anything");
 });
 
diff --git a/t/features-hook.t b/t/features-hook.t
index 72a8975..8b06c8b 100644
--- a/t/features-hook.t
+++ b/t/features-hook.t
@@ -51,7 +51,7 @@ sub connect_and_get_features{
   {
      my $features = connect_and_get_features($client);
 
-     is("<features xmlns='http://etherx.jabber.org/streams'><auth xmlns='http://jabber.org/features/iq-auth'/></features>",
+     is("<stream:features><auth xmlns=\"http://jabber.org/features/iq-auth\"/></stream:features>",
         $features, "should get features, including auth and nothing else");
   }
   $server->kill;  
@@ -97,10 +97,10 @@ sub connect_and_get_features{
   {
      my $features = connect_and_get_features($client);
 
-     is("<features xmlns='http://etherx.jabber.org/streams'>".
-        "<auth xmlns='http://jabber.org/features/iq-auth'/>".
-        "<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>".
-        "</features>",
+     is("<stream:features>".
+        "<auth xmlns=\"http://jabber.org/features/iq-auth\"/>".
+        "<starttls xmlns=\"urn:ietf:params:xml:ns:xmpp-tls\"/>".
+        "</stream:features>",
         $features, "should get features, including auth and starttls");
   }
   $server->kill;  
@@ -136,10 +136,10 @@ sub connect_and_get_features{
   {
      my $features = connect_and_get_features($client);
 
-     is("<features xmlns='http://etherx.jabber.org/streams'>".
-        "<auth xmlns='http://jabber.org/features/iq-auth'/>".
+     is("<stream:features>".
+        "<auth xmlns=\"http://jabber.org/features/iq-auth\"/>".
         "<foobar/>".
-        "</features>",
+        "</stream:features>",
         $features, "should get features, including auth and starttls");
   }
   $server->kill;  
diff --git a/t/handle-stanza-hook.t b/t/handle-stanza-hook.t
index 6bf5dc6..f781b5e 100644
--- a/t/handle-stanza-hook.t
+++ b/t/handle-stanza-hook.t
@@ -69,7 +69,7 @@ my $client = Test::DJabberd::Client->new(server => $server, name => "client");
     $client->send_xml(qq{<bogus-stanza/>});
     # should get a stream error
     is($client->recv_xml, 
-        "<error xmlns='http://etherx.jabber.org/streams'><unsupported-stanza-type xmlns='urn:ietf:params:xml:ns:xmpp-streams'/></error>",
+        "<stream:error><unsupported-stanza-type xmlns=\"urn:ietf:params:xml:ns:xmpp-streams\"/></stream:error>",
         "should get a stream error for bogus stanza");
     
     pass "Done";
diff --git a/t/lib/djabberd-test.pl b/t/lib/djabberd-test.pl
index e3da16a..b10c3e5 100644
--- a/t/lib/djabberd-test.pl
+++ b/t/lib/djabberd-test.pl
@@ -556,7 +556,7 @@ sub connect {
 
     my $features = $self->recv_xml;
     warn "FEATURES: $features" if $ENV{TESTDEBUG};
-    die "no features" unless $features =~ /^<features\b/;
+    die "no features" unless $features =~ /^<([^\:]+\:)?features\b/;
     return 1;
 }
 
diff --git a/t/quirk-libgaim-iqerrorfrom.t b/t/quirk-libgaim-iqerrorfrom.t
index fd50c6d..96347e4 100644
--- a/t/quirk-libgaim-iqerrorfrom.t
+++ b/t/quirk-libgaim-iqerrorfrom.t
@@ -51,7 +51,7 @@ sub run_test {
 
 
         $xml = $pb->recv_xml;
-        like($xml, qr{<vCard xmlns='vcard-temp'/>}, "iq vcard query");
+        like($xml, qr{<vCard xmlns="vcard-temp"/>}, "iq vcard query");
         like($xml, qr{\btype=.get\b}, "is a get");
 
         # now we'll make pb be the broken libgaim.  note the bogus from address.
diff --git a/t/xmlnamespace.t b/t/xmlnamespace.t
new file mode 100644
index 0000000..1db13eb
--- /dev/null
+++ b/t/xmlnamespace.t
@@ -0,0 +1,28 @@
+#!/usr/bin/perl
+use strict;
+use Test::More tests => 8;
+use lib 't/lib';
+
+require 'djabberd-test.pl';
+
+two_parties(sub {
+    my ($pa, $pb) = @_;
+    $pa->login;
+    $pb->login;
+
+    # now pa/pb send presence to become available resources
+    $pa->send_xml("<presence/>");
+    $pb->send_xml("<presence/>");
+    select(undef, undef, undef, 0.25);
+
+    # PA to PB
+    $pa->send_xml(qq{<message from="$pa" to="$pb" id="1"><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2001/12/soap-envelope"><SOAP-ENV:Body><x0:foo xmlns:x0="urn:test" /></SOAP-ENV:Body></SOAP-ENV:Envelope></message>});
+
+    my $msg = $pb->recv_xml;
+    like($msg, qr/SOAP-ENV:Envelope/, "pb got Envelope in the correct prefix");
+    like($msg, qr/xmlns:SOAP-ENV/, "pb got SOAP-ENV prefix decl");
+    like($msg, qr/x0:foo/, "pb got foo in the correct prefix");
+    like($msg, qr/xmlns:x0/, "pb got x0 prefix decl");
+
+});
+

commit c5578e48de4b4c8c73b998f5f19f6567156cd674
Author: Yann Kerherve <yann at cyberion.net>
Date:   Tue Jun 1 17:21:57 2010 -0700

    Reverts XML attribute quote from " to '
    
    We would need an explanation before approving this change

diff --git a/lib/DJabberd/XMLElement.pm b/lib/DJabberd/XMLElement.pm
index 0a0b041..1cad511 100644
--- a/lib/DJabberd/XMLElement.pm
+++ b/lib/DJabberd/XMLElement.pm
@@ -175,17 +175,17 @@ sub as_xml {
             my ($nsuri, $name) = ($1, $2);
             if ($nsuri eq 'xmlns' ||
                 $nsuri eq 'http://www.w3.org/2000/xmlns/') {
-                $attr_str .= " xmlns:$name=\"" . DJabberd::Util::exml($value)
-                          . "\"";
+                $attr_str .= " xmlns:$name='" . DJabberd::Util::exml($value)
+                          . "'";
             } elsif ($k eq '{}xmlns') {
-                $attr_str .= " xmlns=\"" . DJabberd::Util::exml($value) . "\"";
+                $attr_str .= " xmlns='" . DJabberd::Util::exml($value) . "'";
             } else {
                 my $nsprefix = $self->_resolve_prefix($nsmap, $def_ns, $nsuri);
-                $attr_str .= " $nsprefix$name=\"" . DJabberd::Util::exml($value)
-                          ."\"";
+                $attr_str .= " $nsprefix$name='" . DJabberd::Util::exml($value)
+                          ."'";
             }
         } else {
-            $attr_str .= " $k=\"" . DJabberd::Util::exml($value) . "\"";
+            $attr_str .= " $k='" . DJabberd::Util::exml($value) . "'";
         }
     }
 
diff --git a/t/disco.t b/t/disco.t
index 702fb4d..67a488d 100644
--- a/t/disco.t
+++ b/t/disco.t
@@ -17,7 +17,7 @@ once_logged_in(sub {
   <query xmlns='http://jabber.org/protocol/disco#info'/>
 </iq>");
 
-    like($pa->recv_xml, qr{<identity type="im" category="server" name="djabberd"/>}, "Say we are a server");
+    like($pa->recv_xml, qr{<identity type='im' category='server' name='djabberd'/>}, "Say we are a server");
 
     $pa->send_xml(qq{<iq type='get'
                          from='$pa/$res'
@@ -26,6 +26,6 @@ once_logged_in(sub {
                          <query xmlns='http://jabber.org/protocol/disco#items'/>
                          </iq>});
 
-    like($pa->recv_xml, qr{<query xmlns="http://jabber.org/protocol/disco#items"/>}, "We dont currently return anything");
+    like($pa->recv_xml, qr{<query xmlns='http://jabber.org/protocol/disco#items'/>}, "We dont currently return anything");
 });
 
diff --git a/t/features-hook.t b/t/features-hook.t
index 8b06c8b..25c6d33 100644
--- a/t/features-hook.t
+++ b/t/features-hook.t
@@ -51,7 +51,7 @@ sub connect_and_get_features{
   {
      my $features = connect_and_get_features($client);
 
-     is("<stream:features><auth xmlns=\"http://jabber.org/features/iq-auth\"/></stream:features>",
+     is("<stream:features><auth xmlns='http://jabber.org/features/iq-auth'/></stream:features>",
         $features, "should get features, including auth and nothing else");
   }
   $server->kill;  
@@ -98,8 +98,8 @@ sub connect_and_get_features{
      my $features = connect_and_get_features($client);
 
      is("<stream:features>".
-        "<auth xmlns=\"http://jabber.org/features/iq-auth\"/>".
-        "<starttls xmlns=\"urn:ietf:params:xml:ns:xmpp-tls\"/>".
+        "<auth xmlns='http://jabber.org/features/iq-auth'/>".
+        "<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>".
         "</stream:features>",
         $features, "should get features, including auth and starttls");
   }
@@ -137,7 +137,7 @@ sub connect_and_get_features{
      my $features = connect_and_get_features($client);
 
      is("<stream:features>".
-        "<auth xmlns=\"http://jabber.org/features/iq-auth\"/>".
+        "<auth xmlns='http://jabber.org/features/iq-auth'/>".
         "<foobar/>".
         "</stream:features>",
         $features, "should get features, including auth and starttls");
diff --git a/t/handle-stanza-hook.t b/t/handle-stanza-hook.t
index f781b5e..f34e720 100644
--- a/t/handle-stanza-hook.t
+++ b/t/handle-stanza-hook.t
@@ -69,7 +69,7 @@ my $client = Test::DJabberd::Client->new(server => $server, name => "client");
     $client->send_xml(qq{<bogus-stanza/>});
     # should get a stream error
     is($client->recv_xml, 
-        "<stream:error><unsupported-stanza-type xmlns=\"urn:ietf:params:xml:ns:xmpp-streams\"/></stream:error>",
+        "<stream:error><unsupported-stanza-type xmlns='urn:ietf:params:xml:ns:xmpp-streams'/></stream:error>",
         "should get a stream error for bogus stanza");
     
     pass "Done";
diff --git a/t/quirk-libgaim-iqerrorfrom.t b/t/quirk-libgaim-iqerrorfrom.t
index 96347e4..fd50c6d 100644
--- a/t/quirk-libgaim-iqerrorfrom.t
+++ b/t/quirk-libgaim-iqerrorfrom.t
@@ -51,7 +51,7 @@ sub run_test {
 
 
         $xml = $pb->recv_xml;
-        like($xml, qr{<vCard xmlns="vcard-temp"/>}, "iq vcard query");
+        like($xml, qr{<vCard xmlns='vcard-temp'/>}, "iq vcard query");
         like($xml, qr{\btype=.get\b}, "is a get");
 
         # now we'll make pb be the broken libgaim.  note the bogus from address.

commit acb8bd6fd1c30034046a2354abb7b3bfabe3ece7
Author: Yann Kerherve <yann at cyberion.net>
Date:   Tue Jun 1 17:33:45 2010 -0700

    Applies namespaces fix to SASL tests

diff --git a/t/features-hook.t b/t/features-hook.t
index 25c6d33..c55e9d8 100644
--- a/t/features-hook.t
+++ b/t/features-hook.t
@@ -64,7 +64,7 @@ sub connect_and_get_features{
     {
         my $features = connect_and_get_features($client);
 
-        like($features, qr{^<features xmlns='http://etherx.jabber.org/streams'>.*</features>$});
+        like($features, qr{^<stream:features>.*</stream:features>$});
         like($features, qr{<auth xmlns='http://jabber.org/features/iq-auth'/>});
         like($features, qr{<mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>.*</mechanisms>});
         like($features, qr{<optional/>}, "our test setup makes sasl optional, bc of history of djabberd");
diff --git a/t/lib/djabberd-test.pl b/t/lib/djabberd-test.pl
index b10c3e5..bf06d23 100644
--- a/t/lib/djabberd-test.pl
+++ b/t/lib/djabberd-test.pl
@@ -627,7 +627,7 @@ sub sasl_login {
 
     my $features = $self->recv_xml;
     warn "FEATURES: $features" if $ENV{TESTDEBUG};
-    die "no features" unless $features =~ /^<features\b/;
+    die "no features" unless $features =~ /^<([^\:]+\:)?features\b/;
     die "no bind"     unless $features =~ /bind\b/sm;
     die "no session"  unless $features =~ /session\b/sm;
 

commit e036ba041fd0d5ceec73a4086e2c718ccd692c50
Author: Yann Kerherve <yann at cyberion.net>
Date:   Wed Jun 2 11:24:32 2010 -0700

    Fixes spurious warning about undefined resource

diff --git a/t/lib/djabberd-test.pl b/t/lib/djabberd-test.pl
index e3da16a..031401d 100644
--- a/t/lib/djabberd-test.pl
+++ b/t/lib/djabberd-test.pl
@@ -573,7 +573,7 @@ sub send_stream_start {
 sub sasl_login {
     my $self = shift;
     my $sasl = shift;
-    my $res  = shift;
+    my $res  = shift || '';
     my $sec  = shift;
 
     warn "connecting for sasl login..\n" if $ENV{TESTDEBUG};

commit b1cd8c279cfe6ef82b8830286dcd696f02232747
Author: Yann Kerherve <yann at cyberion.net>
Date:   Wed Jun 2 11:25:34 2010 -0700

    Only decode challenge if there is one
    
    Issue #1

diff --git a/t/lib/djabberd-test.pl b/t/lib/djabberd-test.pl
index 031401d..3f9007b 100644
--- a/t/lib/djabberd-test.pl
+++ b/t/lib/djabberd-test.pl
@@ -597,9 +597,11 @@ sub sasl_login {
         my $challenge = $self->recv_xml;
         warn "challenge response: [$challenge]\n" if $ENV{TESTDEBUG};
         die "Didn't get expected response: $challenge" unless $challenge =~ /challenge|success\b/;
-        $challenge =~ s/^.*>(.+)<.*$/$1/sm;
-        $challenge = decode_base64($challenge);
-        warn "decoded challenge: [$challenge]\n" if $ENV{TESTDEBUG};
+
+        if ($challenge =~ s/^.*>(.+)<.*$/$1/sm) {
+            $challenge = decode_base64($challenge);
+            warn "decoded challenge: [$challenge]\n" if $ENV{TESTDEBUG};
+        }
 
         my $response = $conn->client_step($challenge);
         if ($conn->is_success) {

commit 992449ce1155f917e63867dbe709d7346f587e29
Author: Yann Kerherve <yann at cyberion.net>
Date:   Wed Jun 2 12:22:26 2010 -0700

    Don't log to SCREEN unless TESTDEBUG is set

diff --git a/t/lib/djabberd-test.pl b/t/lib/djabberd-test.pl
index 3f9007b..d2f32f0 100644
--- a/t/lib/djabberd-test.pl
+++ b/t/lib/djabberd-test.pl
@@ -311,6 +311,15 @@ sub start {
         
         my $childpid = fork;
         if (!$childpid) {
+            unless ($ENV{TESTDEBUG}) {
+                ## no spurious output unless debugging
+                close(STDIN);
+                close(STDOUT);
+                close(STDERR);
+                open(STDIN,  "+>/dev/null");
+                open(STDOUT, "+>&STDIN");
+                open(STDERR, "+>&STDIN");
+            }
             $server->run;
             exit 0;
         }

commit d6772d6480d5312af9b2367f66d478ad4966306d
Merge: 992449c acb8bd6
Author: Yann Kerherve <yann at cyberion.net>
Date:   Thu Jun 3 12:52:33 2010 -0700

    Merge branch 'namespaces-fix'


commit dadcef6715900d8583430165bc9fe479bf235921
Author: Yann Kerherve <yann at cyberion.net>
Date:   Thu Jun 3 13:01:31 2010 -0700

    Updates CHANGES

diff --git a/CHANGES b/CHANGES
index 4d32678..5e983a2 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,13 @@
+  - SASL support (Previously released, but not advertised here)
+    (Yann Kerherve <yann at cyberion.net>)
+
+  - Implement proper support for XML namespace prefixes
+    (Daniel Ruoso <daniel at ruoso.com>)
+
+  - Meta: djabberd is now hosted on http://github.com/djabberd
+
+  - Meta: The core repository is now separated from plugins.
+
   - Treat the node and domain parts of a JID as case-insensitive as per
     the XMPP spec. This creates a dependency on the CPAN module
     Unicode::Stringprep. A backward-compatibility setting is provided

commit 68d1b031df9d004869808d85b3e5825ede737d5a
Merge: dadcef6 9d7420b
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Sep 8 12:21:23 2010 -0400

    Merge branch 'gafyd-fixes'


-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list