MailKit - invalid character in folder name - mailkit

MailKit is throwing the following exception when there is a folder containing ] or [ in its name:
MailKit.Net.Imap.ImapProtocolException: Syntax error in untagged STATUS response. Unexpected token: ']'
at MailKit.Net.Imap.ImapEngine.UpdateStatus(CancellationToken cancellationToken)
at MailKit.Net.Imap.ImapEngine.ProcessUntaggedResponse(CancellationToken cancellationToken)
at MailKit.Net.Imap.ImapCommand.Step()
at MailKit.Net.Imap.ImapEngine.Iterate()
at MailKit.Net.Imap.ImapEngine.Wait(ImapCommand ic)
at MailKit.Net.Imap.ImapFolder.GetSubfolders(StatusItems items, Boolean subscribedOnly, CancellationToken cancellationToken)
But the folder in question seems valid. Here is what I'm getting back from the server:
C: A00000006 LIST "" "INBOX.Trash.5454.%" RETURN (SUBSCRIBED CHILDREN STATUS (UIDVALIDITY))
S: * LIST (\HasNoChildren \UnMarked) "." INBOX.Trash.5454.2121]
S: * STATUS INBOX.Trash.5454.2121] (UIDVALIDITY 1500382965)
S: A00000006 OK List completed (0.001 + 0.000 secs).
Has anyone else encountered such a problem, it seems this is due to a limitation in MailKit?

The ']' character is supposed to be quoted but whatever IMAP server you are connecting to is obviously not properly quoting it.
If you aren't already using MailKit 1.18.1, please try upgrading to see if that fixes the problem. 1.18.1 added a work-around for a similar issue but I'm not sure if it handles it in an untagged STATUS response. If it doesn't, let me know, and I'll add the same work-around there.

Related

Trouble deploying solidity smart contract with "invalid or unexpected token" error

Trying to replicate a smart contract in a testing environment for practice. When I go to deploy the contract, I am getting "SyntaxError: Invalid or unexpected token". I've had to troubleshoot a few other problems, but can't seem to get past this one. Can anyone help?
2_deploy_contract.js
var Etheremura = artifacts.require("Etheremura");
module.exports = function(deployer) {
deployer.deploy(Etheremura, 0000000000000000000000000D86C54925E12a52a5929c167f20B989F499b3CB7), 000000000000000000000000000000000000000000000000000000000000005f);
};
C:\Users\Rexdog979\eth>truffle migrate
Compiling your contracts...
===========================
√ Fetching solc version list from solc-bin. Attempt #1
> Everything is up to date, there is nothing to compile.
Starting migrations...
======================
> Network name: 'development'
> Network id: 5777
> Block gas limit: 6721975 (0x6691b7)
2_deploy_contracts.js
=====================
C:\Users\Rexdog979\eth\migrations\2_deploy_contracts.js:4
deployer.deploy(Etheremura, 0000000000000000000000000D86C54925E12a52a5929c167f20B989F499b3CB7), 000000000000000000000000000000000000000000000000000000000000005f);
^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Invalid or unexpected token
at new Script (node:vm:99:7)
at Object.createScript (node:vm:260:10)
at Object.file (C:\Users\Rexdog979\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\require\require.js:93:1)
at Migration._load (C:\Users\Rexdog979\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\migrate\Migration.js:49:1)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at Migration.run (C:\Users\Rexdog979\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\migrate\Migration.js:212:1)
at Object.runMigrations (C:\Users\Rexdog979\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\migrate\index.js:150:1)
at Object.runFrom (C:\Users\Rexdog979\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\migrate\index.js:110:1)
at Object.run (C:\Users\Rexdog979\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\migrate\index.js:87:1)
at runMigrations (C:\Users\Rexdog979\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\commands\migrate.js:258:1)
at Object.run (C:\Users\Rexdog979\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\commands\migrate.js:223:1)
at Command.run (C:\Users\Rexdog979\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\command.js:147:1)
Truffle v5.3.6 (core: 5.3.6)
Node v16.1.0
You have a redundant closing brace ) after the second argument in the deployer.deploy() function.
It also seems that you're trying to pass an address and an unsigned integer as ABI-encoded values. However, the Truffle deploy() function accepts JS scalars - not the ABI encoded values.
So you could do something like this:
deployer.deploy(
Etheremura,
'0xD86C54925E12a52a5929c167f20B989F499b3CB7', // assuming it's an address
95 // assuming it's an integer, 5f hex == 95 decimal
);
Looking at the deploy function deployer.deploy(Etheremura, 0000000000000000000000000D86C54925E12a52a5929c167f20B989F499b3CB7), 000000000000000000000000000000000000000000000000000000000000005f); you have a unnecessary closing bracket after your address.
Also provide your address like "0xD86C54925E12a52a5929c167f20B989F499b3CB7" and value in the form of an integer. Also make sure that the address you are providing is a valid Ethereum address.

SharpSvn - Exception from whitespace in path

