Exemple #1
0
void Client::reloadSettings(bool updateNick) {
	/// @todo update the nick in ADC hubs?
	string prevNick;
	if(!updateNick)
		prevNick = get(Nick);

	auto fav = FavoriteManager::getInstance()->getFavoriteHubEntry(getHubUrl());

	*static_cast<HubSettings*>(this) = SettingsManager::getInstance()->getHubSettings();

	bool isAdcHub = AirUtil::isAdcHub(hubUrl);

	if(fav) {
		FavoriteManager::getInstance()->mergeHubSettings(fav, *this);
		if(!fav->getPassword().empty())
			setPassword(fav->getPassword());

		setStealth(!isAdcHub ? fav->getStealth() : false);
		setFavNoPM(fav->getFavNoPM());

		favToken = fav->getToken();
	} else {
		setStealth(false);
		setFavNoPM(false);
		setPassword(Util::emptyString);
	}

	searchQueue.minInterval = get(HubSettings::SearchInterval) * 1000; //convert from seconds
	if (updateNick)
		checkNick(get(Nick));
	else
		get(Nick) = prevNick;
}
int Server::login(string username,string password){
    cout << "username: "******"username length: " << username.length() << endl;
    cout << "password: "******"password length: " << password.length() << endl;
    cout << getPassword(username) << endl;
    
    if(getPassword(username).find(password)==0){
        return 1;
    }else{

    return 0;
}
    
    // int comp=0;
    // int comp = password.compare(getPassword(username));
    // if(password==getPassword(username)){
    //     comp=1;
    // }else{
    //     comp=0;
    // }
    // cout << "comp: " << comp << endl;
    // if (comp==0){
    //     return 1;
    // } else{
    //     return 0;
    // }
}
                void NLoginCredentials::toStruct(_NLoginCredentials & input)
                {
                    memset(&input, 0, sizeof(_NLoginCredentials));

                    getUsername().copy(input.Username, getUsername().length());
                    getPassword().copy(input.Password, getPassword().length());
                }
