From 730b6f02c42a8315b5ea744a4f4a60bc6570b438 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Thu, 29 Nov 2018 18:13:31 +0100 Subject: [PATCH] Fixed glitches with certificate dialog. --- client/Mac/CMakeLists.txt | 4 +- client/Mac/CertificateDialog.h | 4 + client/Mac/CertificateDialog.m | 12 +- client/Mac/CertificateDialog.xib | 121 ++++--- client/Mac/MRDPView.m | 36 +- client/Mac/cli/MainMenu.xib | 749 +++++++-------------------------------- 6 files changed, 230 insertions(+), 696 deletions(-) diff --git a/client/Mac/CMakeLists.txt b/client/Mac/CMakeLists.txt index 94d7775..b3eb591 100644 --- a/client/Mac/CMakeLists.txt +++ b/client/Mac/CMakeLists.txt @@ -30,7 +30,9 @@ set(MACOSX_BUNDLE_SHORT_VERSION_STRING ${FREERDP_VERSION}) set(MACOSX_BUNDLE_BUNDLE_VERSION ${FREERDP_VERSION}) set(MACOSX_BUNDLE_COPYRIGHT "Copyright 2013-${VERSION_YEAR}. All Rights Reserved.") -set(${MODULE_PREFIX}_XIBS PasswordDialog.xib) +set(${MODULE_PREFIX}_XIBS + CertificateDialog.xib + PasswordDialog.xib) set(${MODULE_PREFIX}_SOURCES "") diff --git a/client/Mac/CertificateDialog.h b/client/Mac/CertificateDialog.h index d89cf25..2fccbcb 100644 --- a/client/Mac/CertificateDialog.h +++ b/client/Mac/CertificateDialog.h @@ -27,16 +27,19 @@ NSTextField* textSubject; NSTextField* textIssuer; NSTextField* textFingerprint; + NSTextField* textMismatch; NSTextField* messageLabel; NSString* serverHostname; BOOL hostMismatch; + BOOL changed; int result; } @property(retain) IBOutlet NSTextField* textCommonName; @property(retain) IBOutlet NSTextField* textSubject; @property(retain) IBOutlet NSTextField* textIssuer; @property(retain) IBOutlet NSTextField* textFingerprint; +@property(retain) IBOutlet NSTextField* textMismatch; @property(retain) IBOutlet NSTextField* messageLabel; - (IBAction)onAccept:(NSObject*)sender; @@ -49,6 +52,7 @@ @property(retain) NSString* issuer; @property(retain) NSString* fingerprint; @property BOOL hostMismatch; +@property BOOL changed; @property(readonly) int result; - (int) runModal:(NSWindow*)mainWindow; diff --git a/client/Mac/CertificateDialog.m b/client/Mac/CertificateDialog.m index 2495405..450b90f 100644 --- a/client/Mac/CertificateDialog.m +++ b/client/Mac/CertificateDialog.m @@ -42,6 +42,8 @@ @synthesize issuer; @synthesize subject; @synthesize hostMismatch; +@synthesize changed; +@synthesize result; - (id)init { @@ -53,9 +55,17 @@ [super windowDidLoad]; // Implement this method to handle any initialization after your window controller's window has been loaded from its nib file. [self.window setTitle:self.serverHostname]; - [self.messageLabel setStringValue:[NSString stringWithFormat:@"Certificate for %@", + if (self.changed) + [self.messageLabel setStringValue:[NSString stringWithFormat:@"Changed certificate for %@", self.serverHostname]]; + else + [self.messageLabel setStringValue:[NSString stringWithFormat:@"New Certificate for %@", + self.serverHostname]]; + if (!self.hostMismatch) + [self.textMismatch setStringValue:[NSString stringWithFormat:@"NOTE: The server name matches the certificate, good."]]; + else + [self.textMismatch setStringValue:[NSString stringWithFormat:@"ATTENTION: The common name does not match the server name!"]]; [self.textCommonName setStringValue:self.commonName]; [self.textFingerprint setStringValue:self.fingerprint]; [self.textIssuer setStringValue:self.issuer]; diff --git a/client/Mac/CertificateDialog.xib b/client/Mac/CertificateDialog.xib index 27f215d..b9da883 100644 --- a/client/Mac/CertificateDialog.xib +++ b/client/Mac/CertificateDialog.xib @@ -8,11 +8,12 @@ - - - + + + + @@ -26,38 +27,12 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -77,7 +52,7 @@ Gw + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - diff --git a/client/Mac/MRDPView.m b/client/Mac/MRDPView.m index 52b333b..24e8c79 100644 --- a/client/Mac/MRDPView.m +++ b/client/Mac/MRDPView.m @@ -1030,27 +1030,45 @@ DWORD mac_verify_certificate(freerdp* instance, const char* common_name, const c mfContext* mfc = (mfContext*) instance->context; MRDPView* view = (MRDPView*) mfc->view; CertificateDialog* dialog = [CertificateDialog new]; - dialog.serverHostname = [NSString stringWithCString:subject encoding: - NSUTF8StringEncoding];; + dialog.serverHostname = [NSString stringWithFormat:@"TODO: The server name we connect to."]; dialog.commonName = [NSString stringWithCString:common_name encoding: - NSUTF8StringEncoding];; + NSUTF8StringEncoding]; dialog.subject = [NSString stringWithCString:subject encoding: - NSUTF8StringEncoding];; + NSUTF8StringEncoding]; dialog.issuer = [NSString stringWithCString:issuer encoding: - NSUTF8StringEncoding];; + NSUTF8StringEncoding]; dialog.fingerprint = [NSString stringWithCString:fingerprint encoding: - NSUTF8StringEncoding];; + NSUTF8StringEncoding]; dialog.hostMismatch = host_mismatch; + dialog.changed = FALSE; [dialog performSelectorOnMainThread:@selector(runModal:) withObject:[view window] waitUntilDone:TRUE]; return dialog.result; } -DWORD mac_verify_changed_certificate(freerdp* instance, const char* common_name, const char* subject, const char* issuer, const char* fingerprint, const char* old_subject, const char* old_issuer, const char* old_fingerprint) +DWORD mac_verify_changed_certificate(freerdp* instance, const char* common_name, + const char* subject, const char* issuer, const char* fingerprint, + const char* old_subject, const char* old_issuer, const char* old_fingerprint) { - WLog_WARN(TAG, "TODO: Implement %s, accepting everything", __FUNCTION__); - return 2; + mfContext* mfc = (mfContext*) instance->context; + MRDPView* view = (MRDPView*) mfc->view; + CertificateDialog* dialog = [CertificateDialog new]; + dialog.serverHostname = [NSString stringWithFormat:@"TODO: The server name we connect to."]; + dialog.commonName = [NSString stringWithCString:common_name encoding: + NSUTF8StringEncoding]; + dialog.subject = [NSString stringWithCString:subject encoding: + NSUTF8StringEncoding]; + dialog.issuer = [NSString stringWithCString:issuer encoding: + NSUTF8StringEncoding]; + dialog.fingerprint = [NSString stringWithCString:fingerprint encoding: + NSUTF8StringEncoding]; + dialog.hostMismatch = FALSE; + dialog.changed = TRUE; + [dialog performSelectorOnMainThread:@selector(runModal:) withObject:[view + window] waitUntilDone:TRUE]; + + return dialog.result; } int mac_logon_error_info(freerdp* instance, UINT32 data, UINT32 type) diff --git a/client/Mac/cli/MainMenu.xib b/client/Mac/cli/MainMenu.xib index 65e72b1..f647699 100644 --- a/client/Mac/cli/MainMenu.xib +++ b/client/Mac/cli/MainMenu.xib @@ -1,631 +1,120 @@ - - - 1070 - 12E55 - 3084 - 1187.39 - 626.00 - - com.apple.InterfaceBuilder.CocoaPlugin - 3084 - - - NSCustomObject - NSMenu - NSMenuItem - NSView - NSWindowTemplate - - - com.apple.InterfaceBuilder.CocoaPlugin - - - PluginDependencyRecalculationVersion - - - - - NSApplication - - - FirstResponder - - - NSApplication - - - AMainMenu - - - - FreeRDP - - 1048576 - 2147483647 - - NSImage - NSMenuCheckmark - - - NSImage - NSMenuMixedState - - submenuAction: - - FreeRDP - - - - About FreeRDP - - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Hide FreeRDP - h - 1048576 - 2147483647 - - - - - - Hide Others - h - 1572864 - 2147483647 - - - - - - Show All - - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Quit FreeRDP - q - 1048576 - 2147483647 - - - - - _NSAppleMenu - - - - - File - - 1048576 - 2147483647 - - - - - - Edit - - 1048576 - 2147483647 - - - - - - Format - - 2147483647 - - - - - - View - - 1048576 - 2147483647 - - - - - - Window - - 1048576 - 2147483647 - - - submenuAction: - - Window - - - - Minimize - m - 1048576 - 2147483647 - - - - - - Zoom - - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Bring All to Front - - 1048576 - 2147483647 - - - - - _NSWindowsMenu - - - - - Help - - 2147483647 - - - submenuAction: - - Help - - - - Mac Help - ? - 1048576 - 2147483647 - - - - - _NSHelpMenu - - - - _NSMainMenu - - - 15 - 2 - {{163, 10}, {1024, 768}} - 1954021376 - FreeRDP - NSWindow - - - {1024, 768} - {1024, 768} - - - 256 - - {1024, 768} - - - - {{0, 0}, {1920, 1178}} - {1024, 790} - {1024, 790} - 128 - YES - - - AppDelegate - - - NSFontManager - - - - - - - terminate: - - - - 449 - - - - orderFrontStandardAboutPanel: - - - - 142 - - - - delegate - - - - 568 - - - - performMiniaturize: - - - - 37 - - - - arrangeInFront: - - - - 39 - - - - performZoom: - - - - 240 - - - - hide: - - - - 367 - - - - hideOtherApplications: - - - - 368 - - - - unhideAllApplications: - - - - 370 - - - - showHelp: - - - - 493 - - - - window - - - - 570 - - - - - - 0 - - - - - - -2 - - - File's Owner - - - -1 - - - First Responder - - - -3 - - - Application - - - 29 - - - - - - - - - - - - - - 19 - - - - - - - - 56 - - - - - - - - 217 - - - - - - 83 - - - - - - 57 - - - - - - - - - - - - - - 58 - - - - - 134 - - - - - 150 - - - - - 136 - - - - - 236 - - - - - 149 - - - - - 145 - - - - - 24 - - - - - - - - - - - 92 - - - - - 5 - - - - - 239 - - - - - 23 - - - - - 295 - - - - - - 371 - - - - - - - - 372 - - - - - - 375 - - - - - - 420 - - - - - 490 - - - - - - - - 491 - - - - - - - - 492 - - - - - 494 - - - - - - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - com.apple.InterfaceBuilder.CocoaPlugin - {{380, 496}, {480, 360}} - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - - - - 570 - - - 0 - IBCocoaFramework - - com.apple.InterfaceBuilder.CocoaPlugin.macosx - - - YES - 3 - - {11, 11} - {10, 3} - - YES - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- 2.7.4