Ejemplo n.º 1
0
static int compare(OBJECT *obj, FINDTYPE ftype, FINDOP op, void *value, char *propname)
{
	switch (ftype) {
	case FT_ID: return compare_int((int64)obj->id,op,(int64)*(OBJECTNUM*)value);
	case FT_SIZE: return compare_int((int64)obj->oclass->size,op,(int64)*(int*)value);
	case FT_CLASS: return compare_string((char*)obj->oclass->name,op,(char*)value);
	case FT_MODULE: return compare_string((char*)obj->oclass->module->name,op,(char*)value);
	case FT_GROUPID: return compare_string((char*)obj->groupid,op,(char*)value);
	case FT_RANK: return compare_int((int64)obj->rank,op,(int64)*(int*)value);
	case FT_CLOCK: return compare_int((int64)obj->clock,op,(int64)*(TIMESTAMP*)value);
	//case FT_PROPERTY: return compare_property_alt(obj,propname,op,value);
	case FT_PROPERTY: return compare_property(obj,propname,op,value);
	default:
		output_error("findtype %s not supported", ftype);
		/* TROUBLESHOOT
			This error is caused when an object find procedure uses a comparison operator
			that isn't allowed on a that header item.  Make sure the header item
			and the comparison operator are compatible and try again.  If your GLM file
			isn't the cause of the problem, try reducing the complexity of the GLM file 
			you are using to isolate which module is causing the error and file a report 
			with the GLM file attached.
		 */
		return 0;
	}
}
Ejemplo n.º 2
0
static void parse_config_value(unsigned long instance_id, const char *line, const char *prm, int type,
        int *itm_sz, void *itm, const char *sep) {

    if (itm == NULL || compare_property(line, prm) != AM_SUCCESS) {
        return;
    }

    switch (type) {
        case CONF_STRING:
        {
            char **value = (char **) itm;
            *value = (char *) parse_value(line, prm, type, NULL);
            if (strstr(prm, "password") != NULL) {
                AM_LOG_DEBUG(instance_id, "am_get_config_file() %s is set to '%s'",
                        prm, *value == NULL ? "NULL" : "********");
                break;
            }
            AM_LOG_DEBUG(instance_id, "am_get_config_file() %s is set to '%s'",
                    prm, *value == NULL ? "NULL" : *value);
        }
            break;
        case CONF_NUMBER:
        case CONF_DEBUG_LEVEL:
        case CONF_ATTR_MODE:
        case CONF_AUDIT_LEVEL:
        {
            int *value = (int *) itm;
            int *value_tmp = (int *) parse_value(line, prm, type, NULL);
            if (value_tmp != NULL) {
                *value = *value_tmp;
                free(value_tmp);
            }
            AM_LOG_DEBUG(instance_id, "am_get_config_file() %s is set to '%d'", prm, *value);
        }
            break;
        case CONF_STRING_LIST:
        {
            char ***value = (char ***) itm;
            struct val_string_list *value_tmp = (struct val_string_list *) parse_value(line, prm, type, sep);
            if (value_tmp != NULL) {
                *value = value_tmp->list;
                *itm_sz = value_tmp->size;
                free(value_tmp);
            }
            AM_LOG_DEBUG(instance_id, "am_get_config_file() %s is set to %d value(s)", prm, *itm_sz);
        }
            break;
        case CONF_NUMBER_LIST:
        {
            int **value = (int **) itm;
            struct val_number_list *value_tmp = (struct val_number_list *) parse_value(line, prm, type, sep);
            if (value_tmp != NULL) {
                *value = value_tmp->list;
                *itm_sz = value_tmp->size;
                free(value_tmp);
            }
            AM_LOG_DEBUG(instance_id, "am_get_config_file() %s is set to %d value(s)", prm, *itm_sz);
        }
            break;
        case CONF_STRING_MAP:
        {
            int old_sz = *itm_sz;
            am_config_map_t **value = (am_config_map_t **) itm;
            char *value_tmp = (char *) parse_value(line, prm, CONF_STRING, NULL);
            if (value_tmp == NULL) {
                break;
            }
            *value = (am_config_map_t *) realloc(*value, sizeof (am_config_map_t) *(++(*itm_sz)));
            if (*value == NULL) {
                if (--(*itm_sz) < 0) {
                    *itm_sz = 0;
                }
                free(value_tmp);
                break;
            }
            (&(*value)[old_sz])->name = value_tmp;
            (&(*value)[old_sz])->value = value_tmp + strlen(value_tmp) + 1;
            AM_LOG_DEBUG(instance_id, "am_get_config_file() %s is set to %d value(s)", prm, *itm_sz);
        }
            break;
        default:
            AM_LOG_WARNING(instance_id, "am_get_config_file() unknown type value %d setting %s", type, prm);
            break;
    }
}