freerdp: fix improper .rdp file parsing

This commit is contained in:
Marc-André Moreau 2014-05-10 17:28:34 -04:00
parent b8d60d5715
commit 5e97757939
4 changed files with 30 additions and 6 deletions

View File

@ -779,18 +779,18 @@ BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file, rdpSettings*
if (~file->SessionBpp)
freerdp_set_param_uint32(settings, FreeRDP_ColorDepth, file->SessionBpp);
if (~file->ConnectToConsole)
freerdp_set_param_uint32(settings, FreeRDP_ConsoleSession, file->ConnectToConsole);
freerdp_set_param_bool(settings, FreeRDP_ConsoleSession, file->ConnectToConsole);
if (~file->AdministrativeSession)
freerdp_set_param_uint32(settings, FreeRDP_ConsoleSession, file->AdministrativeSession);
freerdp_set_param_bool(settings, FreeRDP_ConsoleSession, file->AdministrativeSession);
if (~file->NegotiateSecurityLayer)
freerdp_set_param_uint32(settings, FreeRDP_NegotiateSecurityLayer, file->NegotiateSecurityLayer);
freerdp_set_param_bool(settings, FreeRDP_NegotiateSecurityLayer, file->NegotiateSecurityLayer);
if (~file->EnableCredSSPSupport)
freerdp_set_param_uint32(settings, FreeRDP_NlaSecurity, file->EnableCredSSPSupport);
freerdp_set_param_bool(settings, FreeRDP_NlaSecurity, file->EnableCredSSPSupport);
if (~((size_t) file->AlternateShell))
freerdp_set_param_string(settings, FreeRDP_AlternateShell, file->AlternateShell);
if (~((size_t) file->ShellWorkingDirectory))
freerdp_set_param_string(settings, FreeRDP_ShellWorkingDirectory, file->ShellWorkingDirectory);
if (~file->ScreenModeId)
{
/**

View File

@ -597,6 +597,7 @@ typedef struct _RDPDR_PARALLEL RDPDR_PARALLEL;
#define FreeRDP_RestrictedAdminModeRequired 1097
#define FreeRDP_AuthenticationServiceClass 1098
#define FreeRDP_DisableCredentialsDelegation 1099
#define FreeRDP_AuthenticationLevel 1100
#define FreeRDP_MstscCookieMode 1152
#define FreeRDP_CookieMaxLength 1153
#define FreeRDP_PreconnectionId 1154
@ -952,7 +953,8 @@ struct rdp_settings
ALIGN64 BOOL RestrictedAdminModeRequired; /* 1097 */
ALIGN64 char* AuthenticationServiceClass; /* 1098 */
ALIGN64 BOOL DisableCredentialsDelegation; /* 1099 */
UINT64 padding1152[1152 - 1100]; /* 1100 */
ALIGN64 BOOL AuthenticationLevel; /* 1100 */
UINT64 padding1152[1152 - 1101]; /* 1101 */
/* Connection Cookie */
ALIGN64 BOOL MstscCookieMode; /* 1152 */

View File

@ -822,6 +822,10 @@ BOOL freerdp_get_param_bool(rdpSettings* settings, int id)
return settings->DisableCredentialsDelegation;
break;
case FreeRDP_AuthenticationLevel:
return settings->AuthenticationLevel;
break;
case FreeRDP_MstscCookieMode:
return settings->MstscCookieMode;
break;
@ -1091,6 +1095,7 @@ BOOL freerdp_get_param_bool(rdpSettings* settings, int id)
break;
default:
fprintf(stderr, "freerdp_get_param_bool: unknown id: %d\n", id);
return -1;
break;
}
@ -1298,6 +1303,10 @@ int freerdp_set_param_bool(rdpSettings* settings, int id, BOOL param)
settings->DisableCredentialsDelegation = param;
break;
case FreeRDP_AuthenticationLevel:
settings->AuthenticationLevel = param;
break;
case FreeRDP_MstscCookieMode:
settings->MstscCookieMode = param;
break;
@ -1567,6 +1576,7 @@ int freerdp_set_param_bool(rdpSettings* settings, int id, BOOL param)
break;
default:
fprintf(stderr, "freerdp_set_param_bool: unknown id %d (param = %d)\n", id, param);
return -1;
break;
}
@ -1590,6 +1600,7 @@ int freerdp_get_param_int(rdpSettings* settings, int id)
break;
default:
fprintf(stderr, "freerdp_get_param_int: unknown id: %d\n", id);
return 0;
break;
}
@ -1610,6 +1621,7 @@ int freerdp_set_param_int(rdpSettings* settings, int id, int param)
break;
default:
fprintf(stderr, "freerdp_set_param_int: unknown id %d (param = %d)\n", id, param);
return -1;
break;
}
@ -1920,6 +1932,7 @@ UINT32 freerdp_get_param_uint32(rdpSettings* settings, int id)
break;
default:
fprintf(stderr, "freerdp_get_param_uint32: unknown id: %d\n", id);
return 0;
break;
}
@ -2228,6 +2241,7 @@ int freerdp_set_param_uint32(rdpSettings* settings, int id, UINT32 param)
break;
default:
fprintf(stderr, "freerdp_set_param_uint32: unknown id %d (param = %u)\n", id, param);
return -1;
break;
}
@ -2247,6 +2261,7 @@ UINT64 freerdp_get_param_uint64(rdpSettings* settings, int id)
break;
default:
fprintf(stderr, "freerdp_get_param_uint64: unknown id: %d\n", id);
return -1;
break;
}
@ -2263,6 +2278,7 @@ int freerdp_set_param_uint64(rdpSettings* settings, int id, UINT64 param)
break;
default:
fprintf(stderr, "freerdp_set_param_uint64: unknown id %d (param = %u)\n", id, (UINT32) param);
return -1;
break;
}
@ -2438,6 +2454,7 @@ char* freerdp_get_param_string(rdpSettings* settings, int id)
break;
default:
fprintf(stderr, "freerdp_get_param_string: unknown id: %d\n", id);
return NULL;
break;
}
@ -2650,6 +2667,7 @@ int freerdp_set_param_string(rdpSettings* settings, int id, const char* param)
break;
default:
fprintf(stderr, "freerdp_set_param_string: unknown id %d (param = %s)\n", id, param);
return -1;
break;
}
@ -2669,6 +2687,7 @@ double freerdp_get_param_double(rdpSettings* settings, int id)
break;
default:
fprintf(stderr, "freerdp_get_param_double: unknown id: %d\n", id);
return 0;
break;
}

View File

@ -263,6 +263,8 @@ rdpSettings* freerdp_settings_new(DWORD flags)
settings->Authentication = TRUE;
settings->AuthenticationOnly = FALSE;
settings->CredentialsFromStdin = FALSE;
settings->DisableCredentialsDelegation = FALSE;
settings->AuthenticationLevel = 2;
settings->ChannelCount = 0;
settings->ChannelDefArraySize = 32;
@ -629,6 +631,7 @@ rdpSettings* freerdp_settings_clone(rdpSettings* settings)
_settings->NegotiateSecurityLayer = settings->NegotiateSecurityLayer; /* 1096 */
_settings->RestrictedAdminModeRequired = settings->RestrictedAdminModeRequired; /* 1097 */
_settings->DisableCredentialsDelegation = settings->DisableCredentialsDelegation; /* 1099 */
_settings->AuthenticationLevel = settings->AuthenticationLevel; /* 1100 */
_settings->MstscCookieMode = settings->MstscCookieMode; /* 1152 */
_settings->SendPreconnectionPdu = settings->SendPreconnectionPdu; /* 1156 */
_settings->IgnoreCertificate = settings->IgnoreCertificate; /* 1408 */