Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.os.linux.development.apps > #652
| From | Jasen Betts <jasen@xnet.co.nz> |
|---|---|
| Newsgroups | comp.os.linux.development.apps |
| Subject | Re: How does one use capabilities |
| Date | 2014-02-12 09:41 +0000 |
| Organization | JJ's own news server |
| Message-ID | <ldffki$4q0$1@gonzo.reversiblemaps.ath.cx> (permalink) |
| References | <5d3aec9e-51c1-4a9a-801c-6281a8e62648@googlegroups.com> |
On 2014-02-12, Andrew Falanga <af300wsm@gmail.com> wrote:
> Hi,
>
> I'm learning about something that I didn't even know was in Linux for quite some time now: capabilities. How do they actually get set?
>
> I did something like this:
ignoring for now the memory leak.
>
> #include <iostream>
> #include <sys/types.h>
> #include <unistd.h>
> #include <sys/capabilities.h>
shoule be
#include <sys/capability.h>
>
> int main() {
> cap_t caps = cap_get_pid(getpid());
>
> std::cout << "capabilities: " << cap_to_text(caps) << std::endl;
should be
cap_to_text(caps,NULL)
,which leaks memory, but atleast doesn't give undefined behaviour.
> return 0;
> }
>
> Which returns "=". It seems unlikely that the process has no capabilities. Plus, every code example I've found thus far (which isn't many) shows that one first allocates a cap_t struct with cap_init() and then sets the values he wishes and then calls cap_set_pid() or similar. Is this how it's supposed to be used?
well, in spite of all that it seems to be working.
try running it as root.
--
Neither the pheasant plucker, nor the pheasant plucker's son.
--- news://freenews.netfront.net/ - complaints: news@netfront.net ---
Back to comp.os.linux.development.apps | Previous | Next — Previous in thread | Next in thread | Find similar
How does one use capabilities Andrew Falanga <af300wsm@gmail.com> - 2014-02-11 17:00 -0800
Re: How does one use capabilities Jasen Betts <jasen@xnet.co.nz> - 2014-02-12 09:41 +0000
Re: How does one use capabilities Andrew Falanga <af300wsm@gmail.com> - 2014-02-12 13:59 -0800
Re: How does one use capabilities Jasen Betts <jasen@xnet.co.nz> - 2014-02-13 11:47 +0000
Re: How does one use capabilities Joe Beanfish <joebeanfish@nospam.duh> - 2014-02-13 14:12 +0000
csiph-web