+2004-08-03 Ken Raeburn <raeburn@mit.edu>
+
+ * rc-int.h (struct _krb5_rc_ops): Add new member,
+ recover_or_init.
+ * rc_dfl.c (krb5_rc_dfl_init_locked): New function, with most of
+ the content of old krb5_rc_dfl_init.
+ (krb5_rc_dfl_init): Call it.
+ (krb5_rc_dfl_recover_or_init): New function.
+ * rc_dfl.h (krb5_rc_dfl_recover_or_init): Declare.
+ * rcdef.c (krb5_rc_dfl_ops): Initialize new field.
+ * rc_none.c (krb5_rc_none_recover_or_init): New macro.
+ (krb5_rc_none_ops): Initialize new field.
+ * rcfns.c (krb5_rc_recover_or_initialize): New function.
+
2004-07-30 Ken Raeburn <raeburn@mit.edu>
* rc_none.c: New file.
(krb5_context, krb5_rcache,krb5_deltat); /* create */
krb5_error_code (KRB5_CALLCONV *recover)
(krb5_context, krb5_rcache); /* open */
+ krb5_error_code (KRB5_CALLCONV *recover_or_init)
+ (krb5_context, krb5_rcache,krb5_deltat);
krb5_error_code (KRB5_CALLCONV *destroy)
(krb5_context, krb5_rcache);
krb5_error_code (KRB5_CALLCONV *close)
}
krb5_error_code KRB5_CALLCONV
-krb5_rc_dfl_init(krb5_context context, krb5_rcache id, krb5_deltat lifespan)
+krb5_rc_dfl_init_locked(krb5_context context, krb5_rcache id, krb5_deltat lifespan)
{
struct dfl_data *t = (struct dfl_data *)id->data;
krb5_error_code retval;
- retval = k5_mutex_lock(&id->lock);
- if (retval)
- return retval;
t->lifespan = lifespan ? lifespan : context->clockskew;
/* default to clockskew from the context */
#ifndef NOIOSTUFF
if ((retval = krb5_rc_io_creat(context, &t->d, &t->name))) {
- k5_mutex_unlock(&id->lock);
return retval;
}
if ((krb5_rc_io_write(context, &t->d,
(krb5_pointer) &t->lifespan, sizeof(t->lifespan))
|| krb5_rc_io_sync(context, &t->d))) {
- k5_mutex_unlock(&id->lock);
return KRB5_RC_IO;
}
#endif
- k5_mutex_unlock(&id->lock);
return 0;
}
+krb5_error_code KRB5_CALLCONV
+krb5_rc_dfl_init(krb5_context context, krb5_rcache id, krb5_deltat lifespan)
+{
+ krb5_error_code retval;
+
+ retval = k5_mutex_lock(&id->lock);
+ if (retval)
+ return retval;
+ retval = krb5_rc_dfl_init_locked(context, id, lifespan);
+ k5_mutex_unlock(&id->lock);
+ return retval;
+}
+
/* Called with the mutex already locked. */
krb5_error_code
krb5_rc_dfl_close_no_free(krb5_context context, krb5_rcache id)
return ret;
}
+krb5_error_code KRB5_CALLCONV
+krb5_rc_dfl_recover_or_init(krb5_context context, krb5_rcache id,
+ krb5_deltat lifespan)
+{
+ struct dfl_data *t = (struct dfl_data *)id->data;
+ krb5_error_code retval;
+
+ retval = k5_mutex_lock(&id->lock);
+ if (retval)
+ return retval;
+ retval = krb5_rc_dfl_recover_locked(context, id);
+ if (retval)
+ retval = krb5_rc_dfl_init_locked(context, id, lifespan);
+ k5_mutex_unlock(&id->lock);
+ return retval;
+}
+
static krb5_error_code
krb5_rc_io_store(krb5_context context, struct dfl_data *t,
krb5_donot_replay *rep)
return krb5_x(id->ops->init,(context, id, span));
}
+krb5_error_code KRB5_CALLCONV
+krb5_rc_recover_or_initialize (krb5_context context, krb5_rcache id,
+ krb5_deltat span)
+{
+ return krb5_x(id->ops->recover_or_init,(context, id, span));
+}
+
krb5_error_code KRB5_CALLCONV
krb5_rc_recover (krb5_context context, krb5_rcache id)
{