mirror of
https://github.com/linux-msm/cdba.git
synced 2026-02-25 13:11:56 -08:00
cdba-server: add syslog support
Log messages to the syslog when the user opens a board. Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#include "cdba-server.h"
|
||||
#include "circ_buf.h"
|
||||
@@ -361,6 +362,8 @@ int main(int argc, char **argv)
|
||||
if (!username)
|
||||
username = "nobody";
|
||||
|
||||
openlog("cdba-server", 0, LOG_DAEMON);
|
||||
|
||||
ret = device_parser(".cdba");
|
||||
if (ret) {
|
||||
ret = device_parser("/etc/cdba");
|
||||
|
||||
9
device.c
9
device.c
@@ -39,6 +39,7 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#include "cdba-server.h"
|
||||
#include "device.h"
|
||||
@@ -127,11 +128,17 @@ struct device *device_open(const char *board,
|
||||
goto found;
|
||||
}
|
||||
|
||||
syslog(LOG_INFO, "user %s asked for non-existing board %s", username, board);
|
||||
return NULL;
|
||||
|
||||
found:
|
||||
if (!device_check_access(device, username))
|
||||
if (!device_check_access(device, username)) {
|
||||
syslog(LOG_INFO, "user %s access denied to the board %s", username, board);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
syslog(LOG_INFO, "user %s opening board %s", username, board);
|
||||
|
||||
assert(device->console_ops);
|
||||
assert(device->console_ops->open);
|
||||
|
||||
Reference in New Issue
Block a user