GStaticMutex mutex;
gboolean finalized;
GHashTable *open_sessions;
- gboolean auto_authenticate;
+ gint auto_authenticate;
} GP11ModulePrivate;
#define GP11_MODULE_GET_DATA(o) \
g_value_set_pointer (value, gp11_module_get_functions (self));
break;
case PROP_AUTO_AUTHENTICATE:
- g_value_set_boolean (value, gp11_module_get_auto_authenticate (self));
+ g_value_set_int (value, gp11_module_get_auto_authenticate (self));
break;
case PROP_POOL_SESSIONS:
g_value_set_boolean (value, gp11_module_get_pool_sessions (self));
data->funcs = g_value_get_pointer (value);
break;
case PROP_AUTO_AUTHENTICATE:
- gp11_module_set_auto_authenticate (self, g_value_get_boolean (value));
+ gp11_module_set_auto_authenticate (self, g_value_get_int (value));
break;
case PROP_POOL_SESSIONS:
gp11_module_set_pool_sessions (self, g_value_get_boolean (value));
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (gobject_class, PROP_AUTO_AUTHENTICATE,
- g_param_spec_boolean ("auto-authenticate", "Auto Authenticate", "Auto Login to Token when necessary",
- FALSE, G_PARAM_READWRITE));
+ g_param_spec_int ("auto-authenticate", "Auto Authenticate", "Auto Login to Token when necessary",
+ 0, G_MAXINT, 0, G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, PROP_POOL_SESSIONS,
g_param_spec_boolean ("pool-sessions", "Pool Sessions", "Pool sessions?",
*
* Return value: Whether auto login or not.
**/
-gboolean
+gint
gp11_module_get_auto_authenticate (GP11Module *self)
{
GP11ModulePrivate *pv = lock_private (self);
- gboolean ret;
+ gint ret;
g_return_val_if_fail (pv, FALSE);
* signal when an object requires authintication.
**/
void
-gp11_module_set_auto_authenticate (GP11Module *self, gboolean auto_login)
+gp11_module_set_auto_authenticate (GP11Module *self, gint auto_login)
{
GP11ModulePrivate *pv = lock_private (self);
+ /* HACK: Get needed fix around API freeze. */
+ if (auto_login == 1)
+ auto_login = GP11_AUTHENTICATE_TOKENS | GP11_AUTHENTICATE_OBJECTS;
+
g_return_if_fail (pv);
{
args.slot = self;
args.flags = flags;
args.password = NULL;
- args.auto_login = gp11_module_get_auto_authenticate (module);
+ args.auto_login = (gp11_module_get_auto_authenticate (module) & GP11_AUTHENTICATE_TOKENS) ? TRUE : FALSE;
args.session = 0;
if (_gp11_call_sync (self, perform_open_session, complete_open_session, &args, cancellable, err))
module = gp11_slot_get_module (self);
slot_id = gp11_slot_get_handle (self);
args->session = _gp11_module_pooled_session_handle (module, slot_id, flags);
- args->auto_login = gp11_module_get_auto_authenticate (module);
+ args->auto_login = (gp11_module_get_auto_authenticate (module) & GP11_AUTHENTICATE_TOKENS) ? TRUE : FALSE;
g_object_unref (module);
call = _gp11_call_async_ready (args, cancellable, callback, user_data);
#define GP11_INVALID G_MAXULONG
+enum {
+ GP11_AUTHENTICATE_TOKENS = 2,
+ GP11_AUTHENTICATE_OBJECTS = 4
+};
+
/* Used on varargs functions that should end with GP11_INVALID */
#ifdef NOT_YET_SUPPORTED
#define GP11_INVALID_TERMINATED __attribute__((__sentinel__(G_MAXULONG)))
void gp11_module_set_pool_sessions (GP11Module *self,
gboolean pool_sessions);
-gboolean gp11_module_get_auto_authenticate (GP11Module *self);
+gint gp11_module_get_auto_authenticate (GP11Module *self);
void gp11_module_set_auto_authenticate (GP11Module *self,
- gboolean auto_authenticate);
+ gint auto_authenticate);
gboolean gp11_module_enumerate_objects (GP11Module *self,
GP11ObjectForeachFunc func,