| 427 | } |
| 428 | |
| 429 | static int libssh_move(URLContext *h_src, URLContext *h_dst) |
| 430 | { |
| 431 | int ret; |
| 432 | LIBSSHContext *libssh = h_src->priv_data; |
| 433 | char path_src[MAX_URL_SIZE], path_dst[MAX_URL_SIZE]; |
| 434 | char hostname_src[1024], hostname_dst[1024]; |
| 435 | char credentials_src[1024], credentials_dst[1024]; |
| 436 | int port_src = 22, port_dst = 22; |
| 437 | |
| 438 | av_url_split(NULL, 0, |
| 439 | credentials_src, sizeof(credentials_src), |
| 440 | hostname_src, sizeof(hostname_src), |
| 441 | &port_src, |
| 442 | path_src, sizeof(path_src), |
| 443 | h_src->filename); |
| 444 | |
| 445 | av_url_split(NULL, 0, |
| 446 | credentials_dst, sizeof(credentials_dst), |
| 447 | hostname_dst, sizeof(hostname_dst), |
| 448 | &port_dst, |
| 449 | path_dst, sizeof(path_dst), |
| 450 | h_dst->filename); |
| 451 | |
| 452 | if (strcmp(credentials_src, credentials_dst) || |
| 453 | strcmp(hostname_src, hostname_dst) || |
| 454 | port_src != port_dst) { |
| 455 | return AVERROR(EINVAL); |
| 456 | } |
| 457 | |
| 458 | if ((ret = libssh_connect(h_src, h_src->filename, path_src, sizeof(path_src))) < 0) |
| 459 | goto cleanup; |
| 460 | |
| 461 | if (sftp_rename(libssh->sftp, path_src, path_dst) < 0) { |
| 462 | ret = AVERROR(sftp_get_error(libssh->sftp)); |
| 463 | goto cleanup; |
| 464 | } |
| 465 | |
| 466 | ret = 0; |
| 467 | |
| 468 | cleanup: |
| 469 | libssh_close(h_src); |
| 470 | return ret; |
| 471 | } |
| 472 | |
| 473 | #define OFFSET(x) offsetof(LIBSSHContext, x) |
| 474 | #define D AV_OPT_FLAG_DECODING_PARAM |
nothing calls this directly
no test coverage detected