Author: akhaldi
Date: Sun Sep 28 11:18:16 2014
New Revision: 64362
URL: http://svn.reactos.org/svn/reactos?rev=64362&view=rev
Log:
[MSTSC]
* Partial sync with rdesktop-ce to fix Windows 2008 R2 server login.
CORE-8561 #resolve #comment Should be fixed in r64362. Please retest.
Modified:
trunk/reactos/base/applications/mstsc/constants.h
trunk/reactos/base/applications/mstsc/secure.c
Modified: trunk/reactos/base/applications/mstsc/constants.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mstsc/co…
==============================================================================
--- trunk/reactos/base/applications/mstsc/constants.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mstsc/constants.h [iso-8859-1] Sun Sep 28 11:18:16 2014
@@ -2,7 +2,7 @@
rdesktop: A Remote Desktop Protocol client.
Miscellaneous protocol constants
Copyright (C) Matthew Chapman 1999-2005
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
@@ -13,9 +13,9 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* TCP port for Remote Desktop Protocol */
@@ -60,10 +60,11 @@
#define MCS_USERCHANNEL_BASE 1001
/* RDP secure transport constants */
-#define SEC_RANDOM_SIZE 32
-#define SEC_MODULUS_SIZE 64
-#define SEC_PADDING_SIZE 8
-#define SEC_EXPONENT_SIZE 4
+#define SEC_RANDOM_SIZE 32
+#define SEC_MODULUS_SIZE 64
+#define SEC_MAX_MODULUS_SIZE 256
+#define SEC_PADDING_SIZE 8
+#define SEC_EXPONENT_SIZE 4
#define SEC_CLIENT_RANDOM 0x0001
#define SEC_ENCRYPT 0x0008
Modified: trunk/reactos/base/applications/mstsc/secure.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mstsc/se…
==============================================================================
--- trunk/reactos/base/applications/mstsc/secure.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mstsc/secure.c [iso-8859-1] Sun Sep 28 11:18:16 2014
@@ -13,9 +13,9 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "precomp.h"
@@ -56,7 +56,7 @@
ssl_mod_exp(char* out, int out_len, char* in, int in_len,
char* mod, int mod_len, char* exp, int exp_len);
-extern char g_hostname[];
+extern char g_hostname[16];
extern int g_width;
extern int g_height;
extern unsigned int g_keylayout;
@@ -77,13 +77,14 @@
static void * rc4_encrypt_key = 0;
//static RSA *server_public_key;
static void * server_public_key;
+static uint32 server_public_key_len;
static uint8 sec_sign_key[16];
static uint8 sec_decrypt_key[16];
static uint8 sec_encrypt_key[16];
static uint8 sec_decrypt_update_key[16];
static uint8 sec_encrypt_update_key[16];
-static uint8 sec_crypted_random[SEC_MODULUS_SIZE];
+static uint8 sec_crypted_random[SEC_MAX_MODULUS_SIZE];
uint16 g_server_rdp_version = 0;
@@ -263,7 +264,7 @@
ssl_md5_transform(md5, (char *)pad_92, 48);
ssl_md5_transform(md5, (char *)shasig, 20);
ssl_md5_complete(md5, (char *)md5sig);
- ssl_md5_info_delete(md5);
+ ssl_md5_info_delete(md5);
memcpy(signature, md5sig, siglen);
}
@@ -347,16 +348,32 @@
/* Perform an RSA public key encryption operation */
static void
-sec_rsa_encrypt(uint8 * out, uint8 * in, int len, uint8 * modulus, uint8 * exponent)
+//sec_rsa_encrypt(uint8 * out, uint8 * in, int len, uint8 * modulus, uint8 * exponent)
+sec_rsa_encrypt(uint8 * out, uint8 * in, int len, uint32 modulus_size, uint8 * modulus, uint8 * exponent)
{
ssl_mod_exp((char *)out, 64, (char *)in, 32, (char *)modulus, 64, (char *)exponent, 4);
+/*
+ssl_mod_exp(out, 64, in, 32, modulus, 64, exponent, 4);
+
+ssl_mod_exp(char* out, int out_len, char* in, int in_len,
+ char* mod, int mod_len, char* exp, int exp_len)
+
+e = (DIGIT_T*)l_exp;
+x = (DIGIT_T*)l_in;
+y = (DIGIT_T*)l_out;
+m = (DIGIT_T*)l_mod;
+
+*/
+
+ //BN_CTX *ctx;
+
/*
BN_CTX *ctx;
BIGNUM mod, exp, x, y;
- uint8 inr[SEC_MODULUS_SIZE];
+ uint8 inr[SEC_MAX_MODULUS_SIZE];
int outlen;
- reverse(modulus, SEC_MODULUS_SIZE);
+ reverse(modulus, modulus_size);
reverse(exponent, SEC_EXPONENT_SIZE);
memcpy(inr, in, len);
reverse(inr, len);
@@ -367,14 +384,14 @@
BN_init(&x);
BN_init(&y);
- BN_bin2bn(modulus, SEC_MODULUS_SIZE, &mod);
+ BN_bin2bn(modulus, modulus_size, &mod);
BN_bin2bn(exponent, SEC_EXPONENT_SIZE, &exp);
BN_bin2bn(inr, len, &x);
BN_mod_exp(&y, &x, &exp, &mod, ctx);
outlen = BN_bn2bin(&y, out);
reverse(out, outlen);
- if (outlen < SEC_MODULUS_SIZE)
- memset(out + outlen, 0, SEC_MODULUS_SIZE - outlen);
+ if (outlen < modulus_size)
+ memset(out + outlen, 0, modulus_size - outlen);
BN_free(&y);
BN_clear_free(&x);
@@ -440,14 +457,14 @@
static void
sec_establish_key(void)
{
- uint32 length = SEC_MODULUS_SIZE + SEC_PADDING_SIZE;
+ uint32 length = server_public_key_len + SEC_PADDING_SIZE;
uint32 flags = SEC_CLIENT_RANDOM;
STREAM s;
- s = sec_init(flags, 76);
+ s = sec_init(flags, length+4);
out_uint32_le(s, length);
- out_uint8p(s, sec_crypted_random, SEC_MODULUS_SIZE);
+ out_uint8p(s, sec_crypted_random, server_public_key_len);
out_uint8s(s, SEC_PADDING_SIZE);
s_mark_end(s);
@@ -559,16 +576,18 @@
}
in_uint32_le(s, modulus_len);
- if (modulus_len != SEC_MODULUS_SIZE + SEC_PADDING_SIZE)
- {
- error("modulus len 0x%x\n", modulus_len);
+ modulus_len -= SEC_PADDING_SIZE;
+ if ((modulus_len < 64) || (modulus_len > SEC_MAX_MODULUS_SIZE))
+ {
+ error("Bad server public key size (%u bits)\n", modulus_len*8);
return False;
}
in_uint8s(s, 8); /* modulus_bits, unknown */
in_uint8p(s, *exponent, SEC_EXPONENT_SIZE);
- in_uint8p(s, *modulus, SEC_MODULUS_SIZE);
+ in_uint8p(s, *modulus, modulus_len);
in_uint8s(s, SEC_PADDING_SIZE);
+ server_public_key_len = modulus_len;
return s_check(s);
}
@@ -740,10 +759,10 @@
static void
sec_process_crypt_info(STREAM s)
{
- uint8 *server_random, *modulus = NULL, *exponent = NULL;
+ uint8 *server_random, *modulus, *exponent;
uint8 client_random[SEC_RANDOM_SIZE];
uint32 rc4_key_size;
- uint8 inr[SEC_MODULUS_SIZE];
+ //uint8 inr[SEC_MODULUS_SIZE];
if (!sec_parse_crypt_info(s, &rc4_key_size, &server_random, &modulus, &exponent))
{
@@ -754,15 +773,14 @@
DEBUG(("Generating client random\n"));
/* Generate a client random, and hence determine encryption keys */
/* This is what the MS client do: */
- memset(inr, 0, SEC_RANDOM_SIZE);
+ //memset(inr, 0, SEC_RANDOM_SIZE);
/* *ARIGL!* Plaintext attack, anyone?
- I tried doing:
- generate_random(inr);
- ..but that generates connection errors now and then (yes,
- "now and then". Something like 0 to 3 attempts needed before a
- successful connection. Nice. Not!
- */
-
+ I tried doing:
+ generate_random(inr);
+ ..but that generates connection errors now and then (yes,
+ "now and then". Something like 0 to 3 attempts needed before a
+ successful connection. Nice. Not!
+ */
generate_random(client_random);
if (NULL != server_public_key)
{ /* Which means we should use
@@ -783,7 +801,7 @@
else
{ /* RDP4-style encryption */
sec_rsa_encrypt(sec_crypted_random,
- client_random, SEC_RANDOM_SIZE, modulus, exponent);
+ client_random, SEC_RANDOM_SIZE, server_public_key_len, modulus, exponent);
}
sec_generate_keys(client_random, server_random, rc4_key_size);
}
Author: ekohl
Date: Sun Sep 28 09:19:20 2014
New Revision: 64361
URL: http://svn.reactos.org/svn/reactos?rev=64361&view=rev
Log:
[MC]
- Fix service manager message ids. Message 7004 does not exist.
- Add missing service manager messages.
Modified:
trunk/reactos/include/reactos/mc/neteventmsg.mc
Modified: trunk/reactos/include/reactos/mc/neteventmsg.mc
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/mc/neteven…
==============================================================================
--- trunk/reactos/include/reactos/mc/neteventmsg.mc [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/mc/neteventmsg.mc [iso-8859-1] Sun Sep 28 09:19:20 2014
@@ -180,7 +180,7 @@
The %1 service depends on the following nonexistent service: %2
.
-MessageId=7004
+MessageId=7005
Severity=Error
Facility=System
SymbolicName=EVENT_CALL_TO_FUNCTION_FAILED
@@ -188,7 +188,7 @@
The %1 call failed with the following error: %n%2
.
-MessageId=7005
+MessageId=7006
Severity=Error
Facility=System
SymbolicName=EVENT_CALL_TO_FUNCTION_FAILED_II
@@ -196,7 +196,7 @@
The %1 call failed for %2 with the following error: %n%3
.
-MessageId=7006
+MessageId=7007
Severity=Error
Facility=System
SymbolicName=EVENT_REVERTED_TO_LASTKNOWNGOOD
@@ -204,7 +204,7 @@
The system reverted to its last known good configuration. The system is restarting....
.
-MessageId=7007
+MessageId=7008
Severity=Error
Facility=System
SymbolicName=EVENT_BAD_ACCOUNT_NAME
@@ -212,7 +212,7 @@
No backslash is in the account name.
.
-MessageId=7008
+MessageId=7009
Severity=Error
Facility=System
SymbolicName=EVENT_CONNECTION_TIMEOUT
@@ -220,7 +220,7 @@
Timeout (%1 milliseconds) waiting for the %2 service to connect.
.
-MessageId=7009
+MessageId=7010
Severity=Error
Facility=System
SymbolicName=EVENT_READFILE_TIMEOUT
@@ -228,7 +228,7 @@
Timeout (%1 milliseconds) waiting for ReadFile.
.
-MessageId=7010
+MessageId=7011
Severity=Error
Facility=System
SymbolicName=EVENT_TRANSACT_TIMEOUT
@@ -236,7 +236,7 @@
Timeout (%1 milliseconds) waiting for a transaction response from the %2 service.
.
-MessageId=7011
+MessageId=7012
Severity=Error
Facility=System
SymbolicName=EVENT_TRANSACT_INVALID
@@ -244,7 +244,7 @@
Message returned in transaction has incorrect size.
.
-MessageId=7012
+MessageId=7013
Severity=Error
Facility=System
SymbolicName=EVENT_FIRST_LOGON_FAILED
@@ -252,7 +252,7 @@
Logon attempt with current password failed with the following error: %n%1
.
-MessageId=7013
+MessageId=7014
Severity=Error
Facility=System
SymbolicName=EVENT_SECOND_LOGON_FAILED
@@ -260,7 +260,7 @@
Second logon attempt with old password also failed with the following error: %n%1
.
-MessageId=7014
+MessageId=7015
Severity=Error
Facility=System
SymbolicName=EVENT_INVALID_DRIVER_DEPENDENCY
@@ -268,7 +268,7 @@
Boot-start or system-start driver (%1) must not depend on a service.
.
-MessageId=7015
+MessageId=7016
Severity=Error
Facility=System
SymbolicName=EVENT_BAD_SERVICE_STATE
@@ -276,7 +276,7 @@
The %1 service has reported an invalid current state %2.
.
-MessageId=7016
+MessageId=7017
Severity=Error
Facility=System
SymbolicName=EVENT_CIRCULAR_DEPENDENCY_DEMAND
@@ -284,7 +284,7 @@
Detected circular dependencies demand starting %1.
.
-MessageId=7017
+MessageId=7018
Severity=Error
Facility=System
SymbolicName=EVENT_CIRCULAR_DEPENDENCY_AUTO
@@ -292,7 +292,7 @@
Detected circular dependencies auto-starting services.
.
-MessageId=7018
+MessageId=7019
Severity=Error
Facility=System
SymbolicName=EVENT_DEPEND_ON_LATER_SERVICE
@@ -300,7 +300,7 @@
Circular dependency: The %1 service depends on a service in a group which starts later.
.
-MessageId=7019
+MessageId=7020
Severity=Error
Facility=System
SymbolicName=EVENT_DEPEND_ON_LATER_GROUP
@@ -308,7 +308,7 @@
Circular dependency: The %1 service depends on a group which starts later.
.
-MessageId=7020
+MessageId=7021
Severity=Error
Facility=System
SymbolicName=EVENT_SEVERE_SERVICE_FAILED
@@ -316,7 +316,7 @@
About to revert to the last known good configuration because the %1 service failed to start.
.
-MessageId=7021
+MessageId=7022
Severity=Error
Facility=System
SymbolicName=EVENT_SERVICE_START_HUNG
@@ -324,7 +324,7 @@
The %1 service hung on starting.
.
-MessageId=7022
+MessageId=7023
Severity=Error
Facility=System
SymbolicName=EVENT_SERVICE_EXIT_FAILED
@@ -332,7 +332,7 @@
The %1 service terminated with the following error: %n%2
.
-MessageId=7023
+MessageId=7024
Severity=Error
Facility=System
SymbolicName=EVENT_SERVICE_EXIT_FAILED_SPECIFIC
@@ -340,7 +340,7 @@
The %1 service terminated with service-specific error %2.
.
-MessageId=7024
+MessageId=7025
Severity=Error
Facility=System
SymbolicName=EVENT_SERVICE_START_AT_BOOT_FAILED
@@ -348,7 +348,7 @@
At least one service or driver failed during system startup. Use Event Viewer to examine the event log for details.
.
-MessageId=7025
+MessageId=7026
Severity=Error
Facility=System
SymbolicName=EVENT_BOOT_SYSTEM_DRIVERS_FAILED
@@ -356,7 +356,7 @@
The following boot-start or system-start driver(s) failed to load: %1
.
-MessageId=7026
+MessageId=7027
Severity=Error
Facility=System
SymbolicName=EVENT_RUNNING_LASTKNOWNGOOD
@@ -364,7 +364,7 @@
ReactOS could not be started as configured. A previous working configuration was used instead.
.
-MessageId=7027
+MessageId=7028
Severity=Error
Facility=System
SymbolicName=EVENT_TAKE_OWNERSHIP
@@ -372,7 +372,7 @@
The %1 Registry key denied access to SYSTEM account programs so the Service Control Manager took ownership of the Registry key.
.
-MessageId=7028
+MessageId=7029
Severity=Error
Facility=System
SymbolicName=TITLE_SC_MESSAGE_BOX
@@ -380,7 +380,7 @@
Service Control Manager %0
.
-MessageId=7029
+MessageId=7030
Severity=Error
Facility=System
SymbolicName=EVENT_SERVICE_NOT_INTERACTIVE
@@ -388,7 +388,7 @@
The %1 service is marked as an interactive service. However, the system is configured to not allow interactive services. This service may not function properly.
.
-MessageId=7030
+MessageId=7031
Severity=Error
Facility=System
SymbolicName=EVENT_SERVICE_CRASH
@@ -396,7 +396,7 @@
The %1 service terminated unexpectedly. It has done this %2 time(s). The following corrective action will be taken in %3 milliseconds: %5.
.
-MessageId=7031
+MessageId=7032
Severity=Error
Facility=System
SymbolicName=EVENT_SERVICE_RECOVERY_FAILED
@@ -404,7 +404,7 @@
The Service Control Manager tried to take a corrective action (%2) after the unexpected termination of the %3 service, but this action failed with the following error: %n%4
.
-MessageId=7032
+MessageId=7033
Severity=Error
Facility=System
SymbolicName=EVENT_SERVICE_SCESRV_FAILED
@@ -414,31 +414,31 @@
system is restarting...
.
-MessageId=7033
+MessageId=7034
Severity=Error
Facility=System
SymbolicName=EVENT_SERVICE_CRASH_NO_ACTION
Language=English
The %1 service terminated unexpectedly. It has done this %2 time(s).
-.
-
-MessageId=7034
-Severity=Informational
-Facility=System
-SymbolicName=EVENT_SERVICE_CONTROL_SUCCESS
-Language=English
-The %1 service was successfully sent a %2 control.
.
MessageId=7035
Severity=Informational
Facility=System
+SymbolicName=EVENT_SERVICE_CONTROL_SUCCESS
+Language=English
+The %1 service was successfully sent a %2 control.
+.
+
+MessageId=7036
+Severity=Informational
+Facility=System
SymbolicName=EVENT_SERVICE_STATUS_SUCCESS
Language=English
-Service Control Manager %0
-.
-
-MessageId=7036
+The %1 service entered the %2 state.
+.
+
+MessageId=7037
Severity=Error
Facility=System
SymbolicName=EVENT_SERVICE_CONFIG_BACKOUT_FAILED
@@ -451,7 +451,7 @@
properly, use the Services snap-in in Microsoft Management Console (MMC).
.
-MessageId=7037
+MessageId=7038
Severity=Error
Facility=System
SymbolicName=EVENT_FIRST_LOGON_FAILED_II
@@ -462,6 +462,65 @@
Console (MMC).
.
+MessageId=7039
+Severity=Warning
+Facility=System
+SymbolicName=EVENT_SERVICE_DIFFERENT_PID_CONNECTED
+Language=English
+A service process other than the one launched by the Service Control Manager
+connected when starting the %1 service. The Service Control Manager launched
+process %2 and process %3 connected instead.%n%n
+
+Note that if this service is configured to start under a debugger, this behavior is expected.
+.
+
+MessageId=7040
+Severity=Informational
+Facility=System
+SymbolicName=EVENT_SERVICE_START_TYPE_CHANGED
+Language=English
+The start type of the %1 service was changed from %2 to %3.
+.
+
+MessageId=7041
+Severity=Error
+Facility=System
+SymbolicName=EVENT_SERVICE_LOGON_TYPE_NOT_GRANTED
+Language=English
+The %1 service was unable to log on as %2 with the currently configured password due to the following error:%n
+Logon failure: the user has not been granted the requested logon type at this computer.%n%n
+Service: %1%n
+Domain and account: %2%n%n
+This service account does not have the necessary user right "Log on as a service."%n%n
+User Action%n%n
+Assign "Log on as a service" to the service account on this computer. You can
+use Local Security Settings (Secpol.msc) to do this. If this computer is a
+node in a cluster, check that this user right is assigned to the Cluster
+service account on all nodes in the cluster.%n%n
+If you have already assigned this user right to the service account, and the
+user right appears to be removed, a Group Policy object associated with this
+node might be removing the right. Check with your domain administrator to find
+out if this is happening.
+.
+
+MessageId=7042
+Severity=Informational
+Facility=System
+SymbolicName=EVENT_SERVICE_STOP_SUCCESS_WITH_REASON
+Language=English
+The %1 service was successfully sent a %2 control.%n%n
+The reason specified was: %3 [%4]%n%n
+Comment: %5
+.
+
+MessageId=7043
+Severity=Error
+Facility=System
+SymbolicName=EVENT_SERVICE_SHUTDOWN_FAILED
+Language=English
+The %1 service did not shut down properly after receiving a preshutdown control.
+.
+
;
; transport events 9000-9499