X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=daemon%2Fui.c;h=4918b74b4ebbedc475659b6f6769fddf3aa4b47c;hb=e03e1e7c23b2f527d43ec72b01c93185ebc63008;hp=bdff17b4c48831f7116b7a260093d73448516647;hpb=4a9a79b305b928f53b8820c1cf5372afb8f7a421;p=doldaconnect.git diff --git a/daemon/ui.c b/daemon/ui.c index bdff17b..4918b74 100644 --- a/daemon/ui.c +++ b/daemon/ui.c @@ -324,7 +324,7 @@ static int haspriv(struct uidata *data, int perm) /* Useful macros for the command functions: */ #define haveargs(n) do { if(argc < n) { sq(sk, 0, L"501", L"Wrong number of arguments", NULL); return; } } while(0) -#define havepriv(p) do { if((data->userinfo == NULL) || ((data->userinfo->perms & (p)) != (p))) { sq(sk, 0, L"502", L"Unauthorized request", L"needed", L"%x", (p), L"had", L"%x", data->userinfo->perms, NULL); return; } } while(0) +#define havepriv(p) do { if((data->userinfo == NULL) || ((data->userinfo->perms & (p)) != (p))) { sq(sk, 0, L"502", L"Unauthorized request", L"needed", L"%x", (p), NULL); return; } } while(0) static void cmd_connect(struct socket *sk, struct uidata *data, int argc, wchar_t **argv) { @@ -1338,6 +1338,16 @@ static void cmd_uptime(struct socket *sk, struct uidata *data, int argc, wchar_t sq(sk, 0, L"200", L"%i", time(NULL) - starttime, NULL); } +static void cmd_hup(struct socket *sk, struct uidata *data, int argc, wchar_t **argv) +{ + extern volatile int reinit; + + havepriv(PERM_ADMIN); + flog(LOG_NOTICE, "UI HUP request from %ls", data->username); + reinit = 1; + sq(sk, 0, L"200", L"Will reinit", NULL); +} + #undef haveargs #undef havepriv @@ -1378,6 +1388,7 @@ static struct command commands[] = {L"register", cmd_register}, {L"sendmsg", cmd_sendmsg}, {L"uptime", cmd_uptime}, + {L"hup", cmd_hup}, {NULL, NULL} };