Fix overflow problem when giving a username that is too long. Also minor declaration/header fixes while auditing the code.
Fix overflow problem when giving a username that is too long.
Also minor declaration/header fixes while auditing the code.

jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase