예제 #1
0
BOOL CXMLAttribute::ParseString(LPCTSTR& strXML)
{
	if ( ! ParseIdentifier( strXML, m_sName ) )
		return FALSE;
	if ( ! ParseMatch( strXML, _T("=") ) )
		return FALSE;

	if ( ParseMatch( strXML, _T("\"") ) )
	{
		LPCTSTR pszQuote = _tcschr( strXML, '\"' );
		if ( ! pszQuote || *pszQuote != '\"' )
			return FALSE;

		m_sValue = Unescape( strXML, (int)( pszQuote - strXML ) );
		strXML = pszQuote;

		return ParseMatch( strXML, _T("\"") );
	}

	if ( ParseMatch( strXML, _T("'") ) )
	{
		LPCTSTR pszQuote = _tcschr( strXML, '\'' );
		if ( ! pszQuote || *pszQuote != '\'' )
			return FALSE;

		m_sValue = Unescape( strXML, (int)( pszQuote - strXML ) );
		strXML = pszQuote;

		return ParseMatch( strXML, _T("\'") );
	}

	return FALSE;
}
예제 #2
0
파일: HTTP.cpp 프로젝트: CodeAsm/open-sauce
		/*!
		 * \brief
		 * Splits a urls network address into it's constituent parts.
		 * 
		 * \param network_location
		 * The network location string to parse.
		 * 
		 * Splits a urls network address into it's constituent parts.
		 */
		void c_url_interface::ParseNetworkLocation(std::string network_location)
		{
			//username:password@address:port

			// get the username and password if present
			std::string user_details;

			SplitString(network_location, user_details, "@", true);
			SplitString(user_details, m_username, ":", true);
			m_password = user_details;

			m_username = Unescape(m_username);
			m_password = Unescape(m_password);

			// get the port
			std::string port;
			SplitString(network_location, port, ":", false);

			if(port.length() != 0)
			{
				int count = sscanf_s(port.c_str(), "%i", &m_port);
				if(count == 0)
					m_port = 80;
			}

			// whatever is left is the address
			m_address = network_location;
		}
예제 #3
0
BOOL IBNTO_MESSAGE::Parse(LPCTSTR szURL)
{
	BOOL ret = FALSE;
	LPCTSTR szIbnTo = _T("ibnto:");
	CString str = szURL;
	str.MakeLower();
	int n = str.Find(szIbnTo);
	if(n >= 0)
	{
		LPCTSTR szBegin = szURL + n + _tcslen(szIbnTo);
		LPCTSTR szEnd = szURL + _tcslen(szURL);
		LPCTSTR sz = szBegin;
		// Get login and domain
		while(sz < szEnd && *sz != _T('?'))
			sz++;
		str = CString(szBegin, sz-szBegin);

		CStringArray	MailboxArray;

		int CommaIndex	=	-1;
		while((CommaIndex = str.Find(_T(",")))>0)
		{
			MailboxArray.Add(str.Mid(0,CommaIndex));
			str = str.Mid(CommaIndex+1);
		}
		if(str.GetLength()>0)
			MailboxArray.Add(str);

		for(int MailboxArrayIndex = 0 ; MailboxArrayIndex<MailboxArray.GetSize();MailboxArrayIndex++)
		{
			str = MailboxArray[MailboxArrayIndex];
			
			n = str.ReverseFind(_T('@'));
			if(n > 0)
			{
				CString strLogin = str.Left(n);
				Unescape(&strLogin);
				CString strDomain = str.Mid(n+1);
				Unescape(&strDomain);
				
				Logins.Add(LoginItem(strLogin,strDomain));
			}
		}

		sz++;
		szBegin = sz;
		// Get message body
		while(sz < szEnd)
			sz++;
		Message = CString(szBegin, sz-szBegin);
		Unescape(&Message);
		ret = TRUE;
	}
	return ret;
}
예제 #4
0
파일: xmlrpc.cpp 프로젝트: gerrit-rws/anope
	static bool GetData(Anope::string &content, Anope::string &tag, Anope::string &data)
	{
		if (content.empty())
			return false;

		Anope::string prev, cur;
		bool istag;

		do
		{
			prev = cur;
			cur.clear();

			int len = 0;
			istag = false;

			if (content[0] == '<')
			{
				len = content.find_first_of('>');
				istag = true;
			}
			else if (content[0] != '>')
			{
				len = content.find_first_of('<');
			}

			if (len)
			{
				if (istag)
				{
					cur = content.substr(1, len - 1);
					content.erase(0, len + 1);
					while (!content.empty() && content[0] == ' ')
						content.erase(content.begin());
				}
				else
				{
					cur = content.substr(0,len);
					content.erase(0, len);
				}
			}
		}
		while (istag && !content.empty());

		tag = Unescape(prev);
		data = Unescape(cur);
		return !istag && !data.empty();
	}
예제 #5
0
void ProtocolInterpreter::onCommand(std::string const &command,
                                    std::string const &arguments) {
  size_t commandLength;
  Handler const *handler = findHandler(command, commandLength);
  if (handler == nullptr) {
    DS2LOG(Packet, "handler for command '%s' unknown", command.c_str());

    //
    // The handler couldn't be found, we don't support this packet.
    //
    _session->sendError(kErrorUnsupported);
    return;
  }

  std::string extra;
  if (commandLength != command.length()) {
    //
    // Command has part of the argument, LLDB doesn't use separators :(
    //
    extra = command.substr(commandLength);
  }

  extra += arguments;

  if (extra.find_first_of("*}") != std::string::npos) {
    extra = Unescape(extra);
    DS2LOG(Packet, "args='%.*s'", static_cast<int>(extra.length()), &extra[0]);
  }

  (handler->handler->*handler->callback)(*handler, extra);
}
예제 #6
0
  size_t HandleBinary(const void *_data, size_t length) {
    const uint8_t *const data = (const uint8_t *)_data, *end = data + length;
    const uint8_t *p = data;

    p = std::find(p, end, FLARM::START_FRAME);
    if (p == NULL)
      return length;

    ++p;

    FLARM::FrameHeader header;
    size_t nbytes = Unescape(p, end, &header, sizeof(header));
    p += nbytes;
    if (nbytes < sizeof(header))
      return p - data;

    //XXX size_t payload_length = header.GetLength();

    switch (header.type) {
    case FLARM::MT_PING:
    case FLARM::MT_SELECTRECORD:
      SendACK(header.GetSequenceNumber());
      break;

    case FLARM::MT_EXIT:
      SendACK(header.GetSequenceNumber());
      binary = false;
      break;
    }

    return p - data;
  }
예제 #7
0
wxString RaceAnalyzerComm::readScript(){

	wxMutexLocker lock(_commMutex);

	wxString script = "";
	int scriptPage = 0;
	int to = 0;
	CComm *serialPort = GetSerialPort();
	if (NULL==serialPort) throw CommException(CommException::OPEN_PORT_FAILED);

	FlushReceiveBuffer(serialPort);
	while(!to){

		//wxString cmd = wxString::Format("println(getScriptPage(%d))",scriptPage++);
		wxString cmd = wxString::Format("readScriptPage %d",scriptPage++);
		wxString buffer = SendCommand(serialPort, cmd);

		wxString scriptFrag = GetParam(buffer,"script", true);

		VERBOSE(FMT("escaped: %s", scriptFrag.ToAscii()));
		Unescape(scriptFrag);
		VERBOSE(FMT("unescaped: %s", scriptFrag.ToAscii()));
		size_t scriptFragmentLen = scriptFrag.Length();

		if (scriptFragmentLen > 0 ) script+=scriptFrag;
		//the last page is a 'partial page'
		if (scriptFragmentLen < SCRIPT_PAGE_LENGTH ) break;
	}
	CloseSerialPort();
	if (to){
		throw CommException(CommException::COMM_TIMEOUT);
	}
	return script;
}
예제 #8
0
CStringA CPathUtils::PathUnescape(const CStringA& path)
{
	auto urlabuf = std::make_unique<char[]>(path.GetLength() + 1);

	strcpy_s(urlabuf.get(), path.GetLength()+1, path);
	Unescape(urlabuf.get());

	return urlabuf.get();
}
예제 #9
0
 // All results as strings
 bool CArgMap::Get ( const SString& strCmd, std::vector < SString >& outList ) const
 {
     std::vector < SString > newItems;
     MultiFind ( m_Map, Escape ( strCmd ), &newItems );
     for ( uint i = 0 ; i < newItems.size () ; i++ )
         newItems[i] = Unescape ( newItems[i] );
     ListAppend ( outList, newItems );
     return newItems.size () > 0;
 }
예제 #10
0
CStringA CAppUtils::PathUnescape(const CStringA& path)
{
    std::unique_ptr<char> urlabuf (new char[path.GetLength()+1]);

    strcpy_s(urlabuf.get(), path.GetLength()+1, path);
    Unescape(urlabuf.get());

    return urlabuf.get();
}
예제 #11
0
파일: HTTP.cpp 프로젝트: CodeAsm/open-sauce
		/*!
		 * \brief
		 * Splits a URL query string into individual field-value pairs.
		 * 
		 * \param query
		 * Pointer to the query string to parse.
		 * 
		 * Splits a URL query string into individual field-value pairs.
		 */
		void c_url_interface::ParseQuery(const char* query)
		{
			// field=value&field=&field=value

			// remove any existing queries
			ClearQueries();

			if(!query)
				return;

			std::string query_string(query);

			do
			{
				// split the query string at the next & if present to get the next query
				std::string current_query;
				SplitString(query_string, current_query, "&", true);

				if(current_query.length() == 0)
				{
					// this is the last query so set the string to whatever is left
					current_query = query_string;
					query_string.clear();
				}

				// check the string contains an "="
				if(std::string::npos == current_query.find("="))
				{
					// the query string is invalid, clear the query list and return
					ClearQueries();
					return;
				}

				std::string field;
				std::string value;
				// split at the "=" for the field and set the value to whatever is left
				SplitString(current_query, field, "=", true);

				field = Unescape(field, true);
				value = Unescape(current_query, true);

				AddQuery(field.c_str(), value.c_str());
			}while(query_string.length());
		}
예제 #12
0
파일: Parse.cpp 프로젝트: juherr/fit
  STRING ceefit_call_spec PARSE::HtmlToText(const STRING& s)
  {
		STRING temp(s);

    temp = NormalizeLineBreaks(temp);
    temp = RemoveNonBreakTags(temp);
		temp = CondenseWhitespace(temp);
		temp = Unescape(temp);

    return temp;
  }
예제 #13
0
 // First result as string
 bool CArgMap::Get ( const SString& strCmd, SString& strOut, const char* szDefault ) const
 {
     assert ( szDefault );
     if ( const SString* pResult = MapFind ( m_Map, Escape ( strCmd ) ) )
     {
         strOut = Unescape ( *pResult );
         return true;
     }
     strOut = szDefault;
     return false;
 }
예제 #14
0
char *RestoreStr() {

    if (posHeadEscaped) {
        EscapeBuf(posHeadEscaped, '"');
        posHeadEscaped = NULL;
    }
    if (posNulled) {
        *posNulled = posCh;
        posNulled = NULL;
    }

    if (!posRestore)
        return NULL;

    posRestore = SkipWhiteSpace(posRestore);
    char *end = GetStringEnd(posRestore);

    BOOL bQuotes = FALSE;
    if (*posRestore == '"') {
        // count the number of \'s preceeding the quote
        // if it's an odd number, then the final \ would
        // escape the ", meaning it's not the end quote
        int x=1;
        while ( *(end-1-x) == '\\')
            x++;
        x--;

        if (!(x & 1)) {  // if it's even, the " is valid
            posRestore++;
            end--;
            bQuotes = TRUE;
        }
    }

    posCh = *end;
    posNulled = end;
    *end = 0;


    // if there were characters that were unescaped,
    // we need to remember the beginning of the string, so
    // that we can restore the escaped data after we're done
    if (Unescape(posRestore))
        posHeadEscaped =  posRestore;
    else
        posHeadEscaped = NULL;

    char *ret = posRestore;

    posRestore = end+1;

    return ret;
}
예제 #15
0
파일: HTTP.cpp 프로젝트: CodeAsm/open-sauce
		/*!
		 * \brief
		 * Appends a path or resource to the URL's path section.
		 * 
		 * \param path
		 * Pointer to the path string to append.
		 * 
		 * \param unescape
		 * Sets whether to unescape the directory/resource name(s).
		 * 
		 * Appends a path or resource to the URL's path section.
		 */
		void c_url_interface::AppendPath(const char* path, bool unescape)
		{
			// /directory/directory/directory/resource

			std::string path_string(path);

			if(!path_string.length())
				return;

			std::string::size_type offset;

			// remove trailing and leading slashes
			offset = 0;
			if((std::string::npos != (offset = path_string.find("/"))) && (offset == 0))
				path_string.replace(0, 1, "");

			offset = 0;
			if((std::string::npos != (offset = path_string.rfind("/"))) && (offset == path_string.length() - 1))
				path_string.replace(path_string.length() - 1, 1, "");

			// replace directory traversal dots with empty strings
			offset = 0;
			while(std::string::npos != (offset = path_string.find("..")))
				path_string.replace(offset, 2, "");

			// replace double slashes with single slashes
			offset = 0;
			while(std::string::npos != (offset = path_string.find("//")))
				path_string.replace(offset, 2, "/");

			do
			{
				std::string directory;

				SplitString(path_string, directory, "/", true);

				if((directory.length() == 0) && path_string.length())
				{
					directory = path_string;
					path_string.clear();
				}

				if(directory.length())
				{
					if(unescape)
						Unescape(directory);
					m_path.push_back(directory);
				}
			}while(path_string.length());
		}
static inline void
ParseTask(std::string const & aTask,
          std::string & aAction,
          std::string & aLibrary)
{
  std::string::size_type const colon = aTask.find(':');
  if (colon != std::string::npos) {
    aAction = Strip(aTask.substr(0, colon));
    aLibrary = Unescape(
            Strip(aTask.substr(colon + 1, aAction.length() - colon - 1)));
  }
  else {
    aAction = Strip(aTask);
    aLibrary.clear();
  }
}
예제 #17
0
bool ReadStrings(istream& in, StringTable& strings, bool unescape)
{
  string currentSection;
  while (!in.eof()) {
    string line;
    std::getline(in, line);
    int sep = line.find('=');
    if (sep >= 0) {
      string key, value;
      key = line.substr(0, sep);
      value = line.substr(sep + 1);
      if (unescape)
        value = Unescape(value);
      strings[key] = value;
    }
  }

  return true;
}
예제 #18
0
bool ReadXmlNode(wxXmlNode* node, const wxString& tag, wxString& data)
{

    if (node->GetName() != tag)
    {
        return false;
    }

    wxXmlNode* child = node->GetChildren();

    while (child != NULL)
    {
        if (child->GetType() == wxXML_TEXT_NODE)
        {
            Unescape( child->GetContent(), data );
            return true;
        }
        child = child->GetNext();
    }

    return false;

}
예제 #19
0
파일: HTTP.cpp 프로젝트: CodeAsm/open-sauce
		/*!
		 * \brief
		 * Splits a URL into its constituent parts.
		 * 
		 * \param url
		 * Pointer to the URL string to parse.
		 * 
		 * Splits a URL into its constituent parts.
		 * 
		 * \remarks
		 * The URL string passed to this function must be an escaped URL, attempting to parse an unescaped URL will have unknown results.
		 */
		void c_url_interface::ParseURL(const char* url)
		{
			// scheme://username:password@address:port/directory/directory/resource?field=value&field=&field=value#fragment

			std::string url_string(url);

			std::string query;
			std::string network_location;

			// forward parsing
			// get the scheme
			SplitString(url_string, m_scheme, "://", true, false);

			if(m_scheme.length() == 0)
				m_scheme.assign("http");

			// get the network location
			SplitString(url_string, network_location, "/", true);
			if(!network_location.length())
			{
				network_location = url_string;
				url_string.clear();
			}

			// reverse parsing
			// get the fragment
			SplitString(url_string, m_fragment, "#", false);
			m_fragment = Unescape(m_fragment);

			// get the query
			SplitString(url_string, query, "?", false);

			// get the path
			ParseNetworkLocation(network_location);
			ParsePath(url_string.c_str());
			ParseQuery(query.c_str());
		}
예제 #20
0
std::string Uncompress(std::string const &data) { return Unescape(data); }
sbError
sbiTunesAgentProcessor::ProcessTaskFile()
{
  int retry = 60;

  if (!OpenResultsFile()) {
    return sbError("Failed to open results file to check for start!");
  }
  
  if (OpenResultsFile().tellp() == std::ofstream::pos_type(0)) {
    OpenResultsFile() << '[' << SCHEMA_VERSION << ":2]\n"
                      << '[' << ADDED_MEDIA_ITEMS << "]\n";
  }

  // Keep process all files we find
  while (OpenTaskFile(mInputStream)) {
    if (!mInputStream) {
      // Can't open, maybe it's being written to try again
      if (--retry == 0) {
        return sbError("Unable to open the export track file");
      }
      Sleep(1000);
      continue;
    }
    sbError const & error = Initialize();
    if (error && !ErrorHandler(error)) {
      return error;
    }
    std::string line;
    std::string action;
    std::string source;
    int lineno = 0;
    while (std::getline(mInputStream, line)) {
      std::string::size_type const beginBracket = 
        line.find_first_not_of(" \t");
      // Look for the right bracket as first non-whitespace
      if (beginBracket != std::string::npos && line[beginBracket] == '[') {
        std::string::size_type const endBracket = line.find_last_of(']');
        if (endBracket != std::string::npos) {
          std::string task = line.substr(beginBracket + 1, 
                                         endBracket - beginBracket - 1);
          ParseTask(task, action, source);
          if (action == SCHEMA_VERSION) {
            VersionAction const versionAction = VersionCheck(source);
            action.clear();
            source.clear();
            if (versionAction == ABORT) {
              return sbError("Incompatible version encountered");
            }
            else if (versionAction == RETRY) {
              mInputStream.close();
              continue; // Will hit the inner while and it will stop
            }
          }

          sbError error = ProcessPendingTrackBatch();
          SB_ENSURE_ERRORHANDLER(error);
        }
      }
      else {
        // If there is no action then there's nothing to do yet
        if (action.empty()) {
          ++lineno;
          continue;
        }
        std::string::size_type const equalSign = line.find('=');
        if (equalSign != std::string::npos) {
          std::string const & key =
            Strip(line.substr(0, equalSign));
          std::string const & value =
            Unescape(Strip(line.substr(equalSign + 1)));

          // We've been told to add the track
          if (action == ADDED_MEDIA_ITEMS) {
            sbError const & error = AddTrack(source, key, value, ADDED_MEDIA_ITEMS);
            SB_ENSURE_ERRORHANDLER(error);
          }
          else if (action == UPDATED_MEDIA_ITEMS) {
            sbError const & error = UpdateTrack(key, value);
            SB_ENSURE_ERRORHANDLER(error);
          }
          else if (action == ADDED_PLAYLISTS) {
            sbError error = CreatePlaylist(value);
            SB_ENSURE_ERRORHANDLER(error);
          }
          // We've been told to remove the playlist
          else if (action == DELETED_PLAYLISTS) {
            sbError error = RemovePlaylist(value);
            SB_ENSURE_ERRORHANDLER(error);
          }
          else if (action == UPDATED_SMARTPLAYLIST) {
            sbError const & error = AddTrack(source,
                                             key,
                                             value,
                                             UPDATED_SMARTPLAYLIST);
            SB_ENSURE_ERRORHANDLER(error);
          }
          else {
            std::ostringstream msg;
            msg << action << " is an invalid action , ignoring line " 
                << lineno;
            sbError error(msg.str());
            SB_ENSURE_ERRORHANDLER(error);

            action.clear();
          }
        }
        else {
          // If the line wasn't blank then report an error
          if (!Strip(line).empty()) {
            std::ostringstream msg;
            msg << action 
                << " is an invalid action , ignoring line " << lineno;
            sbError error(msg.str());
            SB_ENSURE_ERRORHANDLER(error);
          }
        }
      }
      ++lineno;
      if (ShouldShutdown()) {
        // Notify shutdown done and exit
        ShutdownDone();
        return sbNoError;
      }
    }
    if (!mTrackBatch.empty()) {
      sbError const & error = ProcessPendingTrackBatch();
      SB_ENSURE_ERRORHANDLER(error);
    }
    // Close the stream and remove the file
    mInputStream.close();
    mInputStream.clear();
    RemoveTaskFile();
  }
  return sbNoError;
}
예제 #22
0
BOOL CXMLElement::ParseString(LPCTSTR& strXML)
{
	if ( ! ParseMatch( strXML, _T("<") ) )
		return FALSE;

	if ( ! ParseIdentifier( strXML, m_sName ) )
		return FALSE;

	while ( ! ParseMatch( strXML, _T(">") ) )
	{
		if ( ParseMatch( strXML, _T("/") ) )
			return ParseMatch( strXML, _T(">") );

		if ( ! *strXML )
			return FALSE;

		CXMLAttribute* pAttribute = new CXMLAttribute( this );

		if ( ! pAttribute || ! pAttribute->ParseString( strXML ) )
		{
			delete pAttribute;
			return FALSE;
		}

		CString strNameLower( pAttribute->m_sName );
		strNameLower.MakeLower();

		// Delete the old attribute if one exists
		CXMLAttribute* pExisting;
		if ( m_pAttributes.Lookup( strNameLower, pExisting ) )
			delete pExisting;

		m_pAttributes.SetAt( strNameLower, pAttribute );

		if ( ! m_pAttributesInsertion.Find( strNameLower ) )
			m_pAttributesInsertion.AddTail( strNameLower );		// Track output order workaround
	}

	CString strClose = _T("</");
	strClose += m_sName + '>';

	for ( ;; )
	{
		if ( ! *strXML )
			return FALSE;

		LPCTSTR pszElement = _tcschr( strXML, '<' );
		if ( ! pszElement || *pszElement != '<' )
			return FALSE;

		if ( ParseMatch( strXML, _T("<![CDATA[") ) )
		{
			pszElement = _tcsstr( strXML, _T("]]>") );
			if ( ! pszElement || *pszElement != ']' )
				return FALSE;
			if ( ! m_sValue.IsEmpty() && m_sValue.Right( 1 ) != ' ' )
				m_sValue += ' ';
			m_sValue += Unescape( strXML, (int)( pszElement - strXML ) );
			pszElement += 3;
			strXML = pszElement;
		}

		if ( pszElement > strXML )
		{
			if ( ! m_sValue.IsEmpty() && m_sValue.Right( 1 ) != ' ' )
				m_sValue += ' ';
			m_sValue += Unescape( strXML, (int)( pszElement - strXML ) );
			strXML = pszElement;
		}

		if ( ParseMatch( strXML, strClose ) )
		{
			break;
		}
		else if ( ParseMatch( strXML, _T("<!--") ) )
		{
			pszElement = _tcsstr( strXML, _T("-->") );
			if ( ! pszElement || *pszElement != '-' )
				return FALSE;
			strXML = pszElement + 3;
		}
		else
		{
			CXMLElement* pElement = new CXMLElement( this );

			if ( pElement->ParseString( strXML ) )
			{
				m_pElements.AddTail( pElement );
			}
			else
			{
				delete pElement;
				return FALSE;
			}
		}
	}

	return TRUE;
}
예제 #23
0
파일: monitor.c 프로젝트: Einheri/wl500g
void Decode( char *in )
{
	struct line_list l, cf, info;
	char *s, *t, *header, *value;
	int i;

	Init_line_list(&l);
	Init_line_list(&cf);
	Init_line_list(&info);

	FPRINTF(STDOUT,"****\n");
	if( debug )FPRINTF(STDOUT, "Decode: %s\n", in );
	if((s = safestrpbrk(in,Value_sep)) ){
		*s++ = 0;
		Unescape(s);
		Free_line_list(&l);
		Split(&l,s,Line_ends,1,Value_sep,1,1,1,0);
		for( i = 0; i < l.count; ++i ){
			t = l.list[i];
			if( debug || safestrncasecmp(t,VALUE,5) ){
				FPRINTF(STDOUT,"%s\n", t );
			}
		}
		s = Find_str_value(&l,VALUE,Value_sep);
		if( s ) Unescape(s);
		if( !safestrcasecmp(in,TRACE) ){
			FPRINTF(STDOUT,"TRACE: '%s'\n", s );
		} else if( !safestrcasecmp(in,UPDATE) ){
			FPRINTF(STDOUT,"UPDATE: '%s'\n", s );
			Split(&info,s,Line_ends,0,0,0,0,0,0);
			for( i = 0; i < info.count; ++i ){
				header = info.list[i];
				if( (value = safestrchr(header,'=')) ) *value++ = 0;
				Unescape(value);
				FPRINTF(STDOUT," [%d] %s='%s'\n", i, header, value );
			}
		} else if( !safestrcasecmp(in,PRSTATUS) ){
			FPRINTF(STDOUT,"PRSTATUS: '%s'\n", s );
		} else if( !safestrcasecmp(in,QUEUE) ){
			FPRINTF(STDOUT,"QUEUE: '%s'\n", s );
			Split(&info,s,Line_ends,0,0,0,0,0,0);
			for( i = 0; i < info.count; ++i ){
				header = info.list[i];
				if( (value = safestrchr(header,'=')) ) *value++ = 0;
				Unescape(value);
				FPRINTF(STDOUT," [%d] %s='%s'\n", i, header, value );
			}
			Free_line_list(&info);
		} else if( !safestrcasecmp(in,DUMP) ){
			FPRINTF(STDOUT,"DUMP:\n");
			Split(&info,s,Line_ends,0,0,0,0,0,0);
			for( i = 0; i < info.count; ++i ){
				header = info.list[i];
				if( (value = safestrchr(header,'=')) ) *value++ = 0;
				Unescape(value);
				if(debug) FPRINTF(STDOUT," [%d] %s='%s'\n", i, header, value );
				if( !safestrcasecmp(header,QUEUE) ){
					FPRINTF(STDOUT," EXTRACT QUEUE '%s'\n",value);
				} else if( !safestrcasecmp(header,UPDATE) ){
					FPRINTF(STDOUT," EXTRACT UPDATE '%s'\n",value);
				} else {
					FPRINTF(STDOUT," EXTRACT '%s' '%s'\n",header, value);
				}
			}
			Free_line_list(&info);
		} else {
			FPRINTF(STDOUT,"%s: '%s'\n", in, s );
		}
	}
	Free_line_list(&l);
	Free_line_list(&cf);
	Free_line_list(&info);
	FPRINTF(STDOUT,"\n");
}
예제 #24
0
// Operator strumienia wyjścia
std::ostream& operator<<(std::ostream& out, const Json& arg)
{
    switch (arg.type)
    {
    case Json::Type::Array:
    {
        auto& array = *arg.value.array;
        auto it = array.begin();
        out << "[";
        if (!array.empty())
        {
            if (it != array.end())
                out << *it;
            while (++it != array.end())
                out << "," << *it;
        }
        out << "]";
        break;
    }
    case Json::Type::Object:
    {
        auto& objects = *arg.value.object;
        auto it = objects.begin();
        out << "{";
        if (!objects.empty())
        {
            if (it != objects.end())
                out << "\"" << it->first << "\":" << it->second;
            while (++it != objects.end())
                out << ",\"" << it->first << "\":" << it->second;
        }
        out << "}";
        break;
    }
    case Json::Type::String:
        out << "\"" << Unescape(*arg.value.string) << "\"";
        break;
    case Json::Type::Boolean:
        out << std::boolalpha << arg.value.boolean;
        break;
    case Json::Type::Floating:
        if (std::fmod(arg.value.floating, 1.0))
            out << std::setprecision(std::numeric_limits<double>::digits10)
            << arg.value.floating;
        else
            out << arg.value.floating << ".0";
        break;
    case Json::Type::Integer:
        out << arg.value.integer;
        break;
    case Json::Type::Uinteger:
        out << arg.value.uinteger;
        break;
    case Json::Type::Null:
        out << "null";
        break;
    default:
        break;
    }
    return out;
}
예제 #25
0
파일: MNotation.cpp 프로젝트: Gd58/MCF
// 其他非静态成员函数。
std::pair<MNotation::ErrorType, const wchar_t *> MNotation::Parse(const WideStringObserver &wsoData){
	MNotation vTemp;

	auto pwcRead = wsoData.GetBegin();
	const auto pwcEnd = wsoData.GetEnd();
	if(pwcRead == pwcEnd){
		return std::make_pair(kErrNone, pwcRead);
	}

	Vector<MNotationNode *> vecPackageStack(1, &vTemp);

	const wchar_t *pwcNameBegin = nullptr;
	const wchar_t *pwcNameEnd = nullptr;
	const wchar_t *pwcValueBegin = nullptr;
	const wchar_t *pwcValueEnd = nullptr;

	enum {
		kStNameIndent,
		kStNameBody,
		kStNamePadding,
		kStValueIndent,
		kStValueBody,
		kStValPadding,
		kStComment,
		kStNameEscaped,
		kStValueEscaped,
		kStCommentEscaped,
	} eState = kStNameIndent;

	ErrorType eError;
	const auto PushPackage = [&]{
		ASSERT(!vecPackageStack.IsEmpty());

		MNotationNode *ppkgSource = nullptr;
		if(pwcValueBegin){
			const auto wsSourceName = Unescape(WideStringObserver(pwcValueBegin, pwcValueEnd));
			const auto pSourceNode = vecPackageStack.GetEnd()[-1]->Get(wsSourceName);
			if(!pSourceNode){
				eError = kErrSourcePackageNotFound;
				return false;
			}
			ppkgSource = &(pSourceNode->Get().second);
		}

		const auto vResult = vecPackageStack.GetEnd()[-1]->Insert(Unescape(WideStringObserver(pwcNameBegin, pwcNameEnd)));
		if(!vResult.second){
//			eError = ERR_DUPLICATE_PACKAGE;
//			return false;
		}
		if(ppkgSource){
			vResult.first->Get().second = *ppkgSource;
		}

		vecPackageStack.Push(&(vResult.first->Get().second));
		pwcNameBegin = nullptr;
		pwcNameEnd = nullptr;
		pwcValueBegin = nullptr;
		pwcValueEnd = nullptr;
		return true;
	};
	const auto PopPackage = [&]{
		if(vecPackageStack.GetSize() <= 1){
			eError = kErrUnexpectedPackageClose;
			return false;
		}

		vecPackageStack.Pop();
		pwcNameBegin = nullptr;
		pwcNameEnd = nullptr;
		pwcValueBegin = nullptr;
		pwcValueEnd = nullptr;
		return true;
	};
	const auto AcceptValue = [&]{
		ASSERT(!vecPackageStack.IsEmpty());

		const auto vResult = vecPackageStack.GetEnd()[-1]->Insert(Unescape(WideStringObserver(pwcNameBegin, pwcNameEnd)));
		if(!vResult.second){
//			eError = kErrDuplicateValue;
//			return false;
		}
		vResult.first->Get().second.Insert(Unescape(WideStringObserver(pwcValueBegin, pwcValueEnd)));

		pwcNameBegin = nullptr;
		pwcNameEnd = nullptr;
		pwcValueBegin = nullptr;
		pwcValueEnd = nullptr;
		return true;
	};

	do {
		const wchar_t wc = *pwcRead;

		switch(wc){
		case L'=':
			switch(eState){
			case kStNameIndent:
			case kStNameBody:
			case kStNamePadding:
				eState = kStValueIndent;
				continue;

			case kStValueIndent:
			case kStValueBody:
			case kStValPadding:
			case kStComment:
			case kStNameEscaped:
			case kStValueEscaped:
			case kStCommentEscaped:
				break;
			};
			break;

		case L'{':
			switch(eState){
			case kStNameIndent:
			case kStNameBody:
			case kStNamePadding:
				if(!PushPackage()){
					return std::make_pair(eError, pwcRead);
				}
				eState = kStNameIndent;
				continue;

			case kStValueIndent:
			case kStValueBody:
			case kStValPadding:
				if(!PushPackage()){
					return std::make_pair(eError, pwcRead);
				}
				eState = kStNameIndent;
				continue;

			case kStComment:
			case kStNameEscaped:
			case kStValueEscaped:
			case kStCommentEscaped:
				break;
			};
			break;

		case L'}':
			switch(eState){
			case kStNameIndent:
				if(!PopPackage()){
					return std::make_pair(eError, pwcRead);
				}
				// eState = kStNameIndent;
				continue;

			case kStNameBody:
			case kStNamePadding:
				return std::make_pair(kErrEquExpected, pwcRead);

			case kStValueIndent:
			case kStValueBody:
			case kStValPadding:
				if(!AcceptValue() || !PopPackage()){
					return std::make_pair(eError, pwcRead);
				}
				eState = kStNameIndent;
				continue;

			case kStComment:
			case kStNameEscaped:
			case kStValueEscaped:
			case kStCommentEscaped:
				break;
			};
			break;

		case L';':
			switch(eState){
			case kStNameIndent:
				eState = kStComment;
				continue;

			case kStNameBody:
			case kStNamePadding:
				return std::make_pair(kErrEquExpected, pwcRead);

			case kStValueIndent:
			case kStValueBody:
			case kStValPadding:
				if(!AcceptValue()){
					return std::make_pair(eError, pwcRead);
				}
				eState = kStComment;
				continue;

			case kStComment:
			case kStNameEscaped:
			case kStValueEscaped:
			case kStCommentEscaped:
				break;
			};
			break;

		case L'\n':
			switch(eState){
			case kStNameIndent:
				continue;

			case kStNameBody:
			case kStNamePadding:
				return std::make_pair(kErrEquExpected, pwcRead);

			case kStValueIndent:
			case kStValueBody:
			case kStValPadding:
				if(!AcceptValue()){
					return std::make_pair(eError, pwcRead);
				}
				eState = kStNameIndent;
				continue;

			case kStComment:
				eState = kStNameIndent;
				continue;

			case kStNameEscaped:
			case kStValueEscaped:
			case kStCommentEscaped:
				break;
			};
			break;
		}

		switch(eState){
		case kStNameIndent:
			switch(wc){
			case L' ':
			case L'\t':
				pwcNameBegin = pwcRead;
				pwcNameEnd = pwcRead;
				// eState = kStNameIndent;
				break;

			default:
				pwcNameBegin = pwcRead;
				pwcNameEnd = pwcRead + 1;
				eState = (wc == L'\\') ? kStNameEscaped : kStNameBody;
				break;
			}
			break;

		case kStNameBody:
			switch(wc){
			case L' ':
			case L'\t':
				eState = kStNamePadding;
				break;

			default:
				pwcNameEnd = pwcRead + 1;
				if(wc == L'\\'){
					eState = kStNameEscaped;
				}
				break;
			}
			break;

		case kStNamePadding:
			switch(wc){
			case L' ':
			case L'\t':
				// eState = kStNamePadding;
				break;

			default:
				pwcNameEnd = pwcRead + 1;
				eState = (wc == L'\\') ? kStNameEscaped : kStNameBody;
				break;
			}
			break;

		case kStValueIndent:
			switch(wc){
			case L' ':
			case L'\t':
				pwcValueBegin = pwcRead;
				pwcValueEnd = pwcRead;
				// eState = kStValueIndent;
				break;

			default:
				pwcValueBegin = pwcRead;
				pwcValueEnd = pwcRead + 1;
				eState = (wc == L'\\') ? kStValueEscaped : kStValueBody;
				break;
			}
			break;

		case kStValueBody:
			switch(wc){
			case L' ':
			case L'\t':
				eState = kStValPadding;
				break;

			default:
				pwcValueEnd = pwcRead + 1;
				if(wc == L'\\'){
					eState = kStValueEscaped;
				}
				break;
			}
			break;

		case kStValPadding:
			switch(wc){
			case L' ':
			case L'\t':
				// eState = kStValPadding;
				break;

			default:
				pwcValueEnd = pwcRead + 1;
				eState = (wc == L'\\') ? kStValueEscaped : kStValueBody;
				break;
			}
			break;

		case kStComment:
			if(wc == L'\\'){
				eState = kStCommentEscaped;
			}
			break;

		case kStNameEscaped:
			pwcNameEnd = pwcRead + 1;
			eState = kStNameBody;
			break;

		case kStValueEscaped:
			pwcValueEnd = pwcRead + 1;
			eState = kStValueBody;
			break;

		case kStCommentEscaped:
			eState = kStComment;
			break;
		}
	} while(++pwcRead != pwcEnd);

	switch(eState){
	case kStNameIndent:
		break;

	case kStNameBody:
	case kStNamePadding:
	case kStNameEscaped:
		return std::make_pair(kErrEquExpected, pwcRead);

	case kStValueIndent:
	case kStValueBody:
	case kStValPadding:
	case kStValueEscaped:
		if(!AcceptValue()){
			return std::make_pair(eError, pwcRead);
		}
		break;

	case kStComment:
	case kStCommentEscaped:
		break;
	};
	if(vecPackageStack.GetSize() > 1){
		return std::make_pair(kErrUnclosedPackage, pwcRead);
	}

	Swap(vTemp);
	return std::make_pair(kErrNone, pwcRead);
}
예제 #26
0
파일: url.cpp 프로젝트: jonntd/dynamica
wxInputStream *wxURL::GetInputStream()
{
    if (!m_protocol)
    {
        m_error = wxURL_NOPROTO;
        return NULL;
    }

    m_error = wxURL_NOERR;
    if (HasUserInfo())
    {
        size_t dwPasswordPos = m_userinfo.find(':');

        if (dwPasswordPos == wxString::npos)
            m_protocol->SetUser(Unescape(m_userinfo));
        else
        {
            m_protocol->SetUser(Unescape(m_userinfo(0, dwPasswordPos)));
            m_protocol->SetPassword(Unescape(m_userinfo(dwPasswordPos+1, m_userinfo.length() + 1)));
        }
    }

#if wxUSE_URL_NATIVE
    // give the native implementation to return a better stream
    // such as the native WinINet functionality under MS-Windows
    if (m_nativeImp)
    {
        wxInputStream *rc;
        rc = m_nativeImp->GetInputStream(this);
        if (rc != 0)
            return rc;
    }
    // else use the standard behaviour
#endif // wxUSE_URL_NATIVE

#if wxUSE_SOCKETS
    wxIPV4address addr;

    // m_protoinfo is NULL when we use a proxy
    if (!m_useProxy && m_protoinfo->m_needhost)
    {
        if (!addr.Hostname(m_server))
        {
            m_error = wxURL_NOHOST;
            return NULL;
        }

        addr.Service(m_port);

        if (!m_protocol->Connect(addr, true)) // Watcom needs the 2nd arg for some reason
        {
            m_error = wxURL_CONNERR;
            return NULL;
        }
    }
#endif

    wxString fullPath;

    // When we use a proxy, we have to pass the whole URL to it.
    if (m_useProxy)
        fullPath += m_url;

    if(m_path.empty())
        fullPath += wxT("/");
    else
        fullPath += m_path;

    if (HasQuery())
        fullPath += wxT("?") + m_query;

    if (HasFragment())
        fullPath += wxT("#") + m_fragment;

    wxInputStream *the_i_stream = m_protocol->GetInputStream(fullPath);

    if (!the_i_stream)
    {
        m_error = wxURL_PROTOERR;
        return NULL;
    }

    return the_i_stream;
}
예제 #27
0
static int Do_secure_work( char *jobsize, int from_server,
	char *tempfile, struct line_list *header_info )
{
	int n, len, linecount = 0, done = 0, fd, status = 0;
	char *s, *t;
	char buffer[SMALLBUFFER];
	char error[SMALLBUFFER];
	struct stat statb;

	error[0] = 0;
	if( (fd = Checkread(tempfile,&statb)) < 0 ){ 
		status = JFAIL;
		plp_snprintf( error, sizeof(error),
			"Do_secure_work: reopen of '%s' failed - %s",
				tempfile, Errormsg(errno));
		goto error;
	}

	buffer[0] = 0;
	n = 0;
	done = 0;
	linecount = 0;

	while( !done && n < (int)sizeof(buffer)-1
		&& (len = Read_fd_len_timeout( Send_query_rw_timeout_DYN, fd, buffer+n, sizeof(buffer)-1-n )) > 0 ){
		buffer[n+len] = 0;
		DEBUGF(DRECV1)("Do_secure_work: read %d - '%s'", len, buffer );
		while( !done && (s = safestrchr(buffer,'\n')) ){
			*s++ = 0;
			if( safestrlen(buffer) == 0 ){
				done = 1;
				break;
			}
			DEBUGF(DRECV1)("Do_secure_work: line [%d] '%s'", linecount, buffer );
			if( (t = strchr(buffer,'=')) ){
				*t++ = 0;
				Unescape(t);
				Set_str_value(header_info, buffer, t );
			} else {
				switch( linecount ){
					case 0:
						if( jobsize ){
							if( from_server ){
								Set_str_value(header_info,CLIENT,buffer);
							}
							done = 1;
						} else {
							Set_str_value(header_info,INPUT,buffer); break;
						}
						break;
					case 1:
						Set_str_value(header_info,CLIENT,buffer);
						done = 1;
						break;
				}
			}
			++linecount;
			memmove(buffer,s,safestrlen(s)+1);
			n = safestrlen(buffer);
		}
	}

	if( fd >= 0 ) close(fd); fd = -1;

	DEBUGFC(DRECV1)Dump_line_list("Do_secure_work - header", header_info );

	if( (status = Check_secure_perms( header_info, from_server, error, sizeof(error))) ){
		goto error;
	}
	DEBUGFC(DRECV1)Dump_line_list("Do_secure_work - header after check", header_info );


	buffer[0] = 0;
	if( jobsize ){
		if( (fd = Checkread(tempfile, &statb) ) < 0 ){
			status = JFAIL;
			plp_snprintf( error, sizeof(error),
				"Do_secure_work: reopen of '%s' for read failed - %s",
					tempfile, Errormsg(errno));
			goto error;
		}
		status = Scan_block_file( fd, error, sizeof(error), header_info );
		if( (fd = Checkwrite(tempfile,&statb,O_WRONLY|O_TRUNC,1,0)) < 0 ){
			status = JFAIL;
			plp_snprintf( error, sizeof(error),
				"Do_secure_work: reopen of '%s' for write failed - %s",
					tempfile, Errormsg(errno));
			goto error;
		}
	} else {
		if( (fd = Checkwrite(tempfile,&statb,O_WRONLY|O_TRUNC,1,0)) < 0 ){
			status = JFAIL;
			plp_snprintf( error, sizeof(error),
				"Do_secure_work: reopen of '%s' for write failed - %s",
					tempfile, Errormsg(errno));
			goto error;
		}
		if( (s = Find_str_value(header_info,INPUT)) ){
			Dispatch_input( &fd, s, "from secure link" );
		}
	}

 error:

	if( fd >= 0 ) close(fd); fd = -1;
	DEBUGF(DRECV1)("Do_secure_work: status %d, tempfile '%s', error '%s'",
		status, tempfile, error );
	if( error[0] ){
		DEBUGF(DRECV1)("Do_secure_work: updating tempfile '%s', error '%s'",
			tempfile, error );
		if( (fd = Checkwrite(tempfile,&statb,O_WRONLY|O_TRUNC,1,0)) < 0 ){
			Errorcode = JFAIL;
			logerr_die(LOG_INFO, "Do_secure_work: reopen of '%s' for write failed",
				tempfile );
		}
		Write_fd_str(fd,error);
		close(fd);
	}
	DEBUGF(DRECV1)("Do_secure_work: returning %d", status );
	return( status );
}
예제 #28
0
/*************************************************************************
 * Receive_secure() - receive a secure transfer
 *************************************************************************/
int Receive_secure( int *sock, char *input )
{
	char *printername;
	char error[SMALLBUFFER];	/* error message */
	char *authtype;
	char *cf, *s;
	char *jobsize = 0;
	char *user = 0;
	int tempfd = -1;
	int ack, status, from_server;
	struct line_list args, header_info, info;
	struct stat statb;
	char *tempfile = 0;
	const struct security *security = 0;

	Name = "RCVSEC";
	memset( error, 0, sizeof(error));
	ack = 0;
	status = 0;

	DEBUGF(DRECV1)("Receive_secure: input line '%s'", input );
	Init_line_list( &args );
	Init_line_list( &header_info );
	Init_line_list( &info );

	Split(&args,input+1,Whitespace,0,0,0,0,0,0);
	DEBUGFC(DRECV1)Dump_line_list("Receive_secure - input", &args);
	if( args.count != 5 && args.count != 4 ){
		plp_snprintf( error+1, sizeof(error)-1,
			_("bad command line '%s'"), input );
		ack = ACK_FAIL;	/* no retry, don't send again */
		status = JFAIL;
		goto error;
	}
	Check_max(&args,1);
	args.list[args.count] = 0;

	/*
     * \REQ_SECUREprintername C/F user authtype jobsize\n - receive a job
     *              0           1   2  3        4
	 */
	printername = args.list[0];
	cf = args.list[1];
	user = args.list[2];	/* user is escape encoded */
	Unescape(user);
	authtype = args.list[3];
	Unescape(authtype);
	jobsize = args.list[4];

	setproctitle( "lpd %s '%s'", Name, printername );

	Perm_check.authtype = authtype;
	from_server = 0;
	if( *cf == 'F' ){
		from_server = 1;
	}

	/* set up the authentication support information */

	if( Is_clean_name( printername ) ){
		plp_snprintf( error+1, sizeof(error)-1,
			_("bad printer name '%s'"), input );
		ack = ACK_FAIL;	/* no retry, don't send again */
		status = JFAIL;
		goto error;
	}

	Set_DYN(&Printer_DYN,printername);

	if( Setup_printer( printername, error+1, sizeof(error)-1, 0 ) ){
		if( jobsize ){
			plp_snprintf( error+1, sizeof(error)-1,
				_("bad printer '%s'"), printername );
			ack = ACK_FAIL;	/* no retry, don't send again */
			status = JFAIL;
			goto error;
		}
	} else {
		int db, dbf;

		db = Debug;
		dbf = DbgFlag;
		s = Find_str_value(&Spool_control,DEBUG);
		if(!s) s = New_debug_DYN;
		Parse_debug( s, 0 );

		if( !(DRECVMASK & DbgFlag) ){
			Debug = db;
			DbgFlag = dbf;
		} else {
			int tdb, tdbf;
			tdb = Debug;
			tdbf = DbgFlag;
			Debug = db;
			DbgFlag = dbf;
			if( Log_file_DYN ){
				tempfd = Checkwrite( Log_file_DYN, &statb,0,0,0);
				if( tempfd > 0 && tempfd != 2 ){
					dup2(tempfd,2);
					close(tempfd);
				}
				tempfd = -1;
			}
			Debug = tdb;
			DbgFlag = tdbf;
			LOGDEBUG("Receive_secure: socket fd %d", *sock);
			Dump_line_list("Receive_secure - input", &args);
		}
		DEBUGF(DRECV1)("Receive_secure: debug '%s', Debug %d, DbgFlag 0x%x",
			s, Debug, DbgFlag );
	}

	if( !(security = Fix_receive_auth(authtype, &info)) ){
		plp_snprintf( error+1, sizeof(error)-1,
			_("unsupported authentication '%s'"), authtype );
		ack = ACK_FAIL;	/* no retry, don't send again */
		status = JFAIL;
		goto error;
	}
	if( !security->server_receive ){
		plp_snprintf( error+1, sizeof(error)-1,
			_("no receive method supported for '%s'"), authtype );
		ack = ACK_FAIL;	/* no retry, don't send again */
		status = JFAIL;
		goto error;
	}


	if( jobsize ){
		double read_len;
		read_len = strtod(jobsize,0);

		DEBUGF(DRECV2)("Receive_secure: spooling_disabled %d",
			Sp_disabled(&Spool_control) );
		if( Sp_disabled(&Spool_control) ){
			plp_snprintf( error+1, sizeof(error)-1,
				_("%s: spooling disabled"), Printer_DYN );
			ack = ACK_RETRY;	/* retry */
			status = JFAIL;
			goto error;
		}
		if( Max_job_size_DYN > 0 && (read_len+1023)/1024 > Max_job_size_DYN ){
			plp_snprintf( error+1, sizeof(error)-1,
				_("%s: job size %0.0f is larger than %d K"),
				Printer_DYN, read_len, Max_job_size_DYN );
			ack = ACK_RETRY;
			status = JFAIL;
			goto error;
		} else if( !Check_space( read_len, Minfree_DYN, Spool_dir_DYN ) ){
			plp_snprintf( error+1, sizeof(error)-1,
				_("%s: insufficient file space"), Printer_DYN );
			ack = ACK_RETRY;
			status = JFAIL;
			goto error;
		}
	}

	tempfd = Make_temp_fd(&tempfile);
	close(tempfd); tempfd = -1;

	DEBUGF(DRECV1)("Receive_secure: sock %d, user '%s', jobsize '%s'",  
		*sock, user, jobsize );

	status = security->server_receive( sock, Send_job_rw_timeout_DYN,
		user, jobsize, from_server, authtype,
		&info,
		error+1, sizeof(error)-1,
		&header_info,
		security, tempfile, Do_secure_work);

 error:
	DEBUGF(DRECV1)("Receive_secure: status %d, ack %d, error '%s'",
		status, ack, error+1 );

	if( status ){
		if( ack == 0 ) ack = ACK_FAIL;
		error[0] = ack;
		DEBUGF(DRECV1)("Receive_secure: sending '%s'", error );
		(void)Link_send( ShortRemote_FQDN, sock,
			Send_query_rw_timeout_DYN, error, safestrlen(error), 0 );
		Errorcode = JFAIL;
	}

	Free_line_list( &args );
	Free_line_list( &header_info );
	Free_line_list( &info );

	close( *sock ); *sock = -1;
	Remove_tempfiles();

	if( status == 0 && jobsize ){
		/* start a new server */
		DEBUGF(DRECV1)("Receive_secure: starting server");
		if( Server_queue_name_DYN ){
			Do_queue_jobs( Server_queue_name_DYN, 0 );
		} else {
			Do_queue_jobs( Printer_DYN, 0 );
		}
	}
	cleanup(0);
}