diff --git a/src/frontend/session.c b/src/frontend/session.c
index ab45cdd17c30cb154a7cf051cf940ba11e47e4b0..f64a1b967cb541bd0ba4241e426f380b14153b1c 100644 (file)
--- a/src/frontend/session.c
+++ b/src/frontend/session.c
*/
int
-sdb_fe_session_start(sdb_conn_t *conn)
+sdb_conn_session_start(sdb_conn_t *conn)
{
char username[sdb_strbuf_len(conn->buf) + 1];
const char *tmp;
username[conn->cmd_len] = '\0';
if (! conn->username) {
- /* We couldn't determine the remote peer when setting up the
- * connection; TODO: add support for password authentication */
- sdb_strbuf_sprintf(conn->errbuf, "Password authentication "
- "not supported");
- return -1;
+ /* We trust the remote peer.
+ * TODO: make the auth mechanism configurable */
+ conn->username = strdup(username);
}
- if (strcmp(conn->username, username)) {
+ else if (strcmp(conn->username, username)) {
sdb_strbuf_sprintf(conn->errbuf, "%s cannot act on behalf of %s",
conn->username, username);
return -1;
sdb_connection_send(conn, SDB_CONNECTION_OK, 0, NULL);
conn->ready = 1;
return 0;
-} /* sdb_fe_session_start */
+} /* sdb_conn_session_start */
/* vim: set tw=78 sw=4 ts=4 noexpandtab : */