Gnus development mailing list
 help / color / mirror / Atom feed
* nntp telnet connection with remote command echoes
@ 2000-07-05 23:32 Rod Whitby
  2000-07-10  5:22 ` list.ding
  2000-08-14 19:05 ` Lars Magne Ingebrigtsen
  0 siblings, 2 replies; 5+ messages in thread
From: Rod Whitby @ 2000-07-05 23:32 UTC (permalink / raw)


I'd like to make some changes to nntp.el to handle remote telnet
programs that echo commands.  I'm looking for advice on whether there
is another way to solve the problem instead of changing nntp.el

Here's the background:

I'm using Gnus to read news from behind a telnet firewall.

The firewall has a very restricted version of telnet.  It does not
understand "mode" commands.  So I modified nntp-open-telnet (well,
actually I copied it and changed the name before modifying it) to look
for the correct login and password prompts (the defaults in
nntp-open-telnet don't match this weird firewall system) and to not
try and send the mode character command (as the firewall telnet won't
accept it - I presume the intent of changing the local escape
character to ^X is to ensure that the "mode character" command goes to
the gateway telnet program instead of the local telnet program).

When I connect to the remote system, all the NNTP commands are echoed
(starting with MODE READER).

So I've created a new defvoo variable "nntp-telnet-remote-echoes", and
modified nntp.el to rip out the echoed commands from the buffer.

Are my assumptions about the "mode character" command going to the
gateway telnet program (not the local telnet program) correct ?

Is there a better way to solve this problem ?

Would the maintainers of nntp.el accept a patch that fixes this
problem (the assumption being that I've written it such that it works
the same as it does currently if the nntp-telnet-remote-echoes
variable is nil) ?

-- 
-- Rod Whitby, Snr Staff Engr, Electronic Design Automation --
-- Motorola Australia Software Centre - Adelaide, Australia --
-- Phone: +61 8 8203 3526, Fax: +61 8 8203 3501, <GMT+9:30> --




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: nntp telnet connection with remote command echoes
  2000-07-05 23:32 nntp telnet connection with remote command echoes Rod Whitby
@ 2000-07-10  5:22 ` list.ding
  2000-07-10 11:49   ` Kai Großjohann
  2000-08-14 19:05 ` Lars Magne Ingebrigtsen
  1 sibling, 1 reply; 5+ messages in thread
From: list.ding @ 2000-07-10  5:22 UTC (permalink / raw)


Rod Whitby <list.ding@rwhitby.net> writes:
> I'd like to make some changes to nntp.el to handle remote telnet
> programs that echo commands.  I'm looking for advice on whether there
> is another way to solve the problem instead of changing nntp.el

Can I assume from the total lack of responses that I should just go
ahead and post the diff ? :-)

Is there no-one else on the list who has to deal with a telnet that
echoes commands ?

-- 
-- Rod Whitby, Snr Staff Engr, Electronic Design Automation --
-- Motorola Australia Software Centre - Adelaide, Australia --
-- Phone: +61 8 8203 3526, Fax: +61 8 8203 3501, <GMT+9:30> --




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: nntp telnet connection with remote command echoes
  2000-07-10  5:22 ` list.ding
@ 2000-07-10 11:49   ` Kai Großjohann
  2000-07-11  0:22     ` Rod Whitby
  0 siblings, 1 reply; 5+ messages in thread
From: Kai Großjohann @ 2000-07-10 11:49 UTC (permalink / raw)
  Cc: ding

What you're suggesting sounds good.  Just make it configurable, and
you should be all set.  If it was configurable via a server parameter,
that would be even greater.
kai
-- 
I like BOTH kinds of music.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: nntp telnet connection with remote command echoes
  2000-07-10 11:49   ` Kai Großjohann
@ 2000-07-11  0:22     ` Rod Whitby
  0 siblings, 0 replies; 5+ messages in thread
From: Rod Whitby @ 2000-07-11  0:22 UTC (permalink / raw)


Kai writes:
> What you're suggesting sounds good.  Just make it configurable, and
> you should be all set.  If it was configurable via a server parameter,
> that would be even greater.

That's what I've done - I've added a 'nntp-telnet-remote-echoes'
variable that can be set in the select method or server parameters).
It defaults to nil, which should leave the operation unchanged.

Here's the diff against the CVS snapshot of nntp.el - how do I get
this tested by others, and eventually included in the distribution ?

*** /cygdrive/c/TEMP/T0001040	Tue Jul 11 09:48:05 2000
--- nntp.el	Mon Jul 10 15:12:09 2000
***************
*** 112,117 ****
--- 112,120 ----
  (defvoo nntp-telnet-switches '("-8")
    "Switches given to the telnet command.")
  
