/// Query fails during stepping a SQL statement
#define PC_ERR_DB_QUERY_STEP -10
-// Unable to establish a connection with the database
+/// Unable to establish a connection with the database
#define PC_ERR_DB_CONNECTION -11
-// There is no application with such app_id
+/// There is no application with such app_id
#define PC_ERR_DB_NO_SUCH_APP -12
-// There already exists a permission with this name and type
+/// There already exists a permission with this name and type
#define PC_ERR_DB_PERM_FORBIDDEN -13
int perm_end(void);
/**
+* Run to rollback any privilege modification.
+*
+* @return PC_OPERATION_SUCCESS on success,
+* PC_ERR_* on error
+*/
+int perm_rollback(void);
+
+/**
* Adds additional rules to the database. The rules can use wild-cards and labels.
* It must be called within database transaction started with perm_begin() and
* finished with perm_end().
/**
+ * Rollbacks last transaction and finishes session
+ * with the database.
+ *
+ * @ingroup RDB API functions
+ * @return PC_OPERATION_SUCCESS on success,
+ * error code otherwise
+ */
+int rdb_modification_rollback(void);
+
+
+/**
* Add application label to the database.
* If label present: do nothing.
*
return rdb_modification_finish();
}
+API int perm_rollback(void)
+{
+ SECURE_C_LOGD("Entering function: %s.", __func__);
+
+ int ret = rdb_modification_rollback();
+
+ if (ret != PC_OPERATION_SUCCESS) {
+ C_LOGE("RDB %s failed with: %d", __func__, ret);
+ return ret;
+ }
+
+ return PC_OPERATION_SUCCESS;
+}
+
API int control_privilege(void)//deprecated
{
SECURE_C_LOGD("Entering function: %s.", __func__);
}
}
+int rdb_modification_rollback(void)
+{
+ if(p_db__) {
+ if(i_session_ret_code__ == PC_OPERATION_SUCCESS) {
+ // Trigger rollback
+ i_session_ret_code__ = PC_ERR_INVALID_OPERATION;
+ }
+ return rdb_modification_finish();
+ } else {
+ C_LOGE("RDB: Error nothing to rollback");
+ return PC_ERR_INVALID_OPERATION;
+ }
+}
int rdb_add_application(const char *const s_label_name)
{