--- a/application/config.c Thu Nov 14 22:28:36 2024 +0100 +++ b/application/config.c Thu Nov 14 23:22:35 2024 +0100 @@ -300,7 +300,7 @@ free(c); } -int get_stored_credentials(char *credid, char **user, char **password) { +int get_stored_credentials(const char *credid, char **user, char **password) { if(!credid) { return 0; } @@ -332,10 +332,10 @@ } -int get_location_credentials(DavCfgRepository *repo, const char *path, char **user, char **password) { +const char* get_location_credentials(DavCfgRepository *repo, const char *path) { PwdStore *secrets = get_pwdstore(); if(!secrets) { - return 0; + return NULL; } /* @@ -371,8 +371,7 @@ // iterate over sorted locations and check if a location is a prefix // of the requested url - char *id = NULL; - int ret = 0; + const char *id = NULL; i = cxListIterator(locations); cx_foreach(CredLocation*, cred, i) { cxstring cred_url = cx_str(cred->location); @@ -390,19 +389,8 @@ } } - // if an id is found and we can access the decrypted secret store - // we can set the user/password - if(id && (secrets->isdecrypted || !pwdstore_decrypt_secrets(secrets))) { - PwdEntry *cred = pwdstore_get(secrets, id); - if(cred) { - *user = cred->user; - *password = cred->password; - ret = 1; - } - } - free(req_url_proto.ptr); cxListDestroy(locations); - return ret; + return id; }