Gnus development mailing list
 help / color / mirror / Atom feed
* nnimap/gssapi/imtest pty stuff
@ 2001-02-15  1:51 NAGY Andras
  2001-02-15  2:36 ` NAGY Andras
  0 siblings, 1 reply; 4+ messages in thread
From: NAGY Andras @ 2001-02-15  1:51 UTC (permalink / raw)


Finally, after fixing the calculate-literal-size-first bug, nnimap
over imtest seemed to work.  While looking at the output of M-x
list-processes, I noticed the following line:

imap         run       *nnimap* mailbox	/dev/pts/14 /usr/local/bin/bash -c imtest -m gssapi -u nagya -p 143 mailbox.inf.elte.hu

That is, imtest has a controlling terminal.  My system (AIX 4.3)
happens to allocate ptys for user programs with permissions like this:

crw-rw-rw-   1 root     system    27, 14 Feb 15 02:25 /dev/pts/14

That is, world read/write acces, and no chance to change this.
Cat'ting the tty causes commands sent out by imap.el to be output by
cat, and imap.el to freeze -- a nice security and denial of service
issue.

But why use a pty anyway?  A pipe would be much simplier and secure.
Let's use a pipe then:

diff -u -r6.3 imap.el
--- imap.el     2000/12/19 22:18:56     6.3
+++ imap.el     2001/02/15 01:33:21
@@ -510,6 +510,7 @@
       (let* ((port (or port imap-default-port))
             (coding-system-for-read imap-coding-system-for-read)
             (coding-system-for-write imap-coding-system-for-write)
+            (process-connection-type nil)
             (process (start-process
                       name buffer shell-file-name shell-command-switch
                       (format-spec

That is, tell emacs not to use any tty (as seen in w3's ssl.el, which
is being used for talking with openssl).

Of course, it simply hangs.  Figured out I should disable imtest's
output buffering:

--- imtest.c.orig       Thu Feb 15 02:22:13 2001
+++ imtest.c    Thu Feb 15 02:20:42 2001
@@ -1179,6 +1179,10 @@
   int dotls=0;
   int server_supports_tls;

+  /* do not buffer output */
+  setbuf(stdout, NULL);
+  setbuf(stderr, NULL);
+
   /* look at all the extra args */
   while ((c = getopt(argc, argv, "zvk:l:p:u:a:m:f:r:t:")) != EOF)
     switch (c) {


Seems to work nice, able to browse folders, read messages etc.

But when trying to upload the Gcc of a message, it hangs at `Setting
marks in nnimap+server:group...'...  imap-log contains:

398 APPEND "INBOX.archive.elte.test.group" {634}
+ go ahead

[... text of the message, exaclty as long as stated ...]

[... at this point, end of the message, and both emacs and imtest just
sit and wait ...]

[... I interrupt emacs with C-g, Gnus acts as if something went wrong
during sending.  I kill the buffer and check for new mail. ...]

399 SELECT "INBOX"

[... Gnus sent a command ...]

398 OK [APPENDUID 979734662 12] Completed

[... And imtest realizes here it has something to say, and does so
(acknowledges the APPEND command) ... ]

* FLAGS (\Answered \Flagged \Draft \Deleted \Seen)
* OK [PERMANENTFLAGS (\Answered \Flagged \Draft \Deleted \Seen \*)]  
* 1 EXISTS
* 0 RECENT
* OK [UIDVALIDITY 975409728]  
* OK [UIDNEXT 2194]  
399 OK [READ-WRITE] Completed

[... And then replies to and acknowledges the SELECT command ...]

400 UID SEARCH UNSEEN UNDELETED

[... Life goes on ...]



Interestingly, this works fine if using a pty.


Any ideas how to fix this?


Andras



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

* Re: nnimap/gssapi/imtest pty stuff
  2001-02-15  1:51 nnimap/gssapi/imtest pty stuff NAGY Andras
@ 2001-02-15  2:36 ` NAGY Andras
  2001-02-15  2:45   ` Daniel Pittman
  2001-02-15  9:36   ` Simon Josefsson
  0 siblings, 2 replies; 4+ messages in thread
From: NAGY Andras @ 2001-02-15  2:36 UTC (permalink / raw)


NAGY Andras <nagya@inf.elte.hu> writes:

> Any ideas how to fix this?

setbuf(stdin, NULL) in imtest.c.


I dream of a world where capabilities of emacs can be extended through
loadable native object code and lisp wrappers, instead of having to
parse the hairy output of helper programs, which were designed for
debugging and not for everyday use by a mailer.


Andras



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

* Re: nnimap/gssapi/imtest pty stuff
  2001-02-15  2:36 ` NAGY Andras
@ 2001-02-15  2:45   ` Daniel Pittman
  2001-02-15  9:36   ` Simon Josefsson
  1 sibling, 0 replies; 4+ messages in thread
From: Daniel Pittman @ 2001-02-15  2:45 UTC (permalink / raw)


On 15 Feb 2001, NAGY Andras wrote:
> NAGY Andras <nagya@inf.elte.hu> writes:
> 
>> Any ideas how to fix this?
> 
> setbuf(stdin, NULL) in imtest.c.
> 
> I dream of a world where capabilities of emacs can be extended through
> loadable native object code and lisp wrappers, instead of having to
> parse the hairy output of helper programs, which were designed for
> debugging and not for everyday use by a mailer.

*grin*  Port SSL network connection code to XEmacs as a loadable module.
21.2 support arbitrary binary extensions. :)

        Daniel

-- 
She takes medicine medicine / Every damn day
For she thinks she is sick / She was brought up that way
        -- Switchblade Symphony, _Funnel_



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

* Re: nnimap/gssapi/imtest pty stuff
  2001-02-15  2:36 ` NAGY Andras
  2001-02-15  2:45   ` Daniel Pittman
@ 2001-02-15  9:36   ` Simon Josefsson
  1 sibling, 0 replies; 4+ messages in thread
From: Simon Josefsson @ 2001-02-15  9:36 UTC (permalink / raw)
  Cc: ding

On 15 Feb 2001, NAGY Andras wrote:

> > Any ideas how to fix this?
>
> setbuf(stdin, NULL) in imtest.c.

Nice.  Did you send patches upstream to CMU people?

> I dream of a world where capabilities of emacs can be extended through
> loadable native object code and lisp wrappers, instead of having to
> parse the hairy output of helper programs, which were designed for
> debugging and not for everyday use by a mailer.

I believe there are patches for Emacs (20) to dynamically load .so's.
Elisp wrappers that load .so's implementing base64, md5, etc are
floating around. You'd still need to write imtest.so though.




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

end of thread, other threads:[~2001-02-15  9:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-15  1:51 nnimap/gssapi/imtest pty stuff NAGY Andras
2001-02-15  2:36 ` NAGY Andras
2001-02-15  2:45   ` Daniel Pittman
2001-02-15  9:36   ` Simon Josefsson

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).