1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

krb5_wrap: More checks for absolute path in smb_krb5_kt_open()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Andreas Schneider 2016-12-14 16:37:17 +01:00 committed by Jeremy Allison
parent 430c2d1844
commit e0990ccf4e

View File

@ -1130,12 +1130,29 @@ krb5_error_code smb_krb5_kt_open(krb5_context context,
bool write_access,
krb5_keytab *keytab)
{
if (keytab_name_req != NULL) {
if (keytab_name_req[0] != '/') {
return KRB5_KT_BADNAME;
}
int cmp;
if (keytab_name_req == NULL) {
return KRB5_KT_BADNAME;
}
if (keytab_name_req[0] == '/') {
goto open_keytab;
}
cmp = strncmp(keytab_name_req, "FILE:/", 6);
if (cmp == 0) {
goto open_keytab;
}
cmp = strncmp(keytab_name_req, "WRFILE:/", 8);
if (cmp == 0) {
goto open_keytab;
}
return KRB5_KT_BADNAME;
open_keytab:
return smb_krb5_kt_open_relative(context,
keytab_name_req,
write_access,