Turn on strict compiling for the store.. bit messy in places :S
This commit is contained in:
@@ -22,6 +22,6 @@ if (DEBUG)
|
||||
endif (DEBUG)
|
||||
|
||||
function (StrictCompile)
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror -std=c99" PARENT_SCOPE)
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror -std=c++98" PARENT_SCOPE)
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror -std=c99 -D_XOPEN_SOURCE=500 -D_POSIX_C_SOURCE=200112" PARENT_SCOPE)
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror -std=c++98 -D_XOPEN_SOURCE=500 -D_POSIX_C_SOURCE=200112" PARENT_SCOPE)
|
||||
endfunction (StrictCompile)
|
||||
|
||||
+3
-2
@@ -166,8 +166,9 @@ void QuickSortIndexFree(unsigned long *index);
|
||||
void LoadProtocolCommandTree(ProtocolCommandTree *tree, ProtocolCommand *commands);
|
||||
ProtocolCommand *ProtocolCommandTreeSearch(ProtocolCommandTree *tree, const unsigned char *command);
|
||||
|
||||
BOOL QuickNCmp(unsigned char *str1, unsigned char *str2, int len);
|
||||
BOOL QuickCmp(unsigned char *str1, unsigned char *str2);
|
||||
void RemoveLineEnding(char *s);
|
||||
BOOL QuickNCmp(char *str1, char *str2, int len);
|
||||
BOOL QuickCmp(char *str1, char *str2);
|
||||
|
||||
#define BongoStrNCpy(dest, src, len) {strncpy((dest), (src), (len)); (dest)[(len) - 1] = '\0';}
|
||||
|
||||
|
||||
+1
-5
@@ -115,11 +115,7 @@ struct _BongoMemChunk {
|
||||
|
||||
BongoMemChunk *next;
|
||||
|
||||
/* Force alignment */
|
||||
union {
|
||||
double dummy;
|
||||
uint32_t data[1];
|
||||
};
|
||||
uint32_t data[1];
|
||||
};
|
||||
|
||||
typedef struct _BongoMemStack {
|
||||
|
||||
+6
-6
@@ -109,7 +109,7 @@ typedef enum {
|
||||
|
||||
EXPORT const unsigned char *
|
||||
MsgGetFile(MsgApiFile file, char *buffer, size_t buffer_size);
|
||||
EXPORT const unsigned char *
|
||||
EXPORT const char *
|
||||
MsgGetDir(MsgApiDirectory directory, char *buffer, size_t buffer_size);
|
||||
|
||||
#define MSGSQL_STMT_SLEEP_MS 250
|
||||
@@ -147,9 +147,9 @@ uint64_t MsgSQLLastRowID(MsgSQLHandle *handle);
|
||||
|
||||
// Misc. util functions
|
||||
|
||||
EXPORT BOOL MsgSetRecoveryFlag(unsigned char *agent_name);
|
||||
EXPORT BOOL MsgGetRecoveryFlag(unsigned char *agent_name);
|
||||
EXPORT BOOL MsgClearRecoveryFlag(unsigned char *agent_name);
|
||||
EXPORT BOOL MsgSetRecoveryFlag(char *agent_name);
|
||||
EXPORT BOOL MsgGetRecoveryFlag(char *agent_name);
|
||||
EXPORT BOOL MsgClearRecoveryFlag(char *agent_name);
|
||||
|
||||
EXPORT BOOL MsgGetServerCredential(char *buffer);
|
||||
EXPORT BOOL MsgSetServerCredential(void);
|
||||
@@ -211,8 +211,8 @@ EXPORT unsigned long MsgGetAgentBindIPAddress(void);
|
||||
|
||||
EXPORT const char *MsgGetUnprivilegedUser(void);
|
||||
|
||||
EXPORT void MsgMakePath(unsigned char *path);
|
||||
EXPORT BOOL MsgCleanPath(unsigned char *path);
|
||||
EXPORT void MsgMakePath(char *path);
|
||||
EXPORT BOOL MsgCleanPath(char *path);
|
||||
|
||||
EXPORT BOOL MsgResolveStart();
|
||||
EXPORT BOOL MsgResolveStop();
|
||||
|
||||
+15
-15
@@ -28,7 +28,7 @@
|
||||
#include <xpl.h>
|
||||
|
||||
typedef struct {
|
||||
unsigned char *Value;
|
||||
char *Value;
|
||||
unsigned long ValueLen;
|
||||
BOOL Encoded;
|
||||
} RFC2231LineStruct;
|
||||
@@ -45,7 +45,7 @@ rfc2231FreeParamLines(RFC2231ParamStruct *ParamLines)
|
||||
}
|
||||
|
||||
__inline static BOOL
|
||||
rcf2231SaveLine(unsigned char *paramValue, unsigned long paramLen, RFC2231ParamStruct **ParamLines, unsigned long LineNum, BOOL Encoded)
|
||||
rcf2231SaveLine(char *paramValue, unsigned long paramLen, RFC2231ParamStruct **ParamLines, unsigned long LineNum, BOOL Encoded)
|
||||
{
|
||||
RFC2231LineStruct *line;
|
||||
|
||||
@@ -86,7 +86,7 @@ rcf2231SaveLine(unsigned char *paramValue, unsigned long paramLen, RFC2231ParamS
|
||||
}
|
||||
}
|
||||
|
||||
line = (RFC2231LineStruct *)((unsigned char *)(*ParamLines) + sizeof(RFC2231ParamStruct));
|
||||
line = (RFC2231LineStruct *)((char *)(*ParamLines) + sizeof(RFC2231ParamStruct));
|
||||
line[LineNum].Value = paramValue;
|
||||
line[LineNum].ValueLen = paramLen;
|
||||
line[LineNum].Encoded = Encoded;
|
||||
@@ -98,14 +98,14 @@ rcf2231SaveLine(unsigned char *paramValue, unsigned long paramLen, RFC2231ParamS
|
||||
}
|
||||
|
||||
__inline static BOOL
|
||||
rfc2231JoinParamLines(unsigned char *ParamValue, unsigned long *ParamLen, RFC2231ParamStruct *ParamLines)
|
||||
rfc2231JoinParamLines(char *ParamValue, unsigned long *ParamLen, RFC2231ParamStruct *ParamLines)
|
||||
{
|
||||
|
||||
if (ParamLines->Used > 0) {
|
||||
|
||||
RFC2231LineStruct *line = (RFC2231LineStruct *)((unsigned char *)ParamLines + sizeof(RFC2231ParamStruct));
|
||||
unsigned char *ptr = ParamValue;
|
||||
unsigned char *endPtr = ParamValue + *ParamLen;
|
||||
RFC2231LineStruct *line = (RFC2231LineStruct *)((char *)ParamLines + sizeof(RFC2231ParamStruct));
|
||||
char *ptr = ParamValue;
|
||||
char *endPtr = ParamValue + *ParamLen;
|
||||
unsigned long i;
|
||||
BOOL encodingStillLegal; /* rfc2231 says that once you stop enconding, you can't start again */
|
||||
|
||||
@@ -158,10 +158,10 @@ rfc2231JoinParamLines(unsigned char *ParamValue, unsigned long *ParamLen, RFC223
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
__inline static unsigned char *
|
||||
GetParamValue(unsigned char *Data, unsigned char **Value, unsigned long *ValueLen)
|
||||
__inline static char *
|
||||
GetParamValue(char *Data, char **Value, unsigned long *ValueLen)
|
||||
{
|
||||
unsigned char *end;
|
||||
char *end;
|
||||
|
||||
if ((*Data == '"') && (end = strchr(Data + 1, '"'))) {
|
||||
Data++;
|
||||
@@ -189,11 +189,11 @@ GetParamValue(unsigned char *Data, unsigned char **Value, unsigned long *ValueLe
|
||||
}
|
||||
|
||||
|
||||
__inline static unsigned char *
|
||||
ParseParam(unsigned char *Data, unsigned char *Buffer, unsigned long *BuffLen, RFC2231ParamStruct **RFC2231ParamLines)
|
||||
__inline static char *
|
||||
ParseParam(char *Data, char *Buffer, unsigned long *BuffLen, RFC2231ParamStruct **RFC2231ParamLines)
|
||||
{
|
||||
unsigned char *nextChar;
|
||||
unsigned char *paramValue;
|
||||
char *nextChar;
|
||||
char *paramValue;
|
||||
unsigned long paramLen;
|
||||
|
||||
if (Data[0] == '=') {
|
||||
@@ -222,7 +222,7 @@ ParseParam(unsigned char *Data, unsigned char *Buffer, unsigned long *BuffLen, R
|
||||
|
||||
if (isdigit(Data[1])) {
|
||||
/* We have a multi-lined rfc2231 parameter */
|
||||
unsigned char *ptr;
|
||||
char *ptr;
|
||||
|
||||
ptr = Data + 1;
|
||||
|
||||
|
||||
+2
-6
@@ -34,6 +34,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
#include <sys/stat.h>
|
||||
@@ -42,6 +43,7 @@
|
||||
# include <dirent.h>
|
||||
# include <netdb.h>
|
||||
# include <netinet/in.h>
|
||||
# include <sys/param.h>
|
||||
# include <sys/poll.h>
|
||||
# include <sys/socket.h>
|
||||
# include <sys/time.h>
|
||||
@@ -113,12 +115,6 @@ typedef unsigned short unicode;
|
||||
/* Limits */
|
||||
#ifdef PATH_MAX
|
||||
# define XPL_MAX_PATH PATH_MAX
|
||||
#elif defined (XPL_MAX_PATH)
|
||||
# define XPL_MAX_PATH XPL_MAX_PATH
|
||||
#elif defined (_PC_PATH_MAX)
|
||||
# define XPL_MAX_PATH sysconf(_PC_PATH_MAX)
|
||||
#elif defined (_MAX_PATH)
|
||||
# define XPL_MAX_PATH _MAX_PATH
|
||||
#else
|
||||
# error "XPL_MAX_PATH is not implemented on this platform"
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# StrictCompile()
|
||||
StrictCompile()
|
||||
|
||||
enable_language(ASM-ATT)
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ typedef struct {
|
||||
|
||||
// this union _must_ be of all the same type, else assumptions elsewhere
|
||||
// will fail..
|
||||
union {
|
||||
__extension__ union {
|
||||
char *hack;
|
||||
char *user;
|
||||
char *group;
|
||||
@@ -196,7 +196,7 @@ StoreCommandAUTHSYSTEM(StoreClient *client, char *md5hash)
|
||||
XplHashWrite(&hash, StoreAgent.server.hash, NMAP_HASH_SIZE);
|
||||
XplHashFinal(&hash, XPLHASH_LOWERCASE, credential, XPLHASH_MD5_LENGTH);
|
||||
|
||||
if (strcmp(credential, md5hash)) {
|
||||
if (strcmp((const char *)credential, md5hash)) {
|
||||
XplDelay(2000);
|
||||
ConnWriteStr(client->conn, MSG3242BADAUTH);
|
||||
ConnFlush(client->conn);
|
||||
|
||||
@@ -168,6 +168,10 @@ StoreSetAlarm(StoreClient *client,
|
||||
StoreObject *event, // docinfo
|
||||
const char *alarmtext)
|
||||
{
|
||||
if (client) {} // compiler error FIXME
|
||||
if (event) {} // compiler error FIXME
|
||||
if (alarmtext) {} // compiler error FIXME
|
||||
|
||||
return 0;
|
||||
#if 0
|
||||
// FIXME awful awful.
|
||||
|
||||
@@ -39,6 +39,8 @@ ParsePrivilege(StoreClient *client, const char const *token, StorePrivilege *pri
|
||||
{
|
||||
StorePrivName const *priventry = StorePrivilegeTable;
|
||||
|
||||
if (client == NULL) return -1;
|
||||
|
||||
while (priventry->name != NULL) {
|
||||
if (strcmp(token, priventry->name) == 0) {
|
||||
*priv = priventry->priv;
|
||||
@@ -75,6 +77,8 @@ PrivilegeToString(const StorePrivilege priv, char const **out)
|
||||
CCode
|
||||
ParsePrincipal(StoreClient *client, const char const *token, StorePrincipalType *type)
|
||||
{
|
||||
if (client == NULL) return -1;
|
||||
|
||||
if (strcmp(token, "user") == 0) {
|
||||
*type = STORE_PRINCIPAL_USER;
|
||||
return TOKEN_OK;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#define TOKEN_OK 0xffff /* magic */
|
||||
|
||||
__inline CCode
|
||||
CCode
|
||||
CheckTokC(StoreClient *client, int n, int min, int max);
|
||||
|
||||
// parse simple data types
|
||||
|
||||
+51
-25
@@ -24,6 +24,8 @@
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "stored.h"
|
||||
#include "command-parsing.h"
|
||||
@@ -131,7 +133,6 @@ StoreSetupCommands()
|
||||
BongoHashtablePutNoReplace(CommandTable, "LINKS", (void *) STORE_COMMAND_LINKS) ||
|
||||
BongoHashtablePutNoReplace(CommandTable, "UNLINK", (void *) STORE_COMMAND_UNLINK) ||
|
||||
BongoHashtablePutNoReplace(CommandTable, "MESSAGES ", (void *) STORE_COMMAND_MESSAGES) ||
|
||||
BongoHashtablePutNoReplace(CommandTable, "MFLAG", (void *) STORE_COMMAND_MFLAG) ||
|
||||
BongoHashtablePutNoReplace(CommandTable, "MIME ", (void *) STORE_COMMAND_MIME) ||
|
||||
BongoHashtablePutNoReplace(CommandTable, "MOVE ", (void *) STORE_COMMAND_MOVE) ||
|
||||
BongoHashtablePutNoReplace(CommandTable, "PROPGET", (void *) STORE_COMMAND_PROPGET) ||
|
||||
@@ -918,19 +919,6 @@ StoreCommandLoop(StoreClient *client)
|
||||
props, int3);
|
||||
break;
|
||||
|
||||
case STORE_COMMAND_MFLAG:
|
||||
/* MFLAG [+ | -] <value> */
|
||||
|
||||
int2 = STORE_FLAG_SHOW; /* action */
|
||||
|
||||
if (TOKEN_OK == (ccode = RequireStore(client)) &&
|
||||
TOKEN_OK == (ccode = CheckTokC(client, n, 2, 2)) &&
|
||||
TOKEN_OK == (ccode = ParseFlag(client, tokens[1], &int1, &int2)))
|
||||
{
|
||||
ccode = StoreCommandMFLAG(client, int1, int2);
|
||||
}
|
||||
break;
|
||||
|
||||
case STORE_COMMAND_MIME:
|
||||
/* MIME <document> */
|
||||
|
||||
@@ -1387,6 +1375,9 @@ finish:
|
||||
CCode
|
||||
StoreCommandALARMS(StoreClient *client, uint64_t start, uint64_t end)
|
||||
{
|
||||
if (client) {} // FIXME compile error
|
||||
if (start) {} // FIXME compile error
|
||||
if (end) {} // FIXME compile error
|
||||
/* FIXME - redo this completely
|
||||
*
|
||||
AlarmInfoStmt *stmt;
|
||||
@@ -1451,6 +1442,10 @@ StoreCommandCALENDARS(StoreClient *client, unsigned long mask,
|
||||
StoreObject calendar_collection;
|
||||
CCode ccode;
|
||||
|
||||
if (mask) {
|
||||
// FIXME : mask is unused in this function thus far
|
||||
}
|
||||
|
||||
StoreObjectFind(client, STORE_CALENDARS_GUID, &calendar_collection);
|
||||
ccode = StoreObjectCheckAuthorization(client, &calendar_collection, STORE_PRIV_LIST);
|
||||
if (ccode) return ccode;
|
||||
@@ -1498,6 +1493,10 @@ StoreCommandCONVERSATIONS(StoreClient *client, const char *source, const char *q
|
||||
int ccode;
|
||||
StoreObject conversation_collection;
|
||||
BOOL show_total;
|
||||
|
||||
if (headers || headercount || source || center) {
|
||||
// FIXME : these are current unused
|
||||
}
|
||||
|
||||
StoreObjectFind(client, STORE_CONVERSATIONS_GUID, &conversation_collection);
|
||||
|
||||
@@ -1788,10 +1787,12 @@ StoreCommandDELIVER(StoreClient *client, char *sender, char *authSender,
|
||||
tmpFile[0] = 0;
|
||||
|
||||
if (!filename) {
|
||||
const char *work_dir = (char *)MsgGetDir(MSGAPI_DIR_WORK, NULL, 0);
|
||||
|
||||
if (bytes <= 0) {
|
||||
return ConnWriteStr(client->conn, MSG3017INTARGRANGE);
|
||||
}
|
||||
msgfile = XplOpenTemp(MsgGetDir(MSGAPI_DIR_WORK, NULL, 0), "w+b", tmpFile);
|
||||
msgfile = XplOpenTemp(work_dir, "w+b", tmpFile);
|
||||
if (!msgfile) {
|
||||
return ConnWriteStr(client->conn, MSG5202TMPWRITEERR);
|
||||
}
|
||||
@@ -1909,6 +1910,10 @@ StoreCommandEVENTS(StoreClient *client,
|
||||
StorePropInfo *props, int propcount)
|
||||
{
|
||||
// pretend we have no events for now.
|
||||
if (client || startUTC || endUTC || calendar || mask ||
|
||||
uid || query || start || end || props || propcount) {
|
||||
// FIXME : compiler warnings in blank function
|
||||
}
|
||||
return ConnWriteStr(client->conn, MSG1000OK);
|
||||
/*
|
||||
CCode ccode = 0;
|
||||
@@ -2063,6 +2068,9 @@ CCode
|
||||
StoreCommandISEARCH(StoreClient *client, const char *query, int start, int end,
|
||||
StorePropInfo *props, int propcount)
|
||||
{
|
||||
if (client || query || start || end || props || propcount) {
|
||||
// FIXME : compiler warnings in blank function
|
||||
}
|
||||
return ConnWriteStr(client->conn, MSG1000OK);
|
||||
/*
|
||||
char buf[200];
|
||||
@@ -2157,6 +2165,9 @@ CCode
|
||||
StoreCommandMAILINGLISTS(StoreClient *client, char *source)
|
||||
{
|
||||
// TODO
|
||||
if (client || source) {
|
||||
// FIXME : blank function
|
||||
}
|
||||
return ConnWriteStr(client->conn, MSG3000UNKNOWN);
|
||||
}
|
||||
|
||||
@@ -2170,17 +2181,14 @@ StoreCommandMESSAGES(StoreClient *client, const char *source, const char *query,
|
||||
{
|
||||
// FIXME: obsolete? This looks very similar to LIST; just added
|
||||
// source and query. Might as well make it one command...
|
||||
if (client || source || query || start || end || center ||
|
||||
flagsmask || flags || displayTotal || headers || headercount ||
|
||||
props || propcount) {
|
||||
// FIXME : stop compiler warning on empty function
|
||||
}
|
||||
return ConnWriteStr(client->conn, MSG3000UNKNOWN);
|
||||
}
|
||||
|
||||
CCode
|
||||
StoreCommandMFLAG(StoreClient *client, uint32_t change, int mode)
|
||||
{
|
||||
// FIXME: obsolete.
|
||||
return ConnWriteStr(client->conn, MSG3000UNKNOWN);
|
||||
}
|
||||
|
||||
|
||||
CCode
|
||||
StoreCommandMIME(StoreClient *client, StoreObject *document)
|
||||
{
|
||||
@@ -2338,6 +2346,8 @@ StoreCommandPROPSET(StoreClient *client,
|
||||
int ccode;
|
||||
|
||||
CHECK_NOT_READONLY(client)
|
||||
|
||||
if (size) {} // FIXME : unused variable
|
||||
|
||||
prop->value = BONGO_MEMSTACK_ALLOC(&client->memstack, prop->valueLen + 1);
|
||||
if (!prop->value) {
|
||||
@@ -2424,6 +2434,8 @@ StoreCommandREINDEX(StoreClient *client, StoreObject *document)
|
||||
{
|
||||
// want to re-do this completely.
|
||||
CHECK_NOT_READONLY(client)
|
||||
|
||||
if (document) { } // FIXME : stop compiler whining
|
||||
|
||||
return ConnWriteStr(client->conn, MSG5005DBLIBERR);
|
||||
}
|
||||
@@ -2482,7 +2494,7 @@ ReceiveToFile(StoreClient *client, const char *path, uint64_t *size)
|
||||
return ConnWriteStr(client->conn, MSG4228CANTWRITEMBOX);
|
||||
}
|
||||
|
||||
if (size >= 0) {
|
||||
if (*size > 0) {
|
||||
ccode = ConnReadToFile(client->conn, fh, *size);
|
||||
receive_size = *size;
|
||||
} else {
|
||||
@@ -2525,8 +2537,13 @@ StoreCommandREPLACE(StoreClient *client, StoreObject *object, int size, uint64_t
|
||||
char path[XPL_MAX_PATH + 1];
|
||||
char tmppath[XPL_MAX_PATH + 1];
|
||||
uint64_t tmpsize;
|
||||
|
||||
|
||||
CHECK_NOT_READONLY(client)
|
||||
|
||||
if (rend <= rstart) {
|
||||
// given a range that makes no sense....!
|
||||
return ConnWriteStr(client->conn, MSG3021BADRANGESIZE);
|
||||
}
|
||||
|
||||
// check object type and permissions
|
||||
if (STORE_IS_FOLDER(object->type) || STORE_IS_CONVERSATION(object->type)) {
|
||||
@@ -2540,6 +2557,8 @@ StoreCommandREPLACE(StoreClient *client, StoreObject *object, int size, uint64_t
|
||||
MaildirTempDocument(client, object->collection_guid, tmppath, sizeof(tmppath));
|
||||
|
||||
tmpsize = size;
|
||||
if (size < 0) tmpsize = 0;
|
||||
|
||||
ccode = ReceiveToFile(client, tmppath, &tmpsize);
|
||||
if (ccode) goto finish;
|
||||
|
||||
@@ -2721,6 +2740,9 @@ CCode
|
||||
StoreCommandTIMEOUT(StoreClient *client, int lockTimeoutMs)
|
||||
{
|
||||
// should be obsolete really
|
||||
if (client || lockTimeoutMs) {
|
||||
// FIXME : unused parameters
|
||||
}
|
||||
return ConnWriteStr(client->conn, MSG3000UNKNOWN);
|
||||
}
|
||||
|
||||
@@ -2825,6 +2847,10 @@ StoreCommandWRITE(StoreClient *client,
|
||||
char path[XPL_MAX_PATH+1];
|
||||
char tmppath[XPL_MAX_PATH+1];
|
||||
|
||||
if (guid_link) {
|
||||
// FIXME : should use this parameter to link to another doc
|
||||
}
|
||||
|
||||
CHECK_NOT_READONLY(client)
|
||||
|
||||
if (STORE_IS_FOLDER(doctype) || STORE_IS_CONVERSATION(doctype)) {
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <config.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "stored.h"
|
||||
|
||||
|
||||
@@ -208,6 +208,10 @@ StoreGetExclusiveFairLockQuiet(StoreClient *client, NFairLock **lock,
|
||||
NFairLock *found_lock;
|
||||
int result = 0;
|
||||
|
||||
if (timeout) {
|
||||
// FIXME : unused parameter; should use this somehow!
|
||||
}
|
||||
|
||||
// find the lock
|
||||
found_lock = FairLockFind(client->storeName, guid);
|
||||
if (found_lock == NULL) return -1; // error
|
||||
@@ -264,6 +268,10 @@ StoreGetSharedFairLockQuiet(StoreClient *client, NFairLock **lock,
|
||||
NFairLock *found_lock;
|
||||
int result = 0;
|
||||
|
||||
if (timeout) {
|
||||
// FIXME : unused parameter; should use this somehow!
|
||||
}
|
||||
|
||||
// first, find the lock
|
||||
found_lock = FairLockFind(client->store, guid);
|
||||
if (found_lock == NULL) return -1; // some error
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
void GuidReset(void) {
|
||||
char name[256 + 1];
|
||||
unsigned char salt[32];
|
||||
char salt[32];
|
||||
#ifdef HAVE_KSTAT_H
|
||||
kstat_t *ksp;
|
||||
kstat_ctl_t *kc;
|
||||
|
||||
+12
-12
@@ -222,7 +222,7 @@ MimeReportFree(MimeReport *report)
|
||||
|
||||
|
||||
__inline static BOOL
|
||||
ParseDispositionParameters(unsigned char *ptr, MIMEPartStruct *part)
|
||||
ParseDispositionParameters(char *ptr, MIMEPartStruct *part)
|
||||
{
|
||||
RFC2231ParamStruct *rfc2231Name = NULL;
|
||||
|
||||
@@ -259,7 +259,7 @@ ParseDispositionParameters(unsigned char *ptr, MIMEPartStruct *part)
|
||||
}
|
||||
|
||||
__inline static BOOL
|
||||
ParseTypeParameters(unsigned char *ptr, MIMEPartStruct *part)
|
||||
ParseTypeParameters(char *ptr, MIMEPartStruct *part)
|
||||
{
|
||||
RFC2231ParamStruct *rfc2231Name = NULL;
|
||||
|
||||
@@ -322,7 +322,7 @@ FileGetLine(FILE *fh, char *buffer, unsigned long bufferLen, unsigned long offse
|
||||
}
|
||||
|
||||
MimeReport *
|
||||
MimeParse(FILE *fh, size_t messageSize, unsigned char *line, unsigned long lineSize)
|
||||
MimeParse(FILE *fh, size_t messageSize, char *line, unsigned long lineSize)
|
||||
{
|
||||
MimeReport *report;
|
||||
int i;
|
||||
@@ -342,12 +342,12 @@ MimeParse(FILE *fh, size_t messageSize, unsigned char *line, unsigned long lineS
|
||||
size_t lastHeaderStart = 0;
|
||||
size_t lastHeaderLen = 0;
|
||||
size_t contentHeaderLen = 0;
|
||||
unsigned char *ptr;
|
||||
unsigned char *start;
|
||||
unsigned char *end;
|
||||
unsigned char *header = NULL;
|
||||
unsigned char *currentSeparator = NULL;
|
||||
unsigned char *allocatedSeparator = NULL;
|
||||
char *ptr;
|
||||
char *start;
|
||||
char *end;
|
||||
char *header = NULL;
|
||||
char *currentSeparator = NULL;
|
||||
char *allocatedSeparator = NULL;
|
||||
BOOL lastInHeader = TRUE;
|
||||
BOOL inHeader = TRUE;
|
||||
BOOL skip = FALSE;
|
||||
@@ -357,7 +357,7 @@ MimeParse(FILE *fh, size_t messageSize, unsigned char *line, unsigned long lineS
|
||||
|
||||
partsAllocated = MIME_STRUCT_ALLOC;
|
||||
part = (MIMEPartStruct *)MemMalloc((sizeof(MIMEPartStruct) * partsAllocated));
|
||||
header = (unsigned char *)MemMalloc(sizeof(unsigned char)*MAX_HEADER);
|
||||
header = (char *)MemMalloc(sizeof(char)*MAX_HEADER);
|
||||
if (!part || !header) {
|
||||
if (part) {
|
||||
MemFree(part);
|
||||
@@ -415,7 +415,7 @@ MimeParse(FILE *fh, size_t messageSize, unsigned char *line, unsigned long lineS
|
||||
} else {
|
||||
header[0]=toupper(header[0]);
|
||||
if (header[0]=='C' && toupper(header[1])=='O') {
|
||||
CHOP_NEWLINE(header);
|
||||
RemoveLineEnding(header);
|
||||
ptr=line;
|
||||
while (isspace(*ptr)) {
|
||||
ptr++;
|
||||
@@ -548,7 +548,7 @@ MimeParse(FILE *fh, size_t messageSize, unsigned char *line, unsigned long lineS
|
||||
while (isspace(*ptr)) {
|
||||
ptr++;
|
||||
}
|
||||
CHOP_NEWLINE(header);
|
||||
RemoveLineEnding(header);
|
||||
TempLen = min(strlen(ptr), MIME_ENCODING_LEN);
|
||||
memcpy(part[useThisPartNo].encoding, ptr, TempLen);
|
||||
part[useThisPartNo].encoding[TempLen] = '\0';
|
||||
|
||||
+12
-12
@@ -40,12 +40,12 @@ XPL_BEGIN_C_LINKAGE
|
||||
#define MIME_ENCODING_LEN 64
|
||||
|
||||
typedef struct _MIMEPartStruct {
|
||||
unsigned char separator[MIME_SEPARATOR_LEN+1];
|
||||
unsigned char type[MIME_TYPE_LEN+1];
|
||||
unsigned char subtype[MIME_SUBTYPE_LEN+1];
|
||||
unsigned char charset[MIME_CHARSET_LEN+1];
|
||||
unsigned char encoding[MIME_ENCODING_LEN+1];
|
||||
unsigned char name[MIME_NAME_LEN+1];
|
||||
char separator[MIME_SEPARATOR_LEN+1];
|
||||
char type[MIME_TYPE_LEN+1];
|
||||
char subtype[MIME_SUBTYPE_LEN+1];
|
||||
char charset[MIME_CHARSET_LEN+1];
|
||||
char encoding[MIME_ENCODING_LEN+1];
|
||||
char name[MIME_NAME_LEN+1];
|
||||
size_t headerStart;
|
||||
size_t headerLen;
|
||||
size_t start;
|
||||
@@ -61,11 +61,11 @@ typedef struct _MIMEPartStruct {
|
||||
|
||||
typedef struct {
|
||||
unsigned long code;
|
||||
unsigned char *type;
|
||||
unsigned char *subtype;
|
||||
unsigned char *charset;
|
||||
unsigned char *encoding;
|
||||
unsigned char *name;
|
||||
char *type;
|
||||
char *subtype;
|
||||
char *charset;
|
||||
char *encoding;
|
||||
char *name;
|
||||
unsigned long headerStart;
|
||||
unsigned long headerLen;
|
||||
unsigned long start;
|
||||
@@ -82,7 +82,7 @@ typedef struct {
|
||||
MimeResponseLine *line;
|
||||
} MimeReport;
|
||||
|
||||
MimeReport *MimeParse(FILE *fh, size_t messageSize, unsigned char *line, unsigned long lineSize);
|
||||
MimeReport *MimeParse(FILE *fh, size_t messageSize, char *line, unsigned long lineSize);
|
||||
BOOL MimeReportSend(void *param, MimeReport *report);
|
||||
void MimeReportFixup(MimeReport *report);
|
||||
void MimeReportFree(MimeReport *report);
|
||||
|
||||
@@ -1163,10 +1163,10 @@ StoreObjectRemoveCollection(StoreClient *client, StoreObject *collection)
|
||||
goto abort;
|
||||
|
||||
// remove each document and then collection
|
||||
for (j = 0; j < i; j++) {
|
||||
for (j = 0; j < i; j++) {
|
||||
StoreObject object;
|
||||
|
||||
if (guid_list[j] > 0) {
|
||||
if (*(guid_list[j]) > 0) {
|
||||
// don't include the container in the results...
|
||||
StoreObjectFind(client, *(guid_list[j]), &object);
|
||||
StoreObjectRemove(client, &object);
|
||||
@@ -1261,6 +1261,7 @@ int
|
||||
StoreObjectSetProperty(StoreClient *client, StoreObject *object, StorePropInfo *prop)
|
||||
{
|
||||
uint64_t timeval;
|
||||
uint32_t int32val;
|
||||
int intval;
|
||||
|
||||
switch (prop->type) {
|
||||
@@ -1305,8 +1306,8 @@ StoreObjectSetProperty(StoreClient *client, StoreObject *object, StorePropInfo *
|
||||
|
||||
// hexadecimal properties
|
||||
case STORE_PROP_MAIL_IMAPUID:
|
||||
if (ParseHexU32(client, prop->value, &intval) != TOKEN_OK) return -1;
|
||||
object->imap_uid = intval;
|
||||
if (ParseHexU32(client, prop->value, &int32val) != TOKEN_OK) return -1;
|
||||
object->imap_uid = int32val;
|
||||
goto save_object;
|
||||
|
||||
case STORE_PROP_EXTERNAL:
|
||||
|
||||
@@ -234,6 +234,8 @@ QueryBuilderAddProperty(QueryBuilder *builder, char const *property, BOOL output
|
||||
static int
|
||||
QueryBuilderPropertyToColumn(QueryBuilder *builder, BongoStringBuilder *sb, StorePropInfo *prop)
|
||||
{
|
||||
if (builder == NULL) return -1;
|
||||
|
||||
if ((prop->table_name != NULL) && (prop->column != NULL)) {
|
||||
BongoStringBuilderAppendF(sb, "%s.%s", prop->table_name, prop->column);
|
||||
} else {
|
||||
|
||||
@@ -228,6 +228,11 @@ DeliverMessageToMailbox(StoreClient *client,
|
||||
unsigned char timeBuffer[80];
|
||||
char buffer[1024];
|
||||
|
||||
if (scmsID || msglen) {
|
||||
// FIXME : SCMS isn't implemented this way any more.
|
||||
// can we get rid of msglen also?
|
||||
}
|
||||
|
||||
if (SetupStore(recipient, &storeRoot, path, sizeof(path))) {
|
||||
return DELIVER_TRY_LATER;
|
||||
}
|
||||
@@ -630,6 +635,9 @@ CCode
|
||||
StoreGetCollectionLock(StoreClient *client, NLockStruct **lock, uint64_t coll)
|
||||
{
|
||||
int result;
|
||||
|
||||
if (client == NULL) return 0;
|
||||
|
||||
*lock = MemMalloc0(sizeof(NLockStruct));
|
||||
result = StoreGetExclusiveFairLockQuiet(client, &((*lock)->fairlock), coll, 3000);
|
||||
if (result != 0) {
|
||||
@@ -641,6 +649,8 @@ StoreGetCollectionLock(StoreClient *client, NLockStruct **lock, uint64_t coll)
|
||||
CCode
|
||||
StoreReleaseCollectionLock(StoreClient *client, NLockStruct **lock)
|
||||
{
|
||||
if (client == NULL) return 0;
|
||||
|
||||
StoreReleaseFairLockQuiet(&((*lock)->fairlock));
|
||||
MemFree(*lock);
|
||||
*lock = NULL;
|
||||
|
||||
@@ -145,7 +145,7 @@ StoreSocketInit()
|
||||
|
||||
|
||||
static void
|
||||
StoreServer(void *ignored)
|
||||
StoreServer()
|
||||
{
|
||||
XplRenameThread(XplGetThreadID(), AGENT_DN " Server");
|
||||
|
||||
|
||||
@@ -236,14 +236,14 @@ struct StoreGlobals {
|
||||
unsigned long ipAddress;
|
||||
unsigned long bytesPerBlock;
|
||||
|
||||
unsigned char host[MAXEMAILNAMESIZE + 1];
|
||||
unsigned char hash[NMAP_HASH_SIZE];
|
||||
char host[MAXEMAILNAMESIZE + 1];
|
||||
char hash[NMAP_HASH_SIZE];
|
||||
} server;
|
||||
|
||||
struct {
|
||||
unsigned char rootDir[XPL_MAX_PATH + 1];
|
||||
unsigned char spoolDir[XPL_MAX_PATH + 1];
|
||||
unsigned char systemDir[XPL_MAX_PATH + 1];
|
||||
char rootDir[XPL_MAX_PATH + 1];
|
||||
char spoolDir[XPL_MAX_PATH + 1];
|
||||
char systemDir[XPL_MAX_PATH + 1];
|
||||
/* FIXME: need a better name for this var: */
|
||||
int incomingQueueBytes; /* max size of "incoming" file */
|
||||
int lockTimeoutMs;
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
const unsigned char *Base64Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
||||
|
||||
BOOL
|
||||
QuickNCmp(unsigned char *str1, unsigned char *str2, int len)
|
||||
QuickNCmp(char *str1, char *str2, int len)
|
||||
{
|
||||
while (--len && *str1 && *str2 && toupper(*str1) == toupper(*str2)) {
|
||||
str1++;
|
||||
@@ -40,7 +40,7 @@ QuickNCmp(unsigned char *str1, unsigned char *str2, int len)
|
||||
}
|
||||
|
||||
BOOL
|
||||
QuickCmp(unsigned char *str1, unsigned char *str2)
|
||||
QuickCmp(char *str1, char *str2)
|
||||
{
|
||||
while (*str1 && *str2 && toupper(*str1) == toupper(*str2)) {
|
||||
str1++;
|
||||
@@ -309,6 +309,19 @@ const unsigned char HexChars[] = {
|
||||
/* 0xFF 255 */ 0
|
||||
};
|
||||
|
||||
void
|
||||
RemoveLineEnding(char *s)
|
||||
{
|
||||
char *p;
|
||||
p = strchr(s, 0x0A);
|
||||
if (p) {
|
||||
*p = '\0';
|
||||
}
|
||||
p = strrchr(s, 0x0D);
|
||||
if (p) {
|
||||
*p = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
uint64_t
|
||||
HexToUInt64(char *hexString, char **endp)
|
||||
|
||||
+17
-17
@@ -1,4 +1,4 @@
|
||||
/****************************************************************************
|
||||
/****************************************************************************
|
||||
* <Novell-copyright>
|
||||
* Copyright (c) 2001 Novell, Inc. All Rights Reserved.
|
||||
*
|
||||
@@ -164,10 +164,10 @@ MsgDomainExists(const unsigned char *domain, unsigned char *domainObjectDN)
|
||||
}
|
||||
|
||||
EXPORT BOOL
|
||||
MsgCleanPath(unsigned char *path)
|
||||
MsgCleanPath(char *path)
|
||||
{
|
||||
unsigned char *ptr;
|
||||
unsigned char *ptr2;
|
||||
char *ptr;
|
||||
char *ptr2;
|
||||
|
||||
/* This code strips off any server names that might be configured in the Path */
|
||||
ptr = path;
|
||||
@@ -208,10 +208,10 @@ MsgCleanPath(unsigned char *path)
|
||||
}
|
||||
|
||||
EXPORT void
|
||||
MsgMakePath(unsigned char *path)
|
||||
MsgMakePath(char *path)
|
||||
{
|
||||
unsigned char *ptr = path;
|
||||
unsigned char *ptr2;
|
||||
char *ptr = path;
|
||||
char *ptr2;
|
||||
struct stat sb;
|
||||
|
||||
ptr = strchr(path, '/');
|
||||
@@ -236,10 +236,10 @@ MsgMakePath(unsigned char *path)
|
||||
}
|
||||
}
|
||||
|
||||
EXPORT const unsigned char *
|
||||
EXPORT const char *
|
||||
MsgGetDir(MsgApiDirectory directory, char *buffer, size_t buffer_size)
|
||||
{
|
||||
const unsigned char *path;
|
||||
const char *path;
|
||||
switch(directory) {
|
||||
case MSGAPI_DIR_BIN:
|
||||
path = XPL_DEFAULT_BIN_DIR;
|
||||
@@ -661,11 +661,11 @@ MsgRecoveryFlagFile(char *agent, char *buffer, size_t buffer_len)
|
||||
}
|
||||
|
||||
EXPORT BOOL
|
||||
MsgSetRecoveryFlag(unsigned char *agent_name)
|
||||
MsgSetRecoveryFlag(char *agent_name)
|
||||
{
|
||||
FILE *flag;
|
||||
unsigned char flagfile[XPL_MAX_PATH];
|
||||
unsigned char pidstr[20];
|
||||
char flagfile[XPL_MAX_PATH];
|
||||
char pidstr[20];
|
||||
|
||||
MsgRecoveryFlagFile(agent_name, flagfile, XPL_MAX_PATH);
|
||||
|
||||
@@ -675,7 +675,7 @@ MsgSetRecoveryFlag(unsigned char *agent_name)
|
||||
}
|
||||
|
||||
snprintf(pidstr, 18, "%u\n", getpid());
|
||||
fwrite(pidstr, strlen(pidstr), sizeof(unsigned char), flag);
|
||||
fwrite(pidstr, strlen(pidstr), sizeof(char), flag);
|
||||
|
||||
fclose(flag);
|
||||
|
||||
@@ -683,9 +683,9 @@ MsgSetRecoveryFlag(unsigned char *agent_name)
|
||||
}
|
||||
|
||||
EXPORT BOOL
|
||||
MsgGetRecoveryFlag(unsigned char *agent_name)
|
||||
MsgGetRecoveryFlag(char *agent_name)
|
||||
{
|
||||
unsigned char flagfile[XPL_MAX_PATH];
|
||||
char flagfile[XPL_MAX_PATH];
|
||||
struct stat filestat;
|
||||
|
||||
MsgRecoveryFlagFile(agent_name, flagfile, XPL_MAX_PATH);
|
||||
@@ -697,9 +697,9 @@ MsgGetRecoveryFlag(unsigned char *agent_name)
|
||||
}
|
||||
|
||||
EXPORT BOOL
|
||||
MsgClearRecoveryFlag(unsigned char *agent_name)
|
||||
MsgClearRecoveryFlag(char *agent_name)
|
||||
{
|
||||
unsigned char flagfile[XPL_MAX_PATH];
|
||||
char flagfile[XPL_MAX_PATH];
|
||||
|
||||
MsgRecoveryFlagFile(agent_name, flagfile, XPL_MAX_PATH);
|
||||
unlink(flagfile);
|
||||
|
||||
Reference in New Issue
Block a user