mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
Make x11_get_auth_from_authfile take a Filename.
I think the only reason it currently takes a plain string is because its interesting caller (in unix/x11.c) has just constructed a string out of an environment variable, and it seemed like the path of least effort not to bother wrapping it into a proper Filename. But when Filename on Windows becomes more interesting, we'll need it to take the full version.
This commit is contained in:
parent
1adcb200f7
commit
85680c77c0
2
ssh.h
2
ssh.h
@ -1370,7 +1370,7 @@ char *platform_get_x_display(void);
|
|||||||
* calling this function to do the rest of the work.
|
* calling this function to do the rest of the work.
|
||||||
*/
|
*/
|
||||||
void x11_get_auth_from_authfile(struct X11Display *display,
|
void x11_get_auth_from_authfile(struct X11Display *display,
|
||||||
const char *authfilename);
|
Filename *authfilename);
|
||||||
void x11_format_auth_for_authfile(
|
void x11_format_auth_for_authfile(
|
||||||
BinarySink *bs, SockAddr *addr, int display_no,
|
BinarySink *bs, SockAddr *addr, int display_no,
|
||||||
ptrlen authproto, ptrlen authdata);
|
ptrlen authproto, ptrlen authdata);
|
||||||
|
@ -33,9 +33,12 @@ void platform_get_x11_auth(struct X11Display *disp, Conf *conf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (xauthfile) {
|
if (xauthfile) {
|
||||||
x11_get_auth_from_authfile(disp, xauthfile);
|
Filename *xauthfn = filename_from_str(xauthfile);
|
||||||
if (needs_free)
|
if (needs_free)
|
||||||
sfree(xauthfile);
|
sfree(xauthfile);
|
||||||
|
|
||||||
|
x11_get_auth_from_authfile(disp, xauthfn);
|
||||||
|
filename_free(xauthfn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ static void BinarySink_put_stringpl_xauth(BinarySink *bs, ptrlen pl)
|
|||||||
BinarySink_put_stringpl_xauth(BinarySink_UPCAST(bs),ptrlen)
|
BinarySink_put_stringpl_xauth(BinarySink_UPCAST(bs),ptrlen)
|
||||||
|
|
||||||
void x11_get_auth_from_authfile(struct X11Display *disp,
|
void x11_get_auth_from_authfile(struct X11Display *disp,
|
||||||
const char *authfilename)
|
Filename *authfilename)
|
||||||
{
|
{
|
||||||
FILE *authfp;
|
FILE *authfp;
|
||||||
char *buf;
|
char *buf;
|
||||||
@ -72,7 +72,7 @@ void x11_get_auth_from_authfile(struct X11Display *disp,
|
|||||||
*/
|
*/
|
||||||
bool localhost = !disp->unixdomain && sk_address_is_local(disp->addr);
|
bool localhost = !disp->unixdomain && sk_address_is_local(disp->addr);
|
||||||
|
|
||||||
authfp = fopen(authfilename, "rb");
|
authfp = f_open(authfilename, "rb", false);
|
||||||
if (!authfp)
|
if (!authfp)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -11,9 +11,9 @@
|
|||||||
|
|
||||||
void platform_get_x11_auth(struct X11Display *disp, Conf *conf)
|
void platform_get_x11_auth(struct X11Display *disp, Conf *conf)
|
||||||
{
|
{
|
||||||
char *xauthpath = conf_get_filename(conf, CONF_xauthfile)->path;
|
Filename *xauthfn = conf_get_filename(conf, CONF_xauthfile);
|
||||||
if (xauthpath[0])
|
if (!filename_is_null(xauthfn))
|
||||||
x11_get_auth_from_authfile(disp, xauthpath);
|
x11_get_auth_from_authfile(disp, xauthfn);
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool platform_uses_x11_unix_by_default = false;
|
const bool platform_uses_x11_unix_by_default = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user