From: Boram Park Date: Tue, 18 Oct 2016 00:55:47 +0000 (+0900) Subject: allow only superuser X-Git-Tag: submit/tizen/20161018.044046^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d02316192d709f33b79fb465c28bc4857b9f97c5;p=platform%2Fcore%2Fuifw%2Flibtdm.git allow only superuser Change-Id: I9dcc7750e8832f1e3667ea0027dd6500af22082d --- diff --git a/src/tdm_server.c b/src/tdm_server.c index 6417fd91..4dee1102 100644 --- a/src/tdm_server.c +++ b/src/tdm_server.c @@ -470,11 +470,19 @@ _tdm_server_cb_debug(struct wl_client *client, struct wl_resource *resource, con { tdm_private_server *private_server = wl_resource_get_user_data(resource); tdm_private_loop *private_loop = private_server->private_loop; - char message[TDM_SERVER_REPLY_MSG_LEN]; int size = sizeof(message); + uid_t uid; + + wl_client_get_credentials(client, NULL, &uid, NULL); + + if (uid != 0) { + snprintf(message, size, "tdm-monitor: SHOULD be a superuser.\n"); + TDM_ERR("%s", message); + } else { + tdm_monitor_server_command(private_loop->dpy, options, message, &size); + } - tdm_monitor_server_command(private_loop->dpy, options, message, &size); wl_tdm_send_debug_done(resource, message); }