🐛 `QUOTA` support is broken for types other than `STORAGE`

オープン
#622 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
30/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
ruby
領域
api, networking

調査の方向性

クォータ応答パーサーと Net::IMAP #getquota、#getquotaroot、#setquota のエントリポイントから着手し、プロトコルの参照として RFC2087 と RFC9208 を使用してください。複数のリソースタイプをクラッシュせずにパースでき、QuotaResponse と後方互換性のある動作が設定を通じてサポートされ、クォータの設定で要求されたリソースタイプを受け付ければ完了です。

索引モデルが issue の本文から書いたものです。

説明

bug

Support for the QUOTA extension is broken in several ways: it assumes STORAGE is the only possible quota resource type (which was not true, even for RFC2087) and the response parser will crash the connection if multiple resource types are returned. Fixing this is backward incompatible, so it will need to be hidden behind new config attribute.

Response Parser

Currently, the response parser for quota-response only allows zero or one quota-resource. It implicitly assumes that resource type is STORAGE, so it doesn't store the resource type. And it crashes for more than one resource type.

  • QUOTA response should be parsed consistently with RFC2087 and RFC9208, into a new QuotaResponse type.
Response Data

MailboxQuota must be deprecated: the #mailbox attribute is misleadingly named (it should be #quota_root), the class is misleadingly named (again: it provides information about a "quota root", which does not have a 1-to-1 relationship with mailbox), and it can only list usage and limit for a single resource type

  • QuotaResponse = Data.define(:quota_root, :resources)
    • #to_deprecated_mailbox_quota for backwards compatibility
  • QuotaResponse::Resource = Data.define(:name, :usage, :limit)
Net::IMAP command methods
  • #getquota: Use use_deprecated_mailbox_quota config:
    • when :silent, return only the STORAGE resource (nil if no STORAGE resource)
    • when true, same as :silent but issue a warning for non STORAGE resource types
    • when false, return QuotaResponse rather than MailboxQuota
  • #getquotaroot: Use use_deprecated_mailbox_quota config (same as #getquota)
  • #setquota: support any number of any resource types via *rest args
Additional

Separately from this bug, there are some other QUOTA related issues (TODO: move these to separate issues/PRs):

  • RFC9208 support
    • new capabilities: QUOTA=RES-* and QUOTASET
      • document at class level, and on all three quota methods
    • QuotaResponse: Add accessors "attributes" for every type in the IANA quota resource type registry:
      • def storage = resources.find { "STORAGE".casecmp?(it.name) }
      • def message = resources.find { "MESSAGE".casecmp?(it.name) }
      • def mailbox = resources.find { "MAILBOX".casecmp?(it.name) }
      • def annotation_storage = resources.find { "ANNOTATION-STORAGE".casecmp?(it.name) }
    • new response code: OVERQUOTA
      • document on ResponseCode class
      • add (trivial) support in response parser
    • #setquota:
      • support IANA-registered resource types via keyword args
  • #getquotaroot:
    • Rather than return an array of mixed MailboxQuotaRoot and QuotaResponse objects, return a single hash-like object that combines them.
      • Config#getquotaroot_returns_quotaroot_data
    • Config#setquota_returns_quota_responses => return matching untagged QUOTA responses
主要言語
Ruby
スター
121
フォーク
47
平均マージ
19時間 25分
マージ済み PR(30日)
3

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ruby/net-imap のほかの issue

ruby/net-imap の issue をすべて見る

似ている issue

Ruby の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。