Re: It's not possible to create folder which name starts with hash-sign (#)

2023-06-21 Thread Benoit TELLIER
Hello Wojtek,

That is because James employs a folder hierarchy where '#' is used to denote a 
namespace.

#private:wojtek:INBOX denotes your inbox on which I would have a shared access.
#shared:marketting:INBOX denotes a shared mailbox for the marketting team.

I bet you could do: #private:wojtek:#hashtest ?

That being said, james have no support for accessing shared mailboxes in IMAP 
just quite yet. The usefulness of that addressing scheme is thus limited.

IMO we could:
 - Drop the #namespace:user:mailbox addressing sheme in IMAP as it is not 
currently in use...
 - Or (lighter) if we can't parse a mailbox path (no : after #) then keep the 
name as is, IE support #hashtest
 - Review and adopt another addressing sheme that matches those of eg cyrus.

--


Best regards,



Benoit TELLIER



General manager of Linagora VIETNAM.

Product owner for Team-Mail product.

Chairman of the Apache James project.



Mail: btell...@linagora.com

Tel: (0033) 6 77 26 04 58 (WhatsApp, Signal)

On Jun 22, 2023 9:10 AM, from Wojtek Hi,
I ran into an issue when importing mails from other servers - it seems that 
it's not possible to
create folder which name starts with hash-sign, e.g.: "#testfolder".

I tested other mail servers (gmail, mailu [postfix?], fastmail [cyrrus?], 
mailbox.org, infomaniak
[no idea what they use]) and all of them allowed folder names starting with "#".


```
A4 CREATE #hashtest
A4 NO CREATE You can not access a mailbox that does not belong to you
```

Looking at the spec (https://datatracker.ietf.org/doc/html/rfc3501#section-5.1) 
it seems that `#`
can have special meaning and could be used to denote namespaces.

Is it a configurable option (i.e. is it possible to disable namespaces/shared 
mailboxes or some
such) that would result in James allowing mailboxes starting with `#`?

--
Wojtek

-
To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
For additional commands, e-mail: server-user-h...@james.apache.org




Re: It's not possible to create folder which name starts with hash-sign (#)

2023-06-21 Thread Benoit TELLIER
By the way https://www.rfc-editor.org/rfc/rfc3501#section-5.1

   5)Two characters, "#" and "&", have meanings by convention, and
 should be avoided except when used in that convention.--


Best regards,



Benoit TELLIER



General manager of Linagora VIETNAM.

Product owner for Team-Mail product.

Chairman of the Apache James project.



Mail: btell...@linagora.com

Tel: (0033) 6 77 26 04 58 (WhatsApp, Signal)

On Jun 22, 2023 12:32 PM, from Benoit Tellier Hello Wojtek,

That is because James employs a folder hierarchy where '#' is used to denote a 
namespace.

#private:wojtek:INBOX denotes your inbox on which I would have a shared access.
#shared:marketting:INBOX denotes a shared mailbox for the marketting team.

I bet you could do: #private:wojtek:#hashtest ?

That being said, james have no support for accessing shared mailboxes in IMAP 
just quite yet. The usefulness of that addressing scheme is thus limited.

IMO we could:
 - Drop the #namespace:user:mailbox addressing sheme in IMAP as it is not 
currently in use...
 - Or (lighter) if we can't parse a mailbox path (no : after #) then keep the 
name as is, IE support #hashtest
 - Review and adopt another addressing sheme that matches those of eg cyrus.

--


Best regards,



Benoit TELLIER



General manager of Linagora VIETNAM.

Product owner for Team-Mail product.

Chairman of the Apache James project.



Mail: btell...@linagora.com

Tel: (0033) 6 77 26 04 58 (WhatsApp, Signal)

On Jun 22, 2023 9:10 AM, from Wojtek Hi,
I ran into an issue when importing mails from other servers - it seems that 
it's not possible to
create folder which name starts with hash-sign, e.g.: "#testfolder".

I tested other mail servers (gmail, mailu [postfix?], fastmail [cyrrus?], 
mailbox.org, infomaniak
[no idea what they use]) and all of them allowed folder names starting with "#".


```
A4 CREATE #hashtest
A4 NO CREATE You can not access a mailbox that does not belong to you
```

