diff options
Diffstat (limited to 'src/authkey.c')
-rw-r--r-- | src/authkey.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/authkey.c b/src/authkey.c index cd284fb5..7bf45165 100644 --- a/src/authkey.c +++ b/src/authkey.c @@ -106,6 +106,8 @@ int pa_authkey_load_from_home(const char *fn, void *data, size_t length) { char *home; char path[PATH_MAX]; + assert(fn && data && length); + if (!(home = getenv("HOME"))) return -2; @@ -113,3 +115,12 @@ int pa_authkey_load_from_home(const char *fn, void *data, size_t length) { return pa_authkey_load(path, data, length); } + +int pa_authkey_load_auto(const char *fn, void *data, size_t length) { + assert(fn && data && length); + + if (*fn == '/') + return pa_authkey_load(fn, data, length); + else + return pa_authkey_load_from_home(fn, data, length); +} |