Handle ctx->peerName==NULL better.
authorZdeněk Salvet <salvet@ics.muni.cz>
Wed, 29 Aug 2007 15:29:47 +0000 (15:29 +0000)
committerZdeněk Salvet <salvet@ics.muni.cz>
Wed, 29 Aug 2007 15:29:47 +0000 (15:29 +0000)
org.glite.lb.server/src/lb_html.c
org.glite.lb.server/src/query.c
org.glite.lb.server/src/userjobs.c

index e91a3ba..0e4683c 100644 (file)
@@ -47,7 +47,7 @@ int edg_wll_UserJobsToHTML(edg_wll_Context ctx, edg_wlc_JobId *jobsOut, char **m
                        "<h2><B>User jobs</B></h2>\r\n"
                        "User subject: %s<p>"
                        "<ul>%s</ul>"
-                       "\t</body>\r\n</html>",ctx->peerName,pomB);
+                       "\t</body>\r\n</html>",ctx->peerName?ctx->peerName: "&lt;anonymous&gt;",pomB);
         free(pomB);
 
         *message = pomA;
index 820c60f..7edeb6c 100644 (file)
@@ -87,9 +87,9 @@ int edg_wll_QueryEventsServer(
                !(job_where = jc_to_head_where(ctx, job_conditions, &i)) )
                goto cleanup;
 
-       peerid = strdup(strmd5(ctx->peerName,NULL));
+       if (ctx->peerName) peerid = strdup(strmd5(ctx->peerName,NULL));
        can_peername = edg_wll_gss_normalize_subj(ctx->peerName, 0);
-       can_peerid = strdup(strmd5(can_peername,NULL));
+       if (can_peername) can_peerid = strdup(strmd5(can_peername,NULL));
 
 /* XXX: similar query in srv_purge.c ! They has to match due to common
  * convert_event_head() called on the result
index 977d55b..59529af 100644 (file)
@@ -27,6 +27,9 @@ int edg_wll_UserJobs(
 
        edg_wll_ResetError(ctx);
        
+       if (!ctx->peerName) {
+               return edg_wll_SetError(ctx,EPERM, "user not authenticated (edg_wll_UserJobs)");
+       }
        can_peername = edg_wll_gss_normalize_subj(ctx->peerName, 0);
        userid = strmd5(can_peername,NULL);
        free(can_peername);