/** * Since the routing node expects any of its clients to use SASL with Anonymous * or PINX in order to connect, this method will send the necessary SASL * Anonymous exchange in order to connect. PINX is no longer supported on the * Thin Client. All thin clients will connect as untrusted clients to the * routing node. */ static AJ_Status AnonymousAuthAdvance(AJ_IOBuffer* rxBuf, AJ_IOBuffer* txBuf) { AJ_Status status = AJ_OK; AJ_GUID localGuid; char buf[40]; /* initiate the SASL exchange with AUTH ANONYMOUS */ status = WriteLine(txBuf, "AUTH ANONYMOUS\n"); ResetRead(rxBuf); if (status == AJ_OK) { /* expect server to send back OK GUID */ status = ReadLine(rxBuf); if (status == AJ_OK) { if (memcmp(rxBuf->readPtr, "OK", 2) != 0) { return AJ_ERR_ACCESS_ROUTING_NODE; } } } if (status == AJ_OK) { status = WriteLine(txBuf, "INFORM_PROTO_VERSION 10\n"); ResetRead(rxBuf); } if (status == AJ_OK) { /* expect server to send back INFORM_PROTO_VERSION version# */ status = ReadLine(rxBuf); } if (status == AJ_OK) { if (memcmp(rxBuf->readPtr, "INFORM_PROTO_VERSION", strlen("INFORM_PROTO_VERSION")) != 0) { status = AJ_ERR_ACCESS_ROUTING_NODE; } } if (status == AJ_OK) { routingProtoVersion = atoi((const char*)(rxBuf->readPtr + strlen("INFORM_PROTO_VERSION") + 1)); if (routingProtoVersion < AJ_GetMinProtoVersion()) { AJ_InfoPrintf(("AnonymousAuthAdvance():: Found version %u but minimum %u required", routingProtoVersion, AJ_GetMinProtoVersion())); status = AJ_ERR_OLD_VERSION; } } if (status == AJ_OK) { /* send BEGIN LocalGUID to server */ AJ_GetLocalGUID(&localGuid); strcpy(buf, "BEGIN "); status = AJ_GUID_ToString(&localGuid, buf + strlen(buf), 33); strcat(buf, "\n"); status = WriteLine(txBuf, buf); ResetRead(rxBuf); } if (status != AJ_OK) { AJ_ErrPrintf(("AnonymousAuthAdvance(): status=%s\n", AJ_StatusText(status))); } return status; }
void BlobBuffer::Reset() { m_lBlobLen = 0; m_BlobPtr = m_BlobBuffer; m_lBufferLen = BLOB_BUFFER_BLOCK_SIZE; ResetRead(); }
//清空所有数据,不释放内存 void BlobBuffer::ClearContent() { m_lBlobLen = 0; ResetRead(); }