void VKBase::Authorization()
{
    if(!_curl || getLogin().empty() || getPassword().empty())
        return;

    char errorBuffer[CURL_ERROR_SIZE];
    std::string buffer = "";	// for response
    std::string url = "https://login.vk.com/?act=login&soft=1&utf8=1";
    std::string request = "_origin=https://oauth.vk.com";
    //request += "&ip_h=62371f194b8af424e4";	// it need parse
    request += "&to=aHR0cHM6Ly9vYXV0aC52ay5jb20vYXV0aG9yaXplP2NsaWVudF9pZD00NTYxOTg5JnJlZGlyZWN0X3VyaT1odHRwJTNBJTJGJTJGYXBpLnZrb250YWt0ZS5ydSUyRmJsYW5rLmh0bWwmcmVzcG9uc2VfdHlwZT10b2tlbiZzY29wZT04JnY9NS4yNCZzdGF0ZT0mcmV2b2tlPTEmZGlzcGxheT1tb2JpbGU-"; // redirect url to base64
    request += "&email="+getLogin();
    request += "&pass="+getPassword();

    curl_easy_setopt(_curl, CURLOPT_URL, url.c_str());
    curl_easy_setopt(_curl, CURLOPT_POSTFIELDS, request.c_str());
    curl_easy_setopt(_curl, CURLOPT_WRITEFUNCTION, &VKBase::writer);
    curl_easy_setopt(_curl, CURLOPT_WRITEDATA, &buffer);
    curl_easy_setopt(_curl, CURLOPT_ERRORBUFFER, errorBuffer);
    CURLcode result = curl_easy_perform(_curl);
    curlCheckError(_curl, result, errorBuffer);

    _ip_h = parseIPhFromHeaders(buffer);
    _hash = parseHashFromHeaders(buffer);
}
int main(void) 
{ 
	TERMIO_Init(); 
	printf("\n\r In test harness of passwords\r\n");
	/* Intializes random number generator */
  srand(rand());
	randomizePasswords();
	printPassword(getPassword(1));
	printPassword(getPassword(2));
	printPassword(getPassword(3));
	printPassword(getPassword(4));
	printf("\r\nThe correct password is %d\r\n\r\n", correctPassword);
	if (checkPassword(getPassword(1)))
		printf("Password1 is correct\r\n");
	else
		printf("Password1 is incorrect\r\n");
	if (checkPassword(getPassword(2)))
		printf("Password2 is correct\r\n");
	else
		printf("Password2 is incorrect\r\n");
	if (checkPassword(getPassword(3)))
		printf("Password3 is correct\r\n");
	else
		printf("Password3 is incorrect\r\n");
	if (checkPassword(getPassword(4)))
		printf("Password4 is correct\r\n");
	else
		printf("Password4 is incorrect\r\n");
		
	// Int to Character Stuff
	char c[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
	for (int i = 0; i < 5; i++) {
		printf("%c\r\n", c[getPassword(1)[i]]);
	}
}
int K3PasswordDialog::getPassword(QWidget *parent, QByteArray &password, const QString &prompt,
	int *keep)
{
    int res = K3PasswordDialog::Rejected;
    if (keep) {
        bool boolkeep = *keep;
        res = getPassword(parent, password, i18n("Password Input"), prompt, &boolkeep);
        *keep = boolkeep;
    }
    else {
        res = getPassword(parent, password, i18n("Password Input"), prompt);
    }
    return res;
}
void FormCreateImage::enableDisableButtons()
{
    bool imageFileEmpty = getImageFile().length() == 0;
    bool passwordEmpty = getPassword().length() == 0;
    
    ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!imageFileEmpty && !passwordEmpty);
}
Exemple #8
0
	SessionPtr WebUserManager::authenticate(const string& aUserName, const string& aPassword, bool aIsSecure, uint64_t aMaxInactivityMinutes, bool aUserSession) noexcept {
		auto u = getUser(aUserName);
		if (!u) {
			return nullptr;
		}

		if (u->getPassword() != aPassword) {
			return nullptr;
		}

		u->setLastLogin(GET_TIME());
		u->addSession();
		fire(WebUserManagerListener::UserUpdated(), u);

		auto uuid = boost::uuids::random_generator()();
		auto session = std::make_shared<Session>(u, boost::uuids::to_string(uuid), aIsSecure, server, aMaxInactivityMinutes, aUserSession);

		{
			WLock l(cs);
			sessionsRemoteId.emplace(session->getAuthToken(), session);
			sessionsLocalId.emplace(session->getId(), session);
		}

		if (aUserSession) {
			ActivityManager::getInstance()->updateActivity();
		}

		return session;
	}
Exemple #9
0
AP_MSG_HANDLER_METHOD(GmModule, IdentityMgmt_SetProperty)
{
  if (!bActive_) { pMsg->apStatus = ApMessage::Ok; return; }

  int ok = 0;

  if (!hasGmLoginData()) { throw ApException(LOG_CONTEXT, "Missing login data"); }
  String sUrl = Apollo::getModuleConfig(MODULE_NAME, "Srpc/Url", "");
  if (sUrl.empty()) { throw ApException(LOG_CONTEXT, "Missing Srpc/Url"); }

  SrpcMessage srpc;
  srpc.set(Srpc::Key::Method, GmService_Method_SetProperty);
  srpc.set("Token", Apollo::getModuleConfig(MODULE_NAME, "Srpc/Token", "8uzxXXZTAmHcni6tK3t-Apollo-3"));
  srpc.set("User", Apollo::getModuleConfig(MODULE_NAME, "User", ""));
  srpc.set("Password", getPassword());
  srpc.set("Key", pMsg->sKey);
  srpc.set("Value", pMsg->sValue);

  SetPropertyClient* pClient = new SetPropertyClient(this);
  if (pClient != 0) {
    ok = pClient->Post(sUrl, srpc);
    if (!ok) {
      apLog_Error((LOG_CHANNEL, LOG_CONTEXT, "SetPropertyClient::Post(%s) failed", _sz(sUrl)));
    }
  }

  if (pMsg->sKey == "Nickname") {
    Apollo::setModuleConfig("Xmpp", "Room/Nickname", pMsg->sValue);
  }

  pMsg->apStatus = ok ? ApMessage::Ok : ApMessage::Error;
}
Exemple #10
0
	void TextField::addToNextCharacter( int unichar )
	{
		if(getTextLength() + 1 > getMaxLength())
		{
			return;
		}

		char buffer[8];
		for(int i = 0; i < 8; ++i)
		{
			buffer[i] = 0;
		}

		unicodeFunctions.encodeUtf8(buffer,unichar);
		std::string appendStr = buffer;
		
		std::string text;
		if(!isPassword())
			text = getText();
		else
			text = getPassword();

		unicodeFunctions.insert(text,getCaretPosition(),buffer);

		setThisText(text);
		positionCaret(getCaretPosition() + 1);

	}
