From 4ae902ec5fb286a7826214f73f718a41cdf82ddb Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 7 Dec 2008 13:12:33 -0600 Subject: Add signature directory as option on libalpm handle This will serve as the home directory we pass to GPGME when making calls so we can have a libalpm-utilized keyring. Signed-off-by: Dan McGee --- lib/libalpm/handle.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'lib/libalpm/handle.c') diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c index 442e99df..42c0cd1f 100644 --- a/lib/libalpm/handle.c +++ b/lib/libalpm/handle.c @@ -84,6 +84,7 @@ void _alpm_handle_free(pmhandle_t *handle) FREE(handle->logfile); FREE(handle->lockfile); FREE(handle->arch); + FREE(handle->signaturedir); FREELIST(handle->dbs_sync); FREELIST(handle->noupgrade); FREELIST(handle->noextract); @@ -174,6 +175,15 @@ const char SYMEXPORT *alpm_option_get_lockfile() return handle->lockfile; } +const char SYMEXPORT *alpm_option_get_signaturedir() +{ + if (handle == NULL) { + pm_errno = PM_ERR_HANDLE_NULL; + return NULL; + } + return handle->signaturedir; +} + int SYMEXPORT alpm_option_get_usesyslog() { if (handle == NULL) { @@ -460,6 +470,24 @@ int SYMEXPORT alpm_option_set_logfile(const char *logfile) return 0; } +int SYMEXPORT alpm_option_set_signaturedir(const char *signaturedir) +{ + ALPM_LOG_FUNC; + + if(!signaturedir) { + pm_errno = PM_ERR_WRONG_ARGS; + return -1; + } + + if(handle->signaturedir) { + FREE(handle->signaturedir); + } + handle->signaturedir = strdup(signaturedir); + + _alpm_log(PM_LOG_DEBUG, "option 'signaturedir' = %s\n", handle->signaturedir); + return 0; +} + void SYMEXPORT alpm_option_set_usesyslog(int usesyslog) { handle->usesyslog = usesyslog; -- cgit v1.2.3-24-g4f1b