/** Return true on success, false on error. */ bool FacebookProto::NegotiateConnection() { debugLogA("*** Negotiating connection with Facebook"); ptrA username(getStringA(FACEBOOK_KEY_LOGIN)); if (!username || !mir_strlen(username)) { NotifyEvent(m_tszUserName, TranslateT("Please enter a username."), NULL, FACEBOOK_EVENT_CLIENT); return false; } ptrA password(getStringA(FACEBOOK_KEY_PASS)); if (!password || !*password) { NotifyEvent(m_tszUserName, TranslateT("Please enter a password."), NULL, FACEBOOK_EVENT_CLIENT); return false; } password = mir_utf8encode(password); // Refresh last time of feeds update facy.last_feeds_update_ = ::time(NULL); // Generate random clientid for this connection facy.chat_clientid_ = utils::text::rand_string(8, "0123456789abcdef", &facy.random_); // Create default group for new contacts if (m_tszDefaultGroup) Clist_CreateGroup(0, m_tszDefaultGroup); return facy.login(username, password); }
void cacheex_push_out(struct s_client *cl, ECM_REQUEST *er) { int32_t res = 0, stats = -1; struct s_reader *reader = cl->reader; struct s_module *module = get_module(cl); // cc-nodeid-list-check if(reader) { if(reader->ph.c_cache_push_chk && !reader->ph.c_cache_push_chk(cl, er)) return; res = reader->ph.c_cache_push(cl, er); stats = cacheex_add_stats(cl, er->caid, er->srvid, er->prid, 0); } else { if(module->c_cache_push_chk && !module->c_cache_push_chk(cl, er)) return; res = module->c_cache_push(cl, er); } debug_ecm(D_CACHEEX, "pushed ECM %s to %s res %d stats %d", buf, username(cl), res, stats); cl->cwcacheexpush++; if(cl->account) { cl->account->cwcacheexpush++; } first_client->cwcacheexpush++; }
int main(){ sLog->Init(LVL_DEBUG); sConfig->Init("seeq.cfg"); signal(SIGINT, SignalHandler); signal(SIGTERM, SignalHandler); LOG(LVL_NOTICE,"Connecting to %s:%ld.", sConfig->GetParam("serverIP").c_str(), sConfig->GetLong("port")); sNetLay->Init(); ZThread::ThreadedExecutor executor; ZThread::Task *networkTask = new ZThread::Task(sNetLay); executor.execute(*networkTask); char buf[1024]; //login seequence LOG(LVL_NOTICE,"Please enter ur username to login:"******"Username length must be more than 3 and less than 20 symbols, \ but yours is %d symbols long!", username.size()); SignalHandler(0); } else {
void cacheex_timeout(ECM_REQUEST *er) { if(er->cacheex_wait_time_expired) return; er->cacheex_wait_time_expired = 1; if(er->rc >= E_UNHANDLED) { cs_log_dbg(D_LB, "{client %s, caid %04X, prid %06X, srvid %04X} cacheex timeout! ", (check_client(er->client) ? er->client->account->usr : "******"), er->caid, er->prid, er->srvid); // if check_cw mode=0, first try to get cw from cache without check counter! CWCHECK check_cw = get_cwcheck(er); if(!check_cw.mode) { struct ecm_request_t *ecm = NULL; ecm = check_cache(er, er->client); if(ecm) // found in cache { struct s_write_from_cache *wfc = NULL; if(!cs_malloc(&wfc, sizeof(struct s_write_from_cache))) { NULLFREE(ecm); return; } wfc->er_new = er; wfc->er_cache = ecm; if(!add_job(er->client, ACTION_ECM_ANSWER_CACHE, wfc, sizeof(struct s_write_from_cache))) // write_ecm_answer_fromcache { NULLFREE(ecm); } return; } } // check if "normal" readers selected, if not send NOT FOUND! // cacheex1-client (having always no "normal" reader), // or not-cacheex-1 client with no normal readers available (or filtered by LB) if((er->reader_count + er->fallback_reader_count - er->cacheex_reader_count) <= 0) { if(!cfg.wait_until_ctimeout) { er->rc = E_NOTFOUND; er->selected_reader = NULL; er->rcEx = 0; cs_log_dbg(D_LB, "{client %s, caid %04X, prid %06X, srvid %04X} cacheex timeout: NO \"normal\" readers... not_found! ", (check_client(er->client) ? er->client->account->usr : "******"), er->caid, er->prid, er->srvid); send_dcw(er->client, er); return; } } else { if(er->stage < 2) { debug_ecm(D_TRACE, "request for %s %s", username(er->client), buf); request_cw_from_readers(er, 0); } } } }
void createConnection (URL::OpenStreamProgressCallback* progressCallback, void* progressCallbackContext) { static HINTERNET sessionHandle = InternetOpen (_T("juce"), INTERNET_OPEN_TYPE_PRECONFIG, 0, 0, 0); close(); if (sessionHandle != 0) { // break up the url.. const int fileNumChars = 65536; const int serverNumChars = 2048; const int usernameNumChars = 1024; const int passwordNumChars = 1024; HeapBlock<TCHAR> file (fileNumChars), server (serverNumChars), username (usernameNumChars), password (passwordNumChars); URL_COMPONENTS uc = { 0 }; uc.dwStructSize = sizeof (uc); uc.lpszUrlPath = file; uc.dwUrlPathLength = fileNumChars; uc.lpszHostName = server; uc.dwHostNameLength = serverNumChars; uc.lpszUserName = username; uc.dwUserNameLength = usernameNumChars; uc.lpszPassword = password; uc.dwPasswordLength = passwordNumChars; if (InternetCrackUrl (address.toWideCharPointer(), 0, 0, &uc)) openConnection (uc, sessionHandle, progressCallback, progressCallbackContext); } }
/** * store received remote id */ static void camd35_cacheex_push_receive_remote_id(struct s_client *cl, uint8_t *buf) { memcpy(cl->ncd_skey, buf + 20, 8); cl->ncd_skey[8] = 1; cs_log_dbg(D_CACHEEX, "cacheex: received id answer from %s: %" PRIu64 "X", username(cl), cacheex_node_id(cl->ncd_skey)); }
QList<Message> StandardFeed::obtainNewMessages(bool* error_during_obtaining) { QByteArray feed_contents; int download_timeout = qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::UpdateTimeout)).toInt(); QList<QPair<QByteArray, QByteArray>> headers; headers << NetworkFactory::generateBasicAuthHeader(username(), password()); m_networkError = NetworkFactory::performNetworkOperation(url(), download_timeout, QByteArray(), feed_contents, QNetworkAccessManager::GetOperation, headers).first; if (m_networkError != QNetworkReply::NoError) { qWarning("Error during fetching of new messages for feed '%s' (id %d).", qPrintable(url()), id()); setStatus(NetworkError); *error_during_obtaining = true; return QList<Message>(); } else { *error_during_obtaining = false; } // Encode downloaded data for further parsing. QTextCodec* codec = QTextCodec::codecForName(encoding().toLocal8Bit()); QString formatted_feed_contents; if (codec == nullptr) { // No suitable codec for this encoding was found. // Use non-converted data. formatted_feed_contents = feed_contents; } else { formatted_feed_contents = codec->toUnicode(feed_contents); } // Feed data are downloaded and encoded. // Parse data and obtain messages. QList<Message> messages; switch (type()) { case StandardFeed::Rss0X: case StandardFeed::Rss2X: messages = RssParser(formatted_feed_contents).messages(); break; case StandardFeed::Rdf: messages = RdfParser().parseXmlData(formatted_feed_contents); break; case StandardFeed::Atom10: messages = AtomParser(formatted_feed_contents).messages(); default: break; } return messages; }
static void camd33_request_emm(void) { uchar mbuf[20]; struct s_reader *aureader = NULL, *rdr = NULL; //TODO: just take the first reader in list LL_ITER itr = ll_iter_create(cur_client()->aureader_list); while((rdr = ll_iter_next(&itr))) { aureader = rdr; break; } if(!aureader) { return; } if(aureader->hexserial[0]) { cs_log("%s emm-request sent (reader=%s, caid=%04X, auprovid=%06X)", username(cur_client()), aureader->label, aureader->caid, aureader->auprovid ? aureader->auprovid : b2i(4, aureader->prid[0])); mbuf[0] = 0; mbuf[1] = aureader->caid >> 8; mbuf[2] = aureader->caid & 0xff; memcpy(mbuf + 3, aureader->hexserial, 4); memcpy(mbuf + 7, &aureader->prid[0][1], 3); memcpy(mbuf + 10, &aureader->prid[2][1], 3); camd33_send(mbuf, 13); }
QByteArray SmtpAuthenticator::getAuthentication(const QMailAccountConfiguration::ServiceConfiguration &svcCfg, const QStringList &capabilities) { QByteArray result(QMailAuthenticator::getAuthentication(svcCfg, capabilities)); if (!result.isEmpty()) return result.prepend("AUTH "); #ifndef QT_NO_SSL SmtpConfiguration smtpCfg(svcCfg); if (smtpCfg.smtpAuthentication() != SmtpConfiguration::Auth_NONE) { QMailAccountId id(smtpCfg.id()); QByteArray username(smtpCfg.smtpUsername().toUtf8()); QByteArray password(smtpCfg.smtpPassword().toUtf8()); if (smtpCfg.smtpAuthentication() == SmtpConfiguration::Auth_LOGIN) { result = QByteArray("LOGIN"); gResponses[id] = (QList<QByteArray>() << username << password); } else if (smtpCfg.smtpAuthentication() == SmtpConfiguration::Auth_PLAIN) { result = QByteArray("PLAIN ") + QByteArray(username + '\0' + username + '\0' + password).toBase64(); gResponses[id] = (QList<QByteArray>() << QByteArray(username + '\0' + username + '\0' + password)); } } #endif if (!result.isEmpty()) { result.prepend("AUTH "); } return result; }
void UserItem::messageRecived(const QString &message) { m_chatlog.append(username() + ": "); m_chatlog.append(message); m_chatlog.append("\n"); emit chatlogChanged(); }
bool QXmppSaslClientFacebook::respond(const QByteArray &challenge, QByteArray &response) { if (m_step == 0) { // no initial response response = QByteArray(); m_step++; return true; } else if (m_step == 1) { // parse request QUrlQuery requestUrl(challenge); if (!requestUrl.hasQueryItem("method") || !requestUrl.hasQueryItem("nonce")) { warning("QXmppSaslClientFacebook : Invalid challenge, nonce or method missing"); return false; } // build response QUrlQuery responseUrl; responseUrl.addQueryItem("access_token", password()); responseUrl.addQueryItem("api_key", username()); responseUrl.addQueryItem("call_id", 0); responseUrl.addQueryItem("method", requestUrl.queryItemValue("method")); responseUrl.addQueryItem("nonce", requestUrl.queryItemValue("nonce")); responseUrl.addQueryItem("v", "1.0"); response = responseUrl.query().toUtf8(); m_step++; return true; } else { warning("QXmppSaslClientFacebook : Invalid step"); return false; } }
int LuaLobby::SayPrivate(lua_State *L) { LuaLobby* lob = toLuaLobby(L, 1); std::string username(luaL_checkstring(L, 2)); std::string message(luaL_checkstring(L, 3)); lob->SayPrivate(username, message); return 0; }
AuthenticationCredentials PasswordDialog::credentials() const { AuthenticationCredentials cred; cred.setLogonUsername( username() ); cred.setLogonPassword( password() ); return cred; }
void CSteamProto::OnGotRsaKey(const HttpResponse *response) { if (!CheckResponse(response)) return; // load rsa key parts JSONNode root = JSONNode::parse(response->pData); if (!root) return; if (!root["success"].as_bool()) return; std::string modulus = root["publickey_mod"].as_string(); // exponent "010001" is used as constant in CSteamProto::RsaEncrypt //std::string exponent = root["publickey_exp"].as_string(); std::string timestamp = root["timestamp"].as_string(); // encrcrypt password ptrA base64RsaEncryptedPassword; ptrA szPassword(getStringA("Password")); DWORD error = 0; DWORD encryptedSize = 0; if ((error = RsaEncrypt(modulus.c_str(), szPassword, NULL, encryptedSize)) != 0) { debugLogA("CSteamProto::OnGotRsaKey: encryption error (%lu)", error); return; } BYTE *encryptedPassword = (BYTE*)mir_calloc(encryptedSize); if ((error = RsaEncrypt(modulus.c_str(), szPassword, encryptedPassword, encryptedSize)) != 0) { debugLogA("CSteamProto::OnGotRsaKey: encryption error (%lu)", error); return; } base64RsaEncryptedPassword = mir_base64_encode(encryptedPassword, encryptedSize); mir_free(encryptedPassword); // run authorization request T2Utf username(getTStringA("Username")); ptrA guardId(getStringA("GuardId")); if (!guardId) guardId = mir_strdup(""); ptrA guardCode(getStringA("GuardCode")); if (!guardCode) guardCode = mir_strdup(""); ptrA captchaId(getStringA("CaptchaId")); if (!captchaId) captchaId = mir_strdup("-1"); ptrA captchaText(getStringA("CaptchaText")); if (!captchaText) captchaText = mir_strdup(""); PushRequest( new AuthorizationRequest(username, base64RsaEncryptedPassword, timestamp.c_str(), "", guardCode, guardId, captchaId, captchaText), &CSteamProto::OnAuthorization); }
static int32_t cc_cacheex_push_chk(struct s_client *cl, struct ecm_request_t *er) { struct cc_data *cc = cl->cc; if(chk_is_null_nodeid(cc->peer_node_id,8)) { cs_log_dbg(D_CACHEEX, "cacheex: NO peer_node_id got yet, skip!"); return 0; } if(ll_count(er->csp_lastnodes) >= cacheex_maxhop(cl)) //check max 10 nodes to push: { cs_log_dbg(D_CACHEEX, "cacheex: nodelist reached %d nodes, no push", cacheex_maxhop(cl)); return 0; } uint8_t *remote_node = cc->peer_node_id; //search existing peer nodes: LL_LOCKITER *li = ll_li_create(er->csp_lastnodes, 0); uint8_t *node; while((node = ll_li_next(li))) { cs_log_dbg(D_CACHEEX, "cacheex: check node %" PRIu64 "X == %" PRIu64 "X ?", cacheex_node_id(node), cacheex_node_id(remote_node)); if(memcmp(node, remote_node, 8) == 0) { break; } } ll_li_destroy(li); //node found, so we got it from there, do not push: if(node) { cs_log_dbg(D_CACHEEX, "cacheex: node %" PRIu64 "X found in list => skip push!", cacheex_node_id(node)); return 0; } if(!cl->cc) { if(cl->reader && !cl->reader->tcp_connected) { cc_cli_connect(cl); } } if(!cc || !cl->udp_fd) { cs_log_dbg(D_CACHEEX, "cacheex: not connected %s -> no push", username(cl)); return 0; } //check if cw is already pushed if(check_is_pushed(er->cw_cache, cl)) { return 0; } return 1; }
NS_IMETHODIMP nsSmtpServer::GetUsernamePasswordWithUI(const PRUnichar * aPromptMessage, const PRUnichar *aPromptTitle, nsIAuthPrompt* aDialog, nsACString &aUsername, nsACString &aPassword) { nsresult rv; if (!m_password.IsEmpty()) { rv = GetUsername(aUsername); NS_ENSURE_SUCCESS(rv, rv); return GetPassword(aPassword); } NS_ENSURE_ARG_POINTER(aDialog); nsCString serverUri; rv = GetServerURI(serverUri); NS_ENSURE_SUCCESS(rv, rv); nsString uniUsername; nsString uniPassword; bool okayValue = true; rv = aDialog->PromptUsernameAndPassword(aPromptTitle, aPromptMessage, NS_ConvertASCIItoUTF16(serverUri).get(), nsIAuthPrompt::SAVE_PASSWORD_PERMANENTLY, getter_Copies(uniUsername), getter_Copies(uniPassword), &okayValue); NS_ENSURE_SUCCESS(rv, rv); // If the user pressed cancel, just return emtpy strings. if (!okayValue) { aUsername.Truncate(); aPassword.Truncate(); return rv; } // We got a username and password back...so remember them. NS_LossyConvertUTF16toASCII username(uniUsername); rv = SetUsername(username); NS_ENSURE_SUCCESS(rv, rv); NS_LossyConvertUTF16toASCII password(uniPassword); rv = SetPassword(password); NS_ENSURE_SUCCESS(rv, rv); aUsername = username; aPassword = password; return NS_OK; }
//函数用于修改用户密码 void change_password() { User_infor changeU; User_infor userWHV; char fileloc[100]; char pw_repeat[100]; strcpy_s(fileloc, location); //cout << fileloc;// strcat_s(fileloc, "\\userinfor\\"); cout << "请输入账号:"; changeU.get_name(); if (confirm(changeU)) { //连接用户的用户文件 1.1版本之后 需要改成功用函数 可以节省代码数量 strcat_s(fileloc, changeU.name); fstream username(fileloc); ofstream output(fileloc,ios::in); //cout << fileloc; username >> userWHV; username.close(); //cout << userWHV; fstream username1(fileloc); username1 >> changeU; username1.close(); //cout << changeU; cout << "请输入密码:"; changeU.get_password(); //比较密码是否一致 if (passwordcmp(userWHV, changeU)) { cout << "身份验证成功,请输入您要修改的密码"; changeU.get_password(); cout << "请重复您的密码:"; cin >> pw_repeat; cout << userWHV; if (compare(pw_repeat, changeU)) { output << changeU; cout << "完成"; output.close(); getchar(); getchar(); } else { cout << "您输入的密码不同"; } } else { cout << "密码错误"; getchar(); getchar(); } }
QXmppSaslServer::Response QXmppSaslServerDigestMd5::respond(const QByteArray &request, QByteArray &response) { if (m_step == 0) { QMap<QByteArray, QByteArray> output; output["nonce"] = m_nonce; if (!realm().isEmpty()) output["realm"] = realm().toUtf8(); output["qop"] = "auth"; output["charset"] = "utf-8"; output["algorithm"] = "md5-sess"; m_step++; response = QXmppSaslDigestMd5::serializeMessage(output); return Challenge; } else if (m_step == 1) { const QMap<QByteArray, QByteArray> input = QXmppSaslDigestMd5::parseMessage(request); const QByteArray realm = input.value("realm"); const QByteArray digestUri = input.value("digest-uri"); if (input.value("qop") != "auth") { warning("QXmppSaslServerDigestMd5 : Invalid quality of protection"); return Failed; } setUsername(QString::fromUtf8(input.value("username"))); if (password().isEmpty() && passwordDigest().isEmpty()) return InputNeeded; m_nc = input.value("nc"); m_cnonce = input.value("cnonce"); if (!password().isEmpty()) { m_secret = QCryptographicHash::hash( username().toUtf8() + ":" + realm + ":" + password().toUtf8(), QCryptographicHash::Md5); } else { m_secret = passwordDigest(); } if (input.value("response") != calculateDigest("AUTHENTICATE", digestUri, m_secret, m_nonce, m_cnonce, m_nc)) return Failed; QMap<QByteArray, QByteArray> output; output["rspauth"] = calculateDigest(QByteArray(), digestUri, m_secret, m_nonce, m_cnonce, m_nc); m_step++; response = QXmppSaslDigestMd5::serializeMessage(output); return Challenge; } else if (m_step == 2) { m_step++; response = QByteArray(); return Succeeded; } else { warning("QXmppSaslServerDigestMd5 : Invalid step"); return Failed; } }
clientstruct::clientstruct(guidtype gid, appidtype app, acclevtype lev, const std::string& hst, const std::string& ip_, const std::string& usernm_, indx clid) { guid_ = static_cast<unum64> (gid); accesslevel(lev); appid(app); host(hst); user(clid); username(usernm_); ip(ip_); }
/* Work threads are named like this: w[r|c]XX-[rdr->label|client->username] w - work thread prefix [r|c] - depending whether the the action is related to reader or client XX - two digit action code from enum actions label - reader label or client username (see username() function) */ static void set_work_thread_name(struct job_data *data) { char thread_name[16 + 1]; snprintf(thread_name, sizeof(thread_name), "w%c%02d-%s", data->action < ACTION_CLIENT_FIRST ? 'r' : 'c', data->action, username(data->cl) ); set_thread_name(thread_name); }
void QtVoxOxCallBarFrame::fillComboBox() { QStringList tobeinserted = QStringList(); clearComboBox(); //CUserProfile * cUserProfile = // _qtWengoPhone->getCWengoPhone().getCUserProfileHandler().getCUserProfile(); if (!_cUserProfile) { return; } //completion of history //if _qtHistoryWidget is set it means that History has been created bool isWengoAccountConnected = _cUserProfile->getUserProfile().hasWengoAccount(); CHistory* chistory = _cUserProfile->getCHistory(); if (chistory) { HistoryMementoCollection * mementos = chistory->getMementos(HistoryMemento::OutgoingCall, 10); Config & config = ConfigManager::getInstance().getCurrentConfig(); QString wengoSuffix = "@" + QString::fromStdString( config.getWengoRealm() ); for (HistoryMap::iterator it = mementos->begin(); it != mementos->end(); it++) { HistoryMemento * memento = (*it).second; SipAddress sipAddress(memento->getPeer()); QString username(sipAddress.getSipAddress().c_str()); if (isWengoAccountConnected) { username.remove(wengoSuffix); } username.remove("sip:"); if( !username.isEmpty() && (memento->getState()==HistoryMemento::OutgoingCall) && !tobeinserted.contains(username) ) { tobeinserted << username; } } OWSAFE_DELETE(mementos); } //// tobeinserted.sort(); QStringList::const_iterator constIterator; for (constIterator = tobeinserted.constBegin(); constIterator != tobeinserted.constEnd();++constIterator){ addComboBoxItem(*constIterator); } if(tobeinserted.count() > 0){ if(_ui->callBarComboBox->findText(CLEAR_RECENT_CALLS_MESSAGE) == -1){ _ui->callBarComboBox->insertItem (_ui->callBarComboBox->count(), CLEAR_RECENT_CALLS_MESSAGE ); } } clearComboBoxEditText(); }
static int32_t camd35_cacheex_push_chk(struct s_client *cl, ECM_REQUEST *er) { if(ll_count(er->csp_lastnodes) >= cacheex_maxhop(cl)) //check max 10 nodes to push: { cs_log_dbg(D_CACHEEX, "cacheex: nodelist reached %d nodes, no push", cacheex_maxhop(cl)); return 0; } if(cl->reader) { if(!cl->reader->tcp_connected) { cs_log_dbg(D_CACHEEX, "cacheex: not connected %s -> no push", username(cl)); return 0; } } //if(chk_is_null_nodeid(remote_node,8)){ if(!cl->ncd_skey[8]) { cs_log_dbg(D_CACHEEX, "cacheex: NO peer_node_id got yet, skip!"); return 0; } uint8_t *remote_node = cl->ncd_skey; //it is sended by reader(mode 2) or client (mode 3) each 30s using keepalive msgs //search existing peer nodes: LL_LOCKITER *li = ll_li_create(er->csp_lastnodes, 0); uint8_t *node; while((node = ll_li_next(li))) { cs_log_dbg(D_CACHEEX, "cacheex: check node %" PRIu64 "X == %" PRIu64 "X ?", cacheex_node_id(node), cacheex_node_id(remote_node)); if(memcmp(node, remote_node, 8) == 0) { break; } } ll_li_destroy(li); //node found, so we got it from there, do not push: if(node) { cs_log_dbg(D_CACHEEX, "cacheex: node %" PRIu64 "X found in list => skip push!", cacheex_node_id(node)); return 0; } //check if cw is already pushed if(check_is_pushed(er->cw_cache, cl)) { return 0; } cs_log_dbg(D_CACHEEX, "cacheex: push ok %" PRIu64 "X to %" PRIu64 "X %s", cacheex_node_id(camd35_node_id), cacheex_node_id(remote_node), username(cl)); return 1; }
static unsigned posted (unsigned margin) { time_t now = time (& now); static char datetime [LOGTIME_LEN]; strftime (datetime, sizeof (datetime), LOGTIME, localtime (& now)); indent (margin++, "<div class='%s'>", style_posted); indent (margin, "Posted %s on %s by %s", datetime, hostname (), username (getuid ())); indent (margin--, "</div>"); return (margin); }
/** * request remote id */ void camd35_cacheex_push_request_remote_id(struct s_client *cl) { uint8_t rbuf[32];//minimal size memset(rbuf, 0, sizeof(rbuf)); rbuf[0] = 0x3d; rbuf[1] = 12; rbuf[2] = 0; memcpy(rbuf + 20, camd35_node_id, 8); cs_log_dbg(D_CACHEEX, "cacheex: sending id request to %s", username(cl)); camd35_send(cl, rbuf, 12); //send adds +20 }
const std::string Settings::dump() const { std::stringstream ss; ss << "Settings: " << std::endl; ss << "\tusername: "******"\t address: " << serverAddress() << std::endl; ss << "\t server?: " << (isServer() ? "true":"false") << std::endl; ss << "\t port: " << port() << std::endl; return ss.str(); }
void cs_disconnect_client(struct s_client * client) { char buf[32] = { 0 }; if (IP_ISSET(client->ip)) snprintf(buf, sizeof(buf), " from %s", cs_inet_ntoa(client->ip)); cs_log("%s disconnected%s", username(client), buf); if (client == cur_client()) cs_exit(0); else kill_thread(client); }
static void log_cacheex_cw(ECM_REQUEST *er, char *reason) { uint8_t *data; uchar remotenodeid[16]; data = ll_last_element(er->csp_lastnodes); if(data) memcpy(remotenodeid, data, 8); char buf_ecm[109]; format_ecm(er, buf_ecm, 109); cs_log_dbg(D_CACHEEX,"got pushed ecm [%s]: %s - odd/even 0x%x - CSP cw: %s - pushed from %s, at hop %d, origin node-id %" PRIu64 "X", reason, buf_ecm, er->ecm[0], (checkECMD5(er)?"NO":"YES"), er->from_csp ? "csp" : username((er->cacheex_src?er->cacheex_src:er->client)), ll_count(er->csp_lastnodes), er->csp_lastnodes ? cacheex_node_id(remotenodeid): 0); }
/** * @function ssh.connect * * ### Synopsis * * var conn = ssh.connect(host, username, password); * var conn = ssh.connect(host, username, password, port); * * Connect to a remote host via SSH. * * @param {string} host - name of remote host. * @param {string} username - username for password authentication at remote host. * @param {string} password - password for authentication at remote host. * @param {int} port - SSH port at remote host (defaults to 21).. * @return {object} conn - connection ready to use for other methods. */ static JSVAL ssh2_connect(JSARGS args) { HandleScope scope; String::Utf8Value host(args[0]); String::Utf8Value username(args[1]); String::Utf8Value password(args[2]); int port = 22; if (args.Length() > 3) { port = args[3]->IntegerValue(); } SSH2 *ssh2 = new SSH2(*host, *username, *password, port); return scope.Close(External::New(ssh2)); }
bool QXmppSaslClientPlain::respond(const QByteArray &challenge, QByteArray &response) { Q_UNUSED(challenge); if (m_step == 0) { response = QString('\0' + username() + '\0' + password()).toUtf8(); m_step++; return true; } else { warning("QXmppSaslClientPlain : Invalid step"); return false; } }
Status loginServerOtpPending(std::list<DataChunk> users, std::list<bool> &isPending) { const auto url = ABC_SERVER_ROOT "/v1/otp/pending/check"; std::string param; std::map<std::string, bool> userMap; std::list<std::string> usersEncoded; for (const auto &u : users) { std::string username = base64Encode(u); param += (username + ","); userMap[username] = false; usersEncoded.push_back(username); } JsonObject json; ABC_CHECK(json.set("l1s", param)); HttpReply reply; ABC_CHECK(AirbitzRequest().post(reply, url, json.encode())); ServerReplyJson replyJson; ABC_CHECK(replyJson.decode(reply)); JsonArray arrayJson = replyJson.results(); size_t size = arrayJson.size(); for (size_t i = 0; i < size; i++) { json_t *pJSON_Row = arrayJson[i].get(); if (!pJSON_Row || !json_is_object(pJSON_Row)) return ABC_ERROR(ABC_CC_JSONError, "Error parsing JSON array element object"); json_t *pJSON_Value = json_object_get(pJSON_Row, "login"); if (!pJSON_Value || !json_is_string(pJSON_Value)) return ABC_ERROR(ABC_CC_JSONError, "Error otp/pending/login JSON"); std::string username(json_string_value(pJSON_Value)); pJSON_Value = json_object_get(pJSON_Row, ABC_SERVER_JSON_OTP_PENDING); if (!pJSON_Value || !json_is_boolean(pJSON_Value)) return ABC_ERROR(ABC_CC_JSONError, "Error otp/pending/pending JSON"); if (json_is_true(pJSON_Value)) { userMap[username] = json_is_true(pJSON_Value); } } isPending.clear(); for (auto &username: usersEncoded) { isPending.push_back(userMap[username]); } return Status(); }