On Fri, Jul 03, 2015 at 05:13:37PM +0800, Yuan Sun wrote:
> Hi Jan,
>     The following link is unaccessible because HuaWei's network
> security strategy.
>     Could you please attach the test.c file for me?
> http://fpaste.org/239445/35909330/

Was afraid my web email client would mangle it. Attached.

Regards,
Jan

#include <linux/types.h>
#include <sys/capability.h>
#include <stdio.h>

#define NUMBER_OF_CAP_SETS      3
#if defined(_LINUX_CAPABILITY_VERSION_3)
# if (_LINUX_CAPABILITY_VERSION_3 != 0x20080522)
#  error Kernel <linux/capability.h> v3 does not match library
#  error file "libcap.h" --> fix and recompile libcap
# else
#  define _LIBCAP_CAPABILITY_VERSION  _LINUX_CAPABILITY_VERSION_3
#  define _LIBCAP_CAPABILITY_U32S     _LINUX_CAPABILITY_U32S_3
# endif
#endif

struct _cap_struct {
    struct __user_cap_header_struct head;
    union {
        struct __user_cap_data_struct set;
        __u32 flat[NUMBER_OF_CAP_SETS];
    } u[_LIBCAP_CAPABILITY_U32S];
};

int main(void)
{
        
        cap_t caps, expectedcaps;
        int i;

        caps = cap_get_proc();
        expectedcaps = cap_from_text("=ep");
        
        for (i = 0; i < _LIBCAP_CAPABILITY_U32S; i++)
                printf("%08x ", caps->u[i].flat[CAP_EFFECTIVE]);
        printf("\n");

        for (i = 0; i < _LIBCAP_CAPABILITY_U32S; i++)
                printf("%08x ", expectedcaps->u[i].flat[CAP_EFFECTIVE]);
        printf("\n");

        printf("cap_compare: %d\n", cap_compare(caps, expectedcaps));

        return 0;
}
------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to