Skip to content

Commit

Permalink
Add SSL certificate verification option
Browse files Browse the repository at this point in the history
  • Loading branch information
psychs committed Jun 18, 2020
1 parent 004638d commit 5c4fc38
Show file tree
Hide file tree
Showing 22 changed files with 275 additions and 228 deletions.
4 changes: 2 additions & 2 deletions Classes/Dialogs/ChannelDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
- (void)show;
- (void)close;

- (void)ok:(id)sender;
- (void)cancel:(id)sender;
- (IBAction)ok:(id)sender;
- (IBAction)cancel:(id)sender;

@end

Expand Down
4 changes: 2 additions & 2 deletions Classes/Dialogs/IgnoreItemSheet.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@

- (void)start;

- (void)addChannel:(id)sender;
- (void)deleteChannel:(id)sender;
- (IBAction)addChannel:(id)sender;
- (IBAction)deleteChannel:(id)sender;

@end

Expand Down
2 changes: 1 addition & 1 deletion Classes/Dialogs/InviteSheet.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

- (void)startWithChannels:(NSArray*)channels;

- (void)invite:(id)sender;
- (IBAction)invite:(id)sender;

@end

Expand Down
8 changes: 4 additions & 4 deletions Classes/Dialogs/ListDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@

- (void)addChannel:(NSString*)channel count:(int)count topic:(NSString*)topic;

- (void)onClose:(id)sender;
- (void)onUpdate:(id)sender;
- (void)onJoin:(id)sender;
- (void)onSearchFieldChange:(id)sender;
- (IBAction)onClose:(id)sender;
- (IBAction)onUpdate:(id)sender;
- (IBAction)onJoin:(id)sender;
- (IBAction)onSearchFieldChange:(id)sender;

@end

Expand Down
2 changes: 1 addition & 1 deletion Classes/Dialogs/ModeSheet.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

- (void)start;

- (void)onChangeCheck:(id)sender;
- (IBAction)onChangeCheck:(id)sender;

@end

Expand Down
2 changes: 1 addition & 1 deletion Classes/Dialogs/PasteSheet.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

- (void)start;

- (void)sendInChannel:(id)sender;
- (IBAction)sendInChannel:(id)sender;

@end

Expand Down
22 changes: 11 additions & 11 deletions Classes/Dialogs/Preferences/PreferencesController.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@

- (void)show;

- (void)onAddKeyword:(id)sender;
- (void)onAddExcludeWord:(id)sender;

- (void)onTranscriptFolderChanged:(id)sender;
- (void)onLayoutChanged:(id)sender;
- (void)onChangedTheme:(id)sender;
- (void)onOpenThemePath:(id)sender;
- (void)onSelectFont:(id)sender;
- (void)onInputSelectFont:(id)sender;
- (void)onOverrideFontChanged:(id)sender;
- (void)onChangedTransparency:(id)sender;
- (IBAction)onAddKeyword:(id)sender;
- (IBAction)onAddExcludeWord:(id)sender;

- (IBAction)onTranscriptFolderChanged:(id)sender;
- (IBAction)onLayoutChanged:(id)sender;
- (IBAction)onChangedTheme:(id)sender;
- (IBAction)onOpenThemePath:(id)sender;
- (IBAction)onSelectFont:(id)sender;
- (IBAction)onInputSelectFont:(id)sender;
- (IBAction)onOverrideFontChanged:(id)sender;
- (IBAction)onChangedTransparency:(id)sender;

@end

Expand Down
24 changes: 13 additions & 11 deletions Classes/Dialogs/ServerDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

@property (nonatomic) IBOutlet NSComboBox* hostCombo;
@property (nonatomic) IBOutlet NSButton* sslCheck;
@property (nonatomic) IBOutlet NSButton* sslCertificateVerificationCheck;
@property (nonatomic) IBOutlet NSTextField* portText;

@property (nonatomic) IBOutlet NSTextField* nickText;
Expand Down Expand Up @@ -63,21 +64,22 @@
- (void)show;
- (void)close;

- (void)ok:(id)sender;
- (void)cancel:(id)sender;
- (IBAction)ok:(id)sender;
- (IBAction)cancel:(id)sender;

