Setting the owner of job payload, authz not done, yet
authorDaniel Kouřil <kouril@ics.muni.cz>
Thu, 17 Feb 2011 13:50:29 +0000 (13:50 +0000)
committerDaniel Kouřil <kouril@ics.muni.cz>
Thu, 17 Feb 2011 13:50:29 +0000 (13:50 +0000)
org.glite.lb.client/examples/job_status.c
org.glite.lb.client/src/EventAttrNames.pl
org.glite.lb.client/src/StatusAttrNames.pl
org.glite.lb.server/src/lb_html.c
org.glite.lb.server/src/lb_text.c
org.glite.lb.server/src/store.c.T
org.glite.lb.state-machine/interface/intjobstat.h
org.glite.lb.state-machine/src/intjobstat_supp.c
org.glite.lb.state-machine/src/process_event.c
org.glite.lb.types/events.T
org.glite.lb.types/status.T

index b64d7ea..145f618 100644 (file)
@@ -220,6 +220,7 @@ static void printstat(edg_wll_JobStat stat, int level)
        printf("%sstate : %s\n", ind, s);
        printf("%sjobId : %s\n", ind, j1 = edg_wlc_JobIdUnparse(stat.jobId)); free(j1);
        printf("%sowner : %s\n", ind, stat.owner);
