Commit 1d66e714 authored by Max Kellermann's avatar Max Kellermann

client: add function client_is_local()

parent d98a863b
...@@ -45,6 +45,17 @@ bool client_is_expired(const struct client *client); ...@@ -45,6 +45,17 @@ bool client_is_expired(const struct client *client);
G_GNUC_PURE G_GNUC_PURE
int client_get_uid(const struct client *client); int client_get_uid(const struct client *client);
/**
* Is this client running on the same machine, connected with a local
* (UNIX domain) socket?
*/
G_GNUC_PURE
static inline bool
client_is_local(const struct client *client)
{
return client_get_uid(client) > 0;
}
G_GNUC_PURE G_GNUC_PURE
unsigned client_get_permission(const struct client *client); unsigned client_get_permission(const struct client *client);
......
...@@ -451,7 +451,7 @@ static enum command_return ...@@ -451,7 +451,7 @@ static enum command_return
handle_urlhandlers(struct client *client, handle_urlhandlers(struct client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[])
{ {
if (client_get_uid(client) > 0) if (client_is_local(client))
client_puts(client, "handler: file://\n"); client_puts(client, "handler: file://\n");
print_supported_uri_schemes(client); print_supported_uri_schemes(client);
return COMMAND_RETURN_OK; return COMMAND_RETURN_OK;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment