Special case for well-known accounts.\r
Ignore the password if we're editing and the username hasn't changed.\r
*/\r
- if (! requires_password(service->username)) {\r
- if (is_localsystem(service->username)) {
+ const TCHAR *well_known = well_known_username(service->username);
+ if (well_known) {\r
+ if (str_equiv(well_known, NSSM_LOCALSYSTEM_ACCOUNT)) {
HeapFree(GetProcessHeap(), 0, service->username);\r
service->username = 0;\r
service->usernamelen = 0;\r
}
else {
- TCHAR *canon = canonical_username(service->username);
- HeapFree(GetProcessHeap(), 0, service->username);\r
- service->username = 0;\r
- service->usernamelen = 0;\r
- if (canon) {
- service->usernamelen = _tcslen(canon) + 1;
- service->username = (TCHAR *) HeapAlloc(GetProcessHeap(), 0, service->usernamelen * sizeof(TCHAR));
- if (! service->username) {
- LocalFree(canon);
- print_message(stderr, NSSM_MESSAGE_OUT_OF_MEMORY, _T("canon"), _T("install()"));
- return 6;
- }
- memmove(service->username, canon, service->usernamelen * sizeof(TCHAR));
- LocalFree(canon);
+ service->usernamelen = _tcslen(well_known) + 1;
+ service->username = (TCHAR *) HeapAlloc(GetProcessHeap(), 0, service->usernamelen * sizeof(TCHAR));
+ if (! service->username) {
+ print_message(stderr, NSSM_MESSAGE_OUT_OF_MEMORY, _T("canon"), _T("install()"));
+ return 6;
}
- else return 6;
+ memmove(service->username, well_known, service->usernamelen * sizeof(TCHAR));
}
}\r
else {\r