pacemaker  2.1.6-802a72226b
Scalable High-Availability cluster resource manager
Data Structures | Macros | Typedefs | Functions
crmcommon_private.h File Reference
#include <stdint.h>
#include <stdbool.h>
#include <sys/types.h>
#include <glib.h>
#include <libxml/tree.h>
#include <qb/qbipcc.h>
Include dependency graph for crmcommon_private.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  pcmk__deleted_xml_s
 
struct  xml_node_private_s
 
struct  xml_doc_private_s
 
struct  pcmk__ipc_methods_s
 
struct  pcmk_ipc_api_s
 
struct  pcmk__ipc_header_s
 

Macros

#define PCMK__BUFFER_SIZE   4096
 
#define pcmk__set_xml_flags(xml_priv, flags_to_set)
 
#define pcmk__clear_xml_flags(xml_priv, flags_to_clear)
 
#define PCMK__IPC_VERSION   1
 
#define PCMK__CONTROLD_API_MAJOR   "1"
 
#define PCMK__CONTROLD_API_MINOR   "0"
 
#define PCMK__XML_PREFIX_CREATED   "++"
 XML is newly created. More...
 
#define PCMK__XML_PREFIX_DELETED   "--"
 XML has been deleted. More...
 
#define PCMK__XML_PREFIX_MODIFIED   "+ "
 XML has been modified. More...
 
#define PCMK__XML_PREFIX_MOVED   "+~"
 XML has been moved. More...
 
#define PCMK__PW_BUFFER_LEN   500
 

Typedefs

typedef struct pcmk__deleted_xml_s pcmk__deleted_xml_t
 
typedef struct xml_node_private_s xml_node_private_t
 
typedef struct xml_doc_private_s xml_doc_private_t
 
typedef struct pcmk__ipc_methods_s pcmk__ipc_methods_t
 
typedef struct pcmk__ipc_header_s pcmk__ipc_header_t
 

Functions

G_GNUC_INTERNAL void pcmk__xml2text (xmlNodePtr data, uint32_t options, GString *buffer, int depth)
 
G_GNUC_INTERNAL bool pcmk__tracking_xml_changes (xmlNode *xml, bool lazy)
 
G_GNUC_INTERNAL void pcmk__mark_xml_created (xmlNode *xml)
 
G_GNUC_INTERNAL int pcmk__xml_position (const xmlNode *xml, enum xml_private_flags ignore_if_set)
 
G_GNUC_INTERNAL xmlNode * pcmk__xml_match (const xmlNode *haystack, const xmlNode *needle, bool exact)
 
G_GNUC_INTERNAL void pcmk__xml_update (xmlNode *parent, xmlNode *target, xmlNode *update, bool as_diff)
 
G_GNUC_INTERNAL xmlNode * pcmk__xc_match (const xmlNode *root, const xmlNode *search_comment, bool exact)
 
G_GNUC_INTERNAL void pcmk__xc_update (xmlNode *parent, xmlNode *target, xmlNode *update)
 
G_GNUC_INTERNAL void pcmk__free_acls (GList *acls)
 
G_GNUC_INTERNAL void pcmk__unpack_acl (xmlNode *source, xmlNode *target, const char *user)
 
G_GNUC_INTERNAL bool pcmk__is_user_in_group (const char *user, const char *group)
 
G_GNUC_INTERNAL void pcmk__apply_acl (xmlNode *xml)
 
G_GNUC_INTERNAL void pcmk__apply_creation_acl (xmlNode *xml, bool check_top)
 
G_GNUC_INTERNAL void pcmk__mark_xml_attr_dirty (xmlAttr *a)
 
G_GNUC_INTERNAL bool pcmk__xa_filterable (const char *name)
 