boolean WiFiManager::autoConnect(char const *apName) {
    begin(apName);

//  DEBUG_PRINT("");
//    DEBUG_PRINT("AutoConnect");
    // read eeprom for ssid and pass
    String ssid = getSSID();
    String pass = getPassword();
    
    if ( ssid.length() > 1 ) {
        display.print("Waiting for Wifi to connect");
        DEBUG_PRINT("Waiting for Wifi to connect");

        WiFi.mode(WIFI_STA);
        WiFi.begin(ssid.c_str(), pass.c_str());
        if ( hasConnected() ) {
            return true;
        }
    }
    //setup AP
    beginConfigMode();
    //start portal and loop
    startWebConfig();
    return false;
}
bool Checkin::operator==(const Checkin& other) const {
	return true
		 && _isUsernameSet(mgen::SHALLOW) == other._isUsernameSet(mgen::SHALLOW)
		 && _isPasswordSet(mgen::SHALLOW) == other._isPasswordSet(mgen::SHALLOW)
		 && getUsername() == other.getUsername()
		 && getPassword() == other.getPassword();
}
Exemple #13
0
Result Server::connect()
{
    if(mServerHandle)
    {
        return Error;
    }

    mServerHandle = mysql_init(NULL);
    if(mServerHandle == NULL)
    {
        return Error;
    }
    
    unsigned long flags=0;
    if(mysql_real_connect(mServerHandle,
                          getHost()->c_str(),
                          getUsername()->c_str(),
                          getPassword()->c_str(),
                          NULL,
                          mPort,
                          NULL,
                          flags) == NULL)
    {

        printError();
        
        return Error;
    }
    
    return OK;
}
Exemple #14
0
void MainWindow::on_loginButon_clicked()
{
    UsersDBManager udb;
    HomeWindow *home = new HomeWindow();

    //passes the value of username from MainWindow to Welcome Label of HomeWindow
    connect(this,SIGNAL(setUName(QString)),home,SLOT(setWelcomeLabel(QString)));

    //Checking the input username and password are give or not
    if(ui->userName_txt->text().isEmpty() || ui->password_txt->text().isEmpty()){
        mainMsgBox.setText("Please input the username and password");
        mainMsgBox.exec();
    }
    setUserName(ui->userName_txt->text());
    setPassword(ui->password_txt->text());

    bool successLogin = udb.checkLogin(getUserName(),getPassword());

    if(successLogin){
        //display another home window
        emit setUName(ui->userName_txt->text());
        home->show();
        this->close();
    }
    else
    {
        //display qmessage login failed
        mainMsgBox.setText("Login failed. Please enter correct \nusername and password");
        mainMsgBox.exec();
    }
}
Exemple #15
0
bool CUserItem::getAsString( wxString& strUser )
{
    wxString wxstr;
    strUser.Empty();
        
    strUser += wxString::Format( _("%ld;"), getUserID() );
    strUser += getUser();
    strUser += _(";");
    // Protect password
    wxstr = getPassword();
    for ( int i=0; i<wxstr.Length(); i++ ) {
        strUser += _("*");
    }
    //strUser += getPassword();
    strUser += _(";");
    strUser += getFullname();
    strUser += _(";");
    vscp_writeFilterToString( getFilter(), wxstr );
    strUser += wxstr;
    strUser += _(";");
    vscp_writeMaskToString( getFilter(), wxstr );
    strUser += wxstr;
    strUser += _(";");
    strUser += getUserRightsAsString();
    strUser += _(";");
    strUser += getAllowedRemotesAsString();
    strUser += _(";");
    strUser += getAllowedEventsAsString();
    strUser += _(";");
    strUser += wxBase64Encode( getNote().mbc_str(), strlen( getNote().mbc_str() ) ); 	
    //strUser += getNote();
    
    return true;
}
void Server_Game::getInfo(ServerInfo_Game &result) const
{
	QMutexLocker locker(&gameMutex);
	
	result.set_room_id(room->getId());
	result.set_game_id(gameId);
	if (gameClosed)
		result.set_closed(true);
	else {
		for (int i = 0; i < gameTypes.size(); ++i)
			result.add_game_types(gameTypes[i]);
		
		result.set_max_players(getMaxPlayers());
		result.set_description(getDescription().toStdString());
		result.set_with_password(!getPassword().isEmpty());
		result.set_player_count(getPlayerCount());
		result.set_started(gameStarted);
		result.mutable_creator_info()->CopyFrom(*getCreatorInfo());
		result.set_only_buddies(onlyBuddies);
		result.set_only_registered(onlyRegistered);
		result.set_spectators_allowed(getSpectatorsAllowed());
		result.set_spectators_need_password(getSpectatorsNeedPassword());
		result.set_spectators_can_chat(spectatorsCanTalk);
		result.set_spectators_omniscient(spectatorsSeeEverything);
		result.set_spectators_count(getSpectatorCount());
		result.set_start_time(startTime.toTime_t());
	}
}
Exemple #17
0
int RockComMailbox::loginRequest()
{
// 	LOG_ENTER("RockComMailbox::loginRequest");
	const std::string vars = std::string("show_frame=Enter&action=login&domain=")
		+ escape("rock.com")
		+ "&mail_language=us&longlogin=1&login="******"&password="******"&submit.x=41&submit.y=8";
// 	setState(Mailbox::LoginIP);
// 	LOG_ENTER(getUser());
// 	LOG_ENTER(getPassword());
	page=doPost("http://webmail.rock.com/scripts/common/proxy.main", vars);
	boost::regex re("a");
	boost::smatch match;
	if (boost::regex_search(page, match, re))
	{
// 		setState(Mailbox::LoginDone); // logged in
		auth = match[1];
// 		LOG(Log::Debug, "auth=" + auth);
		return 0;
	}
	else
	{
// 		setState(Mailbox::LoginError); //login failure
		return 1;
	}
}
Exemple #18
0
void JabberClient::auth_digest()
{
    AuthRequest *req = new AuthRequest(this);
    req->start_element("query");
    req->add_attribute("xmlns", "jabber:iq:auth");
    req->text_tag("username", data.owner.ID);

    string digest = m_id;
    digest += getPassword().utf8();
    SHA_CTX c;
    unsigned char md[SHA_DIGEST_LENGTH];
    SHA1_Init(&c);
    SHA1_Update(&c, digest.c_str(),(unsigned long)digest.length());
    SHA1_Final(md, &c);
    digest = "";
    for (unsigned i = 0; i < SHA_DIGEST_LENGTH; i++){
        char b[3];
        sprintf(b, "%02x",md[i]);
        digest += b;
    }

    req->text_tag("digest", digest.c_str());
    req->text_tag("resource", data.owner.Resource);
    req->send();
    m_requests.push_back(req);
}
Exemple #19
0
static int processThread(HttpConn *conn, MprEvent *event)
{
    ThreadData  *td;
    cchar       *path;
    char        *url;
    int         next;

    td = mprGetCurrentThread()->data;
    httpFollowRedirects(conn, !app->nofollow);
    httpSetTimeout(conn, app->timeout, app->timeout);

    if (strcmp(app->protocol, "HTTP/1.0") == 0) {
        httpSetKeepAliveCount(conn, 0);
        httpSetProtocol(conn, "HTTP/1.0");
    }
    if (app->username) {
        if (app->password == 0 && !strchr(app->username, ':')) {
            app->password = getPassword();
        }
        httpSetCredentials(conn, app->username, app->password);
    }
    while (!mprShouldDenyNewRequests(conn) && (app->success || app->continueOnErrors)) {
        if (app->singleStep) waitForUser();
        if (app->files && !app->upload) {
            for (next = 0; (path = mprGetNextItem(app->files, &next)) != 0; ) {
                /*
                    If URL ends with "/", assume it is a directory on the target and append each file name 
                 */
                if (app->target[strlen(app->target) - 1] == '/') {
                    url = mprJoinPath(app->target, mprGetPathBase(path));
                } else {
                    url = app->target;
                }
                app->requestFiles = mprCreateList(-1, MPR_LIST_STATIC_VALUES);
                mprAddItem(app->requestFiles, path);
                td->url = url = resolveUrl(conn, url);
                if (app->verbose) {
                    mprPrintf("putting: %s to %s\n", path, url);
                }
                if (doRequest(conn, url, app->requestFiles) < 0) {
                    app->success = 0;
                    break;
                }
            }
        } else {
            td->url = url = resolveUrl(conn, app->target);
            if (doRequest(conn, url, app->files) < 0) {
                app->success = 0;
                break;
            }
        }
        if (iterationsComplete()) {
            break;
        }
    }
    httpDestroyConn(conn);
    finishThread((MprThread*) event->data);
    return -1;
}
bool SCRAMSHA1ClientAuthenticator::setChallenge(const boost::optional<ByteArray>& challenge) {
	if (step == Initial) {
		if (!challenge) {
			return false;
		}
		initialServerMessage = *challenge;

		std::map<char, std::string> keys = parseMap(initialServerMessage.toString());

		// Extract the salt
		ByteArray salt = Base64::decode(keys['s']);

		// Extract the server nonce
		std::string clientServerNonce = keys['r'];
		if (clientServerNonce.size() <= clientnonce.size()) {
			return false;
		}
		std::string receivedClientNonce = clientServerNonce.substr(0, clientnonce.size());
		if (receivedClientNonce != clientnonce) {
			return false;
		}
		serverNonce = clientServerNonce.substr(clientnonce.size(), clientServerNonce.npos);

		// Extract the number of iterations
		int iterations = 0;
		try {
			iterations = boost::lexical_cast<int>(keys['i']);
		}
		catch (const boost::bad_lexical_cast&) {
			return false;
		}
		if (iterations <= 0) {
			return false;
		}

		ByteArray channelBindData;
		if (useChannelBinding && tlsChannelBindingData) {
			channelBindData = *tlsChannelBindingData;
		}

		// Compute all the values needed for the server signature
		saltedPassword = PBKDF2::encode(StringPrep::getPrepared(getPassword(), StringPrep::SASLPrep), salt, iterations);
		authMessage = getInitialBareClientMessage() + "," + initialServerMessage + "," + getFinalMessageWithoutProof();
		ByteArray serverKey = HMACSHA1::getResult(saltedPassword, "Server Key");
		serverSignature = HMACSHA1::getResult(serverKey, authMessage);

		step = Proof;
		return true;
	}
	else if (step == Proof) {
		ByteArray result = ByteArray("v=") + ByteArray(Base64::encode(serverSignature));
		step = Final;
		return challenge && challenge == result;
	}
	else {
		return true;
	}
}
Exemple #21
0
int main(void)
{
    char password[SIZE];
    printf("please enter password\n");
    getPassword(password);

    printf("Do something with the password <<%s>>\n", password);
    return 0;
}
Exemple #22
0
void HTTPS_Proxy::send_auth()
{
    if (getAuth()){
        string s = basic_auth(getUser(), getPassword());
        bOut << "Proxy-Authorization: Basic ";
        bOut << s.c_str();
        bOut << "\r\n";
    }
}
Exemple #23
0
int AGIPUserLogin::showInfo()
{
    int nRetCode        = E_ERROR;


    char strUserName[AGIP_USER_NAME_LEN + 1];
    char strPassword[AGIP_PASSWORD_LEN + 1];
    int8_t cPasswordType = 0;
    uint32_t unUserIP    = 0;
    uint16_t usUserPort  = 0;
    uint8_t *pucIPSeg    = 0;


    SysProtocol::showInfo();
    nRetCode = getUserName(strUserName);
    strUserName[AGIP_USER_NAME_LEN] = '\0';
    nRetCode = getPassword(strPassword);
    strPassword[AGIP_PASSWORD_LEN] = '\0';

    nRetCode = getPasswordType(&cPasswordType);
    nRetCode = getUserIP(&unUserIP);
    nRetCode = getUserPort(&usUserPort);

    printf("--------------------------------------------------------AGIPUserLogin\n");
    printf("User_Name:\t%s\n", strUserName);
    printf("Password:\t%s\n", strPassword);

    switch(cPasswordType)
    {
    case PASSWORD_TYPE_AUTHENTICATION:
        printf("Password_Type:\t%d(Authentication)\n", cPasswordType);
        break;
    case PASSWORD_TYPE_SECURITY:
        printf("Password_Type:\t%d(Security Code Verify)\n", cPasswordType);
        break;
    default:
        printf("Password_Type:\t%d(Others)\n", cPasswordType);
        break;
    }

#if (defined(WIN32) || defined(LINUX))
    pucIPSeg = (uint8_t *)&unUserIP;
    printf("User_IP:\t%08X(%u.%u.%u.%u)\n",
        unUserIP,
        pucIPSeg[3], pucIPSeg[2], pucIPSeg[1], pucIPSeg[0]
    );
#else
    pucIPSeg = (uint8_t *)&unUserIP;
    printf("User_IP:\t%08X(%u.%u.%u.%u)\n",
        unUserIP,
        pucIPSeg[0], pucIPSeg[1], pucIPSeg[2], pucIPSeg[3]
    );
#endif
    printf("User_Port:\t%u\n", usUserPort);
    printf("--------------------------------------------------------AGIPUserLogin\n");
    return S_SUCCESS;
}
Exemple #24
0
void ICQClient::snac_login(unsigned short type, unsigned short)
{
    unsigned long newUin;
    switch (type){
    case ICQ_SNACxLOGIN_ERROR:
        m_reconnect = NO_RECONNECT;
        m_socket->error_state(I18N_NOOP("Login error"), AuthError);
        break;
    case ICQ_SNACxLOGIN_REGISTER:
        if (data.owner.Uin.value){
            m_socket->error_state(I18N_NOOP("Registered in no register state"));
            break;
        }
        m_socket->readBuffer.incReadPos(0x2E);
        m_socket->readBuffer.unpack(newUin);
        log(L_DEBUG, "Register %u %08lX", newUin, newUin);
        setUin(newUin);
        setState(Connecting);
        m_socket->connect(getServer(), getPort(), this);
        break;
    case ICQ_SNACxLOGIN_AUTHxKEYxRESPONSE:
        if (data.owner.Screen.ptr){
            string md5_key;
            m_socket->readBuffer.unpackStr(md5_key);
            snac(ICQ_SNACxFAM_LOGIN, ICQ_SNACxLOGIN_MD5xLOGIN, false, false);
            m_socket->writeBuffer.tlv(0x0001, data.owner.Screen.ptr);
            MD5_CTX c;
            MD5_Init(&c);
            unsigned char md[MD5_DIGEST_LENGTH];
            MD5_Update(&c, md5_key.c_str(), md5_key.length());
            string pswd = getContacts()->fromUnicode(NULL, getPassword());
            MD5_Update(&c, pswd.c_str(), pswd.length());
            pswd = "AOL Instant Messenger (SM)";
            MD5_Update(&c, pswd.c_str(), pswd.length());
            MD5_Final(md, &c);

            m_socket->writeBuffer.tlv(0x0025, (char*)&md, sizeof(md));
            m_socket->writeBuffer.tlv(0x0003, "AOL Instant Messenger, version 5.1.3036/WIN32");
            m_socket->writeBuffer.tlv(0x0016, (unsigned short)0x0109);
            m_socket->writeBuffer.tlv(0x0017, (unsigned short)0x0005);
            m_socket->writeBuffer.tlv(0x0018, (unsigned short)0x0001);
            m_socket->writeBuffer.tlv(0x0019, (unsigned short)0x0000);
            m_socket->writeBuffer.tlv(0x001A, (unsigned short)0x0BDC);
            m_socket->writeBuffer.tlv(0x0014, 0x000000D2L);
            m_socket->writeBuffer.tlv(0x000F, "en");
            m_socket->writeBuffer.tlv(0x000E, "us");
            m_socket->writeBuffer.tlv(0x004A, "\x01");
            sendPacket();
        }
        break;
    case ICQ_SNACxLOGIN_LOGINxREPLY:
        chn_close();
        break;
    default:
        log(L_WARN, "Unknown login family type %04X", type);
    }
}
Exemple #25
0
void JabberClient::auth_register()
{
    AuthRequest *req = new AuthRequest(this);
    req->start_element("query");
    req->add_attribute("xmlns", "jabber:iq:register");
    req->text_tag("username", data.owner.ID);
    req->text_tag("password", getPassword());
    req->send();
    m_requests.push_back(req);
}
Exemple #26
0
void cQTMySQLConnection::setPassword( const QString &p_qsPwd ) throw()
/* This function sets the Password for the MySQL database access.
 * If the database is already open, it will be closed first. */
{
    if( getPassword() != p_qsPwd )
    {
        close();
        m_poDB->setPassword( p_qsPwd );
    }
}
Exemple #27
0
void Url::dump()
{
    UtlString proto;
    getUrlType(proto);
    printf("Url type: '%s'\n", proto.data());

    UtlString disp;
    getDisplayName(disp);
    printf("DisplayName: '%s'\n", disp.data());

    UtlString user;
    getUserId(user);
    printf("UserId: '%s'\n", user.data());

    UtlString pwd;
    getPassword(pwd);
    printf("Password: '******'\n", pwd.data());

    UtlString server;
    getHostAddress(server);
    printf("Address: '%s'\n", server.data());

    int port = getHostPort();
    printf("Port: %d\n", port);

    UtlString callId;
    getHeaderParameter("call-id", callId);
    printf("Call-Id: '%s'\n", callId.data());

    UtlString name;
    UtlString value;
    int index = 0;
    printf("\nHeader Parameters:\n");
    while(getHeaderParameter(index, name, value))
    {
        printf("'%s'='%s'\n", name.data(), value.data());
        index++;
    }

    index = 0;
    printf("\nField Parameters:\n");
    while(getFieldParameter(index, name, value))
    {
        printf("'%s'='%s'\n", name.data(), value.data());
        index++;
    }

    index = 0;
    printf("\nURL Parameters:\n");
    while(getUrlParameter(index, name, value))
    {
        printf("'%s'='%s'\n", name.data(), value.data());
        index++;
    }
}
Exemple #28
0
bool TestCppBase::TestSatelliteServer() {
  IniSetting::Map ini = IniSetting::Map::object;
  Hdf hdf;
  hdf.fromString(
    "Satellites {\n"
    "  rpc {\n"
    "    Type = RPCServer\n"
    "    Port = 9999\n"
    "    RequestInitDocument = my/rpc/rpc.php\n"
    "    RequestInitFunction = init_me\n"
    "    Password = abcd0987\n"
    "    Passwords {\n"
    "      * = abcd0987\n"
    "    }\n"
    "  }\n"
    "  ips {\n"
    "    Type = InternalPageServer\n"
    "    BlockMainServer = false\n"
    "  }\n"
    "}\n"
  );


  std::vector<std::shared_ptr<SatelliteServerInfo>> infos;
  RuntimeOption::ReadSatelliteInfo(ini, hdf, infos,
                                   RuntimeOption::XboxPassword,
                                   RuntimeOption::XboxPasswords);
  for (auto& info_ptr : infos) {
    auto info = info_ptr.get();
    auto name = info->getName();
    if (name == "rpc") {
      VERIFY(info->getType() == SatelliteServer::Type::KindOfRPCServer);
      VERIFY(info->getPort() == 9999);
      VERIFY(info->getThreadCount() == 5);
      VERIFY(info->getTimeoutSeconds() ==
        std::chrono::seconds(RuntimeOption::RequestTimeoutSeconds));
      VERIFY(info->getURLs().size() == 0);
      VERIFY(info->getMaxRequest() == 500);
      VERIFY(info->getMaxDuration() == 120);
      VERIFY(info->getReqInitFunc() == "init_me");
      VERIFY(info->getReqInitDoc() == "my/rpc/rpc.php");
      VERIFY(info->getPassword() == "abcd0987");
      VERIFY(info->getPasswords().size() == 1);
      VERIFY(info->getPasswords().find("abcd0987") !=
             info->getPasswords().end());
      VERIFY(info->alwaysReset() == false);
      VERIFY(RuntimeOption::XboxPassword == "abcd0987");
    } else if (name == "ips") {
      VERIFY(info->getType() ==
             SatelliteServer::Type::KindOfInternalPageServer);
      VERIFY(info->getURLs().size() == 0);
    }
  }
  return Count(true);
}
Exemple #29
0
void SOCKS5_Proxy::read_ready()
{
    char b1, b2;
    unsigned long ip;
    switch (m_state){
    case WaitAnswer:
        read(2);
        bIn >> b1 >> b2;
        if ((b1 != 0x05) || (b2 == '\xFF')) {
            error_state(ANSWER_ERROR, m_plugin->ProxyErr);
            return;
        }
        if (b2 == 0x02) {
            const char *user = getUser();
            const char *pswd = getPassword();
            bOut
            << (char)0x01
            << (char)strlen(user)
            << user
            << (char)strlen(pswd)
            << pswd;
            m_state = WaitAuth;
            write();
            return;
        }
        send_connect();
        return;
    case WaitAuth:
        read(2);
        bIn >> b1 >> b2;
        if ((b1 != 0x01) || (b2 != 0x00)) {
            error_state(AUTH_ERROR, m_plugin->ProxyErr);
            return;
        }
        send_connect();
        return;
    case WaitConnect:
        read(10);
        bIn >> b1 >> b2;
        if ((b1 != 0x05) || (b2 != 0x00)) {
            error_state(ANSWER_ERROR, m_plugin->ProxyErr);
            return;
        }
        bIn >> b1 >> b2;
        bIn >> ip;
        if (notify)
            notify->resolve_ready(ip);
        proxy_connect_ready();
        return;
    default:
        break;
    }
}
void DSN::loadAttributesFromRegistry()
{
	char buf[65536];
	const char* filename = "ODBC.INI";
	if (getName().size() == 0) return; // don't load from registry if this dsn does not have a name.
	SQLGetPrivateProfileString(getName().c_str(), "url", getUrl().c_str(), buf, 65536, filename);
	setUrl(buf);
	SQLGetPrivateProfileString(getName().c_str(), "uid", getUser().c_str(), buf, 65536, filename);
	setUser(buf);
	SQLGetPrivateProfileString(getName().c_str(), "pwd", getPassword().c_str(), buf, 65536, filename);
	setPassword(buf);
}