emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Modifying Emacs to use the Mac OS X Keychain Services


From: Ben Key
Subject: Re: Modifying Emacs to use the Mac OS X Keychain Services
Date: Tue, 14 Jun 2011 21:15:18 -0500

Stefan Monnier wrote:

> No, a simple type cast won't do.  If the Lisp_Object is fully under your
> control (so you always know you're the one who built it and never need
> to check what kind of Lisp_Object it is), you can use
> a Lisp_Misc_Save_value.  "grep -i save_value src/*.[ch]" should get
> you started.
>

The Lisp_Object is not always under my control.  The idea is to
provide three functions to open a Mac OS X keychain file.  The
functions are ns-keychain-open to open a keychain file,
ns-keychain-create to create a keychain file, and
ns-keychain-create-or-open to open a keychain file if it exists or
create it if it does not exist.  All three of these functions, which
will be callable from Lisp, need to return a SecKeychainRef object.
The SecKeychainRef object is just a pointer to a structure, allocated
by the operating system.  Additional functions such as
ns-keychain-add-generic-password and ns-keychain-get-generic-password
will expect to be called with the keychain parameter set to the value
returned by an earlier call to ns-keychain-open,  ns-keychain-create,
or ns-keychain-create-or-open.  Once the calling package is finished
with the keychain object it will be expected to call ns-keychain-close
to release the keychain reference.

Since the SecKeychainRef object will need to pass the boundary between
internal Emacs code and Lisp code it cannot be considered to be always
under my control.  As a result I am not certain that a
Lisp_Misc_Save_value is appropriate for my purpose.  I am not certain
that pseudovectors are appropriate either.  It seems that we use
pseudovectors to represent structures that are allocated by Emacs but
the SecKeychainRef object is allocated by the OS.

The problem is that I am not certain how to return a SecKeychainRef
object from ns-keychain-open,  ns-keychain-create, and
ns-keychain-create-or-open so that they are callable from Lisp.  Any
suggestions are welcome.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]