Exemplo n.º 1
0
/* turn libselinux messages into SSSD DEBUG() calls */
static void sss_semanage_error_callback(void *varg,
                                        semanage_handle_t *handle,
                                        const char *fmt, ...)
{
    int level = -1;
    int ret;
    char * message = NULL;
    va_list ap;

    switch (semanage_msg_get_level(handle)) {
        case SEMANAGE_MSG_ERR:
            level = 1;
            break;
        case SEMANAGE_MSG_WARN:
            level = 4;
            break;
        case SEMANAGE_MSG_INFO:
            level = 6;
            break;
    }

    va_start(ap, fmt);
    ret = vasprintf(&message, fmt, ap);
    va_end(ap);
    if (ret < 0) {
        /* ENOMEM */
        return;
    }

    DEBUG_MSG(level, "libsemanage", message);
    free(message);
}
Exemplo n.º 2
0
static void semanage_error_callback (unused void *varg,
                                     semanage_handle_t *handle,
                                     const char *fmt, ...)
{
	int ret;
	char * message = NULL;
	va_list ap;


	va_start (ap, fmt);
	ret = vasprintf (&message, fmt, ap);
	va_end (ap);
	if (ret < 0) {
		/* ENOMEM */
		return;
	}

	switch (semanage_msg_get_level (handle)) {
	case SEMANAGE_MSG_ERR:
	case SEMANAGE_MSG_WARN:
		fprintf (stderr, _("[libsemanage]: %s\n"), message);
		break;
	case SEMANAGE_MSG_INFO:
		/* nop */
		break;
	}

	free (message);
}
Exemplo n.º 3
0
/* turn libselinux messages into SSSD DEBUG() calls */
static void sss_semanage_error_callback(void *varg,
                                        semanage_handle_t *handle,
                                        const char *fmt, ...)
{
    int level = SSSDBG_INVALID;
    va_list ap;

    switch (semanage_msg_get_level(handle)) {
        case SEMANAGE_MSG_ERR:
            level = SSSDBG_CRIT_FAILURE;
            break;
        case SEMANAGE_MSG_WARN:
            level = SSSDBG_MINOR_FAILURE;
            break;
        case SEMANAGE_MSG_INFO:
            level = SSSDBG_TRACE_FUNC;
            break;
    }

    va_start(ap, fmt);
    if (DEBUG_IS_SET(level)) {
        sss_vdebug_fn(__FILE__, __LINE__, "libsemanage", level, fmt, ap);
    }
    va_end(ap);
}
Exemplo n.º 4
0
/* turn libselinux messages into SSSD DEBUG() calls */
static void sss_semanage_error_callback(void *varg,
                                        semanage_handle_t *handle,
                                        const char *fmt, ...)
{
    int level = SSSDBG_INVALID;
    int ret;
    char * message = NULL;
    va_list ap;

    switch (semanage_msg_get_level(handle)) {
        case SEMANAGE_MSG_ERR:
            level = SSSDBG_CRIT_FAILURE;
            break;
        case SEMANAGE_MSG_WARN:
            level = SSSDBG_MINOR_FAILURE;
            break;
        case SEMANAGE_MSG_INFO:
            level = SSSDBG_TRACE_FUNC;
            break;
    }

    va_start(ap, fmt);
    ret = vasprintf(&message, fmt, ap);
    va_end(ap);
    if (ret < 0) {
        /* ENOMEM */
        return;
    }

    if (DEBUG_IS_SET(level))
        debug_fn(__FILE__, __LINE__, "libsemanage", level, "%s\n", message);
    free(message);
}