openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/dbus/1.12.16-r0/dbus-1.12.16/bus/apparmor.c
dbus_bool_t bus_apparmor_full_init(DBusError* error)
{
#ifdef HAVE_APPARMOR
    char *label, *mode;

    if (apparmor_enabled)
    {
        if (apparmor_config_mode == APPARMOR_DISABLED)
        {
            apparmor_enabled = FALSE;
            return TRUE;
        }

        if (bus_con == NULL)
        {
            if (aa_getcon(&label, &mode) == -1)
            {
                dbus_set_error(error, DBUS_ERROR_FAILED,
                               "Error getting AppArmor context of bus: %s",
                               _dbus_strerror(errno));
                return FALSE;
            }

            bus_con = bus_apparmor_confinement_new(label, mode);
            if (bus_con == NULL)
            {
                BUS_SET_OOM(error);
                free(label);
                return FALSE;
            }
        }
    }
    else
    {
        if (apparmor_config_mode == APPARMOR_REQUIRED)
        {
            dbus_set_error(error, DBUS_ERROR_FAILED,
                           "AppArmor mediation required but not present");
            return FALSE;
        }
        else if (apparmor_config_mode == APPARMOR_ENABLED)
        {
            return TRUE;
        }
    }
#endif

    return TRUE;
}
/**
 * Verify that the config mode is compatible with the kernel's AppArmor
 * support. If AppArmor mediation will be enabled, determine the bus
 * confinement label.
 */
Verify that the config mode is compatible with the kernel's AppArmor
support. If AppArmor mediation will be enabled, determine the bus
confinement label.
Verify that the config mode is compatible with the kernel ' s AppArmor support . If AppArmor mediation will be enabled determine the bus confinement label .
dbus_bool_t bus_apparmor_full_init(DBusError* error)
{
#ifdef HAVE_APPARMOR
    char *label, *mode;
    if (apparmor_enabled)
    {
        if (apparmor_config_mode == APPARMOR_DISABLED)
        {
            apparmor_enabled = FALSE;
            return TRUE;
        }
        if (bus_con == NULL)
        {
            if (aa_getcon(&label, &mode) == -1)
            {
                dbus_set_error(error, DBUS_ERROR_FAILED,
                               "Error getting AppArmor context of bus: %s",
                               _dbus_strerror(errno));
                return FALSE;
            }
            bus_con = bus_apparmor_confinement_new(label, mode);
            if (bus_con == NULL)
            {
                BUS_SET_OOM(error);
                free(label);
                return FALSE;
            }
        }
    }
    else
    {
        if (apparmor_config_mode == APPARMOR_REQUIRED)
        {
            dbus_set_error(error, DBUS_ERROR_FAILED,
                           "AppArmor mediation required but not present");
            return FALSE;
        }
        else if (apparmor_config_mode == APPARMOR_ENABLED)
        {
            return TRUE;
        }
    }
#endif
    return TRUE;
}
dbus_bool_t bus_apparmor_full_init ( DBusError * error ) { #ifdef HAVE_APPARMOR char * label , * mode ; if ( apparmor_enabled ) { if ( apparmor_config_mode == APPARMOR_DISABLED ) { apparmor_enabled = FALSE ; return TRUE ; } if ( bus_con == NULL ) { if ( aa_getcon ( & label , & mode ) == -1 ) { dbus_set_error ( error , DBUS_ERROR_FAILED , " " , _dbus_strerror ( errno ) ) ; return FALSE ; } bus_con = bus_apparmor_confinement_new ( label , mode ) ; if ( bus_con == NULL ) { BUS_SET_OOM ( error ) ; free ( label ) ; return FALSE ; } } } else { if ( apparmor_config_mode == APPARMOR_REQUIRED ) { dbus_set_error ( error , DBUS_ERROR_FAILED , " " ) ; return FALSE ; } else if ( apparmor_config_mode == APPARMOR_ENABLED ) { return TRUE ; } } #endif return TRUE ; }
Verify that the config mode is compatible with the kernel's AppArmor
 support.
Verify that the config mode is compatible with the kernel ' s AppArmor support .