From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jonas Bernoulli Newsgroups: gmane.emacs.bugs Subject: bug#50511: [PATCH] No longer raise error when authentication failed Date: Thu, 16 Sep 2021 20:32:11 +0200 Message-ID: <20210916183211.5669-1-jonas@bernoul.li> References: Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9338"; mail-complaints-to="usenet@ciao.gmane.io" To: 50511@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Sep 16 20:33:54 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mQwCn-0002Bn-Tv for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 16 Sep 2021 20:33:54 +0200 Original-Received: from localhost ([::1]:39728 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mQwCm-0007hN-7G for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 16 Sep 2021 14:33:52 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52924) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mQwBy-0007h8-9X for bug-gnu-emacs@gnu.org; Thu, 16 Sep 2021 14:33:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45000) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mQwBy-0005T1-2S for bug-gnu-emacs@gnu.org; Thu, 16 Sep 2021 14:33:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mQwBx-0002k5-TL for bug-gnu-emacs@gnu.org; Thu, 16 Sep 2021 14:33:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jonas Bernoulli Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 16 Sep 2021 18:33:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50511 X-GNU-PR-Package: emacs Original-Received: via spool by 50511-submit@debbugs.gnu.org id=B50511.163181714010480 (code B ref 50511); Thu, 16 Sep 2021 18:33:01 +0000 Original-Received: (at 50511) by debbugs.gnu.org; 16 Sep 2021 18:32:20 +0000 Original-Received: from localhost ([127.0.0.1]:56546 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQwBI-0002iy-9Q for submit@debbugs.gnu.org; Thu, 16 Sep 2021 14:32:20 -0400 Original-Received: from mail.hostpark.net ([212.243.197.30]:50682) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQwBG-0002in-Hi for 50511@debbugs.gnu.org; Thu, 16 Sep 2021 14:32:19 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id C8C7E165C9; Thu, 16 Sep 2021 20:32:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h= content-transfer-encoding:mime-version:references:in-reply-to :x-mailer:message-id:date:date:subject:subject:from:from :received:received; s=sel2011a; t=1631817134; bh=s1TCh/ow5v+yXrn jVH9kNvJ4VM0u0R+IcCUXUliTMQM=; b=NHbfbQafUgJbObrY+UxgAdxjNTwVxxf uhBz+ehiXVJIf1tLLpIkPhjqdv5WTYEqiEU8FyL3+wnmtCceRZJHEEDPgvcHiCb3 VWhRLIXQAs4ZEXNpiZclgcEsekq1t2cjdLsef1wq88/ZhU019BLljPPPrDYSIktz ZeRLvxJr5uCE= X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Original-Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail0.hostpark.net [127.0.0.1]) (amavisd-new, port 10224) with ESMTP id D96Gqn7KJxeW; Thu, 16 Sep 2021 20:32:14 +0200 (CEST) Original-Received: from customer (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.hostpark.net (Postfix) with ESMTPSA id 948D1165C1; Thu, 16 Sep 2021 20:32:11 +0200 (CEST) X-Mailer: git-send-email 2.33.0 In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:214497 Archived-At: * lisp/url/url-http.el (url-http-handle-authentication): Return t instead of raising an error, instructing the caller to invoke the request specific error handler (bug#50511). --- lisp/url/url-http.el | 94 ++++++++++++++++++++++---------------------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el index ba13a17a8f..1530016397 100644 --- a/lisp/url/url-http.el +++ b/lisp/url/url-http.el @@ -462,53 +462,53 @@ url-http-handle-authentication ;; credentials to the server, and they were wrong, so just give ;; up. (let ((authorization (assoc "Authorization" url-http-extra-headers))) - (when (and authorization - (not (string-match "^NTLM " (cdr authorization)))) - (error "Wrong authorization used for %s" url))) - - ;; find strongest supported auth - (dolist (this-auth auths) - (setq this-auth (url-eat-trailing-space - (url-strip-leading-spaces - this-auth))) - (let* ((this-type - (downcase (if (string-match "[ \t]" this-auth) - (substring this-auth 0 (match-beginning 0)) - this-auth))) - (registered (url-auth-registered this-type)) - (this-strength (cddr registered))) - (when (and registered (> this-strength strength)) - (setq auth this-auth - type this-type - strength this-strength)))) - - (if (not (url-auth-registered type)) - (progn - (widen) - (goto-char (point-max)) - (insert "
Sorry, but I do not know how to handle " (or type auth url "") - " authentication. If you'd like to write it," - " please use M-x report-emacs-bug RET.
") - ;; We used to set a `status' var (declared "special") but I can't - ;; find the corresponding let-binding, so it's probably an error. - ;; FIXME: Maybe it was supposed to set `success', i.e. to return t? - ;; (setq status t) - nil) ;; Not success yet. - - (let* ((args (url-parse-args (subst-char-in-string ?, ?\; auth))) - (auth (url-get-authentication auth-url - (cdr-safe (assoc "realm" args)) - type t args))) - (if (not auth) - t ;Success. - (push (cons (if proxy "Proxy-Authorization" "Authorization") auth) - url-http-extra-headers) - (let ((url-request-method url-http-method) - (url-request-data url-http-data) - (url-request-extra-headers url-http-extra-headers)) - (url-retrieve-internal url url-callback-function - url-callback-arguments)) - nil))))) ;; Not success yet. + (if (and authorization + (not (string-match "^NTLM " (cdr authorization)))) ;Bug#43566 + t ;; Instruct caller to signal an error. Bug#50511 + ;; Find strongest supported auth. + (dolist (this-auth auths) + (setq this-auth (url-eat-trailing-space + (url-strip-leading-spaces + this-auth))) + (let* ((this-type + (downcase (if (string-match "[ \t]" this-auth) + (substring this-auth 0 (match-beginning 0)) + this-auth))) + (registered (url-auth-registered this-type)) + (this-strength (cddr registered))) + (when (and registered (> this-strength strength)) + (setq auth this-auth + type this-type + strength this-strength)))) + + (if (not (url-auth-registered type)) + (progn + (widen) + (goto-char (point-max)) + (insert "
Sorry, but I do not know how to handle " + (or type auth url "") + " authentication. If you'd like to write it," + " please use M-x report-emacs-bug RET.
") + ;; We used to set a `status' var (declared "special") but I can't + ;; find the corresponding let-binding, so it's probably an error. + ;; FIXME: Maybe it was supposed to set `success', i.e. to return t? + ;; (setq status t) + nil) ;; Not success yet. + + (let* ((args (url-parse-args (subst-char-in-string ?, ?\; auth))) + (auth (url-get-authentication auth-url + (cdr-safe (assoc "realm" args)) + type t args))) + (if (not auth) + t ;Success. + (push (cons (if proxy "Proxy-Authorization" "Authorization") auth) + url-http-extra-headers) + (let ((url-request-method url-http-method) + (url-request-data url-http-data) + (url-request-extra-headers url-http-extra-headers)) + (url-retrieve-internal url url-callback-function + url-callback-arguments)) + nil))))))) ;; Not success yet. (defun url-http-parse-response () "Parse just the response code." -- 2.33.0