fix: fixed capitalisation bugs in command parsing
This commit is contained in:
parent
81a1c7447c
commit
9418c7b9a4
7 changed files with 107 additions and 5 deletions
|
|
@ -16,6 +16,8 @@ name: { \
|
|||
#define IMAP_ROUTINE_END imap_flush(node, ssl);
|
||||
#define IMAP_ROUTINE_OK(routine) \
|
||||
imap_write(node, ssl, "%s OK " #routine " completed\n", cmd.tag);
|
||||
#define IMAP_ROUTINE_NO(routine) \
|
||||
imap_write(node, ssl, "%s NO " #routine " completed\n", cmd.tag);
|
||||
#define IMAP_STRING(fmt, ...) \
|
||||
imap_write(node, ssl, fmt, ##__VA_ARGS__);
|
||||
#define IMAP_NLINE imap_write(node, ssl, "\n");
|
||||
|
|
@ -77,7 +79,7 @@ static inline uint8_t imap_routine_auth(imap_cmd cmd, client_list *node, uint8_t
|
|||
|
||||
int bytes;
|
||||
|
||||
if (strcmp(cmd.params[0], "PLAIN") == 0) {
|
||||
if (strcmp(cmd.params[0], "plain") == 0) {
|
||||
IMAP_STRING("+\n");
|
||||
if ((bytes = imap_read(node, buf, CMD_MAX_SIZE, ssl)) < 0) {
|
||||
perror("recv");
|
||||
|
|
@ -98,5 +100,15 @@ static inline uint8_t imap_routine_auth(imap_cmd cmd, client_list *node, uint8_t
|
|||
|
||||
static inline uint8_t imap_routine_login(imap_cmd cmd, client_list *node, uint8_t ssl, uint8_t state)
|
||||
{
|
||||
IMAP_CHECK_STATE(NO_AUTH)
|
||||
IMAP_CHECK_ARGS(2)
|
||||
|
||||
if ((strcmp(cmd.params[0], "lorenzo") == 0) && (strcmp(cmd.params[1], "lorenzo06") == 0)) {
|
||||
IMAP_ROUTINE_OK(LOGIN)
|
||||
} else {
|
||||
IMAP_ROUTINE_NO(LOGIN)
|
||||
}
|
||||
|
||||
IMAP_ROUTINE_END
|
||||
return IMAP_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue