Skip to content

Commit

Permalink
Merge pull request #735 from hodarh/test/oldsubmit
Browse files Browse the repository at this point in the history
Do not show 'ready for ds-submit' for old keys
  • Loading branch information
halderen committed Apr 17, 2018
2 parents a37500c + acc4a61 commit 30f775d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions enforcer/src/enforcer/enforcer.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,15 @@ getState(struct dbw_key* key, enum dbw_keystate_type type)
* \return a key_state_state_t for the next state
*/
static enum dbw_keystate_state
getDesiredState(int introducing, enum dbw_keystate_state state)
getDesiredState(int introducing, enum dbw_keystate_state state, struct dbw_keystate *ks)
{
if (!introducing) {
switch (state) {
case RUMOURED:
if (ks->type == DBW_DS && ks->key->ds_at_parent < DBW_DS_AT_PARENT_SUBMITTED) {
ks->key->ds_at_parent = DBW_DS_AT_PARENT_UNSUBMITTED;
}
return UNRETENTIVE;
case OMNIPRESENT: return UNRETENTIVE;
case UNRETENTIVE: return HIDDEN;
default: return state;
Expand Down Expand Up @@ -1008,7 +1012,7 @@ updateZone(struct dbw_db *db, struct dbw_zone *zone, const time_t now,
for (size_t s = 0; s < key->keystate_count; s++) {
time_t returntime_keystate;
struct dbw_keystate *keystate = key->keystate[s];
enum dbw_keystate_state next_state = getDesiredState(key->introducing, keystate->state);
enum dbw_keystate_state next_state = getDesiredState(key->introducing, keystate->state, keystate);
if (next_state == keystate->state) continue;
if (is_ds_waiting_for_user(keystate, next_state)) continue;

Expand Down
1 change: 1 addition & 0 deletions enforcer/src/keystate/keystate_list_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ keystate(int p, int c, int introducing, int dsstate)
if (p == HID && c == HID) return KS_RET; /* dead */
if (p == UNR || c == UNR) return KS_RET;
if (p == OMN || c == OMN) return KS_RDY;
if (p == RUM && c == HID) return KS_RET;
if (p == RUM || c == RUM) return KS_RDY;
return KS_RET;
}
Expand Down

0 comments on commit 30f775d

Please sign in to comment.