コード例 #1
0
ファイル: extract.cpp プロジェクト: ikvm/mpc-hc
bool CmdExtract::ExtrGetPassword(CommandData *Cmd,Archive &Arc,const wchar *ArcFileName)
{
  if (!Password.IsSet())
  {
    if (!GetPassword(PASSWORD_FILE,ArcFileName,&Password))
    {
      return false;
    }
  }
#if !defined(GUI) && !defined(SILENT)
  else
    if (!PasswordAll && !Arc.FileHead.Solid)
    {
      eprintf(St(MUseCurPsw),ArcFileName);
      switch(Cmd->AllYes ? 1:Ask(St(MYesNoAll)))
      {
        case -1:
          ErrHandler.Exit(RARX_USERBREAK);
        case 2:
          if (!GetPassword(PASSWORD_FILE,ArcFileName,&Password))
            return false;
          break;
        case 3:
          PasswordAll=true;
          break;
      }
    }
#endif
  return true;
}
コード例 #2
0
	bool VolumePasswordWizardPage::IsValid ()
	{
		if (ConfirmationMode && !PasswordPanel->PasswordsMatch())
			return false;

		shared_ptr <KeyfileList> keyfiles (GetKeyfiles());
		shared_ptr <VolumePassword> password (GetPassword());

		return (password && !GetPassword()->IsEmpty()) || (keyfiles && !keyfiles->empty());
	}
コード例 #3
0
 void OrthancPeerParameters::ToJson(Json::Value& value) const
 {
   value = Json::arrayValue;
   value.append(GetUrl());
   value.append(GetUsername());
   value.append(GetPassword());
 }
コード例 #4
0
/**
 * Handle the manifest file.
 */