G_GNUC_INTERNAL void pcmk__log_xmllib_err (void *ctx, const char *fmt,...) G_GNUC_PRINTF(2
 
G_GNUC_INTERNAL int pcmk__send_ipc_request (pcmk_ipc_api_t *api, xmlNode *request)
 
G_GNUC_INTERNAL void pcmk__call_ipc_callback (pcmk_ipc_api_t *api, enum pcmk_ipc_event event_type, crm_exit_t status, void *event_data)
 
G_GNUC_INTERNAL unsigned int pcmk__ipc_buffer_size (unsigned int max)
 
G_GNUC_INTERNAL bool pcmk__valid_ipc_header (const pcmk__ipc_header_t *header)
 
G_GNUC_INTERNAL pcmk__ipc_methods_tpcmk__attrd_api_methods (void)
 
G_GNUC_INTERNAL pcmk__ipc_methods_tpcmk__controld_api_methods (void)
 
G_GNUC_INTERNAL pcmk__ipc_methods_tpcmk__pacemakerd_api_methods (void)
 
G_GNUC_INTERNAL pcmk__ipc_methods_tpcmk__schedulerd_api_methods (void)
 
int pcmk__crm_ipc_is_authentic_process (qb_ipcc_connection_t *qb_ipc, int sock, uid_t refuid, gid_t refgid, pid_t *gotpid, uid_t *gotuid, gid_t *gotgid)
 Check the authenticity of the IPC socket peer process. More...
 
G_GNUC_INTERNAL int pcmk__bare_output_new (pcmk__output_t **out, const char *fmt_name, const char *filename, char **argv)
 
G_GNUC_INTERNAL void pcmk__register_patchset_messages (pcmk__output_t *out)
 

Macro Definition Documentation

◆ PCMK__BUFFER_SIZE

#define PCMK__BUFFER_SIZE   4096

Definition at line 25 of file crmcommon_private.h.

◆ pcmk__clear_xml_flags

#define pcmk__clear_xml_flags (   xml_priv,
  flags_to_clear 
)
Value:
do { \
(xml_priv)->flags = pcmk__clear_flags_as(__func__, __LINE__, \
LOG_NEVER, "XML", "XML node", (xml_priv)->flags, \
(flags_to_clear), #flags_to_clear); \
} while (0)
#define LOG_NEVER
Definition: logging.h:47
uint64_t flags
Definition: remote.c:215

Definition at line 59 of file crmcommon_private.h.

◆ PCMK__CONTROLD_API_MAJOR

#define PCMK__CONTROLD_API_MAJOR   "1"

Definition at line 132 of file crmcommon_private.h.

◆ PCMK__CONTROLD_API_MINOR

#define PCMK__CONTROLD_API_MINOR   "0"

Definition at line 133 of file crmcommon_private.h.

◆ PCMK__IPC_VERSION

#define PCMK__IPC_VERSION   1

Definition at line 130 of file crmcommon_private.h.

◆ PCMK__PW_BUFFER_LEN

#define PCMK__PW_BUFFER_LEN   500

Definition at line 322 of file crmcommon_private.h.

◆ pcmk__set_xml_flags

#define pcmk__set_xml_flags (   xml_priv,
  flags_to_set 
)
Value:
do { \
(xml_priv)->flags = pcmk__set_flags_as(__func__, __LINE__, \
LOG_NEVER, "XML", "XML node", (xml_priv)->flags, \
(flags_to_set), #flags_to_set); \
} while (0)
#define LOG_NEVER
Definition: logging.h:47
uint64_t flags
Definition: remote.c:215

Definition at line 53 of file crmcommon_private.h.

◆ PCMK__XML_PREFIX_CREATED

#define PCMK__XML_PREFIX_CREATED   "++"

XML is newly created.

Definition at line 256 of file crmcommon_private.h.

◆ PCMK__XML_PREFIX_DELETED

#define PCMK__XML_PREFIX_DELETED   "--"

XML has been deleted.

Definition at line 259 of file crmcommon_private.h.

◆ PCMK__XML_PREFIX_MODIFIED

#define PCMK__XML_PREFIX_MODIFIED   "+ "

XML has been modified.

Definition at line 262 of file crmcommon_private.h.

◆ PCMK__XML_PREFIX_MOVED

#define PCMK__XML_PREFIX_MOVED   "+~"

XML has been moved.

Definition at line 265 of file crmcommon_private.h.

Typedef Documentation

◆ pcmk__deleted_xml_t

◆ pcmk__ipc_header_t

◆ pcmk__ipc_methods_t

◆ xml_doc_private_t

◆ xml_node_private_t

Function Documentation

◆ pcmk__apply_acl()

G_GNUC_INTERNAL void pcmk__apply_acl ( xmlNode *  xml)

Definition at line 224 of file acl.c.

◆ pcmk__apply_creation_acl()

G_GNUC_INTERNAL void pcmk__apply_creation_acl ( xmlNode *  xml,
bool  check_top 
)

Definition at line 566 of file acl.c.

◆ pcmk__attrd_api_methods()

G_GNUC_INTERNAL pcmk__ipc_methods_t* pcmk__attrd_api_methods ( void  )

Definition at line 117 of file ipc_attrd.c.

◆ pcmk__bare_output_new()

G_GNUC_INTERNAL int pcmk__bare_output_new ( pcmk__output_t **  out,
const char *  fmt_name,
const char *  filename,
char **  argv 
)

Definition at line 61 of file output.c.

◆ pcmk__call_ipc_callback()

G_GNUC_INTERNAL void pcmk__call_ipc_callback ( pcmk_ipc_api_t api,
enum pcmk_ipc_event  event_type,
crm_exit_t  status,
void *  event_data 
)

Definition at line 146 of file ipc_client.c.

◆ pcmk__controld_api_methods()

G_GNUC_INTERNAL pcmk__ipc_methods_t* pcmk__controld_api_methods ( void  )

Definition at line 296 of file ipc_controld.c.

◆ pcmk__crm_ipc_is_authentic_process()

int pcmk__crm_ipc_is_authentic_process ( qb_ipcc_connection_t *  qb_ipc,
int  sock,
uid_t  refuid,
gid_t  refgid,
pid_t *  gotpid,
uid_t *  gotuid,
gid_t *  gotgid 
)

Check the authenticity of the IPC socket peer process.

If everything goes well, peer's authenticity is verified by the means of comparing against provided referential UID and GID (either satisfies), and the result of this check can be deduced from the return value. As an exception, detected UID of 0 ("root") satisfies arbitrary provided referential daemon's credentials.

Parameters
[in]qb_ipclibqb client connection if available
[in]sockIPC related, connected Unix socket to check peer of
[in]refuidreferential UID to check against
[in]refgidreferential GID to check against
[out]gotpidto optionally store obtained PID of the peer (not available on FreeBSD, special value of 1 used instead, and the caller is required to special case this value respectively)
[out]gotuidto optionally store obtained UID of the peer
[out]gotgidto optionally store obtained GID of the peer
Returns
Standard Pacemaker return code ie: 0 if it the connection is authentic pcmk_rc_ipc_unauthorized if the connection is not authentic, standard errors.
Note
While this function is tolerant on what constitutes authorized IPC daemon process (its effective user matches UID=0 or refuid, or at least its group matches refgid), either or both (in case of UID=0) mismatches on the expected credentials of such peer process shall be investigated at the caller when value of 1 gets returned there, since higher-than-expected privileges in respect to the expected/intended credentials possibly violate the least privilege principle and may pose an additional risk (i.e. such accidental inconsistency shall be eventually fixed).

Definition at line 1389 of file ipc_client.c.

◆ pcmk__free_acls()

G_GNUC_INTERNAL void pcmk__free_acls ( GList *  acls)

Definition at line 44 of file acl.c.

◆ pcmk__ipc_buffer_size()

G_GNUC_INTERNAL unsigned int pcmk__ipc_buffer_size ( unsigned int  max)

Definition at line 31 of file ipc_common.c.

◆ pcmk__is_user_in_group()

G_GNUC_INTERNAL bool pcmk__is_user_in_group ( const char *  user,
const char *  group 
)

Definition at line 54 of file utils.c.

◆ pcmk__log_xmllib_err()

G_GNUC_INTERNAL void pcmk__log_xmllib_err ( void *  ctx,
const char *  fmt,
  ... 
)

◆ pcmk__mark_xml_attr_dirty()

G_GNUC_INTERNAL void pcmk__mark_xml_attr_dirty ( xmlAttr *  a)

Definition at line 132 of file xml.c.

◆ pcmk__mark_xml_created()

G_GNUC_INTERNAL void pcmk__mark_xml_created ( xmlNode *  xml)

Definition at line 114 of file xml.c.

◆ pcmk__pacemakerd_api_methods()

G_GNUC_INTERNAL pcmk__ipc_methods_t* pcmk__pacemakerd_api_methods ( void  )

Definition at line 259 of file ipc_pacemakerd.c.

◆ pcmk__register_patchset_messages()

G_GNUC_INTERNAL void pcmk__register_patchset_messages ( pcmk__output_t out)

Definition at line 439 of file patchset_display.c.

◆ pcmk__schedulerd_api_methods()

G_GNUC_INTERNAL pcmk__ipc_methods_t* pcmk__schedulerd_api_methods ( void  )

Definition at line 128 of file ipc_schedulerd.c.

◆ pcmk__send_ipc_request()

G_GNUC_INTERNAL int pcmk__send_ipc_request ( pcmk_ipc_api_t api,
xmlNode *  request 
)

Definition at line 639 of file ipc_client.c.

◆ pcmk__tracking_xml_changes()

G_GNUC_INTERNAL bool pcmk__tracking_xml_changes ( xmlNode *  xml,
bool  lazy 
)

Definition at line 48 of file xml.c.

◆ pcmk__unpack_acl()

G_GNUC_INTERNAL void pcmk__unpack_acl ( xmlNode *  source,
xmlNode *  target,
const char *  user 
)

Definition at line 282 of file acl.c.

◆ pcmk__valid_ipc_header()

G_GNUC_INTERNAL bool pcmk__valid_ipc_header ( const pcmk__ipc_header_t header)

Definition at line 81 of file ipc_common.c.

◆ pcmk__xa_filterable()

G_GNUC_INTERNAL bool pcmk__xa_filterable ( const char *  name)

Definition at line 234 of file digest.c.

◆ pcmk__xc_match()

G_GNUC_INTERNAL xmlNode* pcmk__xc_match ( const xmlNode *  root,
const xmlNode *  search_comment,
bool  exact 
)

Definition at line 2160 of file xml.c.

◆ pcmk__xc_update()

G_GNUC_INTERNAL void pcmk__xc_update ( xmlNode *  parent,
xmlNode *  target,
xmlNode *  update 
)

Definition at line 2209 of file xml.c.

◆ pcmk__xml2text()

G_GNUC_INTERNAL void pcmk__xml2text ( xmlNodePtr  data,
uint32_t  options,
GString *  buffer,
int  depth 
)

Definition at line 1574 of file xml.c.

◆ pcmk__xml_match()

G_GNUC_INTERNAL xmlNode* pcmk__xml_match ( const xmlNode *  haystack,
const xmlNode *  needle,
bool  exact 
)

Definition at line 363 of file xml.c.

◆ pcmk__xml_position()

G_GNUC_INTERNAL int pcmk__xml_position ( const xmlNode *  xml,
enum xml_private_flags  ignore_if_set 
)

Definition at line 309 of file xml.c.

◆ pcmk__xml_update()

G_GNUC_INTERNAL void pcmk__xml_update ( xmlNode *  parent,
xmlNode *  target,
xmlNode *  update,
bool  as_diff 
)

Definition at line 2240 of file xml.c.