pass server identity tru context to slaves
authorMiloš Mulač <mulac@civ.zcu.cz>
Thu, 2 Nov 2006 17:50:04 +0000 (17:50 +0000)
committerMiloš Mulač <mulac@civ.zcu.cz>
Thu, 2 Nov 2006 17:50:04 +0000 (17:50 +0000)
- enables to log DG.USER of CollectionState event

org.glite.lb.common/interface/context-int.h
org.glite.lb.server/src/bkserverd.c
org.glite.lb.server/src/jobstat.c

index 91c13cc..8536a8e 100644 (file)
@@ -64,6 +64,7 @@ struct _edg_wll_Context {
        
        time_t          peerProxyValidity;
        char            *peerName;
+       char            *serverIdentity;                /* DN of server certificate or "anonymous" */
        edg_wll_VomsGroups      vomsGroups;
        int             allowAnonymous;
        int             noAuth;         /* if set, you can obtain info about events     */
index d04f934..f634070 100644 (file)
@@ -132,6 +132,7 @@ static char                    *purgeStorage = EDG_PURGE_STORAGE;
 static char                       *dumpStorage = EDG_DUMP_STORAGE;
 static char                       *jpregDir = JPREG_DEF_DIR;
 static int                             jpreg = 0;
+static char                            *server_subject = NULL;
 
 
 static time_t                  purge_timeout[EDG_WLL_NUMBER_OF_STATCODES];
@@ -549,12 +550,16 @@ a.sin_addr.s_addr = INADDR_ANY;
                int     i;
 
                dprintf(("Server identity: %s\n",mysubj));
+               server_subject = strdup(mysubj);
                for ( i = 0; super_users && super_users[i]; i++ ) ;
                super_users = realloc(super_users, (i+2)*sizeof(*super_users));
                super_users[i] = mysubj;
                super_users[i+1] = NULL;
        }
-       else dprintf(("Running unauthenticated\n"));
+       else {
+               dprintf(("Running unauthenticated\n"));
+               server_subject = strdup("anonymous LB");
+       }
 
        if ( noAuth ) dprintf(("Promiscuous mode\n"));
        dprintf(("Listening at %d,%d (accepting protocols: " COMP_PROTO " and compatible) ...\n",atoi(port),atoi(port)+1));
@@ -795,6 +800,8 @@ int bk_handle_connection(int conn, struct timeval *timeout, void *data)
        ctx->connPool[ctx->connToUse].peerPort = ntohs(a.sin_port);
        ctx->count_statistics = count_statistics;
 
+       ctx->serverIdentity = strdup(server_subject);
+
        gettimeofday(&conn_start, 0);
 
        h_errno = asyn_gethostbyaddr(&name, (char *)&a.sin_addr.s_addr,sizeof(a.sin_addr.s_addr), AF_INET, &dns_to);
index 17050f8..96f31ca 100644 (file)
@@ -717,8 +717,7 @@ static int log_collectionState_event(edg_wll_Context ctx, edg_wll_JobStatCode st
        edg_wll_Event  *event = 
                edg_wll_InitEvent(EDG_WLL_EVENT_COLLECTIONSTATE);
 
-       // XXX: fill in event->any part of event...
-       event->any.user = strdup(pis->pub.owner);       // XXX: use this identity?
+       event->any.user = strdup(ctx->serverIdentity);  
        event->any.seqcode = strdup(ce->any.seqcode);   // XXX: nonsense, just something..
        edg_wlc_JobIdDup(pis->pub.jobId, &(event->any.jobId));
        gettimeofday(&event->any.timestamp,0);