Changeset d45051e in code for icb.c


Ignore:
Timestamp:
Jun 17, 2014, 11:31:02 AM (11 years ago)
Author:
Mike Belopuhov <mike@…>
Branches:
master
Children:
9440414
Parents:
383d37b
git-author:
Mike Belopuhov <mike@…> (06/17/14 11:30:10)
git-committer:
Mike Belopuhov <mike@…> (06/17/14 11:31:02)
Message:

make sure to abort bufferevent processing after icbd_drop was called

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icb.c

    r383d37b rd45051e  
    3535void   icb_command(struct icb_session *, char *, char *);
    3636void   icb_groupmsg(struct icb_session *, char *);
    37 void   icb_login(struct icb_session *, char *, char *, char *);
     37int    icb_login(struct icb_session *, char *, char *, char *);
    3838int    icb_dowho(struct icb_session *, struct icb_group *);
    3939char  *icb_nextfield(char **, int);
     
    7171 *  icb_input: main input processing routine
    7272 */
    73 void
     73int
    7474icb_input(struct icb_session *is)
    7575{
    7676        char *msg = is->buffer;
    7777        unsigned char type;
     78        int res = 0;
    7879
    7980        is->last = getmonotime();
     
    8283        if (!ISSETF(is->flags, ICB_SF_LOGGEDIN) && type != ICB_M_LOGIN) {
    8384                icb_error(is, "Not logged in");
    84                 return;
     85                return (0);
    8586        }
    8687        switch (type) {
     
    9596                        icb_error(is, "Command not implemented");
    9697                        icbd_drop(is, NULL);
    97                         return;
     98                        return (1);
    9899                }
    99100                if (strlen(cmd) == 0 || strcmp(cmd, "login") != 0) {
    100101                        icb_error(is, "Malformed login packet");
    101102                        icbd_drop(is, NULL);
    102                         return;
    103                 }
    104                 icb_login(is, group, nick, client);
     103                        return (1);
     104                }
     105                res = icb_login(is, group, nick, client);
    105106                break;
    106107        }
     
    132133                icb_error(is, "Undefined message type %u", type);
    133134        }
     135        return (res);
    134136}
    135137
     
    137139 *  icb_login: handles login ('a') packets
    138140 */
    139 void
     141int
    140142icb_login(struct icb_session *is, char *grp, char *nick, char *client)
    141143{
     
    149151                icb_error(is, "Invalid nick");
    150152                icbd_drop(is, NULL);
    151                 return;
     153                return (1);
    152154        }
    153155        if (!grp || strlen(grp) == 0)
     
    163165                        icb_error(is, "Invalid group %s", group);
    164166                        icbd_drop(is, NULL);
    165                         return;
     167                        return (1);
    166168                } else {
    167169                        if ((ig = icb_addgroup(is, group, NULL)) == NULL) {
    168170                                icb_error(is, "Can't create group %s", group);
    169                                 return;
     171                                return (0);
    170172                        }
    171173                        icbd_log(NULL, LOG_DEBUG, "%s created group %s",
     
    177179                        icb_error(is, "Nick is already in use");
    178180                        icbd_drop(is, NULL);
    179                         return;
     181                        return (1);
    180182                }
    181183        }
     
    207209                icb_status(is, STATUS_TOPIC, "Topic for %s is \"%s\"",
    208210                    ig->name, ig->topic);
     211        return (0);
    209212}
    210213
Note: See TracChangeset for help on using the changeset viewer.