mirror of https://github.com/rd235/cado
Merge branch 'master' of https://github.com/rd235/cado
This commit is contained in:
commit
648d301eb3
3
cado.c
3
cado.c
|
@ -30,6 +30,7 @@
|
||||||
#include <capset_from_namelist.h>
|
#include <capset_from_namelist.h>
|
||||||
#include <read_conf.h>
|
#include <read_conf.h>
|
||||||
#include <set_ambient_cap.h>
|
#include <set_ambient_cap.h>
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
static void printcapset(uint64_t capset, char *indent) {
|
static void printcapset(uint64_t capset, char *indent) {
|
||||||
cap_value_t cap;
|
cap_value_t cap;
|
||||||
|
@ -41,7 +42,7 @@ static void printcapset(uint64_t capset, char *indent) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (count > 1)
|
if (count > 1)
|
||||||
printf("%s %016llx\n",indent,capset);
|
printf("%s %016" PRIx64 "\n",indent,capset);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define OPTSTRING "hqvs"
|
#define OPTSTRING "hqvs"
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <libgen.h>
|
#include <libgen.h>
|
||||||
#include <sys/capability.h>
|
#include <sys/capability.h>
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
char *tag="CapAmb:\t";
|
char *tag="CapAmb:\t";
|
||||||
uint64_t get_capamb(pid_t pid) {
|
uint64_t get_capamb(pid_t pid) {
|
||||||
|
@ -46,7 +47,9 @@ uint64_t get_capamb(pid_t pid) {
|
||||||
if (c == tag[status]) {
|
if (c == tag[status]) {
|
||||||
status++;
|
status++;
|
||||||
if (status == target) {
|
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;
|
break;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
|
@ -126,6 +129,8 @@ int main(int argc, char *argv[]) {
|
||||||
if (prompt) printf("#");
|
if (prompt) printf("#");
|
||||||
if (compact) printf("\n");
|
if (compact) printf("\n");
|
||||||
if (longlist && count > 1)
|
if (longlist && count > 1)
|
||||||
printf(" %016llx\n",capamb);
|
printf(" %016" PRIx64 "\n",capamb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ static int addcap(char *name, uint64_t *capset) {
|
||||||
int capset_from_namelist(char *namelist, uint64_t *capset) {
|
int capset_from_namelist(char *namelist, uint64_t *capset) {
|
||||||
int rv=0;
|
int rv=0;
|
||||||
char *onecap;
|
char *onecap;
|
||||||
char *tmptok;
|
char *tmptok = NULL;
|
||||||
for (; (onecap=strtok_r(namelist,",",&tmptok)) != NULL; namelist=NULL)
|
for (; (onecap=strtok_r(namelist,",",&tmptok)) != NULL; namelist=NULL)
|
||||||
rv |= addcap(onecap,capset);
|
rv |= addcap(onecap,capset);
|
||||||
return rv;
|
return rv;
|
||||||
|
|
|
@ -8,7 +8,6 @@ AC_CONFIG_SRCDIR([pam_check.h])
|
||||||
AC_CONFIG_HEADERS([config.h])
|
AC_CONFIG_HEADERS([config.h])
|
||||||
|
|
||||||
# Checks for programs.
|
# Checks for programs.
|
||||||
AC_PROG_CXX
|
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
AC_PROG_INSTALL
|
AC_PROG_INSTALL
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue