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
+1 -7
View File
@@ -120,6 +120,7 @@ EXPORT BOOL MsgSetRecoveryFlag(void);
EXPORT BOOL MsgGetRecoveryFlag(void);
EXPORT BOOL MsgGetServerCredential(char *buffer);
EXPORT BOOL MsgSetServerCredential(void);
#define MSGSRV_AGENT_ADDRESSBOOK "Address Book Agent"
#define MSGSRV_AGENT_ALIAS "Alias Agent"
@@ -173,13 +174,6 @@ EXPORT BOOL MsgGetConfigProperty(unsigned char *Buffer, unsigned char *Property)
EXPORT const unsigned char *MsgFindUserStore(const unsigned char *user, const unsigned char *defaultPath);
EXPORT BOOL MsgFindUserNmap(const unsigned char *user, unsigned char *nmap, int nmap_len, unsigned short *port);
EXPORT const unsigned char *MsgGetDBFDir(char *directory);
EXPORT const unsigned char *MsgGetWorkDir(char *directory);
EXPORT const unsigned char *MsgGetNLSDir(char *directory);
EXPORT const unsigned char *MsgGetLibDir(char *directory);
EXPORT const unsigned char *MsgGetBinDir(char *directory);
EXPORT const unsigned char *MsgGetTLSCertPath(char *path);
EXPORT const unsigned char *MsgGetTLSKeyPath(char *path);
EXPORT unsigned long MsgGetHostIPAddress(void);
EXPORT unsigned long MsgGetAgentBindIPAddress(void);
+5
View File
@@ -78,6 +78,11 @@ InitializeDataArea(void)
MsgMakePath(path);
}
}
if (!MsgSetServerCredential()) {
XplConsolePrintf(_("ERROR: Cannot create server credential\n"));
exit(2);
}
}
void
+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;
}