Hostnamechanger index was outside the bounds of the array. fog 1.3.0 rev 2402
-
hi,
im trying to change the hostname on the computer but im receiving this error:
“hostnamechanger index was outside the bounds of the array”
unbuntu 12.04 lts
fog rev 2402.
does anybody now a possible solution?best regards
-
This is often caused when
A.) You entered a product key for the host without compiling the new patched HostnameChanger.dll
B.) You compiled the un-patched new HostnameChanger.dll without giving the computer a product key.The HostnameChanger source files in the svn repository will compile a version that fixes this issue as well.
-
[quote=“Jbob, post: 37573, member: 21733”]This is often caused when
A.) You entered a product key for the host without compiling the new patched HostnameChanger.dll
B.) You compiled the un-patched new HostnameChanger.dll without giving the computer a product key.The HostnameChanger source files in the svn repository will compile a version that fixes this issue as well.[/quote]
hi, I will try this today and get back to you with an answer.best regards
-
Did you ever find a solution to this problem? I’m having the same issue but we do not use product key management through FOG. Is this required for HostNameChanger to work properly?
EDIT
I’ve recompiled HostNameChanger myself using VS 2008. Prior to this I was getting an invalid padding error. It’s driving me bonkers. -
I think someone had a similar issue to this before, and re-installing the FOG client on the image fixed it.
Gotta use the client that comes from your FOG server. It’s available in the Web GUI for download.
-
I’ve actually got it working now. I thought that recompiling HostNameChanger and changing the passkey was enough, but the out of bounds error is caused by the unpatched MOD_hostnamechanger.cs that is packed with 1.2.0. I cloned the latest version from git, changed the passkey and recompiled and now everything is working great. The error lies in the function at line 362 of MOD_HostnmeChanger.cs. The unpatched version only allows an array size of 6:
[CODE]if (arData.Length == 6)
{
strHostName = strHostResults.Remove(0, 5);
String strUseAD = arData[1];
String strD = arData[2];
String strOU = arData[3];
String strU = arData[4];
String strP = arData[5];
String strKey = arData[6];
if (strKey != null)
{
strKey = strKey.Trim();
if (strKey.StartsWith(“#Key=”))
{
strKey = strKey.Replace(“#Key=”, “”);
Process scriptProc = new Process();
scriptProc.StartInfo.FileName = @“cscript”;
scriptProc.StartInfo.Arguments =@“//B //Nologo c:\windows\system32\slmgr.vbs /ipk " + strKey;
scriptProc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
scriptProc.Start();
scriptProc.WaitForExit();
scriptProc.Close();
scriptProc.StartInfo.Arguments =@”//B //Nologo c:\windows\system32\slmgr.vbs /ato";
scriptProc.Start();
scriptProc.WaitForExit();
scriptProc.Close();
}
}[/CODE]As apposed to the patched version from git that allows for an array size of 6 OR 7:
[CODE]if (arData.Length == 6 || arData.Length == 7)
{
strHostName = strHostResults.Remove(0, 5);
String strUseAD = arData[1];
String strD = arData[2];
String strOU = arData[3];
String strU = arData[4];
String strP = arData[5];if(arData.Length == 7) { String strKey = arData[6]; if (strKey != null) { strKey = strKey.Trim(); if (strKey.StartsWith("#Key=")) { strKey = strKey.Replace("#Key=", ""); Process scriptProc = new Process(); scriptProc.StartInfo.FileName = @"cscript"; scriptProc.StartInfo.Arguments =@"//B //Nologo c:\windows\system32\slmgr.vbs /ipk " + strKey; scriptProc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; scriptProc.Start(); scriptProc.WaitForExit(); scriptProc.Close(); scriptProc.StartInfo.Arguments =@"//B //Nologo c:\windows\system32\slmgr.vbs /ato"; scriptProc.Start(); scriptProc.WaitForExit(); scriptProc.Close(); } } }[/CODE]
Not really certain exactly what data the array is accepting, as I haven’t really had the time to scrutinize the code, but that seems to be the issue. Looks like it has something to do with a key value, but that doesn’t make sense because I’m not sending any key values. If anyone could explain what the data is that this array is being populated with that would be great. Otherwise I’ll come back and update when I’ve had the time to figure it out.
The version I used can be found here: [url]https://github.com/FOGProject/fogproject/tree/4b6a98a5a5ab552fbe066e062af857b33a17a15f/FOGService/src/FOG_HostNameChanger[/url]
The post on this forum that led me to this solution can be found here: [url]http://fogproject.org/forum/threads/active-directory-registration-not-working-windows-7-x64-client.11514/[/url]
Many thanks to Jbob for the info.
-
The data array contains all of the info returned by the server. The version included in v1.2.0 is broken, as you have discovered. Please note that this client is old and is about to be replaced by a new one. (A beta of the new version can be expected in the coming week(s) )
-
[quote=“Jbob, post: 43736, member: 21733”]The data array contains all of the info returned by the server. The version included in v1.2.0 is broken, as you have discovered. Please note that this client is old and is about to be replaced by a new one. (A beta of the new version can be expected in the coming week(s) )[/quote]
That’s great news. I looked over the code and I see how it populates now. Looks like the older version overpopulated by default, and didn’t check for null key value. Correct?
Will an in-place upgrade to the new beta be possible? Or will the server need to be rebuilt?
-
Correct, the old system didn’t always check null vaues.
The server will need to be upgraded to handle the new client. After that though, the clients can perform in-place upgrades.