Skip to content

Commit 12bd874

Browse files
committed
Fix fallback to external_creds interface
The code was incorrectly immediately erroring out if no credential file is provided. Change the code to try to look for external credentials in case of any error in the previous code block. Signed-off-by: Simo Sorce <[email protected]>
1 parent 7184fc6 commit 12bd874

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/gss_creds.c

+11-8
Original file line numberDiff line numberDiff line change
@@ -441,19 +441,22 @@ uint32_t gssntlm_acquire_cred_from(uint32_t *minor_status,
441441
char *filename;
442442

443443
filename = get_user_file_envvar();
444-
if (!filename) {
445-
set_GSSERRS(ENOENT, GSS_S_CRED_UNAVAIL);
446-
goto done;
444+
if (filename) {
445+
retmin = get_user_file_creds(filename, name, cred);
446+
free(filename);
447+
} else {
448+
retmin = ENOENT;
447449
}
448-
retmin = get_user_file_creds(filename, name, cred);
449450
if (retmin) {
450-
retmin = external_get_creds(name, cred);
451+
uint32_t ret;
452+
ret = external_get_creds(name, cred);
453+
if (ret != ERR_NOTAVAIL) {
454+
retmin = ret;
455+
}
451456
}
452-
453-
free(filename);
454457
}
455458
if (retmin) {
456-
set_GSSERR(retmin);
459+
set_GSSERRS(retmin, GSS_S_CRED_UNAVAIL);
457460
goto done;
458461
}
459462
} else if (cred_usage == GSS_C_ACCEPT) {

0 commit comments

Comments
 (0)