Looking at the spec (https://datatracker.ietf.org/doc/html/rfc3501#section-5.1) 
it seems that `#`
can have special meaning and could be used to denote namespaces.

Is it a configurable option (i.e. is it possible to disable namespaces/shared 
mailboxes or some
such) that would result in James allowing mailboxes starting with `#`?

--
Wojtek

-
To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
For additional commands, e-mail: server-user-h...@james.apache.org




Re: It's not possible to create folder which name starts with hash-sign (#)

2023-06-22 Thread Wojtek
I did linked it in the email - I'm aware of the specification but as with RFCs - it's not even 
"SHOULD" (or SHOULD NOT), not to mention explicit MUST, and considering that all other 
implementations (that I tested) ignore it then I'm not sure it's valid.


Wojtek

On 22/06/2023 01:33, Benoit TELLIER wrote:

By the way https://www.rfc-editor.org/rfc/rfc3501#section-5.1

5)Two characters, "#" and "&", have meanings by convention, and
  should be avoided except when used in that convention.--


Best regards,



Benoit TELLIER



General manager of Linagora VIETNAM.

Product owner for Team-Mail product.

Chairman of the Apache James project.



Mail: btell...@linagora.com

Tel: (0033) 6 77 26 04 58 (WhatsApp, Signal)

On Jun 22, 2023 12:32 PM, from Benoit Tellier Hello Wojtek,

That is because James employs a folder hierarchy where '#' is used to denote a 
namespace.

#private:wojtek:INBOX denotes your inbox on which I would have a shared access.
#shared:marketting:INBOX denotes a shared mailbox for the marketting team.

I bet you could do: #private:wojtek:#hashtest ?

That being said, james have no support for accessing shared mailboxes in IMAP 
just quite yet. The usefulness of that addressing scheme is thus limited.

IMO we could:
  - Drop the #namespace:user:mailbox addressing sheme in IMAP as it is not 
currently in use...
  - Or (lighter) if we can't parse a mailbox path (no : after #) then keep the 
name as is, IE support #hashtest
  - Review and adopt another addressing sheme that matches those of eg cyrus.

--


Best regards,



Benoit TELLIER



General manager of Linagora VIETNAM.

Product owner for Team-Mail product.

Chairman of the Apache James project.



Mail: btell...@linagora.com

Tel: (0033) 6 77 26 04 58 (WhatsApp, Signal)

On Jun 22, 2023 9:10 AM, from Wojtek Hi,
I ran into an issue when importing mails from other servers - it seems that 
it's not possible to
create folder which name starts with hash-sign, e.g.: "#testfolder".

I tested other mail servers (gmail, mailu [postfix?], fastmail [cyrrus?], 
mailbox.org, infomaniak
[no idea what they use]) and all of them allowed folder names starting with "#".


```
A4 CREATE #hashtest
A4 NO CREATE You can not access a mailbox that does not belong to you
```

Looking at the spec (https://datatracker.ietf.org/doc/html/rfc3501#section-5.1) 
it seems that `#`
can have special meaning and could be used to denote namespaces.

Is it a configurable option (i.e. is it possible to disable namespaces/shared 
mailboxes or some
such) that would result in James allowing mailboxes starting with `#`?

--
Wojtek

-
To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
For additional commands, e-mail: server-user-h...@james.apache.org





-
To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
For additional commands, e-mail: server-user-h...@james.apache.org



Re: It's not possible to create folder which name starts with hash-sign (#)

2023-06-22 Thread Wojtek

Hi,


Wojtek

On 22/06/2023 01:32, Benoit TELLIER wrote:

Hello Wojtek,

That is because James employs a folder hierarchy where '#' is used to denote a 
namespace.


I assumed as much.


#private:wojtek:INBOX denotes your inbox on which I would have a shared access.
#shared:marketting:INBOX denotes a shared mailbox for the marketting team.

I bet you could do: #private:wojtek:#hashtest ?


Unfortunately not:

```
A4 CREATE #private:admin@atlantiscity:#hashtest
A4 NO CREATE You can not access a mailbox that does not belong to you
```

[More at the end]

( `store.getFolder("#private:" + email + ":#hashtest").create(HOLDS_MESSAGES)` )

What's weird is that the original exception that made me investigate it didn't have hashtag in the 
foldername itself:

```
21:33:47.588 [ERROR] o.a.j.i.p.StatusProcessor - Status failed for mailbox 
#private:u...@james.domain.com:Apple Mail To Do
org.apache.james.mailbox.exception.MailboxNotFoundException: #private:u...@james.domain.com:Apple 
Mail To Do can not be found
at 
org.apache.james.mailbox.store.StoreMailboxManager.lambda$getMailboxReactive$1(StoreMailboxManager.java:282)

```



That being said, james have no support for accessing shared mailboxes in IMAP 
just quite yet. The usefulness of that addressing scheme is thus limited.

IMO we could:
  - Drop the #namespace:user:mailbox addressing sheme in IMAP as it is not 
currently in use...
  - Or (lighter) if we can't parse a mailbox path (no : after #) then keep the 
name as is, IE support #hashtest
  - Review and adopt another addressing sheme that matches those of eg cyrus.


I'm not sure how other implementations do it (only checked it from the end-user 
point of view).

