117
118
PSTR buffer = NULL;
120
PCSTR description = "Unknown error";
121
DWORD err = CENTERROR_DOMAINJOIN_LSASS_ERROR;
119
122
size_t bufferSize;
124
symbol = LwWin32ExtErrorToName(code);
120
130
bufferSize = LwGetErrorString(code, NULL, 0);
121
131
LW_CLEANUP_CTERR(dest, CTAllocateMemory(bufferSize, PPCAST(&buffer)));
122
132
if (LwGetErrorString(code, buffer, bufferSize) == bufferSize && bufferSize > 0 && strlen(buffer) > 0)
124
DWORD err = CENTERROR_DOMAINJOIN_LSASS_ERROR;
128
case LW_ERROR_FAILED_TO_LOOKUP_DC:
129
err = CENTERROR_DOMAINJOIN_UNRESOLVED_DOMAIN_NAME;
133
LWRaiseEx(dest, err, file, line, "Lsass Error", "0x%X - %s", code, buffer);
136
(*dest)->subcode = code;
141
LWRaiseEx(dest, CENTERROR_DOMAINJOIN_LSASS_ERROR, file, line, "Unable to convert lsass error", "Lsass error code 0x%X has occurred, but an error string cannot be retrieved", code);
134
description = buffer;
139
case LW_ERROR_FAILED_TO_LOOKUP_DC:
140
err = CENTERROR_DOMAINJOIN_UNRESOLVED_DOMAIN_NAME;
144
LWRaiseEx(dest, err, file, line, "Lsass Error", "%d (0x%X) %s - %s", code, code, symbol, description);
142
145
if (dest != NULL)
144
147
(*dest)->subcode = code;
815
818
PSTR pszCanonicalizedOU = NULL;
816
819
ModuleState *state = DJGetModuleStateByName(options, "join");
817
BOOLEAN bNoTimeSyncFileExists = FALSE;
819
821
if (!IsNullOrEmptyString(getenv("LD_LIBRARY_PATH")) ||
820
822
!IsNullOrEmptyString(getenv("LD_PRELOAD")))
836
838
pszCanonicalizedOU = NULL;
839
LW_CLEANUP_CTERR(exc, CTCheckFileExists(NO_TIME_SYNC_FILE,
840
&bNoTimeSyncFileExists));
842
if (options->disableTimeSync && !bNoTimeSyncFileExists)
844
/* Create no time sync file */
845
FILE* noTimeSyncFile = NULL;
847
LW_CLEANUP_CTERR(exc, CTOpenFile(NO_TIME_SYNC_FILE,
848
"w", &noTimeSyncFile));
850
CTCloseFile(noTimeSyncFile);
852
else if (!options->disableTimeSync && bNoTimeSyncFileExists)
854
/* Remove no time sync file */
855
LW_CLEANUP_CTERR(exc, CTRemoveFile(NO_TIME_SYNC_FILE));
841
LW_TRY(exc, SetLsassTimeSync("", !options->disableTimeSync, &LW_EXC));
859
843
LW_TRY(exc, DJCreateComputerAccount(&options->shortDomainName, options, &LW_EXC));
1173
1157
LW_CLEANUP_CTERR(exc, CTMapSystemError(errno));
1176
LW_CLEANUP_LSERR(exc, LWNetExtendEnvironmentForKrb5Affinity(FALSE));
1160
LW_CLEANUP_LSERR(exc, LWNetExtendEnvironmentForKrb5Affinity(TRUE));
1178
1162
if ( options->disableTimeSync )
1630
void SetLsassTimeSync(PCSTR rootPrefix, BOOLEAN sync, LWException **exc)
1632
DWORD dwSync = sync;
1633
HANDLE hReg = (HANDLE)NULL;
1637
LW_CLEANUP_LSERR(exc, RegOpenServer(&hReg));
1638
LW_CLEANUP_LSERR(exc, RegOpenKeyExA(
1641
HKEY_THIS_MACHINE "\\Services\\lsass\\Parameters\\Providers\\ActiveDirectory",
1646
LW_CLEANUP_LSERR(exc, RegSetValueExA(
1655
LW_CLEANUP_LSERR(exc, LsaOpenServer(&lsa));
1656
LW_CLEANUP_LSERR(exc, LsaRefreshConfiguration(lsa));
1661
LsaCloseServer(lsa);
1663
RegCloseKey(hReg, pAdKey);
1664
RegCloseServer(hReg);