Ack from me.
Not tested.

Error strings could be added, but lets do that later.

/AndersBj 

-----Original Message-----
From: Zoran Milinkovic [mailto:[email protected]] 
Sent: den 9 september 2014 13:35
To: [email protected]
Cc: [email protected]
Subject: [devel] [PATCH 1 of 1] imm: add a validation for accessControlMode 
[#1008]

 osaf/services/saf/immsv/immnd/ImmModel.cc |  22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)


Validation that the value of accessControlMode is not out of range.

diff --git a/osaf/services/saf/immsv/immnd/ImmModel.cc 
b/osaf/services/saf/immsv/immnd/ImmModel.cc
--- a/osaf/services/saf/immsv/immnd/ImmModel.cc
+++ b/osaf/services/saf/immsv/immnd/ImmModel.cc
@@ -8278,6 +8278,28 @@ ImmModel::ccbObjectModify(const ImmsvOmC
             LOG_IN("Skipping OI callback for modify on %s since OI is same as 
PBE",
                objectName.c_str());
 
+            /* Check that the value of accessControlMode is in a range */
+            ImmAttrValueMap::iterator avmi = 
afim->mAttrValueMap.find(OPENSAF_IMM_ACCESS_CONTROL_MODE);
+            if(avmi != afim->mAttrValueMap.end()) {
+                osafassert(avmi->second);
+                if(avmi->second->empty()) {
+                    LOG_ER("ERR_BAD_OPERATION: Value of '%s' attribute in 
object '%s' cannot be empty",
+                            OPENSAF_IMM_ACCESS_CONTROL_MODE,
+                            objectName.c_str());
+                    err = SA_AIS_ERR_BAD_OPERATION;
+                    goto bypass_impl;
+                } else {
+                    SaUint32T mode = (SaUint32T)avmi->second->getValue_int();
+                    if(mode > 2) { /* ACCESS_CONTROL_ENFORCING == 2 */
+                        LOG_ER("ERR_BAD_OPERATION: Value of '%s' attribute in 
object '%s' is out of range",
+                                OPENSAF_IMM_ACCESS_CONTROL_MODE,
+                                objectName.c_str());
+                        err = SA_AIS_ERR_BAD_OPERATION;
+                        goto bypass_impl;
+                    }
+                }
+            }
+
             /* Pre validate any changes. More efficent here than in 
apply/completed and
                we need to guard against race on long DN creation allowed. Such 
long DNs
                are themselves created in CCBs or RTO creates.

------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce.
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce.
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to