samth / test-bugs

2 stars 0 forks source link

stmp-send-message fails authentication with long sender/sender/password #172

Closed racket-bug-submit closed 12 years ago

racket-bug-submit commented 12 years ago
Originally submitted by John Griffin on: Thu Jan 19 19:36:01 -0500 2012

stmp-send-message failed to connect on one gmail account while working fine for two others. The problem is around line 100 of smtp.rkt where a base64-encode does a line break at 72 characters on the one account which happens to be long enough to expose a symptom (authentication failure). The two functioning email accounts happen to be shorter strings. Whether using a regex-replace* is better than using (base64-encode-stream in out #"") seemed a toss up. My fix is below for someone to review.

(when auth-user (log "auth\n") (fprintf w "AUTH PLAIN ~a\r\n" ;; Encoding adds CRLF
(regexp-replace*

rx"\r\n"

             (base64-encode
              (string->bytes/latin-1
               (format "~a\0~a\0~a" auth-user auth-user auth-passwd))) ""))
  (check-reply r 235 w))
Steps to Reproduce:
; When using a SENDER PASSWORD combination whose base64
; encoding of SENDER\0SENDER\0PASSWORD is longer than 72 bytes.

(smtp-send-message
           "smtp.gmail.com"
           SENDER
           (list recipient)
           (insert-field "Subject" subject
    (insert-field "To" recipient empty-header))
       (regexp-split #px"\n" message-text)
           #:port-no 465
           #:tcp-connect ssl-connect
           #:auth-user SENDER
           #:auth-passwd PASSWORD)
Release:
5.2.1.3
Environment:
macosx "Darwin JGiMac24.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun  7 16:33:36 PDT
 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386 i386" (i386-macosx/3m) (get-display-depth) =
 32
Human Language: english
(current-memory-use) 225617472
Links: (links) = ("cumulus"); (links #:user? #f) = (); (links #:root? #t) = (); (links
 #:user? #f #:root? #t) = ()

Collections:
("/Users/john/Library/Racket/5.2.1.3/collects"
 (non-existent-path))
("/Users/john/Racket-v5.2.1.3/collects"
 ("2htdp" "algol60" "at-exp" "browser" "combinator-parser" "compiler" "config" "data"
 "datalog" "db" "defaults" "deinprogramm" "drracket" "drscheme" "dynext" "embedded-gui"
 "eopl" "errortrace" "ffi" "file" "framework" "frtime" "games" "graphics" "gui-debugger"
 "guibuilder" "handin-client" "handin-server" "help" "hierlist" "honu" "htdp" "html"
 "icons" "images" "info-domain" "lang" "launcher" "lazy" "macro-debugger" "make" "meta"
 "mred" "mrlib" "mysterx" "mzcom" "mzlib" "mzscheme" "net" "openssl" "parser-tools"
 "picturing-programs" "plai" "planet" "plot" "preprocessor" "profile" "r5rs" "r6rs"
 "racket" "racklog" "rackunit" "raco" "reader" "readline" "redex" "repo-time-stamp" "rnrs"
 "s-exp" "scheme" "schemeunit" "scribble" "scribblings" "scriblib" "setup" "sgl" "sirmail"
 "slatex" "slideshow" "srfi" "stepper" "string-constants" "swindle" "syntax"
 "syntax-color" "teachpack" "test-box-recovery" "test-engine" "tests" "tex2page" "texpict"
 "trace" "typed" "typed-racket" "typed-scheme"!
  "unstable" "version" "web-server" "wxme" "xml" "xrepl"))

Computer Language: (("Determine language from source") (#(#t print mixed-fraction-e #f #t
 debug) (default) #() "#lang racket/base\n" #f #t))
This bug was converted from Gnats bug 12501.

[anon-submit; griffinish at gmail dot com]

racket-bug-submit commented 12 years ago
On Tue, 21 Feb 2012 08:18:09 -0500, mflatt at racket-lang dot org wrote:

A commit by mflatt@racket-lang.org has resolved this report: b656219f8a