UT_Error IE_Imp_OpenDocument::_handleManifestStream() {
    // clear the cryptography state
    m_cryptoInfo.clear();
    m_sPassword = "";

	GsfInput* pMetaInf = gsf_infile_child_by_name(m_pGsfInfile, "META-INF");
    ODi_ManifestStream_ListenerState manifestListener(getDoc(),
                                          *(m_pStreamListener->getElementStack()),
                                           m_cryptoInfo);

	m_pStreamListener->setState(&manifestListener, false);

    UT_Error error = _handleStream (GSF_INFILE(pMetaInf), "manifest.xml", *m_pStreamListener);

    g_object_unref (G_OBJECT (pMetaInf));
    
    if (error != UT_OK) {
        return error;
    }

    if (m_cryptoInfo.size() > 0) {
        // there is at least one entry in the manifest that is encrypted, so
        // ask the user for a password
        m_sPassword = GetPassword();
        if (m_sPassword.size() == 0)
            return UT_IE_PROTECTED;
    }
	
    return UT_OK;
}
コード例 #5
0
// Enable or disable the secure mode, default is enabled
void CSecureEditEx::EnableSecureMode(BOOL bEnable)
{
	if(m_bSecMode == bEnable) return; // Nothing to do

	LPTSTR lpSource = GetPassword(); ASSERT(lpSource != NULL);
	ASSERT((int)_tcslen(lpSource) == m_nOldLen);

	const int iPos = static_cast<int>(GetSel() & 0xFFFF);

	_DeleteAll();
	m_bSecMode = bEnable;

	if(lpSource != NULL)
	{
		m_nOldLen = (int)_tcslen(lpSource);

		if(bEnable == FALSE) SetWindowText(lpSource);
		else
		{
			if(m_nOldLen != 0)
			{
				_InsertCharacters(0, lpSource, (unsigned int)m_nOldLen);
				_tcsset_s(lpSource, m_nOldLen + 1, TCH_STDPWCHAR);
			}

			SetWindowText(lpSource);
		}

		if((iPos >= 0) && (iPos <= m_nOldLen)) SetSel(iPos, iPos, FALSE);
		else { ASSERT(FALSE); }
	}

	DeletePassword(lpSource); lpSource = NULL;
}
コード例 #6
0
ファイル: KeyEditDlg.cpp プロジェクト: redneckz/vocatch
void CKeyEditDlg::OnButtonWrite() 
{
	SRdkitKeyData	keydata;
	BYTE			bBuffer[KEY_DATA_SIZE];
	CString			strCaption,str;

	keydata.dwSize = sizeof(keydata);
	keydata.dwDataOffset = 0;
	keydata.dwDataSize = KEY_DATA_SIZE;
	keydata.pDataPtr = bBuffer;
		
	if(!GetPassword(keydata.pdwCustomerPassword))
	{
		strCaption.LoadString(IDS_ERROR);
		str.LoadString(IDS_ERROR_INVALID_PASSWORD);
		MessageBox(str, strCaption, MB_OK|MB_ICONSTOP);
		return;
	}
	
	LPTSTR endptr;

	for(int i=0; i<KEY_DATA_SIZE; i++)
	{
		str = m_listKeyData.GetItemText(i,0);

		ULONG ulValue = _tcstoul(str, &endptr, 16);
		ASSERT(ulValue != ULONG_MAX);

		bBuffer[i] = BYTE(ulValue);
	}

	strCaption.LoadString(IDS_WRITE);
	str.LoadString(IDS_WRITE_SURE);

	if(MessageBox(str, strCaption, MB_YESNO|MB_ICONQUESTION) != IDYES)
		return;

	if(!RdkitWriteKeyData(&keydata))
	{
		DWORD dwError = GetLastError();

		strCaption.LoadString(IDS_ERROR);
		str.Format(IDS_ERROR_CANT_WRITE_KEY_DATA, ERROR_MESSAGE(dwError));
		MessageBox(str, strCaption, MB_OK|MB_ICONSTOP);
		return;
	}

	// Clear dirty flags
	for(i=0; i<KEY_DATA_SIZE; i++)
	{
		m_listKeyData.SetItemData(i, false);
	}

	strCaption.LoadString(IDS_WRITE);
	str.LoadString(IDS_WRITE_SUCCESS);

	MessageBox(str, strCaption, MB_OK|MB_ICONINFORMATION);
}
コード例 #7
0
ファイル: Client.cpp プロジェクト: martong/nng2014
void CLIENT::Run()
{
	SendMessage("login " + GetPassword());
	if (NeedDebugLog())
	{
		mDebugLog.open("debug.log", std::ofstream::out | std::ofstream::app);
	}

	std::string strLastLineRemaining;
	std::vector<std::string> LastServerResponse;
	for(;;)
	{
		const size_t ReceiveBufferSize = 1<<16;
		char ReceiveBuffer[ ReceiveBufferSize+1 ] = {0};

		int ReceivedBytesCount = recv( mConnectionSocket, ReceiveBuffer, ReceiveBufferSize, 0 );

		if( ReceivedBytesCount == 0 || ReceivedBytesCount == -1)
		{
			// connection is closed or failed
			ConnectionClosed();
			return;
		}
		ReceiveBuffer[ReceivedBytesCount]=0;
		char *line_start = ReceiveBuffer;
		for(;;)
		{
			char *s = strchr(line_start, '\n');
			if (!s)
			{
				strLastLineRemaining = line_start;
				break;
			} else
			{
				std::string alma=strLastLineRemaining;
				*s=0;
				alma+=line_start;
				line_start = s+1;
				strLastLineRemaining = "";
				LastServerResponse.push_back(alma);
				if (alma==".")
				{
					if (NeedDebugLog() && mDebugLog.is_open())
					{
						for(unsigned int i=0;i<LastServerResponse.size();i++)
							mDebugLog<<LastServerResponse[i]<<std::endl;
					}
					std::string strResponse = HandleServerResponse(LastServerResponse);
					if (!strResponse.empty())
					{
						SendMessage(strResponse);
					}
					LastServerResponse.clear();
				}
			}
		}
	}
}
コード例 #8
0
void CaMuleExternalConnector::ConnectAndRun(const wxString &ProgName, const wxString& ProgVersion)
{
	if (m_NeedsConfigSave) {
		SaveConfigFile();
		return;
	}

	#ifdef SVNDATE
		Show(CFormat(_("This is %s %s %s\n")) % wxString::FromAscii(m_appname) % wxT(VERSION) % wxT(SVNDATE));
	#else
		Show(CFormat(_("This is %s %s\n")) % wxString::FromAscii(m_appname) % wxT(VERSION));
	#endif

	// HostName, Port and Password
	if ( m_password.IsEmpty() ) {
		m_password = GetPassword(true);
		// MD5 hash for an empty string, according to rfc1321.
		if (m_password.Encode() == wxT("D41D8CD98F00B204E9800998ECF8427E")) {
			m_password.Clear();
		}
	}

	if (!m_password.IsEmpty()) {

		// Create the socket
		Show(_("\nCreating client...\n"));
		m_ECClient = new CRemoteConnect(NULL);
		m_ECClient->SetCapabilities(m_ZLIB, true, false);	// ZLIB, UTF8 numbers, notification

		// ConnectToCore is blocking since m_ECClient was initialized with NULL
		if (!m_ECClient->ConnectToCore(m_host, m_port, wxT("foobar"), m_password.Encode(), ProgName, ProgVersion)) {
			// no connection => close gracefully
			if (!m_ECClient->GetServerReply().IsEmpty()) {
					Show(CFormat(wxT("%s\n")) % m_ECClient->GetServerReply());
			}
			Show(CFormat(_("Connection Failed. Unable to connect to %s:%d\n")) % m_host % m_port);
		} else {
			// Authenticate ourselves
			// ConnectToCore() already authenticated for us.
			//m_ECClient->ConnectionEstablished();
			Show(m_ECClient->GetServerReply()+wxT("\n"));
			if (m_ECClient->IsSocketConnected()) {
				if (m_interactive) {
					ShowGreet();
				}
				Pre_Shell();
				TextShell(ProgName);
				Post_Shell();
				if (m_interactive) {
					Show(CFormat(_("\nOk, exiting %s...\n")) % ProgName);
				}
			}
		}
		m_ECClient->DestroySocket();
	} else {
		Show(_("Cannot connect with an empty password.\nYou must specify a password either in config file\nor on command-line, or enter one when asked.\n\nExiting...\n"));
	}
}
コード例 #9
0
ファイル: password_dialog.cpp プロジェクト: mdvx/fastonosql
void PasswordDialog::accept() {
  const QString pass = GetPassword();
  if (pass.isEmpty()) {
    password_box_->setFocus();
    return;
  }

  QDialog::accept();
}
コード例 #10
0
ファイル: glooxaccount.cpp プロジェクト: zhao07/leechcraft
	void GlooxAccount::handleServerAuthFailed ()
	{
		const QString& pwd = GetPassword (true);
		if (!pwd.isNull ())
		{
			ClientConnection_->SetPassword (pwd);
			ClientConnection_->SetState (ClientConnection_->GetLastState ());
		}
	}
