Exemple #1
0
void
replay_purge (void)
{
/*  Purges the replay hash of any expired credentials.
 */
    time_t  now;
    int     n;

    if (!replay_hash) {
        return;
    }
    if (time (&now) == (time_t) -1) {
        log_errno (EMUNGE_SNAFU, LOG_ERR, "Failed to query current time");
    }
    n = hash_delete_if (replay_hash, (hash_arg_f) replay_is_expired, &now);
    assert (n >= 0);
    if (n > 0) {
        log_msg (LOG_DEBUG, "Purged %d credential%s from replay hash",
            n, ((n == 1) ? "" : "s"));
    }
    if (timer_set_relative (
      (callback_f) replay_purge, NULL, MUNGE_REPLAY_PURGE_SECS * 1000) < 0) {
        log_errno (EMUNGE_SNAFU, LOG_ERR, "Failed to set replay purge timer");
    }
    return;
}
int 
wrap_hash_delete_if(WRAPPERS_ARGS, hash_t h, hash_arg_f argf, void *arg)
{
  int rv;

  assert(file && function);
    
  if (!h || !argf)
    WRAPPERS_ERR_INVALID_PARAMETERS("hash_delete_if");

  if ((rv = hash_delete_if(h, argf, arg)) < 0)
    WRAPPERS_ERR_ERRNO("hash_delete_if");

  return rv;
}