예제 #1
0
//---------------------------------------------------------------------------
void TFileMasks::SetMasks(const UnicodeString & Value)
{
  if (FStr != Value)
  {
    SetStr(Value, false);
  }
}
예제 #2
0
파일: str.cpp 프로젝트: ChenYingChou/clib
// unsigned long to string
void StrPP::ultos(const unsigned long n)
{
  char num[15];
  ultoa(n, num, 10);

  SetStr(num);
}
예제 #3
0
static void active_connect(char *ip)
{
	int port = g_config.data_port;
	int fd = createsocket(ip, port);
	if (fd < 0)
	{
		LOG(pfs_data_log, LOG_ERROR, "connect %s:%d err %m\n", ip, port);
		char val[256] = {0x0};
		snprintf(val, sizeof(val), "connect %s:%d err %m\n", ip, port);
		SetStr(PFS_STR_CONNECT_E, val);
		return;
	}
	if (svc_initconn(fd))
	{
		LOG(pfs_data_log, LOG_ERROR, "svc_initconn err %m\n");
		close(fd);
		return;
	}
	add_fd_2_efd(fd);
	LOG(pfs_data_log, LOG_NORMAL, "connect %s:%d\n", ip, port);
	struct conn *curcon = &acon[fd];
	pfs_cs_peer *peer = (pfs_cs_peer *) curcon->user;
	peer->sock_stat = IDLE;
	peer->mode = CON_ACTIVE;
}
예제 #4
0
파일: str.cpp 프로젝트: ChenYingChou/clib
// long to string
void StrPP::ltos(const long n)
{
  char num[15];
  ltoa(n, num, 10);

  SetStr(num);
}
예제 #5
0
파일: XMMRCtl.cpp 프로젝트: ja7ude/XMMT
void CXMMRCtrl::DecodeOptions(void)
{
	CString cs;
	LPCSTR s = m_InvokeCommand;
	while(*s){
		if( !strncmp(s, " -C", 3) ){
			SetStr(cs, s + 3);
			ChangeCommonMemory(cs);
		}
		else if( !strncmp(s, " -T", 3) ){
			SetStr(cs, s + 3);
			m_Timeup = (atoi(cs) * 10) + 30;
		}
		s++;
	}
}
예제 #6
0
 TextBuf(size_t bufsize)
     : m_size(bufsize ? bufsize : 1),
       m_buf(new char [bufsize+1]),
       m_fmtsize(4*bufsize ? 4*bufsize : 1),
       m_fmtbuf(new char [m_fmtsize+1])
 {
     SetStr("");
 }
예제 #7
0
 TextBuf(const char *s)
     : m_size(strlen(s)+1),
       m_buf(new char [m_size]),
       m_fmtsize(4*m_size),
       m_fmtbuf(new char [m_fmtsize+1])
 {
     SetStr(s);
 }
예제 #8
0
 TextBuf(size_t bufsize, const char *s)
     : m_size(bufsize),
       m_buf(new char [bufsize+1]),
       m_fmtsize(4*bufsize ? 4*bufsize : 1),
       m_fmtbuf(new char [m_fmtsize+1])
 {
     SetStr(s);
 }
예제 #9
0
 size_t Set(const TextBuf &other)
 {
     if (other.IsByteStr() ) {
         return SetText(other.GetText(), other.GetLen());
     }
     else {
         return SetStr(other.GetStr());
     }
 }
