aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2017-04-22 19:14:33 +0200
committertomsmeding <tom.smeding@gmail.com>2017-04-22 19:14:33 +0200
commit5fad8375bda29e4740720438a38815b773023a38 (patch)
treed0163224006f95331494fdef27eee60d84cb8856
parent0983e38e640d5168c31ddc6663057268afaefb4a (diff)
server: Log out on *all* invalid logins
-rw-r--r--command.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/command.c b/command.c
index 2a75e7f..bcfa2e8 100644
--- a/command.c
+++ b/command.c
@@ -32,6 +32,11 @@ static bool cmd_login(struct conn_data *data,const char *tag,const char **args){
i64 userid=db_find_user(args[0]);
if(userid==-1){
net_send_error(data->fd,tag,"User not found");
+ if(data->userid!=-1){
+ userdata_unregister(data->userid,data->fd);
+ broadcast_online_change(data->userid);
+ data->userid=-1;
+ }
return false;
}
char *pass=db_get_pass(userid);