site_archiver@lists.apple.com Delivered-To: cocoa-dev@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1275374787; bh=k/hI/7lFXe366tziRS/2glP8AeP/fdHYzRgHTnqC0Dg=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:References:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=08OG2Vf8RX/tPrIi+05S/ZBNlHCJwzdJ8KxEhP/C/6/47AyTr2EL8t2+8vxK3Cy5N9F7dBBN7qXj6vdbsnEgDbXWTC1Nm6+3MG4JEmM5V/Z1Ztr/o3S1h9x0Hui0M/9AdrdUAbxuGMe0WrQG/SIkTXfx11psKwMP4jO8R/Eu7bY= Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:References:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=jXcag8rbSUl2FILqn1df4xgZNWKzYT5xnMN+KM52piyK0W86hz4v7jkBsCNJZsTzSiMLKvtg2oabtCvqwDPEoGohlMda6exIx+xKEd91gxCMitr974mZI7P/ARQleOQwm/lFWcUgCDpKGCXjeouR8y8kP7OYZv8Hp7ihesxPI0A=; 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 <palacios.dante@gmail.com> To: Chris <idou747@yahoo.com> 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 <jdoe@mac.com>" or "John Doe <jdoe@me.com>" 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 <palacios.dante@gmail.com> 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 <jens@mooseyard.com> 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 (Cocoa-dev@lists.apple.com)
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: http://lists.apple.com/mailman/options/cocoa-dev/palacios.dante%40gmail.com
This email sent to palacios.dante@gmail.com
All the best, Dante.
All the best, Dante. _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/site_archiver%40lists.apple... This email sent to site_archiver@lists.apple.com