Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions dotnet/src/dotnetframework/GxClasses/Data/GXDataCommon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2001,10 +2001,7 @@ protected override string BuildConnectionString(string datasourceName, string us
MAX_TRIES = 100; //Max Pool Size default de ado.net
else
MAX_TRIES = Convert.ToInt32(maxpoolSize);
GXLogging.Debug(log, "MAX_TRIES=" + MAX_TRIES);

return connstr;

}

#if !NETCORE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ protected override string BuildConnectionString(string datasourceName, string us
string maxpoolSize = GetParameterValue(connstr, "Max Pool Size");
if (String.IsNullOrEmpty(maxpoolSize)) MAX_TRIES = 100;
else MAX_TRIES = Convert.ToInt32(maxpoolSize);
GXLogging.Debug(log, "MAX_TRIES=" + MAX_TRIES);
return connstr;
}
public override bool AllowsDuplicateParameters
Expand Down
45 changes: 29 additions & 16 deletions dotnet/src/dotnetframework/GxMail/POP3Session.cs
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ private string getMessageUid(string response)
private void CheckLogin()
{
SendAndWaitResponse("USER " + userName, MailConstants.MAIL_ServerReplyInvalid);
SendAndWaitResponse("PASS " + password, MailConstants.MAIL_ServerReplyInvalid);
SendPrivateDataAndWaitResponse("PASS " + password, MailConstants.MAIL_ServerReplyInvalid, "PASS xxx");

count = GetIntValue("STAT");

Expand Down Expand Up @@ -534,50 +534,63 @@ private void Skip()
#endregion

#region Send Methods
private void SendPrivateDataAndWaitResponse(string cmdMsg, short errorCode, string traceMsg)
{
SendPrivateDataTCP(cmdMsg + CRLF, traceMsg);
WaitResponse(errorCode);
}


private void SendAndWaitResponse(string cmdMsg, short errorCode)
{
SendTCP(cmdMsg + CRLF);

WaitResponse(errorCode);
}
private void WaitResponse(short errorCode)
{
string response = GetResponse();
GXLogging.Debug(log,"SendAndWait Server response: " + response);
GXLogging.Debug(log, "SendAndWait Server response: " + response);
string serverResponse = response;

int firstBlank = serverResponse.IndexOf(" ");
if(firstBlank != -1)
if (firstBlank != -1)
{
serverResponse = serverResponse.Substring(firstBlank).Trim();
}
if(response.StartsWith("-ERR"))
if (response.StartsWith("-ERR"))
{
GXLogging.Error(log,"Command error, server response: " + serverResponse);
throw new GXMailException("Server replied with an error: " + serverResponse, MailConstants.MAIL_ServerRepliedErr);
GXLogging.Error(log, "Command error, server response: " + serverResponse);
throw new GXMailException("Server replied with an error: " + serverResponse, MailConstants.MAIL_ServerRepliedErr);
}
if(!response.StartsWith("+OK"))
if (!response.StartsWith("+OK"))
{
GXLogging.Error(log,"Command error, server response: " + serverResponse);
GXLogging.Error(log, "Command error, server response: " + serverResponse);
throw new GXMailException(response, errorCode);
}
}

private void SendTCP(string cmd)
{
GXLogging.Debug(log,"Command: " + cmd);
SendPrivateDataTCP(cmd, cmd);
}
private void SendPrivateDataTCP(string cmd, string traceCmd)
{
GXLogging.Debug(log, "Command: " + traceCmd);
try
{
byte[] toSend = Encoding.ASCII.GetBytes(cmd);
int sent = connection.Send(toSend);
while(sent != toSend.Length)
while (sent != toSend.Length)
{
sent += connection.Send(toSend, sent, toSend.Length - sent, SocketFlags.None);
}
}
catch(Exception exc)
catch (Exception exc)
{
GXLogging.Error(log,"Error sending command", exc);
throw new GXMailException(exc.Message, MailConstants.MAIL_ConnectionLost);
GXLogging.Error(log, "Error sending command", exc);
throw new GXMailException(exc.Message, MailConstants.MAIL_ConnectionLost);
}
}

private void SendNL(string str)
{
SendTCP(str + CRLF);
Expand Down
88 changes: 48 additions & 40 deletions dotnet/src/dotnetframework/GxMail/SMTPSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ private void CheckLogin(bool startTLS)
}
SendAndWaitResponse("AUTH LOGIN", "334", MAIL_AuthenticationError);
SendAndWaitResponse(ToBase64(userName), "334", MAIL_AuthenticationError);
SendAndWaitResponse(ToBase64(password), "235", MAIL_PasswordRefused);
SendPrivateDataAndWaitResponse(ToBase64(password), "235", MAIL_PasswordRefused, "xxx");
}
else
{
Expand Down Expand Up @@ -510,29 +510,34 @@ private void SendAndWaitResponse(string cmdMsg)
SendAndWaitResponse(cmdMsg, "2", 0);
}