As you mentioned, the namespaces doesn't seem to be directly visible in IMAP, nor it's possible to 
act on them - they are in the repository ("namespace" column) but that's just about it - LIST only 
shows effective folder name (i.e. "INBOX" and not "#private:wojtek:INBOX").


Trying to create mailbox that starts with `#`, be that namespace (#private:admin@atlantiscity:test) 
or plain folder (#test) name just doesn't work.


RFC mentiones namespaces (https://datatracker.ietf.org/doc/html/rfc3501#page-19) but the example is 
about usenet. I'm not sure how they are used in James (especially outside IMAP that you mentioned).


I couldn't find it in the documentation, but through searching I found:
https://github.com/apache/james-project/pull/680
https://issues.apache.org/jira/browse/JAMES-3659
https://www.mail-archive.com/server-dev@james.apache.org/msg71116.html
and finally
https://github.com/apache/james-project/blob/master/server/protocols/jmap-rfc-8621/doc/specs/spec/mail/rights.mdown

Which seems JMAP focused.

The concept of shared mailbox/being able to send messages on behalf of someone seems interesting 
though (at least in our case) usual modus operandi (for example for having support email) is:

- have dedicated mailbox for support user
- have ticketing system that ties to that mailbox -- users simply interact via 
tickets





Regarding possible solutions - maybe, if not referenced directly in IMAP (i.e. if someone doesn't 
ask about namespaced mailbox, i.e. in format `#:username:folder`) then treat it as 
"simple folder" and allow hash sign. Alternatively if someone uses full format then try to access 
shared mailbox? I guess it would be akin your second suggestion or some sort of mix between first 
and second?
Though, I'm not sure if there is any IMAP client that could use it so maybe first option - drop it 
altogether from IMAP - would be better?






Btw. "#" is reserved in James, but only as a prefix (it works in the middle of 
the folder name):

A4 CREATE #private:admin@atlantiscity:test
A4 NO CREATE You can not access a mailbox that does not belong to you

A5 CREATE #shared:admin@atlantiscity:test
A5 NO CREATE You can not access a mailbox that does not belong to you

A6 CREATE #private:admin@atlantiscity:#hashtest
A6 NO CREATE You can not access a mailbox that does not belong to you

A7 CREATE #shared:admin@atlantiscity:#hashtest
A7 NO CREATE You can not access a mailbox that does not belong to you

A8 CREATE #private:admin@atlantiscity:bla#hashtest
A8 NO CREATE You can not access a mailbox that does not belong to you

A9 CREATE #shared:admin@atlantiscity:bla#hashtest
A9 NO CREATE You can not access a mailbox that does not belong to you

A10 CREATE test2
A10 OK [MAILBOXID (27110)] CREATE completed.

A12 CREATE #hashtest2
A12 NO CREATE You can not access a mailbox that does not belong to you

A13 CREATE bla#hashtest2
A13 OK [MAILBOXID (27111)] CREATE completed.

-
To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
For additional commands, e-mail: server-user-h...@james.apache.org



Re: It's not possible to create folder which name starts with hash-sign (#)

2023-06-22 Thread Wojtek
I've been debugging it a bit and I _think_ the problem is with 
`org.apache.james.imap.main.PathConverter#isAbsolute` 
(https://github.com/apache/james-project/blob/master/protocols/imap/src/main/java/org/apache/james/imap/main/PathConverter.java#L60) 
method.


My understanding is that it should check if this is absolute path (i.e. 
`#:username:folder`) but because it only checks first character then it also returns 
"true" for simple folder name like "#test".


Maybe using `session.supportMultipleNamespaces() && mailboxName.charAt(0) == 
MailboxConstants.NAMESPACE_PREFIX_CHAR;` would work?


Then I ran into another issue with `org.apache.james.mailbox.model.MailboxPath#assertAcceptable` 
(https://github.com/apache/james-project/blob/master/mailbox/api/src/main/java/org/apache/james/mailbox/model/MailboxPath.java#L222) 
which also does the check.


It was introduced in https://issues.apache.org/jira/browse/MAILBOX-392 / 
https://github.com/linagora/james-project/pull/4168 but the MailboxPath class already has namespace 
/ user / name as separate members so I'm not sure that `name.startsWith("#");` check makes sense (it 
can't be namespace indication as we already have namespace apart)


After modifying `isAbsolute()` and `nameContainsForbiddenCharacters()` it seems 
to work fine(-ish*).

(* - the LIST after creation gives absolute path: `A7 LIST "" #hashtest11` … * `LIST 
(\HasNoChildren) "." "#private.admin@atlantiscity.#hashtest11"`)


I tried to run tests from Idea but again ran into issues with Scala, so I'll have to figure out 
better way to run them:

```
EventStore is already defined as trait EventStore
trait EventStore {
```

Wojtek

On 22/06/2023 11:01, Wojtek wrote:

Hi,


Wojtek

On 22/06/2023 01:32, Benoit TELLIER wrote:

Hello Wojtek,

That is because James employs a folder hierarchy where '#' is used to denote a 
namespace.


I assumed as much.


#private:wojtek:INBOX denotes your inbox on which I would have a shared access.
#shared:marketting:INBOX denotes a shared mailbox for the marketting team.

I bet you could do: #private:wojtek:#hashtest ?


Unfortunately not:

```
A4 CREATE #private:admin@atlantiscity:#hashtest
A4 NO CREATE You can not access a mailbox that does not belong to you
```

[More at the end]

( `store.getFolder("#private:" + email + ":#hashtest").create(HOLDS_MESSAGES)` )

What's weird is that the original exception that made me investigate it didn't have hashtag in the 
foldername itself:

```
21:33:47.588 [ERROR] o.a.j.i.p.StatusProcessor - Status failed for mailbox 
#private:u...@james.domain.com:Apple Mail To Do
org.apache.james.mailbox.exception.MailboxNotFoundException: #private:u...@james.domain.com:Apple 
Mail To Do can not be found
     at 
org.apache.james.mailbox.store.StoreMailboxManager.lambda$getMailboxReactive$1(StoreMailboxManager.java:282)

```


That being said, james have no support for accessing shared mailboxes in IMAP just quite yet. The 
usefulness of that addressing scheme is thus limited.


IMO we could:
  - Drop the #namespace:user:mailbox addressing sheme in IMAP as it is not 
currently in use...
  - Or (lighter) if we can't parse a mailbox path (no : after #) then keep the name as is, IE 
support #hashtest

  - Review and adopt another addressing sheme that matches those of eg cyrus.


I'm not sure how other implementations do it (only checked it from the end-user 
point of view).

As you mentioned, the namespaces doesn't seem to be directly visible in IMAP, nor it's possible to 
act on them - they are in the repository ("namespace" column) but that's just about it - LIST only 
shows effective folder name (i.e. "INBOX" and not "#private:wojtek:INBOX").


Trying to create mailbox that starts with `#`, be that namespace (#private:admin@atlantiscity:test) 
or plain folder (#test) name just doesn't work.


RFC mentiones namespaces (https://datatracker.ietf.org/doc/html/rfc3501#page-19) but the example is 
about usenet. I'm not sure how they are used in James (especially outside IMAP that you mentioned).


I couldn't find it in the documentation, but through searching I found:
https://github.com/apache/james-project/pull/680
https://issues.apache.org/jira/browse/JAMES-3659
https://www.mail-archive.com/server-dev@james.apache.org/msg71116.html
and finally
https://github.com/apache/james-project/blob/master/server/protocols/jmap-rfc-8621/doc/specs/spec/mail/rights.mdown

Which seems JMAP focused.

The concept of shared mailbox/being able to send messages on behalf of someone seems interesting 
though (at least in our case) usual modus operandi (for example for having support email) is:

- have dedicated mailbox for support user
- have ticketing system that ties to that mailbox -- users simply interact via 
tickets





Regarding possible solutions - maybe, if not referenced directly in IMAP (i.e. if someone doesn't 
ask about namespaced mailbox, i.e. in format `#:username:folder`) then treat it as 
"simple folder" and allow hash sign. Alternatively