예제 #10
0
//---------------------------------------------------------------------------
void TFileMasks::SetStr(const UnicodeString & Str, bool SingleMask)
{
  UnicodeString Backup = FStr;
  try
  {
    FStr = Str;
    Clear();

    intptr_t NextMaskFrom = 1;
    bool Include = true;
    while (NextMaskFrom <= Str.Length())
    {
      intptr_t MaskStart = NextMaskFrom;
      wchar_t NextMaskDelimiter;
      UnicodeString MaskStr;
      if (SingleMask)
      {
        MaskStr = Str;
        NextMaskFrom = Str.Length() + 1;
        NextMaskDelimiter = L'\0';
      }
      else
      {
        MaskStr = CopyToChars(Str, NextMaskFrom, AllFileMasksDelimiters, false, &NextMaskDelimiter, true);
      }
      intptr_t MaskEnd = NextMaskFrom - 2;

      TrimEx(MaskStr, MaskStart, MaskEnd);

      if (!MaskStr.IsEmpty())
      {
        CreateMask(MaskStr, MaskStart, MaskEnd, Include);
      }

      if (NextMaskDelimiter == IncludeExcludeFileMasksDelimiter)
      {
        if (Include)
        {
          Include = false;
        }
        else
        {
          ThrowError(NextMaskFrom - 1, Str.Length());
        }
      }
    }
  }
  catch(...)
  {
    // this does not work correctly if previous mask was set using SetMask.
    // this should not fail (the mask was validated before),
    // otherwise we end in an infinite loop
    SetStr(Backup, false);
    throw;
  }
}
예제 #11
0
파일: str.cpp 프로젝트: ChenYingChou/clib
// double to string
void StrPP::dtos(const double n, const char* format)
{
  char num[40];

  if(format[0] != 0 && fpFormat != format)
    fpFormat = format;			// use the format if given

  sprintf(num, fpFormat, n);

  SetStr(num);
}
예제 #12
0
파일: Date.cpp 프로젝트: swuecho/igblast
void CDate::SetToTime(const CTime& time, CDate::EPrecision prec)
{
    switch (Which()) {
    case e_not_set:
    case e_Std:
        SetStd().SetToTime(time, prec);
        break;
    case e_Str:
        SetStr(time.AsString());
        break;
    }
}
예제 #13
0
파일: MyString.cpp 프로젝트: styxschip/Note
CMyString::CMyString(const char *szBuf)
{
    SetStr(szBuf);
    if (m_pCount != NULL)
    {
        (*m_pCount)++;
    }
    else
    {
        m_pCount = new int(1);
    }    
}
예제 #14
0
파일: MyString.cpp 프로젝트: styxschip/Note
CMyString& CMyString::MyStrCpy(const char *szSrc)
{
    int m_nStrLen = strlen(szSrc);
    if (m_nStrLen + 1 <= m_nSize)
    {
        strcpy(m_szBuf, szSrc);
    }
    else
    {
        ReleaseStr();
        SetStr(szSrc);
    }
    return *this;
}
예제 #15
0
EXC_TYPE CAttachInfo::UpdateStr (LPTSTR& lpszDst, LPCTSTR lpszSrc)
{
	LPTSTR	lpszD=NULL;

	if (!IsEmptyStr(lpszSrc))
	{
		UINT32	ulSLen=0;
		EXC_TYPE	exc=SetStr(lpszD, lpszSrc, ulSLen);
		if (exc != EOK)
			return exc;
	}

	strreleasebuf(lpszDst);
	lpszDst = lpszD;

	return EOK;
}
예제 #16
0
파일: aj_sasl.c 프로젝트: bigzero/ajtcl
/*
 * Compose a REJECTED response that lists the supported authentication mechanisms
 */