private void SendAndWaitResponse(string cmdMsg, string okResponse)
{
SendAndWaitResponse(cmdMsg, okResponse, 0);
}

private void SendAndWaitResponse(string cmdMsg, string okResponse, short errorCode)
private void SendPrivateDataAndWaitResponse(string cmdMsg, string okResponse, short errorCode, string traceCmd)
{
SendPrivateDataTCP(cmdMsg + CRLF, traceCmd);
WaitResponse(okResponse, errorCode);
}

private void SendAndWaitResponse(string cmdMsg, string okResponse, short errorCode)
{
SendTCP(cmdMsg + CRLF);

string response = GetResponse();
GXLogging.Debug(log,"Server response: " + response);
if (!response.Equals(okResponse))
{
if (!response.StartsWith(okResponse))
{
SendNL("RSET");
GXLogging.Error(log,"Command error, server response: " + response);
throw new GXMailException(response, errorCode);
}
}
}

private void SendText(string text)
WaitResponse(okResponse, errorCode);

}
private void WaitResponse(string okResponse, short errorCode)
{

string response = GetResponse();
GXLogging.Debug(log, "Server response: " + response);
if (!response.Equals(okResponse))
{
if (!response.StartsWith(okResponse))
{
SendNL("RSET");
GXLogging.Error(log, "Command error, server response: " + response);
throw new GXMailException(response, errorCode);
}
}
}
private void SendText(string text)
{

StringBuilder strBuilder = new StringBuilder("");
Expand Down Expand Up @@ -624,24 +629,27 @@ private void SendEncodedNL(string cmd, Encoding encoding)

private void SendTCP(string cmd)
{
GXLogging.Debug(log,"Command: " + cmd);
try
{
byte[] toSend = Encoding.Default.GetBytes(cmd);
int sent = connection.Send(toSend);
while (sent != toSend.Length)
{
sent += connection.Send(toSend, sent, toSend.Length - sent, SocketFlags.None);
}
}
catch (Exception exc)
{
GXLogging.Error(log,"Error sending command", exc);
throw new GXMailException(exc.Message, MAIL_ConnectionLost);
}
}

private void SendRecipientList(GXMailRecipientCollection recipients)
SendPrivateDataTCP(cmd, cmd);
}
private void SendPrivateDataTCP(string cmd, string traceCmd)
{
GXLogging.Debug(log, "Command: " + traceCmd);
try
{
byte[] toSend = Encoding.Default.GetBytes(cmd);
int sent = connection.Send(toSend);
while (sent != toSend.Length)
{
sent += connection.Send(toSend, sent, toSend.Length - sent, SocketFlags.None);
}
}
catch (Exception exc)
{
GXLogging.Error(log, "Error sending command", exc);
throw new GXMailException(exc.Message, MAIL_ConnectionLost);
}
}
private void SendRecipientList(GXMailRecipientCollection recipients)
{
try
{
Expand Down