[前][次][番号順一覧][スレッド一覧]

ruby-changes:28367

From: shugo <ko1@a...>
Date: Tue, 23 Apr 2013 14:07:35 +0900 (JST)
Subject: [ruby-changes:28367] shugo:r40419 (trunk): * lib/net/imap.rb (getacl_response): parse the mailbox of an ACL

shugo	2013-04-23 14:07:21 +0900 (Tue, 23 Apr 2013)

  New Revision: 40419

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=40419

  Log:
    * lib/net/imap.rb (getacl_response): parse the mailbox of an ACL
      response correctly.  [ruby-core:54365] [Bug #8281]

  Modified files:
    trunk/ChangeLog
    trunk/lib/net/imap.rb
    trunk/test/net/imap/test_imap_response_parser.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 40418)
+++ ChangeLog	(revision 40419)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Apr 23 14:04:44 2013  Shugo Maeda  <shugo@r...>
+
+	* lib/net/imap.rb (getacl_response): parse the mailbox of an ACL
+	  response correctly.  [ruby-core:54365] [Bug #8281]
+
 Tue Apr 23 11:58:46 2013  Nobuyoshi Nakada  <nobu@r...>
 
 	* string.c (rb_str_scrub): fix for UTF-32.  strlen() on strings
Index: lib/net/imap.rb
===================================================================
--- lib/net/imap.rb	(revision 40418)
+++ lib/net/imap.rb	(revision 40419)
@@ -1740,7 +1740,7 @@ module Net https://github.com/ruby/ruby/blob/trunk/lib/net/imap.rb#L1740
     # rights:: The access rights the indicated user has to the
     #          mailbox.
     #
-    MailboxACLItem = Struct.new(:user, :rights)
+    MailboxACLItem = Struct.new(:user, :rights, :mailbox)
 
     # Net::IMAP::StatusData represents contents of the STATUS response.
     #
@@ -2806,6 +2806,7 @@ module Net https://github.com/ruby/ruby/blob/trunk/lib/net/imap.rb#L2806
         token = match(T_ATOM)
         name = token.value.upcase
         match(T_SPACE)
+        mailbox = astring
         data = []
         token = lookahead
         if token.symbol == T_SPACE
@@ -2821,8 +2822,7 @@ module Net https://github.com/ruby/ruby/blob/trunk/lib/net/imap.rb#L2822
             user = astring
             match(T_SPACE)
             rights = astring
-            ##XXX data.push([user, rights])
-            data.push(MailboxACLItem.new(user, rights))
+            data.push(MailboxACLItem.new(user, rights, mailbox))
           end
         end
         return UntaggedResponse.new(name, data, @str)
Index: test/net/imap/test_imap_response_parser.rb
===================================================================
--- test/net/imap/test_imap_response_parser.rb	(revision 40418)
+++ test/net/imap/test_imap_response_parser.rb	(revision 40419)
@@ -223,4 +223,18 @@ EOF https://github.com/ruby/ruby/blob/trunk/test/net/imap/test_imap_response_parser.rb#L223
     assert_equal("7BIT", delivery_status.encoding)
     assert_equal(410, delivery_status.size)
   end
+
+  # [Bug #8281]
+  def test_acl
+    parser = Net::IMAP::ResponseParser.new
+    response = parser.parse(<<EOF.gsub(/\n/, "\r\n").taint)
+* ACL "INBOX/share" "imshare2copy1366146467@x..." lrswickxteda
+EOF
+    assert_equal("ACL", response.name)
+    assert_equal(1, response.data.length)
+    assert_equal("INBOX/share", response.data[0].mailbox)
+    assert_equal("imshare2copy1366146467@x...",
+                 response.data[0].user)
+    assert_equal("lrswickxteda", response.data[0].rights)
+  end
 end

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]