summaryrefslogtreecommitdiff
path: root/libproto/pop/pop3_trace.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2010-09-07 18:06:11 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2010-09-07 22:48:23 +0300
commitf08e6e0842bae2dd575b085a8182cdd0f0d55cc5 (patch)
treee3f8db0cf4c735771eee74a4239914a62106683a /libproto/pop/pop3_trace.c
parent817286698ccc3f262cd0003401becef6c11050ae (diff)
downloadmailutils-f08e6e0842bae2dd575b085a8182cdd0f0d55cc5.tar.gz
mailutils-f08e6e0842bae2dd575b085a8182cdd0f0d55cc5.tar.bz2
Improve transcript stream.
* include/mailutils/stream.h (MU_IOCTL_LEVEL): New ioctl op. (XSCRIPT_NORMAL, XSCRIPT_SECURE, XSCRIPT_PAYLOAD): New constants. * include/mailutils/sys/xscript-stream.h (_mu_xscript_stream) <level>: New member. * mailbox/xscript-stream.c (TRANS_DISABLED): New flag. (print_transcript): Amount of output varies depending on the current output level. For secure data, try to recognize passwords and to replace them with *** on output. (_xscript_ctl): Support MU_IOCTL_LEVEL. * pop3d/extra.c (set_xscript_level): New function. * pop3d/pop3d.h (set_xscript_level): New proto. * pop3d/retr.c (pop3d_retr): Set XSCRIPT_PAYLOAD level before sending actual data and reset it to XSCRIPT_NORMAL afterwards. * pop3d/top.c (pop3d_top): Likewise. * pop3d/user.c: Set XSCRIPT_SECURE level while expecting the PASS command. * imap4d/fetch.c (imap4d_fetch): Run imap4d_fetch0 in XSCRIPT_PAYLOAD level. * imap4d/uid.c (imap4d_uid): Likewise. * imap4d/imap4d.c (imap4d_mainloop): Unless started in preauth mode, select XSCRIPT_SECURE mode until authentication has been passed. * imap4d/imap4d.h (set_xscript_level): New proto. * imap4d/io.c (io_format_completion_response): Switch to XSCRIPT_NORMAL level when changing to the authenticated state. (imap4d_readline): Read literals in XSCRIPT_PAYLOAD level. * imap4d/util.c (set_xscript_level): New function. * include/mailutils/pop3.h (mu_pop3_trace_mask): New prototype. (MU_POP3_XSCRIPT_MASK): New macro. (_mu_pop3_xscript_level): New proto. * libproto/pop/pop3_pass.c (mu_pop3_pass): Set XSCRIPT_SECURE while sending the password. * libproto/pop/pop3_retr.c (mu_pop3_retr): Set XSCRIPT_PAYLOAD before going to MU_POP3_RETR_RX state. * libproto/pop/pop3_stream.c (_pop3_event_cb): Set XSCRIPT_NORMAL. * libproto/pop/pop3_top.c (mu_pop3_top): Set XSCRIPT_PAYLOAD before going to MU_POP3_TOP_RX state. * libproto/pop/pop3_trace.c (mu_pop3_trace_mask) (_mu_pop3_xscript_level): New functions. * libproto/pop/mbox.c (pop_open): Set trace masks depending on the trace6 and trace7 debug levels. * examples/pop3client.c (com_verbose): Allow to mask/unmask transcript levels.
Diffstat (limited to 'libproto/pop/pop3_trace.c')
-rw-r--r--libproto/pop/pop3_trace.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/libproto/pop/pop3_trace.c b/libproto/pop/pop3_trace.c
index 1a4c27f13..514ac3cad 100644
--- a/libproto/pop/pop3_trace.c
+++ b/libproto/pop/pop3_trace.c
@@ -115,4 +115,36 @@ mu_pop3_trace (mu_pop3_t pop3, int op)
return EINVAL;
}
+int
+mu_pop3_trace_mask (mu_pop3_t pop3, int op, int lev)
+{
+ switch (op)
+ {
+ case MU_POP3_TRACE_SET:
+ pop3->flags |= MU_POP3_XSCRIPT_MASK(lev);
+ break;
+
+ case MU_POP3_TRACE_CLR:
+ pop3->flags &= ~MU_POP3_XSCRIPT_MASK(lev);
+ break;
+
+ case MU_POP3_TRACE_QRY:
+ if (pop3->flags & MU_POP3_XSCRIPT_MASK(lev))
+ break;
+ return MU_ERR_NOENT;
+
+ default:
+ return EINVAL;
+ }
+ return 0;
+}
+
+int
+_mu_pop3_xscript_level (mu_pop3_t pop3, int xlev)
+{
+ if (mu_stream_ioctl (pop3->carrier, MU_IOCTL_LEVEL, &xlev) == 0)
+ return xlev;
+ return XSCRIPT_NORMAL;
+}
+

Return to:

Send suggestions and report system problems to the System administrator.