From 45cd70ed63d5971228c3dbbb9f4538e073aef790 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ji=C5=99=C3=AD=20Filipovi=C4=8D?= Date: Mon, 31 Oct 2011 15:41:55 +0000 Subject: [PATCH] Show notifications only to theirs owner. --- org.glite.lb.server/src/lb_proto.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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); -- 1.8.2.3