X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=service.cpp;h=57dc7a28f103ff3bc69312b982d53f14c40cd94c;hb=6a12d5bf24211cfee30c47354b32befc3abae5b8;hp=ea5a460f6305f8544532f8538fab219c6c181676;hpb=728c4f6eb96313e764600810aa754663a5091f38;p=nssm.git diff --git a/service.cpp b/service.cpp index ea5a460..57dc7a2 100644 --- a/service.cpp +++ b/service.cpp @@ -5,7 +5,7 @@ bool use_critical_section; extern imports_t imports; -const char *exit_action_strings[] = { "Restart", "Ignore", "Exit", "Suicide", 0 }; +const TCHAR *exit_action_strings[] = { _T("Restart"), _T("Ignore"), _T("Exit"), _T("Suicide"), 0 }; static inline int throttle_milliseconds(unsigned long throttle) { /* pow() operates on doubles. */ @@ -32,16 +32,42 @@ SC_HANDLE open_service_manager() { return ret; } +/* Set default values which aren't zero. */ +void set_nssm_service_defaults(nssm_service_t *service) { + if (! service) return; + + service->type = SERVICE_WIN32_OWN_PROCESS; + service->stdin_sharing = NSSM_STDIN_SHARING; + service->stdin_disposition = NSSM_STDIN_DISPOSITION; + service->stdin_flags = NSSM_STDIN_FLAGS; + service->stdout_sharing = NSSM_STDOUT_SHARING; + service->stdout_disposition = NSSM_STDOUT_DISPOSITION; + service->stdout_flags = NSSM_STDOUT_FLAGS; + service->stderr_sharing = NSSM_STDERR_SHARING; + service->stderr_disposition = NSSM_STDERR_DISPOSITION; + service->stderr_flags = NSSM_STDERR_FLAGS; + service->throttle_delay = NSSM_RESET_THROTTLE_RESTART; + service->stop_method = ~0; + service->kill_console_delay = NSSM_KILL_CONSOLE_GRACE_PERIOD; + service->kill_window_delay = NSSM_KILL_WINDOW_GRACE_PERIOD; + service->kill_threads_delay = NSSM_KILL_THREADS_GRACE_PERIOD; +} + /* Allocate and zero memory for a service. */ nssm_service_t *alloc_nssm_service() { nssm_service_t *service = (nssm_service_t *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(nssm_service_t)); - if (! service) log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_OUT_OF_MEMORY, "service", "alloc_nssm_service()", 0); + if (! service) log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_OUT_OF_MEMORY, _T("service"), _T("alloc_nssm_service()"), 0); return service; } /* Free memory for a service. */ void cleanup_nssm_service(nssm_service_t *service) { if (! service) return; + if (service->username) HeapFree(GetProcessHeap(), 0, service->username); + if (service->password) { + SecureZeroMemory(service->password, service->passwordlen); + HeapFree(GetProcessHeap(), 0, service->password); + } if (service->env) HeapFree(GetProcessHeap(), 0, service->env); if (service->env_extra) HeapFree(GetProcessHeap(), 0, service->env_extra); if (service->handle) CloseServiceHandle(service->handle); @@ -53,44 +79,41 @@ void cleanup_nssm_service(nssm_service_t *service) { } /* About to install the service */ -int pre_install_service(int argc, char **argv) { +int pre_install_service(int argc, TCHAR **argv) { /* Show the dialogue box if we didn't give the service name and path */ if (argc < 2) return nssm_gui(IDD_INSTALL, argv[0]); nssm_service_t *service = alloc_nssm_service(); if (! service) { - print_message(stderr, NSSM_EVENT_OUT_OF_MEMORY, "service", "pre_install_service()"); + print_message(stderr, NSSM_EVENT_OUT_OF_MEMORY, _T("service"), _T("pre_install_service()")); return 1; } - memmove(service->name, argv[0], strlen(argv[0])); - memmove(service->exe, argv[1], strlen(argv[1])); + set_nssm_service_defaults(service); + _sntprintf_s(service->name, _countof(service->name), _TRUNCATE, _T("%s"), argv[0]); + _sntprintf_s(service->exe, _countof(service->exe), _TRUNCATE, _T("%s"), argv[1]); /* Arguments are optional */ size_t flagslen = 0; size_t s = 0; - size_t i; - for (i = 2; i < argc; i++) flagslen += strlen(argv[i]) + 1; + int i; + for (i = 2; i < argc; i++) flagslen += _tcslen(argv[i]) + 1; if (! flagslen) flagslen = 1; + if (flagslen > _countof(service->flags)) { + print_message(stderr, NSSM_MESSAGE_FLAGS_TOO_LONG); + return 2; + } - /* - This probably isn't UTF8-safe and should use std::string or something - but it's been broken for the best part of a decade and due for a rewrite - anyway so it'll do as a quick-'n'-dirty fix. Note that we don't free - the flags buffer but as the program exits that isn't a big problem. - */ for (i = 2; i < argc; i++) { - size_t len = strlen(argv[i]); - memmove(service->flags + s, argv[i], len); + size_t len = _tcslen(argv[i]); + memmove(service->flags + s, argv[i], len * sizeof(TCHAR)); s += len; - if (i < argc - 1) service->flags[s++] = ' '; + if (i < argc - 1) service->flags[s++] = _T(' '); } /* Work out directory name */ - size_t len = strlen(service->exe); - for (i = len; i && service->exe[i] != '\\' && service->exe[i] != '/'; i--); - memmove(service->dir, service->exe, i); - service->dir[i] = '\0'; + _sntprintf_s(service->dir, _countof(service->dir), _TRUNCATE, _T("%s"), service->exe); + strip_basename(service->dir); int ret = install_service(service); cleanup_nssm_service(service); @@ -98,12 +121,12 @@ int pre_install_service(int argc, char **argv) { } /* About to remove the service */ -int pre_remove_service(int argc, char **argv) { +int pre_remove_service(int argc, TCHAR **argv) { /* Show dialogue box if we didn't pass service name and "confirm" */ if (argc < 2) return nssm_gui(IDD_REMOVE, argv[0]); - if (str_equiv(argv[1], "confirm")) { + if (str_equiv(argv[1], _T("confirm"))) { nssm_service_t *service = alloc_nssm_service(); - memmove(service->name, argv[0], strlen(argv[0])); + _sntprintf_s(service->name, _countof(service->name), _TRUNCATE, _T("%s"), argv[0]); int ret = remove_service(service); cleanup_nssm_service(service); return ret; @@ -125,29 +148,58 @@ int install_service(nssm_service_t *service) { } /* Get path of this program */ - char path[MAX_PATH]; - GetModuleFileName(0, path, MAX_PATH); - - /* Construct command */ - char command[CMD_LENGTH]; - size_t pathlen = strlen(path); - if (pathlen + 1 >= VALUE_LENGTH) { - print_message(stderr, NSSM_MESSAGE_PATH_TOO_LONG, NSSM); - return 3; - } - if (_snprintf_s(command, sizeof(command), _TRUNCATE, "\"%s\"", path) < 0) { - print_message(stderr, NSSM_MESSAGE_OUT_OF_MEMORY_FOR_IMAGEPATH); - return 4; + TCHAR command[MAX_PATH]; + GetModuleFileName(0, command, _countof(command)); + + /* + The only two valid flags for service type are SERVICE_WIN32_OWN_PROCESS + and SERVICE_INTERACTIVE_PROCESS. + */ + service->type &= SERVICE_INTERACTIVE_PROCESS; + service->type |= SERVICE_WIN32_OWN_PROCESS; + + /* Startup type. */ + unsigned long startup; + switch (service->startup) { + case NSSM_STARTUP_MANUAL: startup = SERVICE_DEMAND_START; break; + case NSSM_STARTUP_DISABLED: startup = SERVICE_DISABLED; break; + default: startup = SERVICE_AUTO_START; } + /* Display name. */ + if (! service->displayname[0]) _sntprintf_s(service->displayname, _countof(service->displayname), _TRUNCATE, _T("%s"), service->name); + /* Create the service */ - service->handle = CreateService(services, service->name, service->name, SC_MANAGER_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS, SERVICE_AUTO_START, SERVICE_ERROR_NORMAL, command, 0, 0, 0, 0, 0); + service->handle = CreateService(services, service->name, service->displayname, SC_MANAGER_ALL_ACCESS, service->type, startup, SERVICE_ERROR_NORMAL, command, 0, 0, 0, service->username, service->password); if (! service->handle) { print_message(stderr, NSSM_MESSAGE_CREATESERVICE_FAILED); CloseServiceHandle(services); return 5; } + if (service->description[0]) { + SERVICE_DESCRIPTION description; + ZeroMemory(&description, sizeof(description)); + description.lpDescription = service->description; + if (! ChangeServiceConfig2(service->handle, SERVICE_CONFIG_DESCRIPTION, &description)) { + log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_SERVICE_CONFIG_DESCRIPTION_FAILED, service->name, error_string(GetLastError()), 0); + } + } + + if (service->startup == NSSM_STARTUP_DELAYED) { + SERVICE_DELAYED_AUTO_START_INFO delayed; + ZeroMemory(&delayed, sizeof(delayed)); + delayed.fDelayedAutostart = 1; + /* Delayed startup isn't supported until Vista. */ + if (! ChangeServiceConfig2(service->handle, SERVICE_CONFIG_DELAYED_AUTO_START_INFO, &delayed)) { + unsigned long error = GetLastError(); + /* Pre-Vista we expect to fail with ERROR_INVALID_LEVEL */ + if (error != ERROR_INVALID_LEVEL) { + log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_SERVICE_CONFIG_DELAYED_AUTO_START_INFO_FAILED, service->name, error_string(error), 0); + } + } + } + /* Now we need to put the parameters into the registry */ if (create_parameters(service)) { print_message(stderr, NSSM_MESSAGE_CREATE_PARAMETERS_FAILED); @@ -200,12 +252,12 @@ int remove_service(nssm_service_t *service) { } /* Service initialisation */ -void WINAPI service_main(unsigned long argc, char **argv) { +void WINAPI service_main(unsigned long argc, TCHAR **argv) { nssm_service_t *service = alloc_nssm_service(); if (! service) return; - if (_snprintf_s(service->name, sizeof(service->name), _TRUNCATE, "%s", argv[0]) < 0) { - log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_OUT_OF_MEMORY, "service->name", "service_main()", 0); + if (_sntprintf_s(service->name, _countof(service->name), _TRUNCATE, _T("%s"), argv[0]) < 0) { + log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_OUT_OF_MEMORY, _T("service->name"), _T("service_main()"), 0); return; } @@ -277,7 +329,7 @@ void set_service_recovery(nssm_service_t *service) { unsigned long error = GetLastError(); /* Pre-Vista we expect to fail with ERROR_INVALID_LEVEL */ if (error != ERROR_INVALID_LEVEL) { - log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_CHANGESERVICECONFIG2_FAILED, service->name, error_string(error), 0); + log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_SERVICE_CONFIG_FAILURE_ACTIONS_FAILED, service->name, error_string(error), 0); } } } @@ -286,8 +338,8 @@ int monitor_service(nssm_service_t *service) { /* Set service status to started */ int ret = start_service(service); if (ret) { - char code[16]; - _snprintf_s(code, sizeof(code), _TRUNCATE, "%d", ret); + TCHAR code[16]; + _sntprintf_s(code, _countof(code), _TRUNCATE, _T("%d"), ret); log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_START_SERVICE_FAILED, service->exe, service->name, ret, 0); return ret; } @@ -301,32 +353,32 @@ int monitor_service(nssm_service_t *service) { return 0; } -char *service_control_text(unsigned long control) { +TCHAR *service_control_text(unsigned long control) { switch (control) { /* HACK: there is no SERVICE_CONTROL_START constant */ - case 0: return "START"; - case SERVICE_CONTROL_STOP: return "STOP"; - case SERVICE_CONTROL_SHUTDOWN: return "SHUTDOWN"; - case SERVICE_CONTROL_PAUSE: return "PAUSE"; - case SERVICE_CONTROL_CONTINUE: return "CONTINUE"; - case SERVICE_CONTROL_INTERROGATE: return "INTERROGATE"; + case 0: return _T("START"); + case SERVICE_CONTROL_STOP: return _T("STOP"); + case SERVICE_CONTROL_SHUTDOWN: return _T("SHUTDOWN"); + case SERVICE_CONTROL_PAUSE: return _T("PAUSE"); + case SERVICE_CONTROL_CONTINUE: return _T("CONTINUE"); + case SERVICE_CONTROL_INTERROGATE: return _T("INTERROGATE"); default: return 0; } } -void log_service_control(char *service_name, unsigned long control, bool handled) { - char *text = service_control_text(control); +void log_service_control(TCHAR *service_name, unsigned long control, bool handled) { + TCHAR *text = service_control_text(control); unsigned long event; if (! text) { /* "0x" + 8 x hex + NULL */ - text = (char *) HeapAlloc(GetProcessHeap(), 0, 11); + text = (TCHAR *) HeapAlloc(GetProcessHeap(), 0, 11 * sizeof(TCHAR)); if (! text) { - log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_OUT_OF_MEMORY, "control code", "log_service_control()", 0); + log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_OUT_OF_MEMORY, _T("control code"), _T("log_service_control()"), 0); return; } - if (_snprintf_s(text, 11, _TRUNCATE, "0x%08x", control) < 0) { - log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_OUT_OF_MEMORY, "control code", "log_service_control()", 0); + if (_sntprintf_s(text, 11, _TRUNCATE, _T("0x%08x"), control) < 0) { + log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_OUT_OF_MEMORY, _T("control code"), _T("log_service_control()"), 0); HeapFree(GetProcessHeap(), 0, text); return; } @@ -428,9 +480,9 @@ int start_service(nssm_service_t *service) { } /* Launch executable with arguments */ - char cmd[CMD_LENGTH]; - if (_snprintf_s(cmd, sizeof(cmd), _TRUNCATE, "\"%s\" %s", service->exe, service->flags) < 0) { - log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_OUT_OF_MEMORY, "command line", "start_service", 0); + TCHAR cmd[CMD_LENGTH]; + if (_sntprintf_s(cmd, _countof(cmd), _TRUNCATE, _T("\"%s\" %s"), service->exe, service->flags) < 0) { + log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_OUT_OF_MEMORY, _T("command line"), _T("start_service"), 0); close_output_handles(&si); return stop_service(service, 2, true, true); } @@ -439,12 +491,20 @@ int start_service(nssm_service_t *service) { bool inherit_handles = false; if (si.dwFlags & STARTF_USESTDHANDLES) inherit_handles = true; - if (! CreateProcess(0, cmd, 0, 0, inherit_handles, 0, service->env, service->dir, &si, &pi)) { + unsigned long flags = 0; +#ifdef UNICODE + flags |= CREATE_UNICODE_ENVIRONMENT; +#endif + if (! CreateProcess(0, cmd, 0, 0, inherit_handles, flags, service->env, service->dir, &si, &pi)) { + unsigned long exitcode = 3; unsigned long error = GetLastError(); - if (error == ERROR_INVALID_PARAMETER && service->env) log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_CREATEPROCESS_FAILED_INVALID_ENVIRONMENT, service->name, service->exe, NSSM_REG_ENV, 0); + if (error == ERROR_INVALID_PARAMETER && service->env) { + log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_CREATEPROCESS_FAILED_INVALID_ENVIRONMENT, service->name, service->exe, NSSM_REG_ENV, 0); + if (test_environment(service->env)) exitcode = 4; + } else log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_CREATEPROCESS_FAILED, service->name, service->exe, error_string(error), 0); close_output_handles(&si); - return stop_service(service, 3, true, true); + return stop_service(service, exitcode, true, true); } service->process_handle = pi.hProcess; service->pid = pi.dwProcessId; @@ -460,10 +520,10 @@ int start_service(nssm_service_t *service) { */ unsigned long delay = service->throttle_delay; if (delay > NSSM_SERVICE_STATUS_DEADLINE) { - char delay_milliseconds[16]; - _snprintf_s(delay_milliseconds, sizeof(delay_milliseconds), _TRUNCATE, "%lu", delay); - char deadline_milliseconds[16]; - _snprintf_s(deadline_milliseconds, sizeof(deadline_milliseconds), _TRUNCATE, "%lu", NSSM_SERVICE_STATUS_DEADLINE); + TCHAR delay_milliseconds[16]; + _sntprintf_s(delay_milliseconds, _countof(delay_milliseconds), _TRUNCATE, _T("%lu"), delay); + TCHAR deadline_milliseconds[16]; + _sntprintf_s(deadline_milliseconds, _countof(deadline_milliseconds), _TRUNCATE, _T("%lu"), NSSM_SERVICE_STATUS_DEADLINE); log_event(EVENTLOG_WARNING_TYPE, NSSM_EVENT_STARTUP_DELAY_TOO_LONG, service->name, delay_milliseconds, NSSM, deadline_milliseconds, 0); delay = NSSM_SERVICE_STATUS_DEADLINE; } @@ -493,7 +553,7 @@ int stop_service(nssm_service_t *service, unsigned long exitcode, bool graceful, } if (default_action && ! exitcode && ! graceful) { - log_event(EVENTLOG_INFORMATION_TYPE, NSSM_EVENT_GRACEFUL_SUICIDE, service->name, service->exe, exit_action_strings[NSSM_EXIT_UNCLEAN], exit_action_strings[NSSM_EXIT_UNCLEAN], exit_action_strings[NSSM_EXIT_UNCLEAN], exit_action_strings[NSSM_EXIT_REALLY] ,0); + log_event(EVENTLOG_INFORMATION_TYPE, NSSM_EVENT_GRACEFUL_SUICIDE, service->name, service->exe, exit_action_strings[NSSM_EXIT_UNCLEAN], exit_action_strings[NSSM_EXIT_UNCLEAN], exit_action_strings[NSSM_EXIT_UNCLEAN], exit_action_strings[NSSM_EXIT_REALLY], 0); graceful = true; } @@ -541,26 +601,29 @@ void CALLBACK end_service(void *arg, unsigned char why) { /* Check exit code */ unsigned long exitcode = 0; - char code[16]; - GetExitCodeProcess(service->process_handle, &exitcode); - if (exitcode == STILL_ACTIVE || get_process_exit_time(service->process_handle, &service->exit_time)) GetSystemTimeAsFileTime(&service->exit_time); - CloseHandle(service->process_handle); + TCHAR code[16]; + if (service->process_handle) { + GetExitCodeProcess(service->process_handle, &exitcode); + if (exitcode == STILL_ACTIVE || get_process_exit_time(service->process_handle, &service->exit_time)) GetSystemTimeAsFileTime(&service->exit_time); + CloseHandle(service->process_handle); + } + else GetSystemTimeAsFileTime(&service->exit_time); service->process_handle = 0; - service->pid = 0; /* Log that the service ended BEFORE logging about killing the process tree. See below for the possible values of the why argument. */ if (! why) { - _snprintf_s(code, sizeof(code), _TRUNCATE, "%lu", exitcode); + _sntprintf_s(code, _countof(code), _TRUNCATE, _T("%lu"), exitcode); log_event(EVENTLOG_INFORMATION_TYPE, NSSM_EVENT_ENDED_SERVICE, service->exe, service->name, code, 0); } /* Clean up. */ if (exitcode == STILL_ACTIVE) exitcode = 0; - kill_process_tree(service, service->pid, exitcode, service->pid); + if (service->pid) kill_process_tree(service, service->pid, exitcode, service->pid); + service->pid = 0; /* The why argument is true if our wait timed out or false otherwise. @@ -573,11 +636,11 @@ void CALLBACK end_service(void *arg, unsigned char why) { /* What action should we take? */ int action = NSSM_EXIT_RESTART; - unsigned char action_string[ACTION_LEN]; + TCHAR action_string[ACTION_LEN]; bool default_action; if (! get_exit_action(service->name, &exitcode, action_string, &default_action)) { for (int i = 0; exit_action_strings[i]; i++) { - if (! _strnicmp((const char *) action_string, exit_action_strings[i], ACTION_LEN)) { + if (! _tcsnicmp((const TCHAR *) action_string, exit_action_strings[i], ACTION_LEN)) { action = i; break; } @@ -624,9 +687,9 @@ void throttle_restart(nssm_service_t *service) { if (service->throttle > 7) service->throttle = 8; - char threshold[8], milliseconds[8]; - _snprintf_s(threshold, sizeof(threshold), _TRUNCATE, "%lu", service->throttle_delay); - _snprintf_s(milliseconds, sizeof(milliseconds), _TRUNCATE, "%lu", ms); + TCHAR threshold[8], milliseconds[8]; + _sntprintf_s(threshold, _countof(threshold), _TRUNCATE, _T("%lu"), service->throttle_delay); + _sntprintf_s(milliseconds, _countof(milliseconds), _TRUNCATE, _T("%lu"), ms); log_event(EVENTLOG_WARNING_TYPE, NSSM_EVENT_THROTTLED, service->name, threshold, milliseconds, 0); if (use_critical_section) EnterCriticalSection(&service->throttle_section); @@ -677,24 +740,24 @@ void throttle_restart(nssm_service_t *service) { 0 if the wait completed. -1 on error. */ -int await_shutdown(nssm_service_t *service, char *function_name, unsigned long timeout) { +int await_shutdown(nssm_service_t *service, TCHAR *function_name, unsigned long timeout) { unsigned long interval; unsigned long waithint; unsigned long ret; unsigned long waited; - char interval_milliseconds[16]; - char timeout_milliseconds[16]; - char waited_milliseconds[16]; - char *function = function_name; + TCHAR interval_milliseconds[16]; + TCHAR timeout_milliseconds[16]; + TCHAR waited_milliseconds[16]; + TCHAR *function = function_name; /* Add brackets to function name. */ - size_t funclen = strlen(function_name) + 3; - char *func = (char *) HeapAlloc(GetProcessHeap(), 0, funclen); + size_t funclen = _tcslen(function_name) + 3; + TCHAR *func = (TCHAR *) HeapAlloc(GetProcessHeap(), 0, funclen * sizeof(TCHAR)); if (func) { - if (_snprintf_s(func, funclen, _TRUNCATE, "%s()", function_name) > -1) function = func; + if (_sntprintf_s(func, funclen, _TRUNCATE, _T("%s()"), function_name) > -1) function = func; } - _snprintf_s(timeout_milliseconds, sizeof(timeout_milliseconds), _TRUNCATE, "%lu", timeout); + _sntprintf_s(timeout_milliseconds, _countof(timeout_milliseconds), _TRUNCATE, _T("%lu"), timeout); waithint = service->status.dwWaitHint; waited = 0; @@ -708,8 +771,8 @@ int await_shutdown(nssm_service_t *service, char *function_name, unsigned long t SetServiceStatus(service->status_handle, &service->status); if (waited) { - _snprintf_s(waited_milliseconds, sizeof(waited_milliseconds), _TRUNCATE, "%lu", waited); - _snprintf_s(interval_milliseconds, sizeof(interval_milliseconds), _TRUNCATE, "%lu", interval); + _sntprintf_s(waited_milliseconds, _countof(waited_milliseconds), _TRUNCATE, _T("%lu"), waited); + _sntprintf_s(interval_milliseconds, _countof(interval_milliseconds), _TRUNCATE, _T("%lu"), interval); log_event(EVENTLOG_INFORMATION_TYPE, NSSM_EVENT_AWAITING_SHUTDOWN, function, service->name, waited_milliseconds, interval_milliseconds, timeout_milliseconds, 0); }