Re: How to get encrypted user password
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:from:date:x-google-sender-auth:message-id:subject:to:cc :content-type; bh=HwI07lJ8V2JVc5CWFn9AmOHzpklTWIBvqIbo5SD58fU=; b=fOkmKI7YkYTToKLMQw7W23sqSPoZaPXiiOjCGvZQNg8as8HIIwqNWVnPA3EyzqA7Wm DT18uTBvCvNcHre38e9sY39vqYSXbSkl0bMY9dQKYA/WQUs9UXGV0T9+1gKYsmO/oEWh GsGg6T6Er5ej2PdtUmc7u8LwapTUnYQ7/SADc= Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; b=Gf46XhCneCGDkvDX/m+8EpllWjKEzmEsDLwm8D/HreHGDoih+IJLyUs/yTKUqkZEgF zWiID16+TOTHqNKb//SW5kU375ESGev2ycunB2kCChCceJCh7bBWof9HGlcb9/mnOoVY 79S5ZfPF4uBWNFiM+antZQEvGuuxPLuEhMl70= Directory Services being as painful of an API as it is, perhaps the Security framework is a better route... bool authenticateUser(const char *userName, const char *password) { AuthorizationRef authRef = nil; AuthorizationRights authRights; AuthorizationEnvironment authEnvironment; AuthorizationItem authRightItems[1], authEnvironmentItems[2]; OSStatus authResult = 0; bool result = false; assert(userName && strlen(userName)); assert(password); authRightItems[0].name = "system.login.tty"; authRightItems[0].value = nil; authRightItems[0].valueLength = 0; authRightItems[0].flags = 0; authRights.items = authRightItems; authRights.count = 1; authEnvironmentItems[0].name = kAuthorizationEnvironmentUsername; authEnvironmentItems[0].value = (void *)userName; authEnvironmentItems[0].valueLength = strlen(userName); authEnvironmentItems[0].flags = 0; authEnvironmentItems[1].name = kAuthorizationEnvironmentPassword; authEnvironmentItems[1].value = (void *)password; authEnvironmentItems[1].valueLength = strlen(password); authEnvironmentItems[1].flags = 0; authEnvironment.items = authEnvironmentItems; authEnvironment.count = 2; authResult = AuthorizationCreate(&authRights, &authEnvironment, kAuthorizationFlagDefaults, &authRef); if (authResult != errAuthorizationSuccess || !authRef) goto cleanup; result = true; cleanup: { if (authRef) AuthorizationFree(authRef, kAuthorizationFlagDefaults), authRef = nil; } return result; } _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com
participants (1)
-
Dave Keck