static AJ_Status Rejected(AJ_SASL_Context* context, char* outStr, uint32_t outLen)
{
    const AJ_AuthMechanism* const* mech = context->mechList;

    SetStr(CMD_REJECTED, outStr, outLen);
    outLen -= (uint32_t)sizeof(CMD_REJECTED);
    while (*mech) {
        uint32_t len = strlen(outStr);
        outLen -= (uint32_t)(strlen((*mech)->name) + 1);
        if ((int32_t)outLen < 0) {
            return AJ_ERR_RESOURCES;
        }
        outStr[len++] = ' ';
        strcpy(outStr + len, (*mech)->name);
        ++mech;
    }
    return AJ_OK;
}
예제 #17
0
파일: str.cpp 프로젝트: ChenYingChou/clib
StrPP& StrPP::operator*=(const int n)
{
  int nlen = n*strLen;

  if(bufferLen > nlen)
  {
    for(int i=0; i<n; i++)
      memcpy(strPtr+i*strLen, strPtr, strLen);
    strPtr[nlen] = 0;
  }
  else
  {
    char *tmp = new char[nlen + 1];

    for(int i=0; i<n; i++)
      memcpy(tmp+i*strLen, strPtr, strLen);
	 tmp[nlen] = 0;

    SetStr(tmp);
  }
  return *this;
}
예제 #18
0
파일: str.cpp 프로젝트: ChenYingChou/clib
// Trim leading and/or trailing characters from the string. 'c' specifies
// the character to be trimmed and defaults to WHITESPACE (spaces & tabs).
StrPP& StrPP::Trim(int mode, char c)
{
  int begin = 0;
  int end = strLen-1;

  if(c == WHITESPACE)			// if we're deleting whitespaces...
  {
    if(mode == LEFT || mode == CENTER)	// delete leading whitespace
    {
      while(isspace(strPtr[begin]) && begin <= end)
	begin++;
    }

    if(mode == RIGHT || mode == CENTER) // delete trailing whitespace
    {
      while(isspace(strPtr[end]) && end >= begin)
	end--;
    }
  }
  else					// else a character was specified
  {
    if(mode == LEFT || mode == CENTER)	// delete leading characters
    {
      while(strPtr[begin] == c && begin <= end)
	begin++;
    }

    if(mode == RIGHT || mode == CENTER) // delete trailing characters
    {
      while(strPtr[end] == c && end >= begin)
	end--;
    }
  }

  SetStr(strPtr, begin, end-begin+1);
  return *this;
}
예제 #19
0
TagInfo* ParseLine(const char* buf,const String& base)
{
  String pos;
  String file;
  SMatch m[10];
  int n=10;
  if(reParse.Match(buf,m,n))
  {
    TagInfo *i=new TagInfo;
    SetStr(i->name,buf,m[1]);
    SetStr(file,buf,m[2]);
    if(file[1]!=':' && file[0]!='\\')
    {
      file.Insert(0,base);
    }
    i->file=file;
    SetStr(pos,buf,m[3]);
    if(pos[0]=='/')
    {
      QuoteMeta(pos);
      ReplaceSpaces(pos);
      i->re=pos;
      if(m[5].start!=-1)
      {
        SetStr(pos,buf,m[5]);
        i->lineno=pos.ToInt();
      }
    }else
    {
      i->lineno=pos.ToInt();
    }
    SetStr(pos,buf,m[4]);
    i->type=pos[0];
    if(m[5].start!=-1)
    {
      SetStr(i->info,buf,m[6]);
    }
    return i;
  }
  return NULL;
}
예제 #20
0
ArrayData* GlobalsArray::SetInt(ArrayData* ad,
                                         int64_t k,
                                         Cell v,
                                         bool copy) {
  return SetStr(ad, String(k).get(), v, copy);
}
예제 #21
0
파일: devutils.cpp 프로젝트: 210230/com0com
const char *DevProperties::DevId(const char *_pDevId)
{
  return SetStr(&pDevId, _pDevId);
}
예제 #22
0
//---------------------------------------------------------------------------
void TFileMasks::SetMask(const UnicodeString & Mask)
{
  SetStr(Mask, true);
}
예제 #23
0
파일: devutils.cpp 프로젝트: 210230/com0com
const char *DevProperties::PhObjName(const char *_pPhObjName)
{
  return SetStr(&pPhObjName, _pPhObjName);
}
예제 #24
0
//---------------------------------------------------------------------------
TFileMasks::TFileMasks(const UnicodeString & AMasks)
{
  Init();
  SetStr(AMasks, false);
}
예제 #25
0
파일: devutils.cpp 프로젝트: 210230/com0com
const char *DevProperties::Location(const char *_pLocation)
{
  return SetStr(&pLocation, _pLocation);
}
예제 #26
0
//---------------------------------------------------------------------------
TFileMasks::TFileMasks(const TFileMasks & Source)
{
  Init();
  FForceDirectoryMasks = Source.FForceDirectoryMasks;
  SetStr(Source.GetMasks(), false);
}
예제 #27
0
CESwitch& CESwitch::operator=(LPCWSTR NewVal)
{
	SetStr(NewVal);
	return *this;
}
예제 #28
0
파일: devutils.cpp 프로젝트: 210230/com0com
static int TryInstallDevice(
    const char *pInfFilePath,
    const char *pDevId,
    const char *pDevInstID,
    PCNC_DEV_CALLBACK pDevCallBack,
    void *pDevCallBackParam,
    bool updateDriver,
    BOOL *pRebootRequired)
{
  GUID classGUID;
  char className[32];

  if (!SetupDiGetINFClass(pInfFilePath, &classGUID, className, sizeof(className)/sizeof(className[0]), 0)) {
    ShowLastError(MB_OK|MB_ICONSTOP, "SetupDiGetINFClass(%s)", pInfFilePath);
    return IDCANCEL;
  }

  //Trace("className=%s\n", className);

  HDEVINFO hDevInfo;

  hDevInfo = SetupDiCreateDeviceInfoList(&classGUID, 0);

  if (hDevInfo == INVALID_HANDLE_VALUE) {
    ShowLastError(MB_OK|MB_ICONSTOP, "SetupDiCreateDeviceInfoList()");
    return IDCANCEL;
  }

  int res = IDCONTINUE;
  SP_DEVINFO_DATA devInfoData;

  devInfoData.cbSize = sizeof(devInfoData);

  if (!pDevInstID) {
    if (StrCmpNI(pDevId, "root\\", 5) == 0) {
      /*
       * root\<enumerator-specific-device-ID>
       */

      if (!SetupDiCreateDeviceInfo(hDevInfo, pDevId + 5, &classGUID, NULL, 0, DICD_GENERATE_ID, &devInfoData))
        res = IDCANCEL;
    } else {
      SetLastError(ERROR_INVALID_DEVINST_NAME);
      res = IDCANCEL;
    }
  }
  else
  if (StrChr(pDevInstID, '\\')) {
    /*
     * <enumerator>\<enumerator-specific-device-ID>\<instance-specific-ID>
     */

    if (!SetupDiCreateDeviceInfo(hDevInfo, pDevInstID, &classGUID, NULL, 0, 0, &devInfoData))
      res = IDCANCEL;

    if (res != IDCONTINUE && GetLastError() == ERROR_DEVINST_ALREADY_EXISTS) {
      char *pTmpDevInstID = NULL;

      if (SetStr(&pTmpDevInstID, pDevInstID)) {
        char *pSave;
        char *p;

        p = STRTOK_R(pTmpDevInstID, "\\", &pSave);

        if (p && !lstrcmp(p, REGSTR_KEY_ROOTENUM)) {
          p = STRTOK_R(NULL, "\\", &pSave);

          if (SetupDiCreateDeviceInfo(hDevInfo, p, &classGUID, NULL, 0, DICD_GENERATE_ID, &devInfoData))
            res = IDCONTINUE;
        }

        SetStr(&pTmpDevInstID, NULL);
      } else {
        SetLastError(ERROR_DEVINST_ALREADY_EXISTS);
      }
    }
  } else {
    /*
     * <enumerator-specific-device-ID>
     */

    if (!SetupDiCreateDeviceInfo(hDevInfo, pDevInstID, &classGUID, NULL, 0, DICD_GENERATE_ID, &devInfoData))
      res = IDCANCEL;
  }

  if (res != IDCONTINUE) {
    ShowLastError(MB_OK|MB_ICONSTOP, "SetupDiCreateDeviceInfo()");
    goto exit1;
  }

  char hardwareId[MAX_DEVICE_ID_LEN + 1 + 1];

  SNPRINTF(hardwareId, sizeof(hardwareId)/sizeof(hardwareId[0]) - 1, "%s", pDevId);

  int hardwareIdLen;

  hardwareIdLen = lstrlen(hardwareId) + 1 + 1;
  hardwareId[hardwareIdLen - 1] = 0;

  if (!SetupDiSetDeviceRegistryProperty(hDevInfo, &devInfoData, SPDRP_HARDWAREID,
                                        (LPBYTE)hardwareId, hardwareIdLen * sizeof(hardwareId[0])))
  {
    res = IDCANCEL;
    ShowLastError(MB_OK|MB_ICONSTOP, "SetupDiSetDeviceRegistryProperty()");
    goto exit1;
  }

  if (!SetupDiCallClassInstaller(DIF_REGISTERDEVICE, hDevInfo, &devInfoData)) {
    res = IDCANCEL;
    ShowLastError(MB_OK|MB_ICONSTOP, "SetupDiCallClassInstaller()");
    goto exit1;
  }

  if (pDevCallBack) {
    DevProperties devProperties;

    if (!devProperties.DevId(pDevId)) {
      res = IDCANCEL;
      goto exit2;
    }

    if (!pDevCallBack(hDevInfo, &devInfoData, &devProperties, NULL, pDevCallBackParam)) {
      res = IDCANCEL;
      goto exit2;
    }
  }

  if (updateDriver)
    res = UpdateDriver(pInfFilePath, pDevId, 0, TRUE, pRebootRequired);

exit2:

  if (res != IDCONTINUE) {
    if (!SetupDiCallClassInstaller(DIF_REMOVE, hDevInfo, &devInfoData))
      ShowLastError(MB_OK|MB_ICONWARNING, "SetupDiCallClassInstaller()");
  }

exit1:

  SetupDiDestroyDeviceInfoList(hDevInfo);

  return res;
}
예제 #29
0
파일: aj_sasl.c 프로젝트: bigzero/ajtcl
/*
 * Responder side of the SASL conversation
 */
static AJ_Status Response(AJ_SASL_Context* context, char* inStr, char* outStr, uint32_t outLen)
{
    AJ_Status status = AJ_OK;
    AJ_AuthResult result;
    const char* cmd;
    const char* rsp = outStr;

    if (context->state == AJ_SASL_SEND_AUTH_REQ) {
        cmd = CMD_REJECTED;
    } else {
        cmd = ParseCmd(&inStr);
    }
    /*
     * The REJECTED command is handled the same in all states
     */
    if (cmd == CMD_REJECTED) {
        context->nextMech++;
        context->mechanism = SelectAuth(context, "");
        if (!context->mechanism) {
            /*
             * No mechanism in common so authentication fails.
             */
            return AJ_ERR_SECURITY;
        }
        status = context->mechanism->Init(AJ_AUTH_RESPONDER, context->pwdFunc);
        /*
         * Initialization must succeed
         */
        if (status != AJ_OK) {
            return status;
        }
        result = context->mechanism->Response(NULL, outStr, outLen);
        if ((result == AJ_AUTH_STATUS_SUCCESS) || (result == AJ_AUTH_STATUS_CONTINUE)) {
            status = PrependStr(context->mechanism->name, outStr, outLen, TRUE);
            if (status == AJ_OK) {
                status = PrependStr(CMD_AUTH, outStr, outLen, FALSE);
            }
            if (status == AJ_OK) {
                status = AppendCRLF(outStr, outLen);
            }
            context->state = (result == AJ_AUTH_STATUS_SUCCESS) ? AJ_SASL_WAIT_FOR_OK : AJ_SASL_WAIT_FOR_DATA;
        } else {
            status = AJ_ERR_SECURITY;
        }
        return status;
    }

    switch (context->state) {
    case AJ_SASL_WAIT_FOR_DATA:
        if (cmd == CMD_DATA) {
            status = HexDecode(inStr);
            if (status == AJ_OK) {
                result = context->mechanism->Response(inStr, outStr, outLen);
                if (result == AJ_AUTH_STATUS_SUCCESS) {
                    status = PrependStr(CMD_DATA, outStr, outLen, TRUE);
                    context->state = AJ_SASL_WAIT_FOR_OK;
                } else if (result == AJ_AUTH_STATUS_ERROR) {
                    status = context->mechanism->Init(AJ_AUTH_RESPONDER, context->pwdFunc);
                    /*
                     * Initialization must succeed
                     */
                    if (status != AJ_OK) {
                        return status;
                    }
                    context->state = AJ_SASL_WAIT_FOR_REJECT;
                    rsp = CMD_CANCEL;
                } else if (result != AJ_AUTH_STATUS_CONTINUE) {
                    if (result == AJ_AUTH_STATUS_RETRY &&
                        context->mechList[context->nextMech + 1] != NULL) {
                        // Notify the challenger to give up on the current authentication mechanism and to be in WAIT_FOR_AUTH state
                        rsp = CMD_ERROR;
                    } else {
                        status = AJ_ERR_SECURITY;
                    }
                }
            }
            break;
        }
    /* Fallthrough */

    case AJ_SASL_WAIT_FOR_OK:
        if (cmd == CMD_OK) {
            AJ_GUID localGuid;
            AJ_GetLocalGUID(&localGuid);
            status = AJ_GUID_ToString(&localGuid, outStr, outLen);
            if (status == AJ_OK) {
                status = PrependStr(CMD_BEGIN, outStr, outLen, FALSE);
            }
            context->state = AJ_SASL_AUTHENTICATED;
        } else if (cmd == CMD_DATA) {
            rsp = CMD_CANCEL;
            context->state = AJ_SASL_WAIT_FOR_REJECT;
        } else if (cmd == CMD_ERROR) {
            rsp = CMD_CANCEL;
            context->state = AJ_SASL_WAIT_FOR_REJECT;
        } else {
            rsp = CMD_ERROR;
        }
        break;

    case AJ_SASL_WAIT_FOR_REJECT:
        status = AJ_ERR_SECURITY;
        break;

    default:
        status = AJ_ERR_UNEXPECTED;
    }

    if (status == AJ_OK) {
        if (rsp != outStr) {
            status = SetStr(rsp, outStr, outLen);
        }
    }
    if (status == AJ_OK) {
        status = AppendCRLF(outStr, outLen);
    }
    return status;
}
예제 #30
0
파일: aj_sasl.c 프로젝트: bigzero/ajtcl
/*
 * Challenger side of the SASL conversation
 */
