| 1511 | } |
| 1512 | |
| 1513 | static int dist_session_token_hash_prefix( |
| 1514 | ds4_session *session, |
| 1515 | uint32_t n_tokens, |
| 1516 | uint64_t *hash, |
| 1517 | char *err, |
| 1518 | size_t errlen) { |
| 1519 | const ds4_tokens *checkpoint = ds4_session_tokens(session); |
| 1520 | if (!hash || !checkpoint || checkpoint->len < 0 || (uint32_t)checkpoint->len < n_tokens) { |
| 1521 | if (errlen) snprintf(err, errlen, "distributed session has no %u-token prefix", n_tokens); |
| 1522 | return 1; |
| 1523 | } |
| 1524 | *hash = dist_token_hash_prefix(checkpoint->v, n_tokens); |
| 1525 | return 0; |
| 1526 | } |
| 1527 | |
| 1528 | static bool dist_bytes_have_nul(const void *p, uint32_t len) { |
| 1529 | return len != 0 && memchr(p, '\0', len) != NULL; |
no test coverage detected