#include <pakfire/private.h>
#include <pakfire/string.h>
+#include <krb5/krb5.h>
+
#define DEFAULT_KEYTAB "/etc/krb5.keytab"
struct pakfire_buildservice {
// A HTTP Client
struct pakfire_downloader* httpclient;
+
+ // Kerberos Context
+ krb5_context krb5_ctx;
};
+static int pakfire_buildservice_setup_auth(struct pakfire_buildservice* service) {
+ const char* error = NULL;
+ int r;
+
+ // Setup a Kerberos context
+ r = krb5_init_context(&service->krb5_ctx);
+ if (r) {
+ error = krb5_get_error_message(service->krb5_ctx, r);
+
+ CTX_ERROR(service->ctx, "Could not initialize Kerberos: %s\n", error);
+ krb5_free_error_message(service->krb5_ctx, error);
+
+ goto ERROR;
+ }
+
+ERROR:
+ return r;
+}
+
static int pakfire_buildservice_setup(struct pakfire_buildservice* service) {
struct pakfire_config* config = NULL;
const char* url = NULL;
if (r)
goto ERROR;
+ // Setup authentication
+ r = pakfire_buildservice_setup_auth(service);
+ if (r)
+ goto ERROR;
+
ERROR:
if (config)
pakfire_config_unref(config);
}
static void pakfire_buildservice_free(struct pakfire_buildservice* service) {
+ if (service->krb5_ctx)
+ krb5_free_context(service->krb5_ctx);
if (service->httpclient)
pakfire_downloader_unref(service->httpclient);
if (service->ctx)