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
changes/89/16489/1
Harald Welte 3 years ago
parent e6fa46acd5
commit d9fb93991b
  1. 12
      src/bankd/bankd_main.c

@ -217,9 +217,15 @@ send_resp:
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);

Loading…
Cancel
Save