me);
}
if ( !cmd || !strcmp(cmd, "new") )
- printf("\n'new' command usage: %s new jobid\n"
- " jobid job ID to connect notif. reg. with\n", me);
+ printf("\n'new' command usage: %s new [-j jobid] [-o owner]\n"
+ " jobid job ID to connect notif. reg. with\n"
+ " owner match this owner DN\n"
+ , me);
if ( !cmd || !strcmp(cmd, "bind") )
printf("\n'bind' command usage: %s bind notifid [fake_addr]\n"
" notifid Notification ID\n"
" fake_addr Fake the client address.\n"
" timeout Timeout to receive operation in seconds.\n", me);
if ( !cmd || !strcmp(cmd, "test") )
- printf("\n'new' command usage: %s test jobid\n"
+ printf("\n'test' command usage: %s test jobid\n"
" jobid job ID to connect notif. reg. with\n", me);
if ( !cmd || !strcmp(cmd, "drop") )
printf("\n'drop' command usage: %s drop notifid\n"
}
else if ( !strcmp(argv[1], "new") )
{
+ int c;
edg_wlc_JobId jid;
edg_wll_NotifId id_out;
+ char *job = NULL,*owner = NULL;
- if ( (argc < 3) || edg_wlc_JobIdParse(argv[2], &jid) ) {
+ while ((c = getopt(argc-1,argv+1,"j:o:")) > 0) switch (c) {
+ case 'j': job = optarg; break;
+ case 'o': owner = optarg; break;
+ default: usage("new"); goto cleanup;
+ }
+
+ if ((!job && !owner) || (job && owner)) {
+ usage("new");
+ goto cleanup;
+ }
+
+ if ( job && edg_wlc_JobIdParse(job, &jid) ) {
printf("Job ID parameter not set propperly!\n");
usage("new");
goto cleanup;
conditions = (edg_wll_QueryRec **)calloc(2,sizeof(edg_wll_QueryRec *));
conditions[0] = (edg_wll_QueryRec *)calloc(2,sizeof(edg_wll_QueryRec));
- conditions[0][0].attr = EDG_WLL_QUERY_ATTR_JOBID;
+ conditions[0][0].attr = job ? EDG_WLL_QUERY_ATTR_JOBID : EDG_WLL_QUERY_ATTR_OWNER;
conditions[0][0].op = EDG_WLL_QUERY_OP_EQUAL;
- conditions[0][0].value.j = jid;
+ if (job) conditions[0][0].value.j = jid;
+ else conditions[0][0].value.c = owner;
if ( !edg_wll_NotifNew(ctx,
(edg_wll_QueryRec const* const*)conditions,
TimeToStr(valid),
valid);
edg_wll_NotifIdFree(id_out);
- edg_wlc_JobIdFree(jid);
+ if (job) edg_wlc_JobIdFree(jid);
}
else if ( !strcmp(argv[1], "bind") )
{
{
edg_wll_GssStatus gss_code;
edg_wll_Context tmp_ctx = (edg_wll_Context)user_data;
- int ret, len;
+ int ret;
+ size_t len;
ret = edg_wll_gss_read_full(&tmp_ctx->connPoolNotif[0].gss,
buffer, max_len,
{
struct pollfd pollfds[1];
struct sockaddr_in a;
- int recv_sock, alen;
+ int recv_sock;
+ size_t alen;
edg_wll_Event *event = NULL;
struct timeval start_time,check_time,tv;
char *event_char = NULL, *jobstat_char = NULL;
/* ctx->connPoolNotif[ctx->connPoolNotifToUse] */
/* notif_send() & notif_receive() should then migrate to */
/* client/connection.c and use connPool management f-cions */
+
+ /* XXX: long-lived contexts may have problems, TODO implement credential reload */
+
+ if (!ctx->connPoolNotif[0].gsiCred) {
+ if (edg_wll_gss_acquire_cred_gsi(
+ ctx->p_proxy_filename ? ctx->p_proxy_filename : ctx->p_cert_filename,
+ ctx->p_proxy_filename ? ctx->p_proxy_filename : ctx->p_key_filename,
+ &ctx->connPoolNotif[0].gsiCred,&gss_code))
+ {
+ edg_wll_SetErrorGss(ctx,"failed aquiring credentials",&gss_code);
+ goto err;
+ }
+ }
if (ctx->connPoolNotif[0].gss.context == NULL)
{