| 407 | } |
| 408 | |
| 409 | void credential_write(const struct credential *c, FILE *fp, |
| 410 | enum credential_op_type op_type) |
| 411 | { |
| 412 | if (credential_has_capability(&c->capa_authtype, op_type)) |
| 413 | credential_write_item(c, fp, "capability[]", "authtype", 0); |
| 414 | if (credential_has_capability(&c->capa_state, op_type)) |
| 415 | credential_write_item(c, fp, "capability[]", "state", 0); |
| 416 | |
| 417 | if (credential_has_capability(&c->capa_authtype, op_type)) { |
| 418 | credential_write_item(c, fp, "authtype", c->authtype, 0); |
| 419 | credential_write_item(c, fp, "credential", c->credential, 0); |
| 420 | if (c->ephemeral) |
| 421 | credential_write_item(c, fp, "ephemeral", "1", 0); |
| 422 | } |
| 423 | credential_write_item(c, fp, "protocol", c->protocol, 1); |
| 424 | credential_write_item(c, fp, "host", c->host, 1); |
| 425 | credential_write_item(c, fp, "path", c->path, 0); |
| 426 | credential_write_item(c, fp, "username", c->username, 0); |
| 427 | credential_write_item(c, fp, "password", c->password, 0); |
| 428 | credential_write_item(c, fp, "oauth_refresh_token", c->oauth_refresh_token, 0); |
| 429 | if (c->password_expiry_utc != TIME_MAX) { |
| 430 | char *s = xstrfmt("%"PRItime, c->password_expiry_utc); |
| 431 | credential_write_item(c, fp, "password_expiry_utc", s, 0); |
| 432 | free(s); |
| 433 | } |
| 434 | for (size_t i = 0; i < c->wwwauth_headers.nr; i++) |
| 435 | credential_write_item(c, fp, "wwwauth[]", c->wwwauth_headers.v[i], 0); |
| 436 | if (credential_has_capability(&c->capa_state, op_type)) { |
| 437 | if (c->multistage) |
| 438 | credential_write_item(c, fp, "continue", "1", 0); |
| 439 | for (size_t i = 0; i < c->state_headers_to_send.nr; i++) |
| 440 | credential_write_item(c, fp, "state[]", c->state_headers_to_send.v[i], 0); |
| 441 | } |
| 442 | } |
| 443 | |
| 444 | static int run_credential_helper(struct credential *c, |
| 445 | const char *cmd, |
no test coverage detected