From: Jiří Filipovič Date: Mon, 31 Oct 2011 15:41:55 +0000 (+0000) Subject: Show notifications only to theirs owner. X-Git-Tag: glite-jobid-api-c_R_2_0_3_2~10 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=45cd70ed63d5971228c3dbbb9f4538e073aef790;p=jra1mw.git Show notifications only to theirs owner. --- diff --git a/org.glite.lb.server/src/lb_proto.c b/org.glite.lb.server/src/lb_proto.c index ea5a8ff..d5886b3 100644 --- a/org.glite.lb.server/src/lb_proto.c +++ b/org.glite.lb.server/src/lb_proto.c @@ -263,10 +263,14 @@ static int getNotifInfo(edg_wll_Context ctx, char *notifId, notifInfo *ni){ glite_lbu_Statement notif = NULL; char *notifc[4] = {NULL, NULL, NULL, NULL}; + char *can_peername = edg_wll_gss_normalize_subj(ctx->peerName, 0); + char *userid = strmd5(can_peername, NULL); + trio_asprintf(&q, "select destination, valid, conditions, flags " "from notif_registrations " - "where notifid='%s'", - notifId); + "where notifid='%s' " + "and userid='%s'", + notifId, userid); glite_common_log_msg(LOG_CATEGORY_LB_SERVER_DB, LOG_PRIORITY_DEBUG, q); if (edg_wll_ExecSQL(ctx, q, ¬if) < 0) goto err; free(q); q = NULL; @@ -285,6 +289,7 @@ static int getNotifInfo(edg_wll_Context ctx, char *notifId, notifInfo *ni){ return 0; err: + free(can_peername); return -1; } @@ -782,6 +787,7 @@ edg_wll_ErrorCode edg_wll_Proto(edg_wll_Context ctx, *pom = 0; if (getNotifInfo(ctx, strrchr(pomCopy, ':')+1, &ni)){ ret = HTTP_NOTFOUND; + edg_wll_SetError(ctx, ENOENT, "Notification ID not know."); goto err; } free(pomCopy);