本文整理汇总了C++中GetPassword函数的典型用法代码示例。如果您正苦于以下问题:C++ GetPassword函数的具体用法?C++ GetPassword怎么用?C++ GetPassword使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetPassword函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: eprintf
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: keyfiles
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: ToJson
void OrthancPeerParameters::ToJson(Json::Value& value) const
{
value = Json::arrayValue;
value.append(GetUrl());
value.append(GetUsername());
value.append(GetPassword());
}
示例4: gsf_infile_child_by_name
/**
* 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: sizeof
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);
}
示例6: SendMessage
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();
}
}
}
}
}
示例7: SaveConfigFile
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"));
}
}
示例8: GetPassword
void PasswordDialog::accept() {
const QString pass = GetPassword();
if (pass.isEmpty()) {
password_box_->setFocus();
return;
}
QDialog::accept();
}
示例9: GetPassword
void GlooxAccount::handleServerAuthFailed ()
{
const QString& pwd = GetPassword (true);
if (!pwd.isNull ())
{
ClientConnection_->SetPassword (pwd);
ClientConnection_->SetState (ClientConnection_->GetLastState ());
}
}
示例10: GetUsername
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;
}
示例11: initializePage
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);
}
示例12: KeyRingOpen
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;
}
示例13: pPostJob
//------------------------------------------------------------------------------
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 );
}
示例14: RINOK
HRESULT COpenCallbackConsole::Open_CryptoGetTextPassword(BSTR *password)
{
PasswordWasAsked = true;
RINOK(Open_CheckBreak());
if (!PasswordIsDefined)
{
Password = GetPassword(OutStream);
PasswordIsDefined = true;
}
return StringToBstr(Password, password);
}
示例15: OpenSCManager
//--------------------------------------------------------------------------------
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;
}