This commit is contained in:
Renzo Davoli 2016-08-04 14:14:28 +02:00
commit 648d301eb3
4 changed files with 10 additions and 5 deletions

3
cado.c
View File

@ -30,6 +30,7 @@
#include <capset_from_namelist.h>
#include <read_conf.h>
#include <set_ambient_cap.h>
#include <inttypes.h>
static void printcapset(uint64_t capset, char *indent) {
cap_value_t cap;
@ -41,7 +42,7 @@ static void printcapset(uint64_t capset, char *indent) {
}
}
if (count > 1)
printf("%s %016llx\n",indent,capset);
printf("%s %016" PRIx64 "\n",indent,capset);
}
#define OPTSTRING "hqvs"

View File

@ -27,6 +27,7 @@
#include <getopt.h>
#include <libgen.h>
#include <sys/capability.h>
#include <inttypes.h>
char *tag="CapAmb:\t";
uint64_t get_capamb(pid_t pid) {
@ -46,7 +47,9 @@ uint64_t get_capamb(pid_t pid) {
if (c == tag[status]) {
status++;
if (status == target) {
fscanf(f,"%llx",&capamb);
int fields = 0;
if ((fields = fscanf(f,"%" PRIx64 "",&capamb)) != 1)
fprintf(stderr, "WARNING: fscanf on %s return %d fields.\n", filename, fields);
break;
}
} else
@ -126,6 +129,8 @@ int main(int argc, char *argv[]) {
if (prompt) printf("#");
if (compact) printf("\n");
if (longlist && count > 1)
printf(" %016llx\n",capamb);
printf(" %016" PRIx64 "\n",capamb);
}
return 0;
}

View File

@ -51,7 +51,7 @@ static int addcap(char *name, uint64_t *capset) {
int capset_from_namelist(char *namelist, uint64_t *capset) {
int rv=0;
char *onecap;
char *tmptok;
char *tmptok = NULL;
for (; (onecap=strtok_r(namelist,",",&tmptok)) != NULL; namelist=NULL)
rv |= addcap(onecap,capset);
return rv;

View File

@ -8,7 +8,6 @@ AC_CONFIG_SRCDIR([pam_check.h])
AC_CONFIG_HEADERS([config.h])
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_INSTALL