本文整理汇总了C++中crm_element_name函数的典型用法代码示例。如果您正苦于以下问题:C++ crm_element_name函数的具体用法?C++ crm_element_name怎么用?C++ crm_element_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了crm_element_name函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: cib_prepare_common
static xmlNode *
cib_prepare_common(xmlNode * root, const char *section)
{
xmlNode *data = NULL;
/* extract the CIB from the fragment */
if (root == NULL) {
return NULL;
} else if (safe_str_eq(crm_element_name(root), XML_TAG_FRAGMENT)
|| safe_str_eq(crm_element_name(root), F_CRM_DATA)
|| safe_str_eq(crm_element_name(root), F_CIB_CALLDATA)) {
data = first_named_child(root, XML_TAG_CIB);
} else {
data = root;
}
/* grab the section specified for the command */
if (section != NULL && data != NULL && crm_str_eq(crm_element_name(data), XML_TAG_CIB, TRUE)) {
data = get_object_root(section, data);
}
/* crm_log_xml_trace(root, "cib:input"); */
return data;
}
开发者ID:JamesGuthrie,项目名称:pacemaker,代码行数:26,代码来源:common.c
示例2: cib_pre_notify
void
cib_pre_notify(
int options, const char *op, xmlNode *existing, xmlNode *update)
{
xmlNode *update_msg = NULL;
const char *type = NULL;
const char *id = NULL;
gboolean needed = FALSE;
g_hash_table_foreach(client_list, need_pre_notify, &needed);
if(needed == FALSE) {
return;
}
/* TODO: consider pre-notification for removal */
update_msg = create_xml_node(NULL, "pre-notify");
if(update != NULL) {
id = crm_element_value(update, XML_ATTR_ID);
}
crm_xml_add(update_msg, F_TYPE, T_CIB_NOTIFY);
crm_xml_add(update_msg, F_SUBTYPE, T_CIB_PRE_NOTIFY);
crm_xml_add(update_msg, F_CIB_OPERATION, op);
if(id != NULL) {
crm_xml_add(update_msg, F_CIB_OBJID, id);
}
if(update != NULL) {
crm_xml_add(update_msg, F_CIB_OBJTYPE, crm_element_name(update));
} else if(existing != NULL) {
crm_xml_add(update_msg, F_CIB_OBJTYPE, crm_element_name(existing));
}
type = crm_element_value(update_msg, F_CIB_OBJTYPE);
attach_cib_generation(update_msg, "cib_generation", the_cib);
if(existing != NULL) {
add_message_xml(update_msg, F_CIB_EXISTING, existing);
}
if(update != NULL) {
add_message_xml(update_msg, F_CIB_UPDATE, update);
}
g_hash_table_foreach(client_list, cib_notify_client, update_msg);
if(update == NULL) {
crm_debug_2("Performing operation %s (on section=%s)",
op, type);
} else {
crm_debug_2("Performing %s on <%s%s%s>",
op, type, id?" id=":"", id?id:"");
}
free_xml(update_msg);
}
开发者ID:ClusterLabs,项目名称:pacemaker-1.0,代码行数:58,代码来源:notify.c
示例3: unpack_action
static crm_action_t *
unpack_action(synapse_t * parent, xmlNode * xml_action)
{
crm_action_t *action = NULL;
const char *value = crm_element_value(xml_action, XML_ATTR_ID);
if (value == NULL) {
crm_err("Actions must have an id!");
crm_log_xml_trace(xml_action, "Action with missing id");
return NULL;
}
action = calloc(1, sizeof(crm_action_t));
CRM_CHECK(action != NULL, return NULL);
action->id = crm_parse_int(value, NULL);
action->type = action_type_rsc;
action->xml = copy_xml(xml_action);
action->synapse = parent;
if (safe_str_eq(crm_element_name(action->xml), XML_GRAPH_TAG_RSC_OP)) {
action->type = action_type_rsc;
} else if (safe_str_eq(crm_element_name(action->xml), XML_GRAPH_TAG_PSEUDO_EVENT)) {
action->type = action_type_pseudo;
} else if (safe_str_eq(crm_element_name(action->xml), XML_GRAPH_TAG_CRM_EVENT)) {
action->type = action_type_crm;
}
action->params = xml2list(action->xml);
value = g_hash_table_lookup(action->params, "CRM_meta_timeout");
if (value != NULL) {
action->timeout = crm_parse_int(value, NULL);
}
/* Take start-delay into account for the timeout of the action timer */
value = g_hash_table_lookup(action->params, "CRM_meta_start_delay");
if (value != NULL) {
action->timeout += crm_parse_int(value, NULL);
}
value = g_hash_table_lookup(action->params, "CRM_meta_interval");
if (value != NULL) {
action->interval = crm_parse_int(value, NULL);
}
value = g_hash_table_lookup(action->params, "CRM_meta_can_fail");
if (value != NULL) {
crm_str_to_boolean(value, &(action->can_fail));
}
crm_trace("Action %d has timer set to %dms", action->id, action->timeout);
return action;
}
开发者ID:beess,项目名称:pacemaker,代码行数:57,代码来源:unpack.c
示例4: revision_check_callback
static void
revision_check_callback(const HA_Message *msg, int call_id, int rc,
crm_data_t *output, void *user_data)
{
int cmp = -1;
const char *revision = NULL;
crm_data_t *generation = NULL;
#if CRM_DEPRECATED_SINCE_2_0_4
if(safe_str_eq(crm_element_name(output), XML_TAG_CIB)) {
generation = output;
} else {
generation = find_xml_node(output, XML_TAG_CIB, TRUE);
}
#else
generation = output;
CRM_DEV_ASSERT(safe_str_eq(crm_element_name(generation), XML_TAG_CIB));
#endif
if(rc != cib_ok) {
fsa_data_t *msg_data = NULL;
register_fsa_error(C_FSA_INTERNAL, I_ERROR, NULL);
return;
}
crm_debug_3("Checking our feature revision is allowed: %s",
CIB_FEATURE_SET);
revision = crm_element_value(generation, XML_ATTR_CIB_REVISION);
cmp = compare_version(revision, CIB_FEATURE_SET);
if(cmp > 0) {
crm_err("This build (%s) does not support the current"
" resource configuration", VERSION);
crm_err("We can support up to CIB feature set %s (current=%s)",
CIB_FEATURE_SET, revision);
crm_err("Shutting down the CRM");
/* go into a stall state */
register_fsa_error_adv(
C_FSA_INTERNAL, I_SHUTDOWN, NULL, NULL, __FUNCTION__);
return;
}
revision = crm_element_value(generation, XML_ATTR_CRM_VERSION);
cmp = compare_version(revision, CRM_FEATURE_SET);
if(cmp > 0) {
crm_err("This build (%s) does not support the current"
" resource configuration", VERSION);
crm_err("We can support up to CRM feature set %s (current=%s)",
revision, CRM_FEATURE_SET);
crm_err("Shutting down the CRM");
/* go into a stall state */
register_fsa_error_adv(
C_FSA_INTERNAL, I_SHUTDOWN, NULL, NULL, __FUNCTION__);
return;
}
}
开发者ID:sipwise,项目名称:heartbeat,代码行数:57,代码来源:cib.c
示例5: cib_pre_notify
void
cib_pre_notify(
int options, const char *op, crm_data_t *existing, crm_data_t *update)
{
HA_Message *update_msg = NULL;
const char *type = NULL;
const char *id = NULL;
update_msg = ha_msg_new(6);
if(update != NULL) {
id = crm_element_value(update, XML_ATTR_ID);
}
ha_msg_add(update_msg, F_TYPE, T_CIB_NOTIFY);
ha_msg_add(update_msg, F_SUBTYPE, T_CIB_PRE_NOTIFY);
ha_msg_add(update_msg, F_CIB_OPERATION, op);
if(id != NULL) {
ha_msg_add(update_msg, F_CIB_OBJID, id);
}
if(update != NULL) {
ha_msg_add(update_msg, F_CIB_OBJTYPE, crm_element_name(update));
} else if(existing != NULL) {
ha_msg_add(update_msg, F_CIB_OBJTYPE, crm_element_name(existing));
}
type = cl_get_string(update_msg, F_CIB_OBJTYPE);
attach_cib_generation(update_msg, "cib_generation", the_cib);
if(existing != NULL) {
add_message_xml(update_msg, F_CIB_EXISTING, existing);
}
if(update != NULL) {
add_message_xml(update_msg, F_CIB_UPDATE, update);
}
g_hash_table_foreach(client_list, cib_notify_client, update_msg);
if(update == NULL) {
crm_debug_2("Performing operation %s (on section=%s)",
op, type);
} else {
crm_debug_2("Performing %s on <%s%s%s>",
op, type, id?" id=":"", id?id:"");
}
crm_msg_del(update_msg);
}
开发者ID:sipwise,项目名称:heartbeat,代码行数:51,代码来源:notify.c
示例6: pcmk__post_process_acl
void
pcmk__post_process_acl(xmlNode *xml)
{
xmlNode *cIter = __xml_first_child(xml);
xml_private_t *p = xml->_private;
if (is_set(p->flags, xpf_created)) {
xmlAttr *xIter = NULL;
char *path = xml_get_path(xml);
/* Always allow new scaffolding (e.g. node with no attributes or only an
* 'id'), except in the ACLs section
*/
for (xIter = xml->properties; xIter != NULL; xIter = xIter->next) {
const char *prop_name = (const char *)xIter->name;
if (!strcmp(prop_name, XML_ATTR_ID)
&& !strstr(path, "/"XML_CIB_TAG_ACLS"/")) {
/* Delay the acl check */
continue;
} else if (pcmk__check_acl(xml, NULL, xpf_acl_write)) {
crm_trace("Creation of %s=%s is allowed",
crm_element_name(xml), ID(xml));
break;
} else {
crm_trace("Cannot add new node %s at %s",
crm_element_name(xml), path);
if (xml != xmlDocGetRootElement(xml->doc)) {
xmlUnlinkNode(xml);
xmlFreeNode(xml);
}
free(path);
return;
}
}
free(path);
}
while (cIter != NULL) {
xmlNode *child = cIter;
cIter = __xml_next(cIter); /* In case it is free'd */
pcmk__post_process_acl(child);
}
}
开发者ID:HideoYamauchi,项目名称:pacemaker,代码行数:48,代码来源:acl.c
示例7: fire_synapse
static gboolean
fire_synapse(crm_graph_t * graph, synapse_t * synapse)
{
GListPtr lpc = NULL;
CRM_CHECK(synapse != NULL, return FALSE);
CRM_CHECK(synapse->ready, return FALSE);
CRM_CHECK(synapse->confirmed == FALSE, return TRUE);
crm_trace("Synapse %d fired", synapse->id);
synapse->executed = TRUE;
for (lpc = synapse->actions; lpc != NULL; lpc = lpc->next) {
crm_action_t *action = (crm_action_t *) lpc->data;
/* allow some leeway */
gboolean passed = FALSE;
/* Invoke the action and start the timer */
passed = initiate_action(graph, action);
if (passed == FALSE) {
crm_err("Failed initiating <%s id=%d> in synapse %d",
crm_element_name(action->xml), action->id, synapse->id);
synapse->confirmed = TRUE;
action->confirmed = TRUE;
action->failed = TRUE;
return FALSE;
}
}
return TRUE;
}
开发者ID:brhellman,项目名称:pacemaker,代码行数:31,代码来源:graph.c
示例8: convert_ha_message
xmlNode *
convert_ha_message(xmlNode * parent, HA_Message * msg, const char *field)
{
int lpc = 0;
xmlNode *child = NULL;
const char *tag = NULL;
CRM_CHECK(msg != NULL, crm_err("Empty message for %s", field);
return parent);
tag = cl_get_string(msg, F_XML_TAGNAME);
if (tag == NULL) {
tag = field;
} else if (parent && safe_str_neq(field, tag)) {
/* For compatibility with 0.6.x */
crm_debug("Creating intermediate parent %s between %s and %s", field,
crm_element_name(parent), tag);
parent = create_xml_node(parent, field);
}
if (parent == NULL) {
parent = create_xml_node(NULL, tag);
child = parent;
} else {
child = create_xml_node(parent, tag);
}
for (lpc = 0; lpc < msg->nfields; lpc++) {
convert_ha_field(child, msg, lpc);
}
return parent;
}
开发者ID:bubble75,项目名称:pacemaker,代码行数:35,代码来源:heartbeat.c
示例9: do_work
int
do_work(xmlNode * input, int call_options, xmlNode ** output)
{
/* construct the request */
the_cib->call_timeout = message_timeout_ms;
if (strcasecmp(CIB_OP_REPLACE, cib_action) == 0
&& safe_str_eq(crm_element_name(input), XML_TAG_CIB)) {
xmlNode *status = get_object_root(XML_CIB_TAG_STATUS, input);
if (status == NULL) {
create_xml_node(input, XML_CIB_TAG_STATUS);
}
}
if (strcasecmp(CIB_OP_SYNC, cib_action) == 0) {
crm_trace("Performing %s op...", cib_action);
return the_cib->cmds->sync_from(the_cib, host, obj_type, call_options);
} else if (strcasecmp(CIB_OP_SLAVE, cib_action) == 0 && (call_options ^ cib_scope_local)) {
crm_trace("Performing %s op on all nodes...", cib_action);
return the_cib->cmds->set_slave_all(the_cib, call_options);
} else if (strcasecmp(CIB_OP_MASTER, cib_action) == 0) {
crm_trace("Performing %s op on all nodes...", cib_action);
return the_cib->cmds->set_master(the_cib, call_options);
} else if (cib_action != NULL) {
crm_trace("Passing \"%s\" to variant_op...", cib_action);
return cib_internal_op(the_cib, cib_action, host, obj_type, input, output, call_options, NULL);
} else {
crm_err("You must specify an operation");
}
return -EINVAL;
}
开发者ID:jnewland,项目名称:pacemaker,代码行数:35,代码来源:cibadmin.c
示例10: find_expression_type
enum expression_type
find_expression_type(xmlNode * expr)
{
const char *tag = NULL;
const char *attr = NULL;
attr = crm_element_value(expr, XML_EXPR_ATTR_ATTRIBUTE);
tag = crm_element_name(expr);
if (safe_str_eq(tag, "date_expression")) {
return time_expr;
} else if (safe_str_eq(tag, XML_TAG_RULE)) {
return nested_rule;
} else if (safe_str_neq(tag, "expression")) {
return not_expr;
} else if (safe_str_eq(attr, "#uname") || safe_str_eq(attr, "#kind") || safe_str_eq(attr, "#id")) {
return loc_expr;
} else if (safe_str_eq(attr, "#role")) {
return role_expr;
}
return attr_expr;
}
开发者ID:aspiers,项目名称:pacemaker,代码行数:27,代码来源:rules.c
示例11: revision_check_callback
static void
revision_check_callback(xmlNode *msg, int call_id, int rc,
xmlNode *output, void *user_data)
{
int cmp = -1;
const char *revision = NULL;
xmlNode *generation = NULL;
if(rc != cib_ok) {
fsa_data_t *msg_data = NULL;
register_fsa_error(C_FSA_INTERNAL, I_ERROR, NULL);
return;
}
generation = output;
CRM_CHECK(safe_str_eq(crm_element_name(generation), XML_TAG_CIB), crm_log_xml_err(output, __FUNCTION__); return);
crm_debug_3("Checking our feature revision is allowed: %s", CIB_FEATURE_SET);
revision = crm_element_value(generation, XML_ATTR_CRM_VERSION);
cmp = compare_version(revision, CRM_FEATURE_SET);
if(cmp > 0) {
crm_err("This build (%s) does not support the current"
" resource configuration", VERSION);
crm_err("We can support up to CRM feature set %s (current=%s)",
revision, CRM_FEATURE_SET);
crm_err("Shutting down the CRM");
/* go into a stall state */
register_fsa_error_adv(
C_FSA_INTERNAL, I_SHUTDOWN, NULL, NULL, __FUNCTION__);
return;
}
}
开发者ID:ClusterLabs,项目名称:pacemaker-1.0,代码行数:34,代码来源:cib.c
示例12: cli_resource_print_cts
void
cli_resource_print_cts(resource_t * rsc)
{
GListPtr lpc = NULL;
const char *host = NULL;
bool needs_quorum = TRUE;
const char *rtype = crm_element_value(rsc->xml, XML_ATTR_TYPE);
const char *rprov = crm_element_value(rsc->xml, XML_AGENT_ATTR_PROVIDER);
const char *rclass = crm_element_value(rsc->xml, XML_AGENT_ATTR_CLASS);
pe_node_t *node = pe__current_node(rsc);
if (safe_str_eq(rclass, PCMK_RESOURCE_CLASS_STONITH)) {
needs_quorum = FALSE;
} else {
// @TODO check requires in resource meta-data and rsc_defaults
}
if (node != NULL) {
host = node->details->uname;
}
printf("Resource: %s %s %s %s %s %s %s %s %d %lld 0x%.16llx\n",
crm_element_name(rsc->xml), rsc->id,
rsc->clone_name ? rsc->clone_name : rsc->id, rsc->parent ? rsc->parent->id : "NA",
rprov ? rprov : "NA", rclass, rtype, host ? host : "NA", needs_quorum, rsc->flags,
rsc->flags);
for (lpc = rsc->children; lpc != NULL; lpc = lpc->next) {
resource_t *child = (resource_t *) lpc->data;
cli_resource_print_cts(child);
}
}
开发者ID:HideoYamauchi,项目名称:pacemaker,代码行数:33,代码来源:crm_resource_print.c
示例13: updateList
enum cib_errors
updateList(crm_data_t *local_cib, crm_data_t *xml_section, crm_data_t *failed,
int operation, const char *section)
{
int rc = cib_ok;
crm_data_t *this_section = get_object_root(section, local_cib);
if (section == NULL || xml_section == NULL) {
crm_err("Section %s not found in message."
" CIB update is corrupt, ignoring.",
crm_str(section));
return cib_NOSECTION;
}
if((CIB_UPDATE_OP_NONE > operation)
|| (operation > CIB_UPDATE_OP_MAX)){
crm_err("Invalid operation on section %s", crm_str(section));
return cib_operation;
}
if(safe_str_eq(crm_element_name(xml_section), section)) {
xml_child_iter(xml_section, a_child,
rc = cib_ok;
cib_update_xml_macro(this_section, a_child);
);
} else {
开发者ID:sipwise,项目名称:heartbeat,代码行数:27,代码来源:messages.c
示例14: cib_process_delete
int
cib_process_delete(const char *op, int options, const char *section, xmlNode * req, xmlNode * input,
xmlNode * existing_cib, xmlNode ** result_cib, xmlNode ** answer)
{
xmlNode *obj_root = NULL;
crm_trace("Processing \"%s\" event", op);
if (options & cib_xpath) {
return cib_process_xpath(op, options, section, req, input,
existing_cib, result_cib, answer);
}
if (input == NULL) {
crm_err("Cannot perform modification with no data");
return -EINVAL;
}
obj_root = get_object_root(section, *result_cib);
if(safe_str_eq(crm_element_name(input), section)) {
xmlNode *child = NULL;
for(child = __xml_first_child(input); child; child = __xml_next(child)) {
if (replace_xml_child(NULL, obj_root, child, TRUE) == FALSE) {
crm_trace("No matching object to delete: %s=%s", child->name, ID(child));
}
}
} else if (replace_xml_child(NULL, obj_root, input, TRUE) == FALSE) {
crm_trace("No matching object to delete: %s=%s", input->name, ID(input));
}
return pcmk_ok;
}
开发者ID:davidvossel,项目名称:pacemaker,代码行数:33,代码来源:cib_ops.c
示例15: mon_update
void
mon_update(const HA_Message *msg, int call_id, int rc,
crm_data_t *output, void*user_data)
{
const char *prefix = NULL;
if(rc == cib_ok) {
crm_data_t *cib = NULL;
#if CRM_DEPRECATED_SINCE_2_0_4
if( safe_str_eq(crm_element_name(output), XML_TAG_CIB) ) {
cib = output;
} else {
cib = find_xml_node(output,XML_TAG_CIB,TRUE);
}
#else
cib = output;
CRM_DEV_ASSERT(safe_str_eq(crm_element_name(cib), XML_TAG_CIB));
#endif
if(as_html_file || web_cgi) {
print_html_status(cib, as_html_file, web_cgi);
} else if (simple_status) {
print_simple_status(cib);
if (has_warnings) {
exit(1);
}
} else {
print_status(cib);
}
if(one_shot) {
exit(LSB_EXIT_OK);
}
} else if(simple_status) {
fprintf(stderr, "Critical: query failed: %s", cib_error2string(rc));
exit(2);
} else if(one_shot) {
fprintf(stderr, "Query failed: %s", cib_error2string(rc));
exit(LSB_EXIT_OK);
} else {
CRM_DEV_ASSERT(cib_conn->cmds->signoff(cib_conn) == cib_ok);
crm_err("Query failed: %s", cib_error2string(rc));
prefix = "Query failed! ";
}
wait_for_refresh(0, prefix, interval);
}
开发者ID:sipwise,项目名称:heartbeat,代码行数:47,代码来源:crm_mon.c
示例16: do_cib_notify
void
do_cib_notify(int options, const char *op, xmlNode * update,
enum cib_errors result, xmlNode * result_data, const char *msg_type)
{
xmlNode *update_msg = NULL;
const char *id = NULL;
update_msg = create_xml_node(NULL, "notify");
if (result_data != NULL) {
id = crm_element_value(result_data, XML_ATTR_ID);
}
crm_xml_add(update_msg, F_TYPE, T_CIB_NOTIFY);
crm_xml_add(update_msg, F_SUBTYPE, msg_type);
crm_xml_add(update_msg, F_CIB_OPERATION, op);
crm_xml_add_int(update_msg, F_CIB_RC, result);
if (id != NULL) {
crm_xml_add(update_msg, F_CIB_OBJID, id);
}
if (update != NULL) {
crm_trace("Setting type to update->name: %s", crm_element_name(update));
crm_xml_add(update_msg, F_CIB_OBJTYPE, crm_element_name(update));
} else if (result_data != NULL) {
crm_trace("Setting type to new_obj->name: %s", crm_element_name(result_data));
crm_xml_add(update_msg, F_CIB_OBJTYPE, crm_element_name(result_data));
} else {
crm_trace("Not Setting type");
}
attach_cib_generation(update_msg, "cib_generation", the_cib);
if (update != NULL) {
add_message_xml(update_msg, F_CIB_UPDATE, update);
}
if (result_data != NULL) {
add_message_xml(update_msg, F_CIB_UPDATE_RESULT, result_data);
}
crm_trace("Notifying clients");
g_hash_table_foreach_remove(client_list, cib_notify_client, update_msg);
free_xml(update_msg);
crm_trace("Notify complete");
}
开发者ID:brhellman,项目名称:pacemaker,代码行数:47,代码来源:notify.c
示例17: cib_handle_remote_msg
static void
cib_handle_remote_msg(crm_client_t * client, xmlNode * command)
{
const char *value = NULL;
value = crm_element_name(command);
if (safe_str_neq(value, "cib_command")) {
crm_log_xml_trace(command, "Bad command: ");
return;
}
if (client->name == NULL) {
value = crm_element_value(command, F_CLIENTNAME);
if (value == NULL) {
client->name = strdup(client->id);
} else {
client->name = strdup(value);
}
}
if (client->userdata == NULL) {
value = crm_element_value(command, F_CIB_CALLBACK_TOKEN);
if (value != NULL) {
client->userdata = strdup(value);
crm_trace("Callback channel for %s is %s", client->id, (char*)client->userdata);
} else {
client->userdata = strdup(client->id);
}
}
/* unset dangerous options */
xml_remove_prop(command, F_ORIG);
xml_remove_prop(command, F_CIB_HOST);
xml_remove_prop(command, F_CIB_GLOBAL_UPDATE);
crm_xml_add(command, F_TYPE, T_CIB);
crm_xml_add(command, F_CIB_CLIENTID, client->id);
crm_xml_add(command, F_CIB_CLIENTNAME, client->name);
#if ENABLE_ACL
crm_xml_add(command, F_CIB_USER, client->user);
#endif
if (crm_element_value(command, F_CIB_CALLID) == NULL) {
char *call_uuid = crm_generate_uuid();
/* fix the command */
crm_xml_add(command, F_CIB_CALLID, call_uuid);
free(call_uuid);
}
if (crm_element_value(command, F_CIB_CALLOPTS) == NULL) {
crm_xml_add_int(command, F_CIB_CALLOPTS, 0);
}
crm_log_xml_trace(command, "Remote command: ");
cib_common_callback_worker(0, 0, command, client, TRUE);
}
开发者ID:ClusterLabs,项目名称:pacemaker,代码行数:58,代码来源:based_remote.c
示例18: pcmk__apply_acl
void
pcmk__apply_acl(xmlNode *xml)
{
GListPtr aIter = NULL;
xml_private_t *p = xml->doc->_private;
xmlXPathObjectPtr xpathObj = NULL;
if (xml_acl_enabled(xml) == FALSE) {
crm_trace("Not applying ACLs for %s", p->user);
return;
}
for (aIter = p->acls; aIter != NULL; aIter = aIter->next) {
int max = 0, lpc = 0;
xml_acl_t *acl = aIter->data;
xpathObj = xpath_search(xml, acl->xpath);
max = numXpathResults(xpathObj);
for (lpc = 0; lpc < max; lpc++) {
xmlNode *match = getXpathResult(xpathObj, lpc);
char *path = xml_get_path(match);
p = match->_private;
crm_trace("Applying %x to %s for %s", acl->mode, path, acl->xpath);
#ifdef SUSE_ACL_COMPAT
if (is_not_set(p->flags, acl->mode)
&& (is_set(p->flags, xpf_acl_read)
|| is_set(p->flags, xpf_acl_write)
|| is_set(p->flags, xpf_acl_deny))) {
crm_config_warn("Configuration element %s is matched by "
"multiple ACL rules, only the first applies "
"('%s' wins over '%s')",
path, __xml_acl_to_text(p->flags),
__xml_acl_to_text(acl->mode));
free(path);
continue;
}
#endif
p->flags |= acl->mode;
free(path);
}
crm_trace("Now enforcing ACL: %s (%d matches)", acl->xpath, max);
freeXpathObject(xpathObj);
}
p = xml->_private;
if (is_not_set(p->flags, xpf_acl_read)
&& is_not_set(p->flags, xpf_acl_write)) {
p->flags |= xpf_acl_deny;
p = xml->doc->_private;
crm_info("Enforcing default ACL for %s to %s",
p->user, crm_element_name(xml));
}
}
开发者ID:HideoYamauchi,项目名称:pacemaker,代码行数:58,代码来源:acl.c
示例19: __xml_acl_parse_entry
static GList *
__xml_acl_parse_entry(xmlNode *acl_top, xmlNode *acl_entry, GList *acls)
{
xmlNode *child = NULL;
for (child = __xml_first_child(acl_entry); child;
child = __xml_next(child)) {
const char *tag = crm_element_name(child);
const char *kind = crm_element_value(child, XML_ACL_ATTR_KIND);
if (strcmp(XML_ACL_TAG_PERMISSION, tag) == 0){
tag = kind;
}
crm_trace("Processing %s %p", tag, child);
if (tag == NULL) {
CRM_ASSERT(tag != NULL);
} else if (strcmp(XML_ACL_TAG_ROLE_REF, tag) == 0
|| strcmp(XML_ACL_TAG_ROLE_REFv1, tag) == 0) {
const char *ref_role = crm_element_value(child, XML_ATTR_ID);
if (ref_role) {
xmlNode *role = NULL;
for (role = __xml_first_child(acl_top); role;
role = __xml_next(role)) {
if (!strcmp(XML_ACL_TAG_ROLE, (const char *) role->name)) {
const char *role_id = crm_element_value(role,
XML_ATTR_ID);
if (role_id && strcmp(ref_role, role_id) == 0) {
crm_debug("Unpacking referenced role: %s", role_id);
acls = __xml_acl_parse_entry(acl_top, role, acls);
break;
}
}
}
}
} else if (strcmp(XML_ACL_TAG_READ, tag) == 0) {
acls = __xml_acl_create(child, acls, xpf_acl_read);
} else if (strcmp(XML_ACL_TAG_WRITE, tag) == 0) {
acls = __xml_acl_create(child, acls, xpf_acl_write);
} else if (strcmp(XML_ACL_TAG_DENY, tag) == 0) {
acls = __xml_acl_create(child, acls, xpf_acl_deny);
} else {
crm_warn("Unknown ACL entry: %s/%s", tag, kind);
}
}
return acls;
}
开发者ID:HideoYamauchi,项目名称:pacemaker,代码行数:56,代码来源:acl.c
示例20: cib_cleanup_query
static int
cib_cleanup_query(int options, xmlNode ** data, xmlNode ** output)
{
CRM_LOG_ASSERT(*data == NULL);
if ((options & cib_no_children)
|| safe_str_eq(crm_element_name(*output), "xpath-query")) {
free_xml(*output);
}
return pcmk_ok;
}
开发者ID:JamesGuthrie,项目名称:pacemaker,代码行数:10,代码来源:common.c
注:本文中的crm_element_name函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论