Create the server credential again - seems it's needed :)

This commit is contained in:
alexhudson
2007-09-01 14:14:20 +00:00
parent e8f69e29cb
commit fb45a44dbb
3 changed files with 35 additions and 7 deletions
+29
View File
@@ -677,3 +677,32 @@ MsgGetServerCredential(char *buffer)
}
return FALSE;
}
EXPORT BOOL
MsgSetServerCredential()
{
unsigned char credential[4097];
unsigned char path[XPL_MAX_PATH];
FILE *credfile;
const char *posschars =
"abcdefghijlkmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWYXZ"
"0123456890";
int i, range;
range = strlen(posschars);
for (i=0; i<4097; i++) {
int ran = rand() % range;
credential[i] = posschars[ran];
}
credential[4096] = '\0';
snprintf(path, XPL_MAX_PATH, "%s/credential.dat", XPL_DEFAULT_DBF_DIR);
credfile = fopen(path, "wb");
if (credfile) {
fwrite(credential, sizeof(char), sizeof(credential), credfile);
fclose(credfile);
return TRUE;
}
return FALSE;
}