コード例 #11
0
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;
}
コード例 #12
0
ファイル: userstatuspage.cpp プロジェクト: AlexWMF/leechcraft
	void UserStatusPage::initializePage ()
	{
		auto cup = qobject_cast<ReportWizard*> (wizard ())->GetChooseUserPage ();

		const auto& login = cup->GetLogin ();
		const auto& pass = cup->GetPassword ();

		if (cup->GetUser () == ChooseUserPage::User::New)
			RegisterUser (login, pass, cup);
	}
コード例 #13
0
ファイル: keyring-srv.c プロジェクト: Bhumi28/sra-tools
rc_t KeyRingOpen(KKeyRing** self, const char* path, const struct KFile* pwd_in, struct KFile* pwd_out)
{
    rc_t rc; 
    assert(self && path && pwd_in && pwd_out);

    *self = (KKeyRing*) malloc(sizeof(**self));
    if (*self)
    { 
        rc = KeyRingInit(*self, path);
        if (rc == 0)
        {
            rc = KeyRingAddRef(*self);
            if (rc == 0)
            {
                KDirectory* wd; 
                rc = KDirectoryNativeDir(&wd);
                if (rc == 0)
                {   /* open the database */
                    if (KDirectoryPathType(wd, "%s", (*self)->path) == kptFile)
                        rc = GetPassword(pwd_in, pwd_out, (*self)->passwd);
                    else /* does not exist; create first */
                    {   
                        rc = GetNewPassword(pwd_in, pwd_out, (*self)->passwd);
                        if (rc == 0)
                            rc = CreateDatabase(*self);
                    }
                    if (rc == 0)
                        rc = OpenDatabase(*self);
                        
                    {
                        rc_t rc2;
                        rc2 = KDirectoryRelease(wd);
                        if (rc == 0)
                            rc = rc2;
                    }
                }
            }
            
            if (rc != 0)
            {
                KeyRingWhack(*self);
                *self = NULL;
            }
        }
        else
        {
            free(*self);
            *self = NULL;
        }
    }
    else
        rc = RC ( rcApp, rcDatabase, rcOpening, rcMemory, rcExhausted );

    return rc;
}
コード例 #14
0
ファイル: PostHandle.cpp プロジェクト: bohge/Bohge_Engine
	//------------------------------------------------------------------------------
	void PostHandle::_OnStart()
	{
		SmartPtr<PostJob> pPostJob( NEW PostJob );
		pPostJob->SetUrl(GetUrl());
		pPostJob->SetPostContent(_GetPostContent().c_str());
		pPostJob->SetUsername(GetUsername());
		pPostJob->SetPassword(GetPassword());
		pPostJob->Connect();
		pPostJob->SetCallback( MEMBER_FUNC_PTR( &PostHandle::JobDoneCallBack ));
		_PushJob( pPostJob );
	}
