bankd: Reject removeSlotmap when ClientID doesn't match
It's a bit of a matter of taste whether we should simply log + ignore
if the Client of a removeMappingReq doesn't match what the bankd
currently has configured. I chose to reject it, as a new createMapping
for the same bandk+slot will overwrite any existing mapping anyway,
at least as of I83e319d22896b881c0d882542842f500075aa546
Change-Id: I892282821f4650614d1d08ed4bdf11eaabf947c0
diff --git a/src/bankd/bankd_main.c b/src/bankd/bankd_main.c
index 03101fb..94227e3 100644
--- a/src/bankd/bankd_main.c
+++ b/src/bankd/bankd_main.c
@@ -217,9 +217,15 @@
LOGPFSML(srvc->fi, LOGL_ERROR, "could not find to-be-deleted slotmap\n");
resp = rspro_gen_RemoveMappingRes(ResultCode_unknownSlotmap);
} else {
- LOGPFSM(srvc->fi, "removing slotmap\n");
- bankd_srvc_remove_mapping(map);
- resp = rspro_gen_RemoveMappingRes(ResultCode_ok);
+ rspro2client_slot(&cs, &rreq->client);
+ if (!client_slot_equals(&map->client, &cs)) {
+ LOGPFSM(srvc->fi, "ClientId in removeMappingReq != map\n");
+ resp = rspro_gen_RemoveMappingRes(ResultCode_unknownSlotmap);
+ } else {
+ LOGPFSM(srvc->fi, "removing slotmap\n");
+ bankd_srvc_remove_mapping(map);
+ resp = rspro_gen_RemoveMappingRes(ResultCode_ok);
+ }
}
}
server_conn_send_rspro(srvc, resp);