From: Sebastian Harl Date: Sun, 14 Sep 2014 09:23:39 +0000 (+0200) Subject: proto: Fixed/clarified authentication handshake options during startup. X-Git-Tag: sysdb-0.5.0~39 X-Git-Url: https://git.tokkee.org/?p=sysdb.git;a=commitdiff_plain;h=c51f1f224fd1ec05ca0045c15be8f7625aeb5cea proto: Fixed/clarified authentication handshake options during startup. The server may request further authentication information from the client before sending an OK status. --- diff --git a/src/client/sock.c b/src/client/sock.c index b60bad4..82a48a6 100644 --- a/src/client/sock.c +++ b/src/client/sock.c @@ -193,10 +193,15 @@ sdb_client_connect(sdb_client_t *client, const char *username) sdb_log(SDB_LOG_ERR, "Encountered end-of-file while waiting " "for server response"); - if (rstatus != CONNECTION_OK) { + if (rstatus == CONNECTION_ERROR) { sdb_log(SDB_LOG_ERR, "Access denied for user '%s'", username); status = -((int)rstatus); } + else if (rstatus != CONNECTION_OK) { + sdb_log(SDB_LOG_ERR, "Received unsupported authentication request " + "(status %d) during startup", (int)rstatus); + status = -((int)rstatus); + } sdb_client_close(client); sdb_strbuf_destroy(buf); diff --git a/src/include/frontend/proto.h b/src/include/frontend/proto.h index 1d549a9..9e02400 100644 --- a/src/include/frontend/proto.h +++ b/src/include/frontend/proto.h @@ -33,7 +33,7 @@ extern "C" { #endif /* - * The SysDB frontend protocol is based messages being passed between the + * The SysDB frontend protocol is based on messages being passed between the * client and the server. Each message includes a header containing the * message type which is usually a status or command code, the length of the * message not including the header, and the message body. The content of the @@ -95,9 +95,10 @@ typedef enum { * username of the user contacting the server. The server may then send * further requests to the client for authentication (not implemented * yet). Once the setup and authentication was successful, the server - * replies with CONNECTION_OK. No other messages may be sent to the server - * before this. Also, the server does not send any asynchronous messages - * before startup is complete. + * replies with CONNECTION_OK. Further information may be requested from + * the server using special messages specific to the authentication + * method. The server does not send any asynchronous messages before + * startup is complete. */ CONNECTION_STARTUP,