コード例 #15
0
HRESULT COpenCallbackConsole::Open_CryptoGetTextPassword(BSTR *password)
{
  PasswordWasAsked = true;
  RINOK(Open_CheckBreak());
  if (!PasswordIsDefined)
  {
    Password = GetPassword(OutStream);
    PasswordIsDefined = true;
  }
  return StringToBstr(Password, password);
}
コード例 #16
0
	bool ChooseUserPage::isComplete () const
	{
		switch (GetUser ())
		{
		case User::Anonymous:
			return true;
		case User::Existing:
			return !GetLogin ().isEmpty () && !GetPassword ().isEmpty ();
		default:
			return false;
		}
	}
コード例 #17
0
ファイル: NTService.cpp プロジェクト: richschonthal/HL7
//--------------------------------------------------------------------------------
BOOL CNTService::InstallService()
	{
	AFX_MANAGE_STATE_IF_DLL

	TCHAR szPath[1024];

	if(GetModuleFileName( 0, szPath, 1023 ) == 0 )
		return FALSE;

	BOOL bRet = FALSE;

	SC_HANDLE schSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);

	if(schSCManager != NULL)
		{
		DWORD nServiceType = GetServiceType();
		DWORD nStartType = GetStartType();

		SC_HANDLE schService =	CreateService(
									schSCManager,
									GetServiceName(),
									GetDisplayName(),
									GetDesiredAccess(),
									nServiceType,
									nStartType,
									GetErrorControl(),
									szPath,
									GetLoadOrderGroup(),
									((nServiceType == SERVICE_KERNEL_DRIVER ||
									  nServiceType == SERVICE_FILE_SYSTEM_DRIVER) &&
									 (nStartType == SERVICE_BOOT_START ||
									  nStartType == SERVICE_SYSTEM_START)) ?
										&m_dwTagID : NULL,
									GetDependencies(),
									GetUserName(),
									GetPassword()
								);

		if(schService != NULL)
			{
			CloseServiceHandle(schService);
			bRet = TRUE;
			}

		CloseServiceHandle(schSCManager);
		}

	if(bRet)
		// installation succeeded. Now register the message file
		RegisterApplicationLog(szPath, EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | EVENTLOG_INFORMATION_TYPE);

	return bRet;
	}
コード例 #18
0
NS_IMETHODIMP
nsSmtpServer::GetPasswordWithUI(const PRUnichar *aPromptMessage,
                                const PRUnichar *aPromptTitle,
                                nsIAuthPrompt* aDialog,
                                nsACString &aPassword)
{
  if (!m_password.IsEmpty())
    return GetPassword(aPassword);

  // We need to get a password, but see if we can get it from the password
  // manager without requiring a prompt.
  nsresult rv = GetPasswordWithoutUI();
  if (rv == NS_ERROR_ABORT)
    return NS_MSG_PASSWORD_PROMPT_CANCELLED;

  // Now re-check if we've got a password or not, if we have, then we
  // don't need to prompt the user.
  if (!m_password.IsEmpty())
  {
    aPassword = m_password;
    return NS_OK;
  }

  NS_ENSURE_ARG_POINTER(aDialog);

  // PromptPassword needs the username as well.
  nsCString serverUri(GetServerURIInternal(true));

  bool okayValue = true;
  nsString uniPassword;

  rv = aDialog->PromptPassword(aPromptTitle, aPromptMessage,
                               NS_ConvertASCIItoUTF16(serverUri).get(),
                               nsIAuthPrompt::SAVE_PASSWORD_PERMANENTLY,
                               getter_Copies(uniPassword), &okayValue);
  NS_ENSURE_SUCCESS(rv, rv);

  // If the user pressed cancel, just return an empty string.
  if (!okayValue)
  {
    aPassword.Truncate();
    return NS_MSG_PASSWORD_PROMPT_CANCELLED;
  }

  NS_LossyConvertUTF16toASCII password(uniPassword);

  rv = SetPassword(password);
  NS_ENSURE_SUCCESS(rv, rv);

  aPassword = password;
  return NS_OK;
}
コード例 #19
0
	void ChooseUserPage::SaveCredentials ()
	{
		if (GetUser () != User::Existing)
			return;

		QSettings settings (QCoreApplication::organizationName (),
			QCoreApplication::applicationName () + "_Dolozhee");
		settings.beginGroup ("Credentials");
		settings.setValue ("Login", GetLogin ());
		settings.endGroup ();

		Util::SavePassword (GetPassword (), GetPassKey (), Proxy_);
	}
