Skip to content

Commit d50b0d2

Browse files
author
Paymon MARANDI
committed
krb5: make sure keytab is a FILE before checking for access
KCM: and API: are other cases besides MEMORY: Resolves: #8555 Signed-off-by: Paymon MARANDI <paymon@encs.concordia.ca>
1 parent 3d27526 commit d50b0d2

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

src/providers/krb5/krb5_keytab.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -157,16 +157,17 @@ krb5_error_code copy_keytab_into_memory(TALLOC_CTX *mem_ctx, krb5_context kctx,
157157
}
158158
kerr = 0;
159159
goto done;
160-
}
161-
162-
if (faccessat(AT_FDCWD, sep+1, R_OK, AT_EACCESS) != 0) {
163-
saved_errno = errno;
164-
DEBUG(SSSDBG_CRIT_FAILURE,
165-
"keytab [%s] is not readable: [%d][%s].\n",
166-
keytab_file, saved_errno, sss_strerror(saved_errno));
160+
} else if ((strncmp(keytab_name, "DIR:", sizeof("DIR:") -1) == 0) ||
161+
(strncmp(keytab_name, "FILE:", sizeof("FILE:") -1) == 0)) {
162+
if (faccessat(AT_FDCWD, sep + 1, R_OK, AT_EACCESS) != 0) {
163+
saved_errno = errno;
164+
DEBUG(SSSDBG_CRIT_FAILURE,
165+
"keytab [%s] is not readable: [%d][%s].\n",
166+
keytab_file, saved_errno, sss_strerror(saved_errno));
167167

168-
kerr = KRB5KRB_ERR_GENERIC;
169-
goto done;
168+
kerr = KRB5KRB_ERR_GENERIC;
169+
goto done;
170+
}
170171
}
171172

172173
kerr = sss_krb5_kt_have_content(kctx, keytab);

0 commit comments

Comments
 (0)