Skip to content

Commit

Permalink
managesieve-login: managesieve_client_input_next_cmd() - minor code c…
Browse files Browse the repository at this point in the history
…leanup
  • Loading branch information
sirainen committed Jun 14, 2017
1 parent 9d66c3e commit ea7e178
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/managesieve-login/client.c
Expand Up @@ -258,7 +258,10 @@ static bool managesieve_client_input_next_cmd(struct client *_client)
int ret = 1;
bool fatal;

if ( client->cmd != NULL && !client->cmd_parsed_args ) {
if (client->cmd == NULL) {
/* unknown command */
ret = -1;
} else if ( !client->cmd_parsed_args ) {
unsigned int arg_count =
( client->cmd->preparsed_args > 0 ? client->cmd->preparsed_args : 0 );
switch (managesieve_parser_read_args(client->parser, arg_count, 0, &args)) {
Expand Down Expand Up @@ -297,18 +300,12 @@ static bool managesieve_client_input_next_cmd(struct client *_client)
if ( args[0].type != MANAGESIEVE_ARG_EOL )
ret = -1;
}
}

if (client->cmd == NULL) {
ret = -1;
client->cmd_finished = TRUE;
} else {
if (ret > 0)
ret = client->cmd->func(client, args);
if (ret != 0)
client->cmd_finished = TRUE;
}

if (ret != 0)
client->cmd_finished = TRUE;
if (ret < 0) {
if (++client->common.bad_counter >= CLIENT_MAX_BAD_COMMANDS) {
client_send_bye(&client->common,
Expand Down

0 comments on commit ea7e178

Please sign in to comment.