[MacRuby-devel] retrieving password from keychain

2009-04-19 Thread Karl Varga
Hi there,

I am having a strange problem that other people don't seem to be
having because I can't find any references to in google searches.  I
am using MacRuby 0.4 installed from the binary available on the
macruby binary releases page (MacRuby version 0.4 (ruby 1.9.1)
[universal-darwin9.5, x86_64])

I have an application which stores username/passwords in the keychain.
 I can add items to the keychain (so I can call
SecKeychainAddGenericPassword() fine and therefore I think my setup
must be OK), but I cannot retrieve them.  When I call:

status, *data = SecKeychainFindGenericPassword(
nil, service.length, service, username.length, username)

I get an error:

Configuration.app/Contents/Resources/Controller.rb:99:in
`SecKeychainFindGenericPassword': wrong number of arguments (5 for 8)
(ArgumentError)

The method signature is this:

OSStatus SecKeychainFindGenericPassword (
   CFTypeRef keychainOrArray,
   UInt32 serviceNameLength,
   const char *serviceName,
   UInt32 accountNameLength,
   const char *accountName,
   UInt32 *passwordLength,
   void **passwordData,
   SecKeychainItemRef *itemRef
);


All the examples I've read suggest that this method in macruby should
only take 5 args and return the status, password length, password
string and item reference (the last 3 extracted from *data) instead of
passing in pointers (which I don't know how to do BTW).

What gives?  Anyone have any idea or had the same problem?

-- 
Karl Varga
kjva...@gmail.com
Cell: +61 (0)4 2075 1356
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] Using built-in ruby libraries in packaged applications.

2009-04-19 Thread Alex Vollmer
I have a bit of code that uses the Ruby base64 library and I would  
like to package the MacRuby framework into my application. I've added  
the "Embed MacRuby" target to my build and the MacRuby framework shows  
up properly in my application's contents directory. The problem is  
that when the program launches the call for requiring the base64.rb  
file causes the runtime to bomb out saying it couldn't find  
'base64.rb'. After a bit of hacking I ended up adding this stanza in  
the rb_main.rb file prior to the loop that requires all the local files:


$:.unshift(File.join(NSBundle.mainBundle.privateFrameworksPath,
 "MacRuby.framework",
 "Versions",
 "Current",
 "usr/lib/ruby/1.9.1"))

This seems a little hacky to me. Is there a better way of doing this?

Thanks,

Alex V.


Musings & Notes — http://alexvollmer.com
Track what you lend and borrow — http://moochbot.com





___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel