summaryrefslogtreecommitdiffstats
path: root/src/rpc.c
diff options
context:
space:
mode:
authorSimon Rettberg2019-06-12 16:21:45 +0200
committerSimon Rettberg2019-06-12 16:21:45 +0200
commit72dac079fbac16ea9dee6de544bdc7ed24a5e208 (patch)
treed53f1c175511f3c9bbe1343cddc8c7f2450df65d /src/rpc.c
parentMake sure user promptly sees warning when using RPC (diff)
downloadidle-daemon-72dac079fbac16ea9dee6de544bdc7ed24a5e208.tar.gz
idle-daemon-72dac079fbac16ea9dee6de544bdc7ed24a5e208.tar.xz
idle-daemon-72dac079fbac16ea9dee6de544bdc7ed24a5e208.zip
Add RPC method "warn" to show messge to users
Only usable by root.
Diffstat (limited to 'src/rpc.c')
-rw-r--r--src/rpc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/rpc.c b/src/rpc.c
index a563f36..823bcca 100644
--- a/src/rpc.c
+++ b/src/rpc.c
@@ -196,6 +196,13 @@ static void handleClient( int fd, struct ucred *creds )
SENDSTRING( fd, "ok" );
}
}
+ } else if ( strncmp( buffer, "warn ", 5 ) == 0 ) {
+ if ( creds->uid != 0 ) {
+ SENDSTRING( fd, "error only root can do this" );
+ } else {
+ main_warnAll( buffer + 5 );
+ SENDSTRING( fd, "ok" );
+ }
} else {
SENDSTRING( fd, "error unknown command" );
}