Module: ngircd.git Branch: master Commit: da4c1ebe81bbd1335356ef40c91741b953c9f8d8 URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=da4c1...
Author: Alexander Barton alex@barton.de Date: Sat Mar 31 16:37:31 2012 +0200
Correctly handle "CAP END", new client type CLIENT_WAITCAPEND
---
src/ngircd/client.h | 1 + src/ngircd/irc-cap.c | 2 +- src/ngircd/login.c | 5 ++++- src/ngircd/parse.c | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/ngircd/client.h b/src/ngircd/client.h index bdad9ce..4dbcc7a 100644 --- a/src/ngircd/client.h +++ b/src/ngircd/client.h @@ -29,6 +29,7 @@ #ifndef STRICT_RFC # define CLIENT_WAITAUTHPING 512 /* waiting for AUTH PONG from client */ #endif +#define CLIENT_WAITCAPEND 1024 /* waiting for "CAP END" command */
#define CLIENT_TYPE int
diff --git a/src/ngircd/irc-cap.c b/src/ngircd/irc-cap.c index 926943c..956b359 100644 --- a/src/ngircd/irc-cap.c +++ b/src/ngircd/irc-cap.c @@ -180,7 +180,7 @@ Handle_CAP_END(CLIENT *Client) /* User is still logging in ... */ Client_CapDel(Client, CLIENT_CAP_PENDING);
- if (Client_Type(Client) == CLIENT_GOTUSER) { + if (Client_Type(Client) == CLIENT_WAITCAPEND) { /* Only "CAP END" was missing: log in! */ return Login_User(Client); } diff --git a/src/ngircd/login.c b/src/ngircd/login.c index ad45219..3808997 100644 --- a/src/ngircd/login.c +++ b/src/ngircd/login.c @@ -80,8 +80,11 @@ Login_User(CLIENT * Client) #endif
/* Still waiting for "CAP END" command? */ - if (Client_Cap(Client) & CLIENT_CAP_PENDING) + if (Client_Cap(Client) & CLIENT_CAP_PENDING) { + Client_SetType(Client, CLIENT_WAITCAPEND); + LogDebug("Connection %d: Waiting for CAP END ...", conn); return CONNECTED; + }
#ifdef PAM if (!Conf_PAM) { diff --git a/src/ngircd/parse.c b/src/ngircd/parse.c index 41e3872..66bfef5 100644 --- a/src/ngircd/parse.c +++ b/src/ngircd/parse.c @@ -114,7 +114,7 @@ static COMMAND My_Commands[] = { "CHANINFO", IRC_CHANINFO, CLIENT_SERVER, 0, 0, 0 }, #endif #ifndef STRICT_RFC - { "CAP", IRC_CAP, CLIENT_UNKNOWN|CLIENT_GOTNICK|CLIENT_GOTPASS|CLIENT_GOTUSER|CLIENT_USER, 0, 0, 0 }, + { "CAP", IRC_CAP, 0xFFFF, 0, 0, 0 }, { "GET", IRC_QUIT_HTTP, CLIENT_UNKNOWN, 0, 0, 0 }, { "POST", IRC_QUIT_HTTP, CLIENT_UNKNOWN, 0, 0, 0 }, #endif