+const bool NNTPConnection::HandleAuthInfoCommand(const NNTPCommand &command)\r
+{\r
+ if(command.m_arguments.size()<2)\r
+ {\r
+ SendBufferedLine("501 Syntax error");\r
+ }\r
+ else if(m_status.m_authenticated==true)\r
+ {\r
+ SendBufferedLine("502 Command unavailable"); // not available when already authenticated\r
+ }\r
+ else\r
+ {\r
+ std::string arg=command.m_arguments[0];\r
+ StringFunctions::UpperCase(arg,arg);\r
+ std::string name="";\r
+ // get remaining args as part of the name since a name might have a space and the args are split on spaces\r
+ for(std::vector<std::string>::const_iterator i=command.m_arguments.begin()+1; i!=command.m_arguments.end(); i++)\r
+ {\r
+ // we split on the space, so add it back\r
+ if(i!=command.m_arguments.begin()+1)\r
+ {\r
+ name+=" ";\r
+ } \r
+ name+=(*i);\r
+ }\r
+ if(arg=="USER")\r
+ {\r
+ LocalIdentity localid;\r
+ if(localid.Load(name))\r
+ {\r
+ m_status.m_authuser=localid;\r
+ m_status.m_authenticated=true;\r
+ SendBufferedLine("281 Authentication accepted");\r
+ }\r
+ else\r
+ {\r
+ SendBufferedLine("481 Authentication failed");\r
+ }\r
+ }\r
+ else if(arg=="PASS")\r
+ {\r
+ SendBufferedLine("482 Authentication commands issued out of sequence"); // only require username\r
+ }\r
+ else\r
+ {\r
+ SendBufferedLine("501 Syntax error");\r
+ }\r
+ }\r
+\r
+ return true;\r
+}\r
+\r