From bc6988dbdfa56504da37041dd72975be95a96fa3 Mon Sep 17 00:00:00 2001
From: Michal 'vorner' Vaner <michal.vaner@nic.cz>
Date: Fri, 22 Jan 2016 14:39:48 +0100
Subject: [PATCH] Allow attacker inputs not to conform to UTF-8

Some data come from attacker. And not all attackers know that passwords
should be in UTF8, so accept everything simply as raw data.
---
 src/master/dbscripts/initdb | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/master/dbscripts/initdb b/src/master/dbscripts/initdb
index aaa1862e..759a83b5 100755
--- a/src/master/dbscripts/initdb
+++ b/src/master/dbscripts/initdb
@@ -452,9 +452,9 @@ CREATE TABLE fake_logs (
 	local INET,
 	remote_port INT,
 	server fake_server NOT NULL,
-	name TEXT,
-	password TEXT,
-	reason TEXT,
+	name BYTEA,
+	password BYTEA,
+	reason BYTEA,
 	FOREIGN KEY (client) REFERENCES clients(id)
 );
 CREATE INDEX fake_logs_server_idx ON fake_logs(server);
@@ -613,8 +613,8 @@ CREATE TABLE ssh_sessions (
 	client_id INT NOT NULL REFERENCES clients(id) ON DELETE CASCADE,
 	start_time TIMESTAMP WITH TIME ZONE NOT NULL,
 	end_time TIMESTAMP WITH TIME ZONE DEFAULT NULL,
-	login TEXT NOT NULL,
-	password TEXT NOT NULL,
+	login BYTEA NOT NULL,
+	password BYTEA NOT NULL,
 	remote INET NOT NULL
 );
 CREATE SEQUENCE ssh_session_ids OWNED BY ssh_sessions.id;
@@ -626,7 +626,7 @@ CREATE TABLE ssh_commands (
 	session_id INTEGER NOT NULL REFERENCES ssh_sessions(id) ON DELETE CASCADE,
 	ts TIMESTAMP WITH TIME ZONE NOT NULL,
 	success BOOLEAN NOT NULL,
-	command TEXT NOT NULL,
+	command BYTEA NOT NULL,
 	archived BOOL NOT NULL DEFAULT false
 );
 
-- 
GitLab