From 373a565b4f0cb765be33dc6efe63b544ecccedb5 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Mon, 4 Jun 2007 10:02:10 +0200 Subject: [PATCH] Documented the protocol. --- submit/PROTOCOL | 27 +++++++++++++++++++++++++++ submit/commands.c | 6 ++++++ 2 files changed, 33 insertions(+) create mode 100644 submit/PROTOCOL diff --git a/submit/PROTOCOL b/submit/PROTOCOL new file mode 100644 index 0000000..7002b5a --- /dev/null +++ b/submit/PROTOCOL @@ -0,0 +1,27 @@ +Protocol spoken by the submit server +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +(1) Server sends "+OK\n" or "+TLS\n" + +(2) TLS is started if requested + +(3) Client sends hello, server replies + +(4) Loop: client sends command, server replies + +Except for the initial "+xxx" message, all requests and replies are simple objects +as handled by the Sherlock library. Each line starts with a single-character +attribute name followed by the value of the attribute, the object is terminated +by an empty line. Parentheses can delimit nested blocks. + +Every reply contains either a "+" or "-" attribute denoting status (OK/failed). +The value of the attribute is a message for the user, which should not be +interpreted in any way. + +Hello request: + + Uusername + +Hello reply: + + (only status) diff --git a/submit/commands.c b/submit/commands.c index 4944099..687e272 100644 --- a/submit/commands.c +++ b/submit/commands.c @@ -14,6 +14,8 @@ #include "submitd.h" +/*** REQUESTS AND REPLIES ***/ + static void NONRET read_error_cb(struct obj_read_state *st UNUSED, byte *msg) { @@ -77,6 +79,8 @@ write_reply(struct conn *c) bflush(&c->tx_fb); } +/*** COMMAND MUX ***/ + static void execute_command(struct conn *c) { @@ -101,6 +105,8 @@ process_command(struct conn *c) return 1; } +/*** INITIAL HANDSHAKE ***/ + static int user_exists_p(byte *user) { -- 2.39.2