Security against deletion of dbPmRoomMap entries

This commit is contained in:
Alex 2020-10-04 20:00:17 +02:00
parent d3ab4fa8ca
commit 7130c7b7d6
2 changed files with 8 additions and 4 deletions

View File

@ -1,7 +1,7 @@
#FROM archlinux:latest FROM archlinux:latest
#RUN pacman -Sy python-pip --noconfirm; pacman -Scc --noconfirm 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 RUN pip install fbchat

6
db.go
View File

@ -255,7 +255,11 @@ func dbGetMxPmRoom(protocol string, them connector.UserID, themMxId string, usMx
} }
func dbDeletePmRoom(room *DbPmRoomMap) { 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) { func dbGetMxUser(protocol string, userId connector.UserID) (string, error) {