+ (defvoo nntp-telnet-remote-echoes nil
+   "If non-nil, commands echoed by the remote server will be stripped.")
+ 
  (defvoo nntp-end-of-line "\r\n"
    "String to use on the end of lines when talking to the NNTP server.
  This is \"\\r\\n\" by default, but should be \"\\n\" when
***************
*** 257,266 ****
      (set-buffer (process-buffer process))
      (goto-char (point-min))
      (while (and (or (not (memq (char-after (point)) '(?2 ?3 ?4 ?5)))
! 		    (looking-at "480"))
  		(memq (process-status process) '(open run)))
!       (when (looking-at "480")
  	(nntp-handle-authinfo process))
        (nntp-accept-process-output process)
        (goto-char (point-min)))
      (prog1
--- 260,276 ----
      (set-buffer (process-buffer process))
      (goto-char (point-min))
      (while (and (or (not (memq (char-after (point)) '(?2 ?3 ?4 ?5)))
! 		    (looking-at "480")
! 		    (and nntp-telnet-remote-echoes nntp-last-command
! 			 (looking-at nntp-last-command)))
  		(memq (process-status process) '(open run)))
!       (cond
!        ((looking-at "480")
  	(nntp-handle-authinfo process))
+        ((and nntp-telnet-remote-echoes nntp-last-command
+ 	     (looking-at nntp-last-command))
+ 	(delete-region (point) (progn (forward-line 1) (point))))
+        )
        (nntp-accept-process-output process)
        (goto-char (point-min)))
      (prog1
***************
*** 419,424 ****
--- 429,438 ----
      (if (search-forward "\n" nil t)
  	t
        nil))
+    ;; An echoed command.
+    ((and nntp-telnet-remote-echoes nntp-last-command
+ 	 (looking-at nntp-last-command))
+     (delete-region (point) (progn (forward-line 1) (point))))
     ;; No result here.
     (t
      nil)))
***************
*** 542,547 ****
--- 556,565 ----
  	;; Now all replies are received.  We remove CRs.
  	(set-buffer buf)
  	(goto-char (point-min))
+ 	;; Remove an echoed command.
+ 	(when (and nntp-telnet-remote-echoes nntp-last-command
+ 		   (looking-at nntp-last-command))
+ 	  (delete-region (point) (progn (forward-line 1) (point))))
  	(while (search-forward "\r" nil t)
  	  (replace-match "" t t))
  
***************
*** 979,992 ****
      (when nntp-process-callback
        ;; do we have an error message?
        (goto-char nntp-process-start-point)
!       (if (memq (following-char) '(?4 ?5))
! 	  ;; wants credentials?
! 	  (if (looking-at "480")
! 	      (nntp-handle-authinfo nntp-process-to-buffer)
! 	    ;; report error message.
! 	    (nntp-snarf-error-message)
! 	    (nntp-do-callback nil))
  
  	;; got what we expect?
  	(goto-char (point-max))
  	(when (re-search-backward
--- 997,1017 ----
      (when nntp-process-callback
        ;; do we have an error message?
        (goto-char nntp-process-start-point)
!       (cond
!        ((memq (following-char) '(?4 ?5))
! 	;; wants credentials?
! 	(if (looking-at "480")
! 	    (nntp-handle-authinfo nntp-process-to-buffer)
! 	  ;; report error message.
! 	  (nntp-snarf-error-message)
! 	  (nntp-do-callback nil)))
! 
!        ;; Remove echoed command.
!        ((and nntp-telnet-remote-echoes nntp-last-command
! 	     (looking-at nntp-last-command))
! 	(delete-region (point) (progn (forward-line 1) (point))))
  
+        (t
  	;; got what we expect?
  	(goto-char (point-max))
  	(when (re-search-backward
***************
*** 1008,1014 ****
  	  ;; report it.
  	  (goto-char (point-max))
  	  (nntp-do-callback
! 	   (buffer-name (get-buffer nntp-process-to-buffer))))))))
  
  (defun nntp-do-callback (arg)
    (let ((callback nntp-process-callback)
--- 1033,1039 ----
  	  ;; report it.
  	  (goto-char (point-max))
  	  (nntp-do-callback
! 	   (buffer-name (get-buffer nntp-process-to-buffer)))))))))
  
  (defun nntp-do-callback (arg)
    (let ((callback nntp-process-callback)

-- 
-- Rod Whitby, Snr Staff Engr, Electronic Design Automation --
-- Motorola Australia Software Centre - Adelaide, Australia --
-- Phone: +61 8 8203 3526, Fax: +61 8 8203 3501, <GMT+9:30> --




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: nntp telnet connection with remote command echoes
  2000-07-05 23:32 nntp telnet connection with remote command echoes Rod Whitby
  2000-07-10  5:22 ` list.ding
@ 2000-08-14 19:05 ` Lars Magne Ingebrigtsen
  1 sibling, 0 replies; 5+ messages in thread
From: Lars Magne Ingebrigtsen @ 2000-08-14 19:05 UTC (permalink / raw)


Rod Whitby <list.ding@rwhitby.net> writes:

> try and send the mode character command (as the firewall telnet won't
> accept it - I presume the intent of changing the local escape
> character to ^X is to ensure that the "mode character" command goes to
> the gateway telnet program instead of the local telnet program).

Yes, that's the intention.

> When I connect to the remote system, all the NNTP commands are echoed
> (starting with MODE READER).

[...]

> Would the maintainers of nntp.el accept a patch that fixes this
> problem (the assumption being that I've written it such that it works
> the same as it does currently if the nntp-telnet-remote-echoes
> variable is nil) ?

If you think that this is something that will be useful for others,
then I think the patch should be applied.  However, if you're the only
one that will ever see this, er, odd version of telnetd, then I think
it probably shouldn't be applied.

-- 
(domestic pets only, the antidote for overdose, milk.)
   larsi@gnus.org * Lars Magne Ingebrigtsen



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2000-08-14 19:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-07-05 23:32 nntp telnet connection with remote command echoes Rod Whitby
2000-07-10  5:22 ` list.ding
2000-07-10 11:49   ` Kai Großjohann
2000-07-11  0:22     ` Rod Whitby
2000-08-14 19:05 ` Lars Magne Ingebrigtsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).