- (void)hostComboChanged:(id)sender;
- (IBAction)hostComboChanged:(id)sender;
- (IBAction)sslCheckChanged:(id)sender;

- (void)encodingChanged:(id)sender;
- (void)proxyChanged:(id)sender;
- (IBAction)encodingChanged:(id)sender;
- (IBAction)proxyChanged:(id)sender;

- (void)addChannel:(id)sender;
- (void)editChannel:(id)sender;
- (void)deleteChannel:(id)sender;
- (IBAction)addChannel:(id)sender;
- (IBAction)editChannel:(id)sender;
- (IBAction)deleteChannel:(id)sender;

- (void)addIgnore:(id)sender;
- (void)editIgnore:(id)sender;
- (void)deleteIgnore:(id)sender;
- (IBAction)addIgnore:(id)sender;
- (IBAction)editIgnore:(id)sender;
- (IBAction)deleteIgnore:(id)sender;

+ (NSArray*)availableServers;

Expand Down
10 changes: 10 additions & 0 deletions Classes/Dialogs/ServerDialog.m
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ - (void)load

_hostCombo.stringValue = _config.host;
_sslCheck.state = _config.useSSL;
_sslCertificateVerificationCheck.state = _config.useSSLCertificateVerification;
_portText.intValue = _config.port;

_nickText.stringValue = _config.nick;
Expand Down Expand Up @@ -123,6 +124,7 @@ - (void)save

_config.host = _hostCombo.stringValue;
_config.useSSL = _sslCheck.state;
_config.useSSLCertificateVerification = _sslCertificateVerificationCheck.state;
_config.port = _portText.intValue;

_config.nick = _nickText.stringValue;
Expand Down Expand Up @@ -179,6 +181,9 @@ - (void)updateConnectionPage
BOOL enabled = name.length && host.length && ![host isEqualToString:@"-"] && port > 0 && nick.length;
[_okButton setEnabled:enabled];

BOOL sslEnabled = _sslCheck.state;
[_sslCertificateVerificationCheck setEnabled:sslEnabled];

BOOL saslEnabled = nickPassword.length > 0;
[_saslCheck setEnabled:saslEnabled];
}
Expand Down Expand Up @@ -246,6 +251,11 @@ - (void)hostComboChanged:(id)sender
[self updateConnectionPage];
}

- (void)sslCheckChanged:(id)sender
{
[self updateConnectionPage];
}

