Remove two more juicy MDB-addicted functions from msgapi
This commit is contained in:
@@ -333,165 +333,6 @@ MsgFindObject(const unsigned char *user, unsigned char *dn, unsigned char *userT
|
||||
return(retVal);
|
||||
}
|
||||
|
||||
EXPORT BOOL
|
||||
MsgFindObjectEx(const unsigned char *user, unsigned char *dn, unsigned char *userType, struct sockaddr_in *nmap, BOOL *disabled, MDBValueStruct *v)
|
||||
{
|
||||
BOOL retVal = FALSE;
|
||||
|
||||
MDBValueStruct *userCtx;
|
||||
MDBValueStruct *types;
|
||||
unsigned long i, j;
|
||||
unsigned char rdn[MDB_MAX_OBJECT_CHARS + 1];
|
||||
|
||||
BOOL isUser = FALSE;
|
||||
BOOL isGroup = FALSE;
|
||||
BOOL isResource = FALSE;
|
||||
BOOL isOrgRole = FALSE;
|
||||
BOOL isDynGroup = FALSE;
|
||||
|
||||
userCtx = MDBCreateValueStruct(MsgGlobal.directoryHandle, NULL);
|
||||
types = MDBShareContext(userCtx);
|
||||
|
||||
XplRWReadLockAcquire(&MsgGlobal.configLock);
|
||||
|
||||
for (i = 0; i < MsgGlobal.vs.server.contexts->Used; i++) {
|
||||
MDBSetValueStructContext(MsgGlobal.vs.server.contexts->Value[i], userCtx);
|
||||
|
||||
if (MDBGetObjectDetailsEx(user, types, rdn, dn, userCtx)) {
|
||||
for (j = 0; j < types->Used; j++) {
|
||||
if (strcmp(types->Value[j], C_USER) == 0) {
|
||||
isUser = TRUE;
|
||||
} else if (strcmp(types->Value[j],
|
||||
MSGSRV_C_RESOURCE) == 0) {
|
||||
isResource = TRUE;
|
||||
} else if (strcmp(types->Value[j], MSGSRV_C_GROUP) == 0 ||
|
||||
strcmp(types->Value[j], C_GROUP) == 0) {
|
||||
isGroup = TRUE;
|
||||
} else if (strcmp(types->Value[j],
|
||||
MSGSRV_C_ORGANIZATIONAL_ROLE) == 0 ||
|
||||
strcmp(types->Value[j],
|
||||
C_ORGANIZATIONAL_ROLE) == 0) {
|
||||
isOrgRole = TRUE;
|
||||
} else if (strcmp(types->Value[j], "dynamicGroup") == 0) {
|
||||
isDynGroup = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
*disabled = FALSE;
|
||||
|
||||
if (isUser || isResource) {
|
||||
if (v) {
|
||||
MDBAddValue(rdn, v);
|
||||
}
|
||||
if (nmap) {
|
||||
memcpy(nmap, &MsgGlobal.vs.server.addr[i], sizeof(struct sockaddr_in));
|
||||
}
|
||||
if (userType) {
|
||||
if (isUser) {
|
||||
strcpy(userType, C_USER);
|
||||
} else if (isResource) {
|
||||
strcpy(userType, MSGSRV_C_RESOURCE);
|
||||
}
|
||||
}
|
||||
retVal = TRUE;
|
||||
} else if (isGroup) {
|
||||
if (v) {
|
||||
MDBSetValueStructContext(MsgGlobal.vs.server.contexts->Value[i], v);
|
||||
MDBRead(user, A_MEMBER, v);
|
||||
|
||||
/* This removes any context from a group member's name */
|
||||
for (j = 0; j < v->Used; j++) {
|
||||
unsigned char *ptr;
|
||||
ptr = strrchr(v->Value[j], '\\');
|
||||
if (ptr) {
|
||||
memmove(v->Value[j], ptr + 1, strlen(ptr + 1) + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (userType) {
|
||||
strcpy(userType, C_GROUP);
|
||||
}
|
||||
retVal = TRUE;
|
||||
} else if (isOrgRole) {
|
||||
if (v) {
|
||||
MDBSetValueStructContext(MsgGlobal.vs.server.contexts->Value[i], v);
|
||||
MDBRead(user, A_ROLE_OCCUPANT, v);
|
||||
|
||||
/* This removes any context from a the roles name */
|
||||
for (j = 0; j < v->Used; j++) {
|
||||
unsigned char *ptr;
|
||||
ptr = strrchr(v->Value[j], '\\');
|
||||
if (ptr) {
|
||||
memmove(v->Value[j], ptr + 1, strlen(ptr + 1) + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (userType) {
|
||||
strcpy(userType, C_ORGANIZATIONAL_ROLE);
|
||||
}
|
||||
retVal = TRUE;
|
||||
} else if (isDynGroup) {
|
||||
if (v) {
|
||||
MDBSetValueStructContext(MsgGlobal.vs.server.contexts->Value[i], v);
|
||||
MDBRead(user, A_MEMBER, v);
|
||||
|
||||
/* This removes any context from a group member's name */
|
||||
for (j = 0; j < v->Used; j++) {
|
||||
unsigned char *ptr;
|
||||
ptr = strrchr(v->Value[j], '\\');
|
||||
if (ptr) {
|
||||
memmove(v->Value[j], ptr + 1, strlen(ptr + 1) + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (userType) {
|
||||
strcpy(userType, "dynamicGroup");
|
||||
}
|
||||
retVal = TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
XplRWReadLockRelease(&MsgGlobal.configLock);
|
||||
|
||||
MDBDestroyValueStruct(userCtx);
|
||||
|
||||
return(retVal);
|
||||
}
|
||||
|
||||
EXPORT const unsigned char *
|
||||
MsgFindUserStore(const unsigned char *user, const unsigned char *defaultPath)
|
||||
{
|
||||
MDBValueStruct *context;
|
||||
unsigned long i;
|
||||
|
||||
XplRWReadLockAcquire(&MsgGlobal.configLock);
|
||||
context = MDBCreateValueStruct(MsgGlobal.directoryHandle, MsgGlobal.vs.server.contexts->Value[0]);
|
||||
|
||||
i = 0;
|
||||
do {
|
||||
if (MDBIsObject(user, context)) {
|
||||
MDBDestroyValueStruct(context);
|
||||
if (MsgGlobal.vs.storePaths->Value[i][0] != EMPTY_CHAR) {
|
||||
XplRWReadLockRelease(&MsgGlobal.configLock);
|
||||
return(MsgGlobal.vs.storePaths->Value[i]);
|
||||
} else {
|
||||
XplRWReadLockRelease(&MsgGlobal.configLock);
|
||||
return(defaultPath);
|
||||
}
|
||||
} else {
|
||||
i++;
|
||||
if (i != MsgGlobal.vs.server.contexts->Used) {
|
||||
MDBSetValueStructContext(MsgGlobal.vs.server.contexts->Value[i], context);
|
||||
}
|
||||
}
|
||||
} while (i != MsgGlobal.vs.server.contexts->Used);
|
||||
XplRWReadLockRelease(&MsgGlobal.configLock);
|
||||
|
||||
MDBDestroyValueStruct(context);
|
||||
return(defaultPath);
|
||||
}
|
||||
|
||||
EXPORT BOOL
|
||||
MsgReadIP(const unsigned char *object, unsigned char *type, MDBValueStruct *v)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user