} // VixPropertyList_RemoveAllWithoutHandles
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * VixPropertyList_MarkAllSensitive --
+ *
+ * Mark all properties in a list sensitive.
+ *
+ * Results:
+ * As above
+ *
+ * Side effects:
+ * None
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+void
+VixPropertyList_MarkAllSensitive(VixPropertyListImpl *propList) // IN/OUT:
+{
+ if (NULL != propList) {
+ VixPropertyValue *property = propList->properties;
+
+ while (NULL != property) {
+ property->isSensitive = TRUE;
+
+ property = property->next;
+ }
+ }
+} // VixPropertyList_MarkAllSensitive
+
+
/*
*-----------------------------------------------------------------------------
*
*/
VixError
-VixPropertyList_Serialize(VixPropertyListImpl *propList, // IN
- Bool dirtyOnly, // IN
- size_t *resultSize, // OUT
- char **resultBuffer) // OUT
+VixPropertyList_Serialize(VixPropertyListImpl *propList, // IN:
+ Bool dirtyOnly, // IN:
+ size_t *resultSize, // OUT:
+ char **resultBuffer) // OUT:
{
VixError err = VIX_OK;
VixPropertyValue *property = NULL;
*
* Results:
* VixError. VIX_OK if the property was found.
- * VIX_E_UNRECOGNIZED_PROPERTY if the property was not found.
+ * VIX_E_UNRECOGNIZED_PROPERTY if the property was not found.
*
* Side effects:
* None
} // VixPropertyList_GetString
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * VixPropertyListSetStringImpl --
+ *
+ * Saves a copy of a string property value. Sets sensitivity.
+ *
+ * Results:
+ * As above
+ *
+ * Side effects:
+ * None
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+static void
+VixPropertyListSetStringImpl(VixPropertyValue *property, // IN:
+ const char *value, // IN:
+ Bool isSensitive) // IN:
+{
+ if (NULL != property->value.strValue) {
+ if (property->isSensitive) {
+ Util_ZeroString(property->value.strValue);
+ }
+ free(property->value.strValue);
+ property->value.strValue = NULL;
+ }
+ if (NULL != value) {
+ property->value.strValue = Util_SafeStrdup(value);
+ }
+ property->isDirty = TRUE;
+ property->isSensitive = isSensitive;
+} // VixPropertyListSetStringImpl
+
+
/*
*-----------------------------------------------------------------------------
*
* Saves a copy of a string property value. The value is identified
* by the integer property ID.
*
- * Value names are unique within a single proeprty list.
+ * Value names are unique within a single property list.
* If a previous value with the same propertyID value already
* existed in this property list, then it is replaced with the new
* value. Otherwise, a new value is added.
*/
VixError
-VixPropertyList_SetString(VixPropertyListImpl *propList, // IN
- int propertyID, // IN
- const char *value) // IN
+VixPropertyList_SetString(VixPropertyListImpl *propList, // IN:
+ int propertyID, // IN:
+ const char *value) // IN:
{
VixError err = VIX_OK;
VixPropertyValue *property = NULL;
err = VIX_E_INVALID_ARG;
goto abort;
}
-
+
/*
* Find or create an entry for this property.
*/
err = VixPropertyList_FindProperty(propList,
- propertyID,
- VIX_PROPERTYTYPE_STRING,
+ propertyID,
+ VIX_PROPERTYTYPE_STRING,
0,
- TRUE,
+ TRUE,
&property);
- if (VIX_OK != err) {
- goto abort;
+ if (VIX_OK == err) {
+ VixPropertyListSetStringImpl(property, value, property->isSensitive);
}
- if (NULL != property->value.strValue) {
- free(property->value.strValue);
- property->value.strValue = NULL;
+abort:
+
+ return err;
+} // VixPropertyList_SetString
+
+
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * VixPropertyList_SetStringSensitive --
+ *
+ * Saves a copy of a string property value. The value is identified
+ * by the integer property ID. Mark sensitive.
+ *
+ * Value names are unique within a single property list.
+ * If a previous value with the same propertyID value already
+ * existed in this property list, then it is replaced with the new
+ * value. Otherwise, a new value is added.
+ *
+ * This fails if the value is present but has a different type.
+ *
+ * Results:
+ * VixError
+ *
+ * Side effects:
+ * None
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+VixError
+VixPropertyList_SetStringSensitive(VixPropertyListImpl *propList, // IN:
+ int propertyID, // IN:
+ const char *value) // IN:
+{
+ VixError err = VIX_OK;
+ VixPropertyValue *property = NULL;
+
+ if (NULL == propList) {
+ err = VIX_E_INVALID_ARG;
+ goto abort;
}
- if (NULL != value) {
- property->value.strValue = Util_SafeStrdup(value);
+
+ /*
+ * Find or create an entry for this property.
+ */
+ err = VixPropertyList_FindProperty(propList,
+ propertyID,
+ VIX_PROPERTYTYPE_STRING,
+ 0,
+ TRUE,
+ &property);
+
+ if (VIX_OK == err) {
+ VixPropertyListSetStringImpl(property, value, TRUE);
}
- property->isDirty = TRUE;
abort:
- return(err);
+
+ return err;
} // VixPropertyList_SetString
*
* Results:
* VixError. VIX_OK if the property was found.
- * VIX_E_UNRECOGNIZED_PROPERTY if the property was not found.
+ * VIX_E_UNRECOGNIZED_PROPERTY if the property was not found.
*
* Side effects:
* None
* Saves a copy of a integer property value. The value is identified
* by the integer property ID.
*
- * Value names are unique within a single proeprty list.
+ * Value names are unique within a single property list.
* If a previous value with the same propertyID value already
* existed in this property list, then it is replaced with the new
* value. Otherwise, a new value is added.
property->isDirty = TRUE;
abort:
- return(err);
+ return err;
} // VixPropertyList_SetInteger
*
* Results:
* VixError. VIX_OK if the property was found.
- * VIX_E_UNRECOGNIZED_PROPERTY if the property was not found.
+ * VIX_E_UNRECOGNIZED_PROPERTY if the property was not found.
*
* Side effects:
* None
* Saves a copy of a Bool property value. The value is identified
* by the integer property ID.
*
- * Value names are unique within a single proeprty list.
+ * Value names are unique within a single property list.
* If a previous value with the same propertyID value already
* existed in this property list, then it is replaced with the new
* value. Otherwise, a new value is added.
property->isDirty = TRUE;
abort:
- return(err);
+ return err;
}
*
* Results:
* VixError. VIX_OK if the property was found.
- * VIX_E_UNRECOGNIZED_PROPERTY if the property was not found.
+ * VIX_E_UNRECOGNIZED_PROPERTY if the property was not found.
*
* Side effects:
* None
* Saves a copy of a int64 property value. The value is identified
* by the integer property ID.
*
- * Value names are unique within a single proeprty list.
+ * Value names are unique within a single property list.
* If a previous value with the same propertyID value already
* existed in this property list, then it is replaced with the new
* value. Otherwise, a new value is added.
property->isDirty = TRUE;
abort:
- return(err);
+ return err;
} // VixPropertyList_SetInt64
*
* Results:
* VixError. VIX_OK if the property was found.
- * VIX_E_UNRECOGNIZED_PROPERTY if the property was not found.
+ * VIX_E_UNRECOGNIZED_PROPERTY if the property was not found.
*
* Side effects:
* None
} // VixPropertyList_GetBlob
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * VixPropertyListSetBlobImpl --
+ *
+ * Saves a copy of a blob property value. Set sensitivity.
+ *
+ * Results:
+ * As above.
+ *
+ * Side effects:
+ * None
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+static void
+VixPropertyListSetBlobImpl(VixPropertyValue *property, // IN:
+ int blobSize, // IN:
+ const unsigned char *value, // IN:
+ Bool isSensitive) // IN:
+{
+ if (NULL != property->value.blobValue.blobContents) {
+ if (property->isSensitive) {
+ Util_Zero(property->value.blobValue.blobContents,
+ property->value.blobValue.blobSize);
+ }
+
+ free(property->value.blobValue.blobContents);
+ property->value.blobValue.blobContents = NULL;
+ }
+
+ property->value.blobValue.blobSize = blobSize;
+ if ((NULL != value) && (blobSize > 0)) {
+ property->value.blobValue.blobContents = Util_SafeMalloc(blobSize);
+ memcpy(property->value.blobValue.blobContents, value, blobSize);
+ }
+
+ property->isDirty = TRUE;
+ property->isSensitive = isSensitive;
+} // VixPropertyListSetBlobImpl
+
+
/*
*-----------------------------------------------------------------------------
*
* Saves a copy of a blob property value. The value is identified
* by the integer property ID.
*
- * Value names are unique within a single proeprty list.
+ * Value names are unique within a single property list.
* If a previous value with the same propertyID value already
* existed in this property list, then it is replaced with the new
* value. Otherwise, a new value is added.
*/
VixError
-VixPropertyList_SetBlob(VixPropertyListImpl *propList, // IN
- int propertyID, // IN
- int blobSize, // IN
- const unsigned char *value) // IN
+VixPropertyList_SetBlob(VixPropertyListImpl *propList, // IN:
+ int propertyID, // IN:
+ int blobSize, // IN:
+ const unsigned char *value) // IN:
{
VixError err = VIX_OK;
VixPropertyValue *property = NULL;
err = VIX_E_INVALID_ARG;
goto abort;
}
-
+
/*
* Find or create an entry for this property.
*/
err = VixPropertyList_FindProperty(propList,
- propertyID,
- VIX_PROPERTYTYPE_BLOB,
+ propertyID,
+ VIX_PROPERTYTYPE_BLOB,
0,
- TRUE,
+ TRUE,
&property);
- if (VIX_OK != err) {
- goto abort;
- }
- if (NULL != property->value.blobValue.blobContents) {
- free(property->value.blobValue.blobContents);
- property->value.blobValue.blobContents = NULL;
+ if (VIX_OK == err) {
+ VixPropertyListSetBlobImpl(property, blobSize, value,
+ property->isSensitive);
}
- property->value.blobValue.blobSize = blobSize;
- if ((NULL != value) && (blobSize > 0)) {
- property->value.blobValue.blobContents = Util_SafeMalloc(blobSize);
- memcpy(property->value.blobValue.blobContents, value, blobSize);
+abort:
+ return err;
+} // VixPropertyList_SetBlob
+
+
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * VixPropertyList_SetBlobSensitive --
+ *
+ * Saves a copy of a blob property value. The value is identified
+ * by the integer property ID. Set sentivity.
+ *
+ * Value names are unique within a single property list.
+ * If a previous value with the same propertyID value already
+ * existed in this property list, then it is replaced with the new
+ * value. Otherwise, a new value is added.
+ *
+ * This fails if the value is present but has a different type.
+ *
+ * Results:
+ * VixError.
+ *
+ * Side effects:
+ * None
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+VixError
+VixPropertyList_SetBlobSensitive(VixPropertyListImpl *propList, // IN:
+ int propertyID, // IN:
+ int blobSize, // IN:
+ const unsigned char *value) // IN:
+{
+ VixError err = VIX_OK;
+ VixPropertyValue *property = NULL;
+
+ if (NULL == propList) {
+ err = VIX_E_INVALID_ARG;
+ goto abort;
}
- property->isDirty = TRUE;
+ /*
+ * Find or create an entry for this property.
+ */
+ err = VixPropertyList_FindProperty(propList,
+ propertyID,
+ VIX_PROPERTYTYPE_BLOB,
+ 0,
+ TRUE,
+ &property);
+
+ if (VIX_OK == err) {
+ VixPropertyListSetBlobImpl(property, blobSize, value, TRUE);
+ }
abort:
- return(err);
+ return err;
} // VixPropertyList_SetBlob
* This is a SHALLOW copy. It only copies the pointer, not what the
* pointer references.
*
- * Value names are unique within a single proeprty list.
+ * Value names are unique within a single property list.
* If a previous value with the same propertyID value already
* existed in this property list, then it is replaced with the new
* value. Otherwise, a new value is added.
property->isDirty = TRUE;
abort:
- return(err);
+ return err;
} // VixPropertyList_SetPtr
foundIt = TRUE;
}
- return(foundIt);
+ return foundIt;
} // VixPropertyList_PropertyExists
/*
* This header file is given out as part of the open source
- * tools. Things in this file are public, but they may not have
+ * tools. Things in this file are public, but they may not have
* been tested or documented, and that may change in future releases.
* The public Vix API is defined in vix.h
*
#ifdef __cplusplus
extern "C"{
-#endif
+#endif
/*
* VIX_HIDE_BORA_DEPENDENCIES:
*
* VIX Handles --
*
- * These are common functions that apply to handles of several types.
+ * These are common functions that apply to handles of several types.
*-----------------------------------------------------------------------------
*/
*-----------------------------------------------------------------------------
*/
-/*
+/*
* VIX Property Type
*/
const char *buffer,
size_t bufferSize,
VixPropertyListBadEncodingAction action);
-
+
VixError
VixPropertyList_DeserializeNoClobber(VixPropertyListImpl *propListImpl,
const char *buffer,
int propertyID,
int index,
char **resultValue);
-
+
+VixError VixPropertyList_SetStringSensitive(struct VixPropertyListImpl *propList,
+ int propertyID,
+ const char *value);
+
VixError VixPropertyList_SetString(struct VixPropertyListImpl *propList,
int propertyID,
const char *value);
int blobSize,
const unsigned char *value);
+VixError VixPropertyList_SetBlobSensitive(struct VixPropertyListImpl *propList,
+ int propertyID,
+ int blobSize,
+ const unsigned char *value);
+
VixError VixPropertyList_RemoveAll(VixHandle propertyListHandle);
VixError VixPropertyList_Remove(VixHandle propertyListHandle,
VixError VixPropertyList_RemoveFromImpl(VixPropertyListImpl *propList,
int propertyID);
-VixError VixPropertyList_AppendProperties(VixHandle handle,
+VixError VixPropertyList_AppendProperties(VixHandle handle,
int firstPropertyID,
...);
int VixPropertyList_GetNumProperties(VixHandle propertyListHandle,
int propertyID);
-VixError VixPropertyList_GetOptionalProperties(VixHandle propertyListHandle,
+VixError VixPropertyList_GetOptionalProperties(VixHandle propertyListHandle,
int firstPropertyID,
...);
-VixError VixPropertyList_GetIndexedProperties(VixHandle propertyListHandle,
+VixError VixPropertyList_GetIndexedProperties(VixHandle propertyListHandle,
Bool ignoreMissingProperties,
int firstPropertyID,
int firstPropertyIndex,
Bool VixPropertyList_Empty(VixPropertyListImpl *propList);
+void VixPropertyList_MarkAllSensitive(VixPropertyListImpl *propList);
+
#endif // VIX_HIDE_FROM_JAVA
*
* VixVM --
*
- * This describes the persistent configuration state of a single VM. The
+ * This describes the persistent configuration state of a single VM. The
* VM may or may not be running.
*
*-----------------------------------------------------------------------------
* Use as:
*
* VIX_DEBUG(("test debug message: %s %d\n", stringArg, intArg));
- *
+ *
* Output will go to logfile if VIX_DEBUG_PREFERENCE_NAME is non-zero
*
* VIX_DEBUG_LEVEL(3, ("test debug message: %s %d\n", stringArg, intArg));
*
* Output will go to logfile if VIX_DEBUG_PREFERENCE_NAME is >=
* the first argument to the macro.
- *
+ *
*-----------------------------------------------------------------------------
*/
#ifdef __cplusplus
} // extern "C" {
-#endif
+#endif
#endif // _VIXOpenSource_h_