I'm receiving an exception from SharpSvn's client when I try to perform some operations if the specified repository sub-path has a whitespace character in its directory name, ie.
https://svn.mycompan​y.com/repos/myteambl​d/MyFolder1/My Folder 2/MyFolder3
I am able to access these paths through other applications, and SharpSvn works beautifully with non-whitespaced paths. Also, I am passing the path in as a Uri (not a string), so all spaces are automatically encoded
Here is the exception:
SharpSvn.SvnClientUnrelatedResourcesException was caught
HResult=-2146233088
Message=Unable to find repository location for 'https://svn.mycompan​y.com/repos/myteambl​d/MyFolder1/My%20Folder%202/MyFolder3' in revision 496637
Source=SharpSvn
Line=0
OperatingSystemErrorCode=0
SubversionErrorCode=195012
StackTrace:
at SharpSvn.SvnClientArgs.HandleResult(SvnClientContext client, SvnException error, Object targets) in g:\dist\src\sharpsvn\svnclientargs.cpp:line 78
at SharpSvn.SvnClientArgs.HandleResult(SvnClientContext client, svn_error_t* error, Object targets) in g:\dist\src\sharpsvn\svnclientargs.cpp:line 42
at SharpSvn.SvnClient.InternalLog(ICollection`1 targets, Uri logRoot, SvnRevision altPegRev, SvnLogArgs args, EventHandler`1 logHandler) in g:\dist\src\sharpsvn\commands\log.cpp:line 345
at SharpSvn.SvnClient.Log(Uri target, SvnLogArgs args, EventHandler`1 logHandler) in g:\dist\src\sharpsvn\commands\log.cpp:line 74
at SharpSvn.SvnClient.GetLog(Uri target, SvnLogArgs args, Collection`1& logItems) in g:\dist\src\sharpsvn\commands\log.cpp:line 402
Spaces aren't valid in URLs. Instead of you should use %20. You can easily encode your URL using Uri.EscapeUriString
This call:
var myUri="https://svn.mycompany.com/repos/myteambld/MyFolder1/My%20Folder%202/MyFolder3";
Uri.EscapeUriString(myUri);
will return:
https://svn.mycompany.com/repos/myteambld/MyFolder1/My%20Folder%202/MyFolder3

Status for connector session is: 1544 Message: Code # 0 Connector Message: Error: Cannot find Connector 'DB2'

I have a database with two agents, well there are really more than two, but two that matter right now. One works, the other does not. Both have Uselsx '*lsxlc' defined in (Options).
I have commented out everything in the failing agent except
Dim s As New NotesSession
Dim db As NotesDatabase
Dim agentLog As NotesLog
Set db = s.CurrentDatabase
'agent log
Set agentLog = New NotesLog("Customers from Aging Report - AKM")
Call agentLog.OpenNotesLog( db.server, "agentinfo.nsf" )
agentLog.LogActions = True 'Set to True/False to turn on/off action logging
agentLog.LogErrors = True 'Set to True/False to turn on/off error logging
Call agentLog.LogAction("Start Agent: GetCustomerDataBasedOnAging")
On Error Goto throwError
Dim lcses As New LCSession
Dim src As New LCConnection(COutConn)
%REM
....
%END REM
Exit Sub
throwError:
'Error code
Dim epos As String
Dim emsg As String
Dim msg As String
Dim result As String
Dim status As Integer
Dim msgcode As Long
If lcses.status <> LCSUCCESS Then
status = lcses.GetStatus (result, msgcode, msg)
Call agentLog.LogError( msgcode,"Status for connector session is: " & Cstr(status) & Chr(10) & "Message: " & msg & " Code # " & Cstr(msgcode) & Chr(10) & "Connector Message: " & result )
emsg = "Customers from Aging Report' Agent: ("+Cstr(Erl)+") "& "[" &Cstr(Err) & "] [" & Error$ & "]"
Call agentLog.LogError( Err, emsg)
Else
emsg = "Customers from Aging Report' Agent: ("+Cstr(Erl)+") "& "[" &Cstr(Err) & "] [" & Error$ & "]"
Call agentLog.LogError( Err, emsg)
End If
Resume Next
COutConn is defined as a constant with value 'DB2'
I get the following error in the agent log:
Status for connector session is: 1544
Message: Code # 0
Connector Message: Error: Cannot find Connector 'DB2'
This happens whether I use the constant COutConn, or "DB2".
The strange thing is that the other agent with the same definitions works properly. I know DB2 exists on the machine, it is i5/OS v5r4. DB2 is built in on this operating system.
What else do I need to look for?
The answer is, be sure you know which machine the agent is running on. When you right click the agent in Domino Designer, and select Run, as I did, the agent is not running on the server that the database resides on, but rather inside the Domino Designer client. that is going to be Windows or Linux depending on your workstation.
So why did the one agent work while the other did not? Well the one that worked was activated from a button in the Notes Client, and the function attached to the button used Run on Server. The server was indeed IBM i. However, in the case of the failing agent, I executed that one from within Domino Designer as mentioned above, thus no DB2 connector.
Here's to hoping someone can learn from my pain!

Download .collabdiff file from Code Collaborator

