Closed Bug 203099 Opened 21 years ago Closed 3 years ago

Asked for password, but doesn't ask for username if username not provided in the prefs - "message could not be sent ... for an unknown reason"

Categories

(MailNews Core :: Networking: SMTP, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: ch.ey, Unassigned)

References

Details

(Keywords: reproducible, Whiteboard: [patchlove][has patch])

Attachments

(2 obsolete files)

1. Configure a SMTP server, check "Use name and password" but don't enter a
Username.
2. Send a mail through this server.

Actual Results:
It asks for password but not for username and fails sending

Expected Results:
It asks for username and password and sending succeeds
Oh, I forgot: Trunk nightly 2003042222 on Linux.

There's some curious code in nsSmtpProtocol::AuthLoginUsername and
nsSmtpProtocol::GetUsernamePassword.

It tries to get the username via smtpServer->GetUsername(getter_Copies(username)).
If this fails it tries to get the password via smtpServer->GetPassword(aPassword). 

If this works, it tries to get the username via smtpServer->GetUsername(aUsername).

If getting the password or the second try for getting username fails, it prompts
the user for password.

That's all. And it looks kind of stupid to me.
-> to me
Assignee: mscott → ch.ey
Attached patch proposed patch (obsolete) — Splinter Review
This patch changes GetUsernamePassword() to really get username and password.
It indirectly uses GetUsernamePasswordWithUI() over the new function
PromptForUsernamePassword().

This is all analogue to GetPassword/PromptPassword/GetPasswordWithUI, although
not few code is duplicate now. I could also merge GetUsernamePassword with
GetPassword and incorporate PromptForPassword/PromptForUsernamePassword.
That would result in one a little bigger function but less code overall.


What I'm not sure about is if GetUsernamePasswordWithUI() in nsSmtpServer
should assign the username get permanently. If the user didn't enter a username
in the prefs, we could assume he knew what he did.
That would make it possible to use one SMTP server for different accounts where
the server requires different username/password.


On this way I also changed the strings for NS_SMTP_PASSWORD_PROMPT and
POP3_ENTER_PASSWORD_PROMPT to 
Enter your password for %1$s logging into %2$s:
instead of
Enter your password for %1$s@%2$s:
because the old one fooled many users (see bug 90507, esp. comment 22).

Any comments are welcome.
-    if (*aPassword && **aPassword)
+    if (**aPassword && *aPassword)
this will crash if *aPassword is null - I think it was the other way around for
that reason.

same thing here:
+    if (**aUsername && *aUsername)
+    {

Re your comments, they sound reasonable. I'm not sure if there was some reason
for the way things are. I can try to look through the checkin logs and see.
> +    if (**aPassword && *aPassword)
> this will crash if *aPassword is null - I think it was the other way around for
> that reason.

Aua, anybody seen my brain? A crash if the pointers pointer is null was what I
wanted to avoid, thought it was wrong as it was. But you're right.
Attached patch patch v2 (obsolete) — Splinter Review
Changed the wrong pointer-test-changes back.
Attachment #122769 - Attachment is obsolete: true
When patch for "dialog format correction" will be available?
You can find many questions & "Bug Reports" due to this bug at Mozillazine
Thunderbird forums, especialy in "Thunderbird Bug forum".
Dialog correction for POP server case(Bug 212937) has already been done.
Should we open another bug for "dialog format correction for SMTP server" only?
WADA, due to some problems on fixing the original issue of this bug, I've done a
separate patch to change the dialog format.
I posted it to bug 90507 (where it belongs) and it has been checked in on
2003-10-21. So you should be able to see the effect in the latest trunk builds.
Summary: When sending mail Mozilla don't asks for username if not provided in the prefs → When sending mail Mozilla doesn't ask for username if not provided in the prefs
Product: MailNews → Core
This is still exist in 
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1b1pre) Gecko/20080831032002 Shredder/3.0b1pre
Product: Core → MailNews Core
Christian, is more info needed from Nikolay?   
Do we have a regression?
Or is what's left still related to bug 90507?
QA Contact: nbaca → networking.smtp
Rod, does this address any of bug 426185?
Severity: normal → minor
Summary: When sending mail Mozilla doesn't ask for username if not provided in the prefs → When sending mail Mozilla doesn't ask for username if not provided in the prefs - "message could not be sent ... for an unknown reason"
Whiteboard: [patchlove][has patch]
If the username is not set permanently from the prompt, then users will still complain that Thunderbird cannot remember their username even though they can see it in Account Settings.

If the username *is* set permanently from the prompt, that's crazy UI design -- to have a required field that can be left blank, and then prompt for the value at some later time in a separate dialog.

So I do not think that this approach is a useful one.
Comment on attachment 124167 [details] [diff] [review]
patch v2

Patch has bitrotted. Christian, up for a new patch? :)

$ patch -p0 --dry-run < ~/Desktop/p203099.diff 
patching file nsSmtpProtocol.cpp
Hunk #1 FAILED at 1667.
Hunk #2 FAILED at 1682.
Hunk #3 FAILED at 1702.
Hunk #4 FAILED at 1723.
Hunk #5 FAILED at 1767.
5 out of 5 hunks FAILED -- saving rejects to file nsSmtpProtocol.cpp.rej
patching file nsSmtpProtocol.h
Hunk #1 FAILED at 245.
1 out of 1 hunk FAILED -- saving rejects to file nsSmtpProtocol.h.rej
can't find file to patch at input line 184
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|Index: nsMsgComposeStringBundle.h
|===================================================================
|RCS file: /cvsroot/mozilla/mailnews/compose/src/nsMsgComposeStringBundle.h,v
|retrieving revision 1.37
|diff -u -w -r1.37 nsMsgComposeStringBundle.h
|--- nsMsgComposeStringBundle.h 2 Dec 2002 23:43:20 -0000       1.37
|+++ nsMsgComposeStringBundle.h 9 May 2003 10:02:57 -0000
--------------------------
File to patch:
Attachment #124167 - Attachment is obsolete: true
Removing myslef on all the bugs I'm cced on. Please NI me if you need something on MailNews Core bugs from me.

Seems improbable that this would still exist.

bouvjaga, what do you think?

Assignee: ch.ey → nobody
Severity: minor → normal
Flags: needinfo?(todventtu)
Summary: When sending mail Mozilla doesn't ask for username if not provided in the prefs - "message could not be sent ... for an unknown reason" → Asked for password, but doesn't ask for username if not provided in the prefs - "message could not be sent ... for an unknown reason"

Still repro.

Went to Account settings, SMTP, removed my username - it let me do it! For IMAP, it does not let me remove it, it complains and just puts it back.

Then, when trying to send an email, it does not ask for username and the sending fails.

Arch Linux
TB 60.6.1

Flags: needinfo?(todventtu)
Keywords: reproducible
Summary: Asked for password, but doesn't ask for username if not provided in the prefs - "message could not be sent ... for an unknown reason" → Asked for password, but doesn't ask for username if username not provided in the prefs - "message could not be sent ... for an unknown reason"

Version 91 has all new smtp backend code. If you can still reproduce this issue, please file a new bug report https://bugzilla.mozilla.org/enter_bug.cgi?product=MailNews%20Core&component=Networking%3A%20SMTP

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → INCOMPLETE
See Also: → 1730151
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: