const krb5_keyblock *privsvr_key, krb5_boolean with_realm,
krb5_data *data);
+
+/*
+ * Read client information from a PAC.
+ *
+ * @param [in] context Library context
+ * @param [in] pac PAC handle
+ * @param [out] authtime_out Authentication timestamp (NULL if not needed)
+ * @param [out] princname_out Client account name
+ *
+ * Read the PAC_CLIENT_INFO buffer in @a pac. Place the client account name as
+ * a string in @a princname_out. If @a authtime_out is not NULL, place the
+ * initial authentication timestamp in @a authtime_out.
+ *
+ * @retval 0 on success, ENOENT if no PAC_CLIENT_INFO buffer is present in @a
+ * pac, ERANGE if the buffer contains invalid lengths.
+ *
+ * @version New in 1.18
+ */
+krb5_error_code KRB5_CALLCONV
+krb5_pac_get_client_info(krb5_context context, const krb5_pac pac,
+ krb5_timestamp *authtime_out, char **princname_out);
+
/**
* Allow the appplication to override the profile's allow_weak_crypto setting.
*
return 0;
}
-krb5_error_code
-k5_pac_validate_client(krb5_context context,
- const krb5_pac pac,
- krb5_timestamp authtime,
- krb5_const_principal principal,
- krb5_boolean with_realm)
+krb5_error_code KRB5_CALLCONV
+krb5_pac_get_client_info(krb5_context context,
+ const krb5_pac pac,
+ krb5_timestamp *authtime_out,
+ char **princname_out)
{
krb5_error_code ret;
krb5_data client_info;
- char *pac_princname, *princname;
+ char *pac_princname;
unsigned char *p;
krb5_timestamp pac_authtime;
krb5_ui_2 pac_princname_length;
int64_t pac_nt_authtime;
- int flags = 0;
+
+ if (authtime_out != NULL)
+ *authtime_out = 0;
+ *princname_out = NULL;
ret = k5_pac_locate_buffer(context, pac, KRB5_PAC_CLIENT_INFO,
&client_info);
if (ret != 0)
return ret;
+ if (authtime_out != NULL)
+ *authtime_out = pac_authtime;
+ *princname_out = pac_princname;
+
+ return 0;
+}
+
+krb5_error_code
+k5_pac_validate_client(krb5_context context,
+ const krb5_pac pac,
+ krb5_timestamp authtime,
+ krb5_const_principal principal,
+ krb5_boolean with_realm)
+{
+ krb5_error_code ret;
+ char *pac_princname, *princname;
+ krb5_timestamp pac_authtime;
+ int flags = 0;
+
+ ret = krb5_pac_get_client_info(context, pac, &pac_authtime,
+ &pac_princname);
+ if (ret != 0)
+ return ret;
+
flags = KRB5_PRINCIPAL_UNPARSE_DISPLAY;
if (!with_realm)
flags |= KRB5_PRINCIPAL_UNPARSE_NO_REALM;