static AJ_Status Challenge(AJ_SASL_Context* context, char* inStr, char* outStr, uint32_t outLen)
{
    AJ_Status status = AJ_OK;
    AJ_AuthResult result;
    const char* rsp = outStr;
    const char* cmd = ParseCmd(&inStr);

    /*
     * The ERROR command is handled the same in all states.
     */
    if (cmd == CMD_ERROR || ((cmd == CMD_CANCEL) && (context->state != AJ_SASL_WAIT_FOR_AUTH))) {
        status = Rejected(context, outStr, outLen);
        if (status == AJ_OK) {
            status = AppendCRLF(outStr, outLen);
        }
        context->state = AJ_SASL_WAIT_FOR_AUTH;
        return status;
    }

    switch (context->state) {
    case AJ_SASL_WAIT_FOR_AUTH:
        if (cmd == CMD_AUTH) {
            context->mechanism = MatchMechanism(context, &inStr);
            if (!context->mechanism) {
                result = AJ_AUTH_STATUS_RETRY;
                status = Rejected(context, outStr, outLen);
                break;
            } else {
                status = context->mechanism->Init(AJ_AUTH_CHALLENGER, context->pwdFunc);
                /*
                 * Initialization must succeed
                 */
                if (status != AJ_OK) {
                    break;
                }
            }
            /*
             * Data following an AUTH command is handled sames as DATA command
             */
            if ((*inStr) || (strcmp(context->mechanism->name, "ANONYMOUS") == 0)) {
                cmd = CMD_DATA;
            } else {
                break;
            }
        }
    /* Falling through */

    case AJ_SASL_WAIT_FOR_DATA:
        if (cmd == CMD_DATA) {
            if (strcmp(context->mechanism->name, "ANONYMOUS") != 0) {
                status = HexDecode(inStr);
            }
            if (status == AJ_OK) {
                result = context->mechanism->Challenge(inStr, outStr, outLen);
                if (result == AJ_AUTH_STATUS_SUCCESS) {
                    AJ_GUID localGuid;
                    AJ_GetLocalGUID(&localGuid);
                    status = AJ_GUID_ToString(&localGuid, outStr, outLen);
                    if (status == AJ_OK) {
                        status = PrependStr(CMD_OK, outStr, outLen, FALSE);
                    }
                    context->state = AJ_SASL_WAIT_FOR_BEGIN;
                } else if (result == AJ_AUTH_STATUS_CONTINUE) {
                    status = PrependStr(CMD_DATA, outStr, outLen, TRUE);
                    context->state = AJ_SASL_WAIT_FOR_DATA;
                } else if (result == AJ_AUTH_STATUS_RETRY) {
                    status = Rejected(context, outStr, outLen);
                } else if (result == AJ_AUTH_STATUS_FAILURE) {
                    status = AJ_ERR_SECURITY;
                } else {
                    rsp = CMD_ERROR;
                }
            }
        } else if (cmd == CMD_BEGIN) {
            status = AJ_ERR_SECURITY;
        } else {
            rsp = CMD_ERROR;
        }
        break;

    case AJ_SASL_WAIT_FOR_BEGIN:
        if (cmd == CMD_BEGIN) {
            context->state = AJ_SASL_AUTHENTICATED;
        } else {
            rsp = CMD_ERROR;
        }
        break;

    default:
        status = AJ_ERR_UNEXPECTED;
    }

    if (status == AJ_OK) {
        if (rsp != outStr) {
            status = SetStr(rsp, outStr, outLen);
        }
    }

    /* The Challenger does not send out any SASL message once the state is AJ_SASL_AUTHENTICATED
       i.e after the BEGIN command is received. So we should not append the CRLF. This results
       in unwanted bytes being put in the tx buffer which gets sent out to the Responder. */
    if ((status == AJ_OK) && (context->state != AJ_SASL_AUTHENTICATED)) {
        status = AppendCRLF(outStr, outLen);
    }
    return status;
}