Comments (7)
Note that this is a bug that may not be obvious to users because both of the capng_apply
calls return 0.
from libcap-ng.
Unrelatedly, this code here seems to skip the CapAmb:
line that the sscanf
would attempt to parse?
Line 408 in e255e07
I.e. I'm not sure whether this get_ambient_set
works correctly either.
from libcap-ng.
Strange. In my testing I was using capng_print_caps_numeric() which hides what the system really thinks. Fixed now.
About the sscanf code, if strcmp() == 1, then we want to read the next line. Its only when its 0 that we want to read it.
from libcap-ng.
Thanks for putting up a fix! I'll test perhaps Monday.
testing using the internal state of capng
That's actually also the topic of my next bug report.
You'll notice that in my repro program I cross-check the result of capng_apply
against procfs
. I think it would be good if libcap-ng
did that internally, feel free to use my proc-parsing code -- I can put up a cleaned-up version (it'll be on github soon, but you can have it even sooner :)
strncmp
So strncmp
will return 0 if the two strings are equal, which means that you will continue;
instead of going on to do sscanf
. Am I reading this wrong?
This would also be improved if you adopt my procfs
parser.
from libcap-ng.
So strncmp will return 0 if the two strings are equal, which means that you will continue; instead of going on to do sscanf.
If strncmp returns a 0, strings match and the "if" fails so we run sscanf. If they mismatch, the "if" is true and we take the continue.
from libcap-ng.
Sorry, you're right about the strncmp
control flow, and I was having a brain glitch. My apologies for taking up your time with this.
from libcap-ng.
I can confirm that b6ff250 fixes the reported issue. However, as per my comment on the subsequent commit 6a24a9c, that one breaks the mitigation that one would need to use before the fix.
I.e. right now I just literally do capng_apply(CAPNG_SELECT_ALL);
twice in a row.
After 6a24a9c, the second capng_apply
fails, which to me seems weird.
I guess I could handle the new world by not checking errors on the second capng_apply
, but that feels dirty, and besides, the semantics of "a no-op apply succeeds" seems more right than a "no-op apply fails". I thought the philosophy of libcap-ng
was to free the end user from managing caps state. Avoiding the "no-op" error requires actively checking whether or not you're making a change before you call capng_apply
, which IMO makes the API harder to use.
from libcap-ng.
Related Issues (20)
- capng_get_caps_process vs sandbox HOT 3
- Warning: comparison of integer expressions of different signedness: 'unsigned int' and 'int' [-Wsign-compare] in lookup_table.c and cap-ng.c HOT 2
- capng_updatev (python) doesnt work HOT 2
- `capng_apply` does not notice it failed to apply a capability HOT 6
- How to support conditional compilation with/without CAPNG_AMBIENT & CAPNG_SELECT_ALL? HOT 4
- Upgrade to libcap-ng 0.8.1 breaks GNOME Keyring and other projects HOT 15
- Improve last cap detection HOT 4
- libdrop_ambient breaks compile if PR_CAP_AMBIENT is undefined HOT 4
- Detect kernel support of PR_CAP_AMBIENT at runtime HOT 5
- Use uid_t and gid_t in capng_change_id HOT 4
- libcap-ng used by "/usr/sbin/mount.cifs" failed due to not having CAP_SETPCAP in capng_apply HOT 3
- capng_change_id() can leave PR_SET_KEEPCAPS set to 1 on failure HOT 4
- Tarball distribution issues. HOT 3
- Problem with namespaces HOT 5
- Why to modify capng_updatev parameter type to signed for python bindings HOT 2
- Misleading output in configure HOT 2
- httpd segfaults on graceful reload (fork()) with 0.7.9 HOT 4
- Any plans to make new release? HOT 3
- undefined reference to `pthread_atfork' HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libcap-ng.