Reworked the logging to console to be simpler.

git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1680 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
Henrik Andersson 2012-11-22 07:57:38 +00:00
parent 51c17488a7
commit 91d026f52c

45
iso.c
View File

@ -247,47 +247,52 @@ iso_connect(char *server, char *username, char *domain, char *password,
if (type == RDP_NEG_FAILURE) if (type == RDP_NEG_FAILURE)
{ {
RD_BOOL retry_without_neg = False;
switch (data) switch (data)
{ {
case SSL_REQUIRED_BY_SERVER:
reason = "SSL required by server";
break;
case SSL_WITH_USER_AUTH_REQUIRED_BY_SERVER: case SSL_WITH_USER_AUTH_REQUIRED_BY_SERVER:
reason = "SSL with user authentication required by server"; reason = "SSL with user authentication required by server";
break; break;
case SSL_NOT_ALLOWED_BY_SERVER: case SSL_NOT_ALLOWED_BY_SERVER:
reason = "SSL not allowed by server"; reason = "SSL not allowed by server";
retry_without_neg = True;
break; break;
case SSL_CERT_NOT_ON_SERVER: case SSL_CERT_NOT_ON_SERVER:
reason = "The server does not have a valid authentication certificate"; reason = "no valid authentication certificate on server";
break; break;
case INCONSISTENT_FLAGS: case INCONSISTENT_FLAGS:
reason = "inconsistent flags"; reason = "inconsistent negotiation flags";
break;
case SSL_REQUIRED_BY_SERVER:
reason = "SSL required by server";
break; break;
case HYBRID_REQUIRED_BY_SERVER: case HYBRID_REQUIRED_BY_SERVER:
reason = "hybrid authentication (CredSSP) required by server"; reason = "CredSSP required by server";
break; break;
default: default:
reason = "unknown reason"; reason = "unknown reason";
} }
tcp_disconnect(); tcp_disconnect();
warning("RDP protocol negotiation failed with reason: %s (error 0x%x),\n",
reason, data);
warning("retrying without negotiation using plain RDP protocol.\n");
g_negotiate_rdp_protocol = False; if (retry_without_neg)
goto retry; {
fprintf(stderr,
"Failed to negotiate protocol, retrying with plain RDP.\n");
g_negotiate_rdp_protocol = False;
goto retry;
}
fprintf(stderr, "Failed to connect, %s.\n", reason);
return False;
} }
if (type != RDP_NEG_RSP) if (type != RDP_NEG_RSP)
{ {
tcp_disconnect(); tcp_disconnect();
error("expected RDP_NEG_RSP, got type = 0x%x\n", type); error("Expected RDP_NEG_RSP, got type = 0x%x\n", type);
warning("retrying without negotiation using plain RDP protocol.\n"); return False;
g_negotiate_rdp_protocol = False;
goto retry;
} }
/* handle negotiation response */ /* handle negotiation response */
@ -300,6 +305,7 @@ iso_connect(char *server, char *username, char *domain, char *password,
} }
/* do not use encryption when using TLS */ /* do not use encryption when using TLS */
g_encryption = False; g_encryption = False;
fprintf(stderr, "Connection established using SSL.\n");
} }
#ifdef WITH_CREDSSP #ifdef WITH_CREDSSP
else if (data == PROTOCOL_HYBRID) else if (data == PROTOCOL_HYBRID)
@ -311,13 +317,18 @@ iso_connect(char *server, char *username, char *domain, char *password,
} }
/* do not use encryption when using TLS */ /* do not use encryption when using TLS */
fprintf(stderr, "Connection established using CredSSP.\n");
g_encryption = False; g_encryption = False;
} }
#endif #endif
else if (data == PROTOCOL_RDP)
{
fprintf(stderr, "Connection established using plain RDP.\n");
}
else if (data != PROTOCOL_RDP) else if (data != PROTOCOL_RDP)
{ {
tcp_disconnect(); tcp_disconnect();
error("unexpected protocol in neqotiation response, got data = 0x%x.\n", error("Unexpected protocol in negotiation response, got data = 0x%x.\n",
data); data);
return False; return False;
} }