Skip to content

OAuth2 and MCOIMAPFetchFoldersOperation segfaults without password set #179

@dbainbridge

Description

@dbainbridge

If password not set before using MCOIMAPFetchFoldersOperation then application will segfault. Setting it to a blank password is enough to prevent the crash.

    MCOIMAPSession *session = [[MCOIMAPSession alloc] init];
    [session setHostname:@"imap.gmail.com"];
    [session setPort:993];
    [session setUsername:email];
    [session setPassword:@""]; // will crash if this line is commented out
    [session setOAuth2Token:accessToken];
    [session setConnectionType:MCOConnectionTypeTLS];
    [session setAuthType:MCOAuthTypeXOAuth2];
    session.connectionLogger = ^(void * connectionID, MCOConnectionLogType type, NSData * data) {
        NSLog(@"data: %@", [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]);
    };


    MCOIMAPFetchFoldersOperation *fetchFolderOperation = [session fetchAllFoldersOperation];
    [fetchFolderOperation start:^(NSError *error, NSArray *folders) {
        NSLog(@"%@", folders);  
    }];

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions