Skip to content

Expand user path for tls options #16323

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
6 tasks done
pjw91 opened this issue May 8, 2025 · 0 comments · May be fixed by #16328
Open
6 tasks done

Expand user path for tls options #16323

pjw91 opened this issue May 8, 2025 · 0 comments · May be fixed by #16328
Labels

Comments

@pjw91
Copy link

pjw91 commented May 8, 2025

mpv Information

mpv v0.40.0-dirty Copyright © 2000-2025 mpv/MPlayer/mplayer2 projects
 built on Apr  4 2025 07:28:54
libplacebo version: v7.349.0
FFmpeg version: n7.1
FFmpeg library versions:
   libavcodec      61.19.100
   libavdevice     61.3.100
   libavfilter     10.4.100
   libavformat     61.7.100
   libavutil       59.39.100
   libswresample   5.3.100
   libswscale      8.3.100

Other Information

- Linux version:NAME="EndeavourOS" / archlinux
- Kernel Version:
- GPU Model:
- Mesa/GPU Driver Version:
- Window Manager and Version:
- Source of mpv:
- Latest known working version:
- Issue started after the following happened:

Reproduction Steps

  1. Givien that https://aa.com/ is protected by a self-signed CA and TLS client authentication
  2. mpv https://aa.com/bbb.mp4 --tls-cert-file=~/.ssl/pubkey.pem --tls-key-file=~/.ssl/privkey.pem --tls-ca-file=~/.ssl/ca.pem

Expected Behavior

mpv expands ~/.ssl/pubkey.pem to /home/user/.ssl/pubkey.pem and reads it

mpv/stream/stream_lavf.c

Lines 202 to 207 in 139591a

if (opts->tls_ca_file)
av_dict_set(dict, "ca_file", opts->tls_ca_file, 0);
if (opts->tls_cert_file)
av_dict_set(dict, "cert_file", opts->tls_cert_file, 0);
if (opts->tls_key_file)
av_dict_set(dict, "key_file", opts->tls_key_file, 0);

I add char *mp_get_user_path(void *talloc_ctx, struct mpv_global *global, const char *path); calls at these lines, and it works.

However, I don't know talloc and mpv well and don't know:

  1. what to fill the 1st arg (talloc_ctx)
  2. whether free the return value of mp_get_user_path or not after av_dict_set calls

Actual Behavior

mpv does not expand the user path and tries to load '~/.ssl/pubkey.pem', which does not exist.

Log File

[ffmpeg] tls: Unable to set cert/key files ~/.ssl/pubkey.pem and ~/.ssl/privkey.pem: Error while reading file.
Failed to open https://aa.com/bbb.mp4.

Sample Files

No response

I carefully read all instruction and confirm that I did the following:

  • I tested with the latest mpv version to validate that the issue is not already fixed.
  • I provided all required information including system and mpv version.
  • I produced the log file with the exact same set of files, parameters, and conditions used in "Reproduction Steps", with the addition of --log-file=output.txt.
  • I produced the log file while the behaviors described in "Actual Behavior" were actively observed.
  • I attached the full, untruncated log file.
  • I attached the backtrace in the case of a crash.
@pjw91 pjw91 added the os:linux label May 8, 2025
@pjw91 pjw91 linked a pull request May 9, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant