xref: /netbsd-src/external/bsd/openldap/dist/contrib/ldapc++/src/SaslInteraction.cpp (revision e670fd5c413e99c2f6a37901bb21c537fcd322d2)
1 // $OpenLDAP$
2 /*
3  * Copyright 2007-2021 The OpenLDAP Foundation, All Rights Reserved.
4  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
5  */
6 
7 #include <SaslInteraction.h>
8 #include <iostream>
9 #include "debug.h"
10 
SaslInteraction(sasl_interact_t * interact)11 SaslInteraction::SaslInteraction( sasl_interact_t *interact ) :
12         m_interact(interact) {}
13 
~SaslInteraction()14 SaslInteraction::~SaslInteraction()
15 {
16     DEBUG(LDAP_DEBUG_TRACE, "SaslInteraction::~SaslInteraction()" << std::endl);
17 }
18 
getId() const19 unsigned long SaslInteraction::getId() const
20 {
21     return m_interact->id;
22 }
23 
getPrompt() const24 const std::string SaslInteraction::getPrompt() const
25 {
26     return std::string(m_interact->prompt);
27 }
28 
getChallenge() const29 const std::string SaslInteraction::getChallenge() const
30 {
31     return std::string(m_interact->challenge);
32 }
33 
getDefaultResult() const34 const std::string SaslInteraction::getDefaultResult() const
35 {
36     return std::string(m_interact->defresult);
37 }
38 
setResult(const std::string & res)39 void SaslInteraction::setResult(const std::string &res)
40 {
41     m_result = res;
42     m_interact->result = m_result.data();
43     m_interact->len = m_result.size();
44 }
45