diff options
author | Alex Auvolat <alex@adnab.me> | 2020-10-04 20:00:17 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2020-10-04 20:00:17 +0200 |
commit | 7130c7b7d6d0c4f49229df33825e2861eb463457 (patch) | |
tree | ede3559a26a6db10ace500730ddfd96bf7d44468 | |
parent | d3ab4fa8cafa0aeedb626d2067659d75c88a1b4f (diff) | |
download | easybridge-7130c7b7d6d0c4f49229df33825e2861eb463457.tar.gz easybridge-7130c7b7d6d0c4f49229df33825e2861eb463457.zip |
Security against deletion of dbPmRoomMap entries
-rw-r--r-- | Dockerfile | 6 | ||||
-rw-r--r-- | db.go | 6 |
2 files changed, 8 insertions, 4 deletions
@@ -1,7 +1,7 @@ -#FROM archlinux:latest -#RUN pacman -Sy python-pip --noconfirm; pacman -Scc --noconfirm +FROM archlinux:latest +RUN pacman -Sy python-pip --noconfirm; pacman -Scc --noconfirm; find /var/cache/pacman/ -type f -delete; find /var/lib/pacman/sync/ -type f -delete -FROM python:3.8-buster +#FROM python:3.8.6-buster RUN pip install fbchat @@ -255,7 +255,11 @@ func dbGetMxPmRoom(protocol string, them connector.UserID, themMxId string, usMx } func dbDeletePmRoom(room *DbPmRoomMap) { - db.Delete(room) + if room.ID != 0 { + db.Delete(room) + } else { + log.Warnf("In dbDeletePmRoom: %#v (not deleting since primary key is zero)", room) + } } func dbGetMxUser(protocol string, userId connector.UserID) (string, error) { |