Re: Stealing settings from Mail.app
Re: Stealing settings from Mail.app
- Subject: Re: Stealing settings from Mail.app
- From: Chris Idou <email@hidden>
- Date: Mon, 31 May 2010 23:46:27 -0700 (PDT)
Hi,
I personally use smtp.me.com as my server, so I think you need to add that.
As far as I see, [@"macdonald.org" rangeOfString:@"mac"].location would be a wrong match. I think you need to look for
[hostName hasSuffix:@".me.com"] || [hostName hasSuffix:@".mac.com"]
Right now I'm using http://github.com/tcurdt/edmessage to send mails.
Does your framework have any benefits over that one?
----- Original Message ----
From: Dante Palacios <email@hidden>
To: Chris <email@hidden>
Sent: Tue, 1 June, 2010 1:38:04 PM
Subject: Re: Stealing settings from Mail.app
Hi Chris,
There's no bug in the code, so far as I know (I can be wrong), the smtp server for a MobileMe account remains smtp.mac.com. The userName must be the user name only E.g with "John Doe <email@hidden>" or "John Doe <email@hidden>" as the full email address, would be "jdoe" and the hostName would be "smtp.mac.com"....
I made a small framework (free and open source) for sending emails that do what you want to do and a little more...
https://code.google.com/p/maildelivery
On May 31, 2010, at 8:35 PM, Chris wrote:
> Thanks, it was the iTools bit I needed. But looks like there is a bug in this code it won't notice me.com and could wrongly think say macdonald.com is mobile me. But thanks, it gives me what I needed.
>
> --
> Chris
>
> On 31/05/2010, at 8:11 PM, Dante Palacios <email@hidden> wrote:
>
> NSString *GetPassword(NSString *userName, NSString *hostName) {
> if (!hostName.length || !userName.length) return nil;
>
> const char *serviceName = [hostName UTF8String];
> const char *serviceUserName = [userName UTF8String];
> const char *path = "";
>
> UInt32 passwordLength = 0;
> char *pass = nil;
>
> OSStatus status = noErr;
> SecKeychainItemRef itemRef;
>
> if ([hostName rangeOfString:@"mac"].location != NSNotFound) {
> serviceName = "iTools"; //<= note this
> status = SecKeychainFindGenericPassword(NULL,
> (UInt32)strlen(serviceName),
> serviceName,
> (UInt32)strlen(serviceUserName),
> serviceUserName,
> &passwordLength,
> (void **)&pass,
> &itemRef);
> }else {
> status = SecKeychainFindInternetPassword(NULL,
> (UInt32)strlen(serviceName),
> serviceName,
> 0,
> NULL,
> (UInt32)strlen(serviceUserName),
> serviceUserName,
> (UInt32)strlen(path),
> path,
> 0,
> kSecAuthenticationTypeAny,
> kSecAuthenticationTypeAny,
> &passwordLength,
> (void **)&pass,
> &itemRef);
> }
>
> if (status != noErr) {
> CFStringRef errMess = SecCopyErrorMessageString(status, NULL);
> NSLog(@"%@", (NSString *)errMess);
> CFRelease(errMess);
> return nil;
> }
>
> return [[[NSString alloc] initWithBytes:pass length:passwordLength encoding:NSUTF8StringEncoding] autorelease];
> }
>
> On May 31, 2010, at 12:11 AM, Jn wrote:
>
> Would you have the API code to retrieve it? Not sure what to pass to get the mobile me password.
>
> --
> Chris
>
> On 31/05/2010, at 2:43 AM, Jens Alfke <email@hidden> wrote:
>
>
> On May 30, 2010, at 12:55 AM, Chris Idou wrote:
>
> OK, I see. So is Mobile-Me the only special case, or is there a more general rule about other places to find smtp server passwords?
>
> AFAIK it’s the only special case. In general, an SMTP server’s password is stored under that server name in the keychain, as you’d expect.
>
> —Jens
>
>
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
> All the best,
> Dante.
>
>
>
>
>
>
>
All the best,
Dante.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden