[idms-dbma-devel]commit - r53 - trunk/modules/protocols/pop3
Status: Pre-Alpha
Brought to you by:
nkukard
|
From: <idm...@li...> - 2004-10-24 19:50:33
|
Author: nkukard
Date: 2004-10-24 21:50:20 +0200 (Sun, 24 Oct 2004)
New Revision: 53
Added:
trunk/modules/protocols/pop3/TODO
Modified:
trunk/modules/protocols/pop3/pop3.c
trunk/modules/protocols/pop3/pop3.h
Log:
* Updated to conform to socklib bugfix
Added: trunk/modules/protocols/pop3/TODO
===================================================================
--- trunk/modules/protocols/pop3/TODO 2004-10-24 17:13:30 UTC (rev 52)
+++ trunk/modules/protocols/pop3/TODO 2004-10-24 19:50:20 UTC (rev 53)
@@ -0,0 +1 @@
+* Upgrade design to new parser, lexer & single file per rfc command
Modified: trunk/modules/protocols/pop3/pop3.c
===================================================================
--- trunk/modules/protocols/pop3/pop3.c 2004-10-24 17:13:30 UTC (rev 52)
+++ trunk/modules/protocols/pop3/pop3.c 2004-10-24 19:50:20 UTC (rev 53)
@@ -50,6 +50,9 @@
data->username = NULL;
data->password = NULL;
+ // FIXME - error check
+ data->cmdLine = malloc(POP3_CMD_LEN);
+
data->tmpBufSize = POP3_RESP_LEN;
data->tmpBuf = malloc(data->tmpBufSize);
@@ -78,6 +81,8 @@
free(data->username);
if (data->password)
free(data->password);
+ if (data->cmdLine)
+ free(data->cmdLine);
free(data->tmpBuf);
free(data);
fprintf(stderr,"%s: Closing connection\n",__FUNCTION__);
@@ -89,7 +94,6 @@
static int pop3_handler(struct clientConnection_t *connection)
{
struct pop3_data_t *data = connection->data;
- char *buffer;
fprintf(stderr,"state = %i, position = %i\n",data->state,data->position);
@@ -135,7 +139,6 @@
data->state = POP3_STATE_QUIT;
goto handler_end;
}
- buffer = getIOBuffer(connection);
}
/* Check if we must process user input */
@@ -143,7 +146,7 @@
{
fprintf(stderr,"We need user input\n");
data->position = unsetBit(data->position,POP3_POS_USER_INPUT);
- queueToReceive(connection,POP3_CMD_LEN,POP3_IO_TIMEOUT);
+ queueToReceive(connection,data->cmdLine,POP3_CMD_LEN,POP3_IO_TIMEOUT);
/* Exit here to bypass the fallthrough queueToSend */
return 0;
}
@@ -394,14 +397,14 @@
/* Small check */
- if (!(cmd = get_field(buffer,0,1)))
+ if (!(cmd = get_field(data->cmdLine,0,1)))
{
snprintf(data->tmpBuf,data->tmpBufSize,"-ERR No command received"EOL);
data->position = setBit(data->position,POP3_POS_USER);
goto handler_end;
}
- D_PRINT(D_DEBUG,"Client command: %s",buffer);
+ D_PRINT(D_DEBUG,"Client command: %s",data->cmdLine);
// Find associated ID
cmd_id = -1;
// Loop and get our command!
@@ -447,7 +450,7 @@
free(data->username);
/* Check if a username wasn't supplied */
- if (!(data->username = get_field(buffer,1,1)))
+ if (!(data->username = get_field(data->cmdLine,1,1)))
snprintf(data->tmpBuf,data->tmpBufSize,"-ERR Missing username"EOL);
else
/* Tell user we have his username */
@@ -476,7 +479,7 @@
}
/* Parse off password */
- if (!(data->password = get_field(buffer,1,1)))
+ if (!(data->password = get_field(data->cmdLine,1,1)))
{
snprintf(data->tmpBuf,data->tmpBufSize,"-ERR Missing password"EOL);
goto cmd_pass_end;
@@ -559,7 +562,7 @@
}
/* Check optional parameter */
- if ((opt = get_field(buffer,1,1)))
+ if ((opt = get_field(data->cmdLine,1,1)))
{
int msgID = atoi(opt);
struct message_t *message;
@@ -639,7 +642,7 @@
}
/* Check parameter */
- if ((opt = get_field(buffer,1,1)))
+ if ((opt = get_field(data->cmdLine,1,1)))
{
int msgID = atoi(opt);
struct message_t *message;
@@ -714,7 +717,7 @@
}
/* Check parameter */
- if ((opt = get_field(buffer,1,1)))
+ if ((opt = get_field(data->cmdLine,1,1)))
{
int msgID = atoi(opt);
struct message_t *message;
@@ -819,7 +822,7 @@
}
/* Check optional parameter */
- if ((opt = get_field(buffer,1,1)))
+ if ((opt = get_field(data->cmdLine,1,1)))
{
int msgID = atoi(opt);
struct message_t *message;
@@ -888,7 +891,7 @@
}
/* Check parameter */
- if ((opt = get_field(buffer,1,1)))
+ if ((opt = get_field(data->cmdLine,1,1)))
{
int msgID = atoi(opt);
struct message_t *message;
@@ -900,7 +903,7 @@
/* Dont need this no more */
free(opt);
/* Verify number of lines to display */
- opt2 = get_field(buffer,2,1);
+ opt2 = get_field(data->cmdLine,2,1);
if (!opt2)
{
snprintf(data->tmpBuf,data->tmpBufSize,"-ERR Missing number of lines"EOL);
Modified: trunk/modules/protocols/pop3/pop3.h
===================================================================
--- trunk/modules/protocols/pop3/pop3.h 2004-10-24 17:13:30 UTC (rev 52)
+++ trunk/modules/protocols/pop3/pop3.h 2004-10-24 19:50:20 UTC (rev 53)
@@ -145,6 +145,8 @@
/* Username & password client entered */
char *username;
char *password;
+ /* commandline stuff */
+ char *cmdLine;
/* Temporary stuff */
char *tmpBuf;
size_t tmpBufSize;
|