+       printf("%spayload_owner : %s\n", ind, stat.payload_owner);
        switch (stat.jobtype) {
                case EDG_WLL_STAT_SIMPLE:
                        printf("%sjobtype : SIMPLE\n", ind);
index 0483291..d752cba 100644 (file)
@@ -57,6 +57,7 @@
        OPERATION
        OWNER
        PARENT
+       PAYLOAD_OWNER
        PERMISSION
        PERMISSION_TYPE
        PID
index ec36be1..9812c2c 100644 (file)
@@ -59,6 +59,7 @@
        NETWORK_SERVER
        OWNER
        PARENT_JOB
+       PAYLOAD_OWNER
        PAYLOAD_RUNNING
        PBS_DEST_HOST
        PBS_ERROR_DESC
index 9428819..71f984d 100644 (file)
@@ -244,6 +244,7 @@ int edg_wll_GeneralJobStatusToHTML(edg_wll_Context ctx UNUSED_VAR, edg_wll_JobSt
        TR("Status","%s",(chstat = edg_wll_StatToString(stat.state)), NULL);
        free(chstat);
        TR("Owner","%s",stat.owner, NULL);
+       TR("Payload Owner","%s",stat.payload_owner, NULL);
        TR("Condor Id","%s",stat.condorId, NULL);
        TR("Globus Id","%s",stat.globusId, NULL);
        TR("Local Id","%s",stat.localId, NULL);
index 3072179..0712737 100644 (file)
@@ -180,6 +180,7 @@ int edg_wll_JobStatusToText(edg_wll_Context ctx UNUSED_VAR, edg_wll_JobStat stat
        TR("Status","%s",(chstat = edg_wll_StatToString(stat.state)));
        free(chstat);
        TR("owner","%s",stat.owner);
+       TR("payload_owner","%s",stat.payload_owner);
        TR("condorId","%s",stat.condorId);
        TR("globusId","%s",stat.globusId);
        TR("localId","%s",stat.localId);
index 3a0cf77..bc9cd85 100644 (file)
@@ -658,6 +658,9 @@ static int check_auth(edg_wll_Context ctx,edg_wll_Event *e)
                        if (e->any.type == EDG_WLL_EVENT_USERTAG &&
                            check_acl(ctx, e, EDG_WLL_CHANGEACL_TAG) == 0)
                                break;
+                       if (e->any.type == EDG_WLL_EVENT_TAKEPAYLOADOWNERSHIP &&
+                           strcmp(e->any.user,EDG_WLL_LOG_USER_DEFAULT) != 0)
+                               break;
                
                        edg_wll_SetError(ctx,EPERM,"check_auth()");
                        break;
index 3c0a3ac..dcb1031 100644 (file)
@@ -31,7 +31,7 @@ limitations under the License.
 /* where Z.XX is version from indent + 1 (version after commit), Y = Z+1 */
 /* and DESCRIPTION is short hit why version changed            */
 
-#define INTSTAT_VERSION "revision 2.9 - file transfers"
+#define INTSTAT_VERSION "revision 2.10 - payload owner"
 //                      ".... MAX LENGTH 32 BYTES !! ...."
 
 // Internal error codes 
@@ -76,6 +76,8 @@ typedef struct _intJobStat {
                struct timeval  last_pbs_event_timestamp;
                int             pbs_reruning;           // true if rerun event arrived
                char            **tag_seq_codes;
+               char            *payload_owner_pending;
+               char            *payload_owner_unconfirmed;
 
                /*!! if adding new field, modify also destroy_intJobStat_extension()    *
                 *!! update dec/enc_intJobStat and increase INTSTAT_VERSION             */
index fd24eb4..c4bb463 100644 (file)
@@ -526,6 +526,7 @@ char *enc_JobStat(char *old, edg_wll_JobStat* stat)
        if (ret) ret = enc_int(ret, stat->jw_status);
        if (ret) ret = enc_jobid(ret, stat->isb_transfer);
        if (ret) ret = enc_jobid(ret, stat->osb_transfer);
+       if (ret) ret = enc_string(ret, stat->payload_owner);
        if (ret) ret = enc_string(ret, stat->pbs_state);
        if (ret) ret = enc_string(ret, stat->pbs_queue);
        if (ret) ret = enc_string(ret, stat->pbs_owner);
@@ -631,6 +632,7 @@ edg_wll_JobStat* dec_JobStat(char *in, char **rest)
         if (tmp_in != NULL) stat->jw_status = dec_int(tmp_in, &tmp_in);
         if (tmp_in != NULL) stat->isb_transfer = dec_jobid(tmp_in, &tmp_in);
         if (tmp_in != NULL) stat->osb_transfer = dec_jobid(tmp_in, &tmp_in);
+       if (tmp_in != NULL) stat->payload_owner = dec_string(tmp_in, &tmp_in);
         if (tmp_in != NULL) stat->pbs_state = dec_string(tmp_in, &tmp_in);
         if (tmp_in != NULL) stat->pbs_queue = dec_string(tmp_in, &tmp_in);
         if (tmp_in != NULL) stat->pbs_owner = dec_string(tmp_in, &tmp_in);
@@ -695,6 +697,8 @@ char *enc_intJobStat(char *old, intJobStat* stat)
        if (ret) ret = enc_timeval(ret, stat->last_pbs_event_timestamp);
        if (ret) ret = enc_int(ret, stat->pbs_reruning);
        if (ret) ret = enc_strlist(ret, stat->tag_seq_codes);
+       if (ret) ret = enc_string(ret, stat->payload_owner_pending);
+       if (ret) ret = enc_string(ret, stat->payload_owner_unconfirmed);
        return ret;
 }
 
@@ -740,6 +744,12 @@ intJobStat* dec_intJobStat(char *in, char **rest)
                if (tmp_in != NULL) {
                        stat->tag_seq_codes = dec_strlist(tmp_in, &tmp_in);
                }
+               if (tmp_in != NULL) {
+                       stat->payload_owner_pending = dec_string(tmp_in, &tmp_in);
+               }
+               if (tmp_in != NULL) {
+                       stat->payload_owner_unconfirmed = dec_string(tmp_in, &tmp_in);
+               }
        } else if (tmp_in != NULL) {
                edg_wll_FreeStatus(pubstat);
                free(pubstat);
index 20fcb21..75d2727 100644 (file)
@@ -979,6 +979,26 @@ static int processEvent_glite(intJobStat *js, edg_wll_Event *e, int ev_seq, int
                                }
                        }
                        break;
+               case EDG_WLL_EVENT_GRANTPAYLOADOWNERSHIP:
+                       if (js->payload_owner_pending) {
+                               if (edg_wll_gss_equal_subj(e->any.user, js->payload_owner_pending))
+                                       js->pub.payload_owner = js->payload_owner_pending;
+                               else
+                                       free(js->payload_owner_pending);
+                               js->payload_owner_pending = NULL;
+                       } else
+                               rep (js->payload_owner_unconfirmed, e->grantPayloadOwnership.payload_owner);
+                       ignore_seq_code = 1;
+                       break;
+               case EDG_WLL_EVENT_TAKEPAYLOADOWNERSHIP:
+                       if (js->payload_owner_unconfirmed &&
+                           edg_wll_gss_equal_subj(e->any.user, js->payload_owner_unconfirmed)) {
+                               js->pub.payload_owner = js->payload_owner_unconfirmed;
+                               js->payload_owner_unconfirmed = NULL;
+                       } else
+                               rep (js->payload_owner_pending, e->any.user);
+                       ignore_seq_code = 1;
+                       break;
 
                default:
                        goto bad_event;
@@ -1088,6 +1108,8 @@ void destroy_intJobStat_extension(intJobStat *p)
                for (i=0; p->tag_seq_codes[i]; i++) free(p->tag_seq_codes[i]);
                free(p->tag_seq_codes);
        }
+       if (p->payload_owner_pending) free(p->payload_owner_pending);
+       if (p->payload_owner_unconfirmed) free(p->payload_owner_unconfirmed);
 
        memset(p,0,sizeof(*p));
 }
index 027223a..4c5d6f0 100644 (file)
        jobid   child           JobId of subjob, which triggered the state change.      
        string  child_event     Event which triggered the state change. 
 
+@type GrantPayloadOwnership    Hand over ownership of actual job payload (e.g. of a pilot job)
+       string  payload_owner   Identity (certificate subject) of the payload owner.
+
+@type TakePayloadOwnership     Take over ownership of actual job payload
+
 @flesh PBS
 
 @type PBSQueued                Job enqued
        _optional_
        string  compute_job     Jobid of (compute) job the sandbox belongs. Exclusive with transfer_job.
        _optional_      
+
index 0ad9dd3..d859a55 100644 (file)
@@ -103,6 +103,7 @@ cclassad    jdl_classad     Unparsed JDL classad
 
 jobid  isb_transfer            Input sandbox corresponding to the job
 jobid  osb_transfer            Output sandbox corresponding to the job
+string payload_owner           Owner of the actual job payload (e.g., for pilot jobs)
 
 _pad_  55