static char short_options[] = "s:p:h";
-/* Two ugly hacks, will be removed once the context is introduced */
-char *vomsconf = NULL;
-
-void
-edg_wlpr_Log(int dbg_level, const char *format, ...);
-
int
main(int argc, char *argv[])
{
glite_renewal_core_context_data ctx;
int ret;
- memset(&ctx, 0, sizeof(ctx));
-
while ((arg = getopt_long(argc, argv, short_options, long_options, NULL)) != EOF) {
switch(arg) {
case 's':
exit(1);
}
+ ret = glite_renewal_core_init_ctx(&ctx);
+ if (ret) {
+ fprintf(stderr, "glite_renewal_core_init_ctx() failed\n");
+ exit(1);
+ }
+
ret = glite_renewal_core_renew(&ctx, server, 0, proxy, &new_proxy);
if (ret) {
fprintf(stderr, "glite_renewal_core_renew() failed: %d\n", ret);
exit(1);
}
+ ret = glite_renewal_core_destroy_ctx(ctx);
+
printf("%s\n", new_proxy);
return 0;
}
-
-void
-edg_wlpr_Log(int dbg_level, const char *format, ...)
-{
- return;
-}
typedef struct glite_renewal_core_context_data {
int dbg_level;
- char *cert;
- char *key;
- char *cadir;
int voms_enabled;
} glite_renewal_core_context_data;
typedef struct glite_renewal_core_context_data *glite_renewal_core_context;
/**
+ * This cal initializes the context and sets default values
+ */
+int
+glite_renewal_core_init_ctx(glite_renewal_core_context *context);
+
+/**
+ * This call frees the context and all memory used by the context
+ */
+int
+glite_renewal_core_destroy_ctx(glite_renewal_core_context context);
+
+/**
* This call tries to renew the proxy certificate using the MyProxy
* repository. If VOMS attributes are present in the proxy they are renewed
* as well.
return ret;
}
+
+int
+glite_renewal_core_init_ctx(glite_renewal_core_context *context)
+{
+ glite_renewal_core_context p = NULL;
+
+ *context = NULL;
+
+ p = calloc(1, sizeof(*p));
+ if (p == NULL)
+ return ENOMEM;
+
+ *context = p;
+ return 0;
+}
+
+int
+glite_renewal_core_destroy_ctx(glite_renewal_core_context context)
+{
+ free(context);
+ return 0;
+}
+
+/* XXX remove these ugly things: */
+
+void
+edg_wlpr_Log(int dbg_level, const char *format, ...)
+{
+ return;
+}
+
+char *vomsconf = NULL;