- (void)encodingChanged:(id)sender
{
int tag = [_encodingCombo selectedTag];
Expand Down
4 changes: 2 additions & 2 deletions Classes/Dialogs/SheetBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
- (void)startSheet;
- (void)endSheet;

- (void)ok:(id)sender;
- (void)cancel:(id)sender;
- (IBAction)ok:(id)sender;
- (IBAction)cancel:(id)sender;

@end
10 changes: 5 additions & 5 deletions Classes/Dialogs/WelcomeDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
- (void)show;
- (void)close;

- (void)onOK:(id)sender;
- (void)onCancel:(id)sender;
- (void)onAddChannel:(id)sender;
- (void)onDeleteChannel:(id)sender;
- (IBAction)onOK:(id)sender;
- (IBAction)onCancel:(id)sender;
- (IBAction)onAddChannel:(id)sender;
- (IBAction)onDeleteChannel:(id)sender;

- (void)onHostComboChanged:(id)sender;
- (IBAction)onHostComboChanged:(id)sender;

@end

Expand Down
8 changes: 4 additions & 4 deletions Classes/Dialogs/WhoisDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
- (void)setAwayMessage:(NSString*)value;
- (void)setIdle:(NSString*)idle signOn:(NSString*)signOn;

- (void)onClose:(id)sender;
- (void)onTalk:(id)sender;
- (void)onUpdate:(id)sender;
- (void)onJoin:(id)sender;
- (IBAction)onClose:(id)sender;
- (IBAction)onTalk:(id)sender;
- (IBAction)onUpdate:(id)sender;
- (IBAction)onJoin:(id)sender;

@end

Expand Down
1 change: 1 addition & 0 deletions Classes/IRC/IRCClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,7 @@ - (void)connect:(ConnectMode)mode
_conn.host = host;
_conn.port = _config.port;
_conn.useSSL = _config.useSSL;
_conn.useSSLCertificateVerification = _config.useSSLCertificateVerification;
_conn.encoding = _config.encoding;

switch (_config.proxyType) {
Expand Down
1 change: 1 addition & 0 deletions Classes/IRC/IRCClientConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ typedef enum {
@property (nonatomic) NSString* host;
@property (nonatomic) int port;
@property (nonatomic) BOOL useSSL;
@property (nonatomic) BOOL useSSLCertificateVerification;

@property (nonatomic) NSString* nick;
@property (nonatomic) NSString* password;
Expand Down
2 changes: 2 additions & 0 deletions Classes/IRC/IRCClientConfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ - (id)initWithDictionary:(NSDictionary*)dic
}
}
_useSSL = [dic boolForKey:@"ssl"];
_useSSLCertificateVerification = [dic boolForKey:@"sslCertificateVerification"];

_nick = [dic stringForKey:@"nick"] ?: @"";
_username = [dic stringForKey:@"username"] ?: @"";
Expand Down Expand Up @@ -134,6 +135,7 @@ - (NSMutableDictionary*)dictionaryValueSavingToKeychain:(BOOL)saveToKeychain inc
if (_host) [dic setObject:_host forKey:@"host"];
[dic setInt:_port forKey:@"port"];
[dic setBool:_useSSL forKey:@"ssl"];
[dic setBool:_useSSLCertificateVerification forKey:@"sslCertificateVerification"];

if (_nick) [dic setObject:_nick forKey:@"nick"];
BOOL useKeychain = YES;
Expand Down
1 change: 1 addition & 0 deletions Classes/IRC/IRCConnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
@property (nonatomic) NSString* host;
@property (nonatomic) int port;
@property (nonatomic) BOOL useSSL;
@property (nonatomic) BOOL useSSLCertificateVerification;
@property (nonatomic) NSStringEncoding encoding;

@property (nonatomic) BOOL useSystemSocks;
Expand Down
1 change: 1 addition & 0 deletions Classes/IRC/IRCConnection.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ - (void)open
_conn.host = _host;
_conn.port = _port;
_conn.useSSL = _useSSL;
_conn.useSSLCertificateVerification = _useSSLCertificateVerification;

if (_useSystemSocks) {
// check if system socks proxy is enabled
Expand Down
1 change: 1 addition & 0 deletions Classes/Library/TCPClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
@property (nonatomic) NSString* host;
@property (nonatomic) int port;
@property (nonatomic) BOOL useSSL;
@property (nonatomic) BOOL useSSLCertificateVerification;

@property (nonatomic) BOOL useSystemSocks;
@property (nonatomic) BOOL useSocks;
Expand Down
6 changes: 3 additions & 3 deletions Classes/Library/TCPClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,14 @@ - (BOOL)onSocketWillConnect:(AsyncSocket*)sender
{
if (_useSystemSocks) {
[_conn useSystemSocksProxy];
}
else if (_useSocks) {
} else if (_useSocks) {
[_conn useSocksProxyVersion:_socksVersion host:_proxyHost port:_proxyPort user:_proxyUser password:_proxyPassword];
}

if (_useSSL) {
[_conn useSSLWithHost:_host validatesCertificateChain:YES];
[_conn useSSLWithHost:_host validatesCertificateChain:_useSSLCertificateVerification];
}

return YES;
}

Expand Down
4 changes: 2 additions & 2 deletions LimeChat.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1662,7 +1662,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 2.45;
CURRENT_PROJECT_VERSION = 2.45.1;
DEVELOPMENT_TEAM = 3723UA4YHT;
GCC_PREPROCESSOR_DEFINITIONS = (
TARGET_APP_STORE,
Expand All @@ -1681,7 +1681,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 2.45;
CURRENT_PROJECT_VERSION = 2.45.1;
DEVELOPMENT_TEAM = 3723UA4YHT;
GCC_PREPROCESSOR_DEFINITIONS = TARGET_APP_STORE;
INFOPLIST_FILE = "Others/AppStore/Info-AppStore.plist";
Expand Down
Loading

0 comments on commit 5c4fc38

Please sign in to comment.