| 413 | #define NONCE_LEN_LIMIT 256 |
| 414 | |
| 415 | static void reject_invalid_nonce(const char *nonce, int len) |
| 416 | { |
| 417 | int i = 0; |
| 418 | |
| 419 | if (NONCE_LEN_LIMIT <= len) |
| 420 | die("the receiving end asked to sign an invalid nonce <%.*s>", |
| 421 | len, nonce); |
| 422 | |
| 423 | for (i = 0; i < len; i++) { |
| 424 | int ch = nonce[i] & 0xFF; |
| 425 | if (isalnum(ch) || |
| 426 | ch == '-' || ch == '.' || |
| 427 | ch == '/' || ch == '+' || |
| 428 | ch == '=' || ch == '_') |
| 429 | continue; |
| 430 | die("the receiving end asked to sign an invalid nonce <%.*s>", |
| 431 | len, nonce); |
| 432 | } |
| 433 | } |
| 434 | |
| 435 | static void get_commons_through_negotiation(struct repository *r, |
| 436 | const char *url, |