[Pvfs2-cvs] commit by nlmills in pvfs2/src/server: prelude.sm

CVS commit program cvs at parl.clemson.edu
Thu May 29 18:32:33 EDT 2008


Update of /anoncvs/pvfs2/src/server
In directory parlweb1:/tmp/cvs-serv3806/src/server

Modified Files:
      Tag: cu-security-branch
	prelude.sm 
Log Message:
basic framework for validation in prelude


Index: prelude.sm
===================================================================
RCS file: /anoncvs/pvfs2/src/server/prelude.sm,v
diff -p -u -r1.74.2.2 -r1.74.2.3
--- prelude.sm	27 May 2008 19:04:47 -0000	1.74.2.2
+++ prelude.sm	29 May 2008 22:32:33 -0000	1.74.2.3
@@ -41,12 +41,12 @@ nested machine pvfs2_prelude_work_sm
     state getattr_if_needed
     {
         run prelude_getattr_if_needed;
-        default => setup_op;
+        default => validate;
     }
 
-    state setup_op
+    state validate
     {
-        run prelude_setup_op;
+        run prelude_validate;
         default => return;
     }
 }
@@ -150,15 +150,24 @@ static PINT_sm_action prelude_getattr_if
     return ret;
 }
 
-static PINT_sm_action prelude_setup_op(
-                                       struct PINT_smcb *smcb,
-                                       job_status_s *js_p
-                                       )
+static PINT_sm_action prelude_validate(struct PINT_smcb *smcb,
+                                       job_status_s *js_p)
 {
     struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+    int ret = -PVFS_EINVAL;
 
     PVFS_ds_attr_to_object_attr(&s_op->ds_attr, &s_op->attr);
     s_op->attr.mask = PVFS_ATTR_COMMON_ALL;
+
+    ret = PINT_verify_capability(&s_op->req->capability);
+    if (ret)
+    {
+        /* TODO: perform actual permission check */
+    }
+    else
+    {
+        js_p->error_code = -PVFS_EACCES;
+    }
 
     return SM_ACTION_COMPLETE;
 }



More information about the Pvfs2-cvs mailing list