From 986ee16cc64f974a52333c006f9f8942bc033068 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Daniel=20Kou=C5=99il?= Date: Tue, 14 Mar 2006 12:35:44 +0000 Subject: [PATCH] Simple example using the glite_renewal_core_renew() call --- .../examples/renew_core.c | 63 ++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 org.glite.security.proxyrenewal/examples/renew_core.c diff --git a/org.glite.security.proxyrenewal/examples/renew_core.c b/org.glite.security.proxyrenewal/examples/renew_core.c new file mode 100644 index 0000000..f150f75 --- /dev/null +++ b/org.glite.security.proxyrenewal/examples/renew_core.c @@ -0,0 +1,63 @@ +#include +#include +#include +#include + +static struct option const long_options[] = { + { "server", required_argument, 0, 's' }, + { "proxy", required_argument, 0, 'p' }, + { NULL, 0, NULL, 0} +}; + +static char short_options[] = "s:p:"; + +/* 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[]) +{ + char *server = NULL; + char *proxy = NULL; + char *new_proxy = NULL; + extern int optind; + char arg; + 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': + server = optarg; break; + case 'p': + proxy = optarg; break; + case 'h': + fprintf(stdout, "Usage: %s --server --proxy \n", argv[0]); + exit(1); + } + } + + if (server == NULL || proxy == NULL) { + fprintf(stderr, "both server and proxy parameters must be given\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); + } + + return 0; +} + +void +edg_wlpr_Log(int dbg_level, const char *format, ...) +{ + return; +} -- 1.8.2.3