コード例 #20
0
ファイル: ADOMgt.cpp プロジェクト: promanz/tuisong
//连接数据库
void CADO::CreateDBCNT( CONNECTPTR& cnt )
{
	try
	{
		cnt.time = CTime::GetCurrentTime();//2012.07.20 无条件的记录一个时间
		cnt.pConn.CreateInstance(__uuidof(Connection));
		cnt.pConn->ConnectionTimeout=30;//连接超时时间设置,单位秒
		CString str;
#ifdef XWB_SQL_LINK
		//Provider=SQLOLEDB;Data Source=192.168.0.102; Initial Catalog=hsrun10; User ID=sa; Password=hs2003info
		str.Format("Provider=SQLOLEDB;Data Source=%s; Initial Catalog=%s; User ID=%s; Password=%s",
			GetDataSource(),GetInitialCatalog(),GetUserID(),GetPassword() );
#else
		str.Format("Provider=OraOLEDB.Oracle;Data Source=%s;User ID=%s;Password=%s;PLSQLRSet=1",
			GetDataSource(),GetUserID(),GetPassword() );
#endif
		_variant_t varSRC( (LPSTR)(LPCTSTR)str );
		_bstr_t bsConnect(varSRC);
		if (S_OK != cnt.pConn->Open(bsConnect, "", "", adModeUnknown))
		{//连接失败
			if(cnt.pConn->State)
				cnt.pConn->Close();
			cnt.pConn = NULL;
		}
		else
		{//连接成功
#ifdef XWB_SQL_LINK //2013.06.13 xuwb: SQL SERVER兼容读取出参和数据集
			cnt.pConn->CursorLocation = adUseClient;
#endif
			cnt.pCommand.CreateInstance(__uuidof(Command));
			cnt.pCommand->ActiveConnection = cnt.pConn;
		}
	}
	catch(...)
	{
		cnt.pConn = NULL;
		cnt.pCommand = NULL;
	}
}
コード例 #21
0
HRESULT COpenCallbackConsole::Open_CryptoGetTextPassword(BSTR *password)
{
  *password = NULL;
  RINOK(CheckBreak2());

  if (!PasswordIsDefined)
  {
    ClosePercents();
    Password = GetPassword(_so);
    PasswordIsDefined = true;
  }
  return StringToBstr(Password, password);
}
コード例 #22
0
HRESULT COpenCallbackConsole::CryptoGetTextPassword(BSTR *password)
{
  PasswordWasAsked = true;
  RINOK(CheckBreak());
  if (!PasswordIsDefined)
  {
    Password = GetPassword(OutStream); 
    PasswordIsDefined = true;
  }
  CMyComBSTR temp(Password);
  *password = temp.Detach();
  return S_OK;
}
コード例 #23
0
static
DWORD
PromptPassword(
    IN PCSTR pszUsername,
    OUT PSTR* ppszPassword
    )
{
    DWORD dwError = 0;
    fprintf(stdout, "%s's password: "******"\n");
    return dwError;
}
コード例 #24
0
ファイル: ScreenSetting.cpp プロジェクト: 6VV/NewTeachingBox
void ScreenSetting::KeyboardEdit(const QString& text)
{
	auto user = Database::UserDatabase::SelectUser(m_cmbUser->currentText());
	if (text==user.GetPassword())
	{
		TeachingBoxContext::GetInstance()->SetUser(user);
		UpdateState(user);
	}
	else
	{
		QMessageBox::warning(this, tr("Log failed"), tr("Password wrong"));
	}

}
コード例 #25
0
ファイル: pgUser.cpp プロジェクト: zr40/pgadmin3-light
wxString pgUser::GetSql(ctlTree *browser)
{
    if (sql.IsNull())
    {
        sql = wxT("-- User: "******"\n\n")
              + wxT("-- DROP USER ") + GetQuotedFullIdentifier() + wxT(";")
              + wxT("\n\nCREATE USER ") + GetQuotedIdentifier()
              + wxT("\n  WITH SYSID ") + NumToStr(userId);
        if (GetPassword() != wxT("********"))
            AppendIfFilled(sql, wxT("\n  ENCRYPTED PASSWORD "), qtDbString(GetPassword()));
        sql += wxT("\n ");
        if (GetCreateDatabase())    sql += wxT(" CREATEDB");
        else                        sql += wxT(" NOCREATEDB");
        if (GetUpdateCatalog())     sql += wxT(" CREATEUSER");
        else                        sql += wxT(" NOCREATEUSER");
        if (GetAccountExpires().IsValid())
            AppendIfFilled(sql, wxT(" VALID UNTIL "), qtDbString(DateToAnsiStr(GetAccountExpires())));
        sql += wxT(";\n");

        size_t index;
        for (index = 0 ; index < configList.GetCount() ; index++)
        {
            if (configList.Item(index).BeforeFirst('=') != wxT("search_path") &&
                    configList.Item(index).BeforeFirst('=') != wxT("temp_tablespaces"))
                sql += wxT("ALTER USER ") + GetQuotedIdentifier()
                       + wxT(" SET ") + configList.Item(index).BeforeFirst('=') + wxT("='") + configList.Item(index).AfterFirst('=') + wxT("';\n");
            else
                sql += wxT("ALTER USER ") + GetQuotedIdentifier()
                       + wxT(" SET ") + configList.Item(index).BeforeFirst('=') + wxT("=") + configList.Item(index).AfterFirst('=') + wxT(";\n");
        }
        for (index = 0 ; index < groupsIn.GetCount() ; index++)
            sql += wxT("ALTER GROUP ") + qtIdent(groupsIn.Item(index))
                   +  wxT(" ADD USER ") + GetQuotedIdentifier() + wxT(";\n");

    }
    return sql;
}
コード例 #26
0
ファイル: Private.cpp プロジェクト: Paolo-Maffei/eibsuite
int Server::_OpenConnection()
{
	//set the log dest
	_log->Init(EMPTY_STRING);
	_log->SetLogLevel(LOG_LEVEL_DEBUG);
	_log->SetPrinterMethod(printf);
	
	Init(_log);

	const char* userName = GetEIBUserName();
	const char* userPassword = GetPassword();
	const char* encryptKey = GetEncryptKey();
	
	CString local_ip;

	START_TRY
		local_ip = Socket::LocalAddress(GetLocalNetworkIf());
	END_TRY_START_CATCH_SOCKET(e)
		_log->Log(LOG_LEVEL_ERROR, e.what());
		return ERR_NETWORK_ERROR;
	END_CATCH

	_log->Log(LOG_LEVEL_DEBUG, "Trying to connect to EIBServer...");

	
	CString serverIP = GetEIBServerAddress();
	int serverPort = GetEIBServerPort();

	DiscoverEIBServer(local_ip,
					  encryptKey,
					  serverIP,
					  serverPort);

	ConnectionResult res;
	res = OpenConnection("Generic",
						userName,
						serverPort,
						encryptKey,
						local_ip.GetBuffer(),
						userName,
						userPassword);

	
	if(res == STATUS_CONN_OK) {
		start();
	}

	return (int)res;
}
コード例 #27
0
ファイル: password.c プロジェクト: hsptools/hsp-wrap
/*
*		RequestPassword(charprompt,charbuffer,intbuffer_size)
*/
char	*RequestPassword( char *prompt, char *buffer, int buffer_size )
{
    char	*result;
    FILE	*fd;
    char	*p;

    /* Clear input buffer */

    *buffer = (char) 0;

    /*	SECURITY MEASURE: The SYBASE_PASSWORD environment variable avoids
	having to put the -Ppassword option on the command line where a
	routine ps can intercept it.  Unfortunately, it doesn't fully
	protect against ps -e.  Clearing the environment variable after
	use may at least limit liability though. */

    if( (p = getenv("SYBASE_PASSWORD")) != NULL && strlen( p ) <= buffer_size )
    {
	strcpy( buffer, p );
	while( *p ) *p++ = (char) 0x7f;	/* Zap SYBASE_PASSWORD for ps -e */
	return( buffer );
    }

    /* Open the TTY */

    if( ! isatty( fileno( stdin ) ) )
	return( buffer );
    fd = fopen( ttyname(fileno(stdin)), "w" );
    if( fd == (FILE *) NULL )
	return( NULL );

    /* Prompt the user */

    fprintf( fd, "%s", prompt );
    fflush( fd );

    /* Get the input */

    result = GetPassword( stdin, buffer, buffer_size );
    fprintf( fd, "\r\n" );

    /* Close up shop */

    (void) fclose( fd );

    /* Done */

    return( result );
}
コード例 #28
0
ファイル: ConnectionSettings.cpp プロジェクト: biophor/AdBook
void ConnectionSettings::Save()
{
    QSettings settings(QApplication::organizationName(), QApplication::applicationName());
    settings.beginGroup(connectionSettingsSection);
    settings.setValue(dcNameParam, QString::fromStdWString(GetDC()));
    settings.setValue(userNameParam, QString::fromStdWString(GetLogin()));    
    QString protectedPassword = ProtectPassword(QString::fromStdWString(GetPassword()));
    settings.setValue(passwordParam, protectedPassword);    
    settings.setValue(currentUserCredParam, CurrentUserCredentials());
    settings.setValue(currentDomainParam, CurrentDomain());
#pragma warning(push, 3)
#pragma warning(disable: 4003)
    BOOST_SCOPE_EXIT(&settings) { settings.endGroup(); }BOOST_SCOPE_EXIT_END
#pragma warning(pop)    
}
コード例 #29
0
ファイル: text_backend.c プロジェクト: CoolerVoid/squid
void
TextHHA1(RequestData * requestData)
{
    const user_data *u = GetPassword(requestData);
    if (!u) {
	requestData->error = -1;
	return;
    }
    if (u->ha1) {
	xstrncpy(requestData->HHA1, u->ha1, sizeof(requestData->HHA1));
    } else {
	HASH HA1;
	DigestCalcHA1("md5", requestData->user, requestData->realm, u->passwd, NULL, NULL, HA1, requestData->HHA1);
    }
}
コード例 #30
0
	void FotoBilderAccount::UploadOneImage (const QByteArray& id,
			const UploadItem& item, const QString& challenge)
	{
		QFile file (item.FilePath_);
		if (!file.open (QIODevice::ReadOnly))
			return;

		auto content = file.readAll ();
		QByteArray md5 = QCryptographicHash::hash (content, QCryptographicHash::Md5);
		file.close ();
		auto reply = Proxy_->GetNetworkAccessManager ()->
				put (CreateRequest (Util::MakeMap<QByteArray, QByteArray> ({
							{ "X-FB-User", Login_.toUtf8 () },
							{ "X-FB-Mode", "UploadPic" },
							{ "X-FB-Auth", ("crp:" + challenge + ":" +
									GetHashedChallenge (GetPassword (), challenge))
										.toUtf8 () },
							{ "X-FB-AuthVerifier", "md5=" + md5 + "&mode=UploadPic" },
							{ "X-FB-UploadPic.ImageData", QDateTime::currentDateTime ()
									.toString (Qt::ISODate).toUtf8 () },
							{ "X-FB-UploadPic.MD5", md5 },
							//TODO access to images
							{ "X-FB-UploadPic.PicSec", "255" },
							{ "X-FB-UploadPic.Meta.Filename", QFileInfo (item.FilePath_)
									.fileName ().toUtf8 () },
							{ "X-FB-UploadPic.Meta.Title", QFileInfo (item.FilePath_)
									.fileName ().toUtf8 () },
							{ "X-FB-UploadPic.Meta.Description", item.Description_.toUtf8 () },
							{ "X-FB-UploadPic.Gallery._size", "1" },
							{ "X-FB-UploadPic.Gallery.0.GalID", id },
							{ "X-FB-UploadPic.ImageSize", QString::number (QFileInfo (item.FilePath_)
									.size ()).toUtf8 () } })),
						content);
		Reply2UploadItem_ [reply] = item;
		connect (reply,
				SIGNAL (finished ()),
				this,
				SLOT (handleImageUploaded ()));
		connect (reply,
				SIGNAL (uploadProgress (qint64, qint64)),
				this,
				SLOT (handleUploadProgress (qint64, qint64)));
		connect (reply,
				SIGNAL (error (QNetworkReply::NetworkError)),
				this,
				SLOT (handleNetworkError (QNetworkReply::NetworkError)));
	}