Remove non-config MDB bits from the store agent

This commit is contained in:
alexhudson
2007-07-09 21:50:30 +00:00
parent 590830a473
commit 490eff0b8c
3 changed files with 14 additions and 33 deletions
+7 -12
View File
@@ -4753,9 +4753,7 @@ StoreCommandRESET(StoreClient *client)
CCode
StoreCommandSTORE(StoreClient *client, char *user)
{
MDBValueStruct *vs;
struct sockaddr_in serv;
unsigned char dn[MDB_MAX_OBJECT_CHARS + 1];
if (!user) {
UnselectStore(client);
@@ -4770,23 +4768,20 @@ StoreCommandSTORE(StoreClient *client, char *user)
}
}
vs = MDBCreateValueStruct(StoreAgent.handle.directory, NULL);
if (!vs) {
return ConnWriteStr(client->conn, MSG5001NOMEMORY);
}
if (!MsgFindObject(user, dn, NULL, &serv, vs)) {
if (! MsgAuthFindUser(user)) {
XplConsolePrintf("Couldn't find user object for %s\r\n", user);
MDBDestroyValueStruct(vs);
/* the previous nmap returned some sort of user locked message? */
return ConnWriteStr(client->conn, MSG4100STORENOTFOUND);
}
MDBDestroyValueStruct(vs);
if (serv.sin_addr.s_addr != MsgGetHostIPAddress()) {
/* non-local store */
// FIXME: Below is a check that the user resides in this store.
// For Bongo 1.0, we're assuming a single store?
#if 0
if (serv.sin_addr.s_addr != MsgGetHostIPAddress()) {
// non-local store
return ConnWriteStr(client->conn, MSG4100STORENOTFOUND);
}
#endif
if (SelectStore(client, user)) {
return ConnWriteStr(client->conn, MSG4224BADSTORE);
+5 -10
View File
@@ -273,33 +273,29 @@ StoreCommandAUTHCOOKIE(StoreClient *client, char *user, char *token, int nouser)
{
CCode ccode;
NLockStruct *lock = NULL;
MDBValueStruct *vs;
unsigned char dn[MDB_MAX_OBJECT_CHARS + 1];
struct sockaddr_in serv;
// struct sockaddr_in serv;
if (StoreAgent.installMode) {
// don't allow cookie logins in installation mode. FIXME: better error message?
return ConnWriteStr(client->conn, MSG3242BADAUTH);
}
vs = MDBCreateValueStruct(StoreAgent.handle.directory, NULL);
if (!vs) {
return ConnWriteStr(client->conn, MSG5001NOMEMORY);
}
if (!MsgFindObject(user, dn, NULL, &serv, vs)) {
if (! MsgAuthFindUser(user)) {
XplConsolePrintf("Couldn't find user object for %s\r\n", user);
ccode = ConnWriteStr(client->conn, MSG3242BADAUTH);
XplDelay(2000);
goto finish;
}
// FIXME: This checks for a non-local store. For Bongo 1.0, we assume a single store.
#if 0
if (serv.sin_addr.s_addr != MsgGetHostIPAddress()) {
/* non-local store, need to verify against user's server */
ccode = TunnelAuthCookie(client, &serv, user, token, nouser);
goto finish;
}
#endif
if (NLOCK_ACQUIRED != ReadNLockAcquire(&lock, NULL, user, STORE_ROOT_GUID, 2000))
{
@@ -328,7 +324,6 @@ finish:
PurgeNLockRelease(lock);
ReadNLockRelease(lock);
}
MDBDestroyValueStruct(vs);
return ccode;
}
+2 -11
View File
@@ -113,19 +113,10 @@ ProcessEntry(void *clientp,
static int
StoreSocketInit()
{
MDBValueStruct *vs;
unsigned short port = BONGO_STORE_DEFAULT_PORT;
if (! StoreAgent.installMode) {
vs = MDBCreateValueStruct(StoreAgent.handle.directory, StoreAgent.server.dn);
if (vs) {
if (MDBRead(MSGSRV_AGENT_STORE, MSGSRV_A_PORT, vs) > 0) {
port = atol(vs->Value[0]);
MDBFreeValues(vs);
}
MDBDestroyValueStruct(vs);
}
}
// FIXME: previously, the port was configurable. However - we don't currently
// have a way of communicating that to Store Agents
StoreAgent.nmapConn = ConnAlloc(FALSE);
if (!StoreAgent.nmapConn) {