krb5: use new krb5_time_abs() function
From Apple Heimdal-597.121.1: replace calls to labs() with krb5_time_abs()
This commit is contained in:
@@ -222,7 +222,7 @@ krb5_rd_cred(krb5_context context,
|
|||||||
|
|
||||||
if (enc_krb_cred_part.timestamp == NULL ||
|
if (enc_krb_cred_part.timestamp == NULL ||
|
||||||
enc_krb_cred_part.usec == NULL ||
|
enc_krb_cred_part.usec == NULL ||
|
||||||
labs(*enc_krb_cred_part.timestamp - sec)
|
krb5_time_abs(*enc_krb_cred_part.timestamp, sec)
|
||||||
> context->max_skew) {
|
> context->max_skew) {
|
||||||
krb5_clear_error_message (context);
|
krb5_clear_error_message (context);
|
||||||
ret = KRB5KRB_AP_ERR_SKEW;
|
ret = KRB5KRB_AP_ERR_SKEW;
|
||||||
|
@@ -136,7 +136,7 @@ krb5_rd_priv(krb5_context context,
|
|||||||
krb5_timeofday (context, &sec);
|
krb5_timeofday (context, &sec);
|
||||||
if (part.timestamp == NULL ||
|
if (part.timestamp == NULL ||
|
||||||
part.usec == NULL ||
|
part.usec == NULL ||
|
||||||
labs(*part.timestamp - sec) > context->max_skew) {
|
krb5_time_abs(*part.timestamp, sec) > context->max_skew) {
|
||||||
krb5_clear_error_message (context);
|
krb5_clear_error_message (context);
|
||||||
ret = KRB5KRB_AP_ERR_SKEW;
|
ret = KRB5KRB_AP_ERR_SKEW;
|
||||||
goto failure_part;
|
goto failure_part;
|
||||||
|
@@ -413,7 +413,7 @@ krb5_verify_ap_req2(krb5_context context,
|
|||||||
|
|
||||||
krb5_timeofday (context, &now);
|
krb5_timeofday (context, &now);
|
||||||
|
|
||||||
if (labs(ac->authenticator->ctime - now) > context->max_skew) {
|
if (krb5_time_abs(ac->authenticator->ctime, now) > context->max_skew) {
|
||||||
ret = KRB5KRB_AP_ERR_SKEW;
|
ret = KRB5KRB_AP_ERR_SKEW;
|
||||||
krb5_clear_error_message (context);
|
krb5_clear_error_message (context);
|
||||||
goto out;
|
goto out;
|
||||||
|
@@ -159,7 +159,7 @@ krb5_rd_safe(krb5_context context,
|
|||||||
|
|
||||||
if (safe.safe_body.timestamp == NULL ||
|
if (safe.safe_body.timestamp == NULL ||
|
||||||
safe.safe_body.usec == NULL ||
|
safe.safe_body.usec == NULL ||
|
||||||
labs(*safe.safe_body.timestamp - sec) > context->max_skew) {
|
krb5_time_abs(*safe.safe_body.timestamp, sec) > context->max_skew) {
|
||||||
ret = KRB5KRB_AP_ERR_SKEW;
|
ret = KRB5KRB_AP_ERR_SKEW;
|
||||||
krb5_clear_error_message (context);
|
krb5_clear_error_message (context);
|
||||||
goto failure;
|
goto failure;
|
||||||
|
@@ -54,11 +54,11 @@ check_set_time(krb5_context context)
|
|||||||
if (ret)
|
if (ret)
|
||||||
krb5_err(context, 1, ret, "krb5_us_timeofday");
|
krb5_err(context, 1, ret, "krb5_us_timeofday");
|
||||||
|
|
||||||
diff2 = labs(sec - tv.tv_sec);
|
diff2 = krb5_time_abs(sec, tv.tv_sec);
|
||||||
|
|
||||||
if (diff2 < 9 || diff > 11)
|
if (diff2 < 9 || diff > 11)
|
||||||
krb5_errx(context, 1, "set time error: diff: %ld",
|
krb5_errx(context, 1, "set time error: diff: %ld",
|
||||||
labs(sec - tv.tv_sec));
|
krb5_time_abs(sec, tv.tv_sec));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -850,11 +850,11 @@ _krb5_extract_ticket(krb5_context context,
|
|||||||
tmp_time = rep->enc_part.authtime;
|
tmp_time = rep->enc_part.authtime;
|
||||||
|
|
||||||
if (creds->times.starttime == 0
|
if (creds->times.starttime == 0
|
||||||
&& labs(tmp_time - sec_now) > context->max_skew) {
|
&& krb5_time_abs(tmp_time, sec_now) > context->max_skew) {
|
||||||
ret = KRB5KRB_AP_ERR_SKEW;
|
ret = KRB5KRB_AP_ERR_SKEW;
|
||||||
krb5_set_error_message (context, ret,
|
krb5_set_error_message (context, ret,
|
||||||
N_("time skew (%ld) larger than max (%ld)", ""),
|
N_("time skew (%ld) larger than max (%ld)", ""),
|
||||||
labs(tmp_time - sec_now),
|
krb5_time_abs(tmp_time, sec_now),
|
||||||
(long)context->max_skew);
|
(long)context->max_skew);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user