I want to be able to download patches associated with change lists in Code Collaborator using the Windows command line. These are the files you get in the web GUI if you click on External Diff. They have an extension ".collabdiff", and are in fact zipped archives containing folders for "before" and "after" of each file. I intend to use these to do a three-way merge using Subversion Merge.
My first approach was to use the Code Collaborator command line utility, e.g.
ccollab admin wget externaldiff?reviewid=%2^&changelistid=%3 > %OutputFile%
Unfortunately, it seems that this expects ASCII data only, because a lot of text appears on the screen, and there is a lot of beeping.
My next approach was to use the external link directly. To do this, I have reused a snippet of PowerShell script I found on the web:
::
:: GetCodeCollaboratorChangeList.cmd
::
:: Downloads a review change list from Code Collaborator.
::
:: %1 Code Collaborator Server
:: %2 Review Id
:: %3 Change List Id
::
#ECHO ON
SETLOCAL
SET OutputFile=%~dp0ChangeList_%2_%3.collabdiff
ECHO Creating %OutputFile%.
:: Sadly, the following line expects that ASCII text should be returned, but the URL returns binary text.
:: It beeps a little, and not much text gets redirected.
::ccollab admin wget externaldiff?reviewid=%2^&changelistid=%3 > %OutputFile%
:: So instead, we have to use our own download code.
SET URL="%1/externaldiff?reviewid=%2&changelistid=%3"
SET S=""
SET S="%S:~1,-1% $webclient = New-Object System.Net.WebClient;"
SET S="%S:~1,-1% $webclient.DownloadFile('%URL:~1,-1%','%OutputFile%');"
PowerShell.exe -ExecutionPolicy unrestricted -noprofile -command "& {%S:~1,-1%}"
EXIT /B
Sadly, I get the following error:
Exception calling "DownloadFile" with "2" argument(s): "The remote server returned an error: (500) Internal Server Error."
At line:1 char:74
+ & { $webclient = New-Object System.Net.WebClient; $webclient.DownloadFile <<<< ('http://server1/externaldiff?reviewid=8077&changelistid=52915','C:\Documents and Settings\Administrator\Desktop\ChangeList_8077_52915.collabdiff');}
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
When taking the URL and pasting it in the browser (rather than clicking on the link), you get the following page:
HTTP Status 500 -
--------------------------------------------------------------------------------
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
java.lang.NullPointerException
com.smartbear.ccollab.datamodel.DataModelUtils.getDefaultPrevVersionToDiff(DataModelUtils.java:379)
com.smartbear.ccollab.datamodel.DataModelUtils.getDefaultPrevVersionToDiff(DataModelUtils.java:351)
com.smartbear.ccollab.rpc.ExternalDiffConfigServlet.getVersionsToDiff(ExternalDiffConfigServlet.java:373)
com.smartbear.ccollab.rpc.ExternalDiffConfigServlet.service(ExternalDiffConfigServlet.java:140)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
com.smartbear.ccollab.AuthTicketFilter.doFilter(AuthTicketFilter.java:74)
com.smartbear.ccollab.CollabCleanupFilter.doFilter(CollabCleanupFilter.java:30)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.20-patched logs.
--------------------------------------------------------------------------------
Apache Tomcat/6.0.20-patched
I have tried modifying the code to modify QueryString and BaseAddress properties separately, and called .DownloadFile('/externaldiff, ...) but there was no change in the error.
Are there any suggestions as to how I can download these files?
Try:
ccollab admin wget 'diff?context=10&reviewid=REVIEWID'
Eg:
ccollab admin wget 'diff?context=10&reviewid=12345'

Asterisk: callfiles and Realtime

Since I'm using Realtime it seems that callfiles don't work properly. As a callfile is executed the phone rings as expected. But asterisk (v 1.6) hang up immediately as the call is answered.
My callfile:
Channel: SIP/1
Callerid: <123>
Context: test
Extension: 100
My Realtime-Extensions:
cont|ext|pr|App
----+---+-+---------
test|100|1|Answer
----+---+-+---------
test|100|2|SayNumber(123)
Error message on the cli:
Channel 'SIP/1-0000001' sent into invalid extension 's' in context 'default', but no invalid handler
It's wired that as I change the extension in the table above from "100" to "s" everything works fine.
Does anybody have a hint?
Update:
Unfortunately also the mv command does not solve the problem. (I also added a further line to my callfile Priority: 1.)
Here are the files:
extconfig.conf
sipusers => mysql,general,sip_users
sippeers => mysql,general,sip_users
extensions => mysql,general,extensions
sip.conf
[general]
language=en
bindport=5060
context=default
canreinvite=no
tos=throughput
nat=yes
Well, I'm not familiar with Realtime, but a posting of the generated sip.conf and extensions.conf would be helpful (at least the relevant sections).
My first instinct though is that you're using cp to copy the call files for asterisk, which is not an atomic operation (files are copied line by line), which can lead to asterisk executing a not-quite-complete call file.
Use the mv command, which is an atomic operation, and will ensure that asterisk is operating on a 100% complete call file.
The reason I suspect this is the issue is that your call file is correct, but if it starts executing with only 2 lines, by default any incoming call will go to the 's' extension of the default context, and if it reads to the third line, it will go to the 's' extension of your test context.
Weird error to be sure.