Libselinux 3.1 deprecates typedef 'security_context_t', leading to several warnings like:
defs.h:330:5: warning: ‘security_context_t’ is deprecated [-Wdeprecated-declarations] 330 | security_context_t scontext; /* security context */ | ^~~~~~~~~~~~~~~~~~ Replace all matches of 'security_context_t' by 'char *'. * find/defs.h (struct predicate.args.scontext): Change to 'char *'. (x_getfilecon): Adjust type of 3rd parameter. * find/parser.c (fallback_getfilecon): Adjust type of 3rd parameter. (optionh_getfilecon): Likewise. (optionl_getfilecon): Likewise. (optionp_getfilecon): Likewise. * find/pred.c (pred_context): Adjust type of 'scontext' variable. * find/print.c (do_fprintf): Likewise. --- find/defs.h | 4 ++-- find/parser.c | 9 ++++----- find/pred.c | 2 +- find/print.c | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/find/defs.h b/find/defs.h index 4cba5b45..2c902bcf 100644 --- a/find/defs.h +++ b/find/defs.h @@ -327,7 +327,7 @@ struct predicate struct samefile_file_id samefileid; /* samefile */ bool types[FTYPE_COUNT]; /* file type(s) */ struct format_val printf_vec; /* printf fprintf fprint ls fls print0 fprint0 print */ - security_context_t scontext; /* security context */ + char *scontext; /* security context */ } args; /* The next predicate in the user input sequence, @@ -626,7 +626,7 @@ struct options int regex_options; /* function used to get file context */ - int (*x_getfilecon) (int, const char *, security_context_t *); + int (*x_getfilecon) (int, const char *, char **); /* Optimisation level. One is the default. */ diff --git a/find/parser.c b/find/parser.c index 07efd83d..8df5f9d3 100644 --- a/find/parser.c +++ b/find/parser.c @@ -331,8 +331,7 @@ static const char *first_nonoption_arg = NULL; static const struct parser_table *noop = NULL; static int -fallback_getfilecon (int fd, const char *name, security_context_t *p, - int prev_rv) +fallback_getfilecon (int fd, const char *name, char **p, int prev_rv) { /* Our original getfilecon () call failed. Perhaps we can't follow a * symbolic link. If that might be the problem, lgetfilecon () the link. @@ -370,7 +369,7 @@ fallback_getfilecon (int fd, const char *name, security_context_t *p, * If the item to be examined is not a command-line argument, we * examine the link itself. */ static int -optionh_getfilecon (int fd, const char *name, security_context_t *p) +optionh_getfilecon (int fd, const char *name, char **p) { int rv; if (0 == state.curdepth) @@ -394,7 +393,7 @@ optionh_getfilecon (int fd, const char *name, security_context_t *p) * -L option is in effect. That option makes us examine the thing the * symbolic link points to, not the symbolic link itself. */ static int -optionl_getfilecon (int fd, const char *name, security_context_t *p) +optionl_getfilecon (int fd, const char *name, char **p) { int rv = getfileconat (fd, name, p); if (0 == rv) @@ -407,7 +406,7 @@ optionl_getfilecon (int fd, const char *name, security_context_t *p) * option is in effect (this is also the default). That option makes * us examine the symbolic link itself, not the thing it points to. */ static int -optionp_getfilecon (int fd, const char *name, security_context_t *p) +optionp_getfilecon (int fd, const char *name, char **p) { return lgetfileconat (fd, name, p); } diff --git a/find/pred.c b/find/pred.c index fc6ee286..9f2f159e 100644 --- a/find/pred.c +++ b/find/pred.c @@ -1233,7 +1233,7 @@ bool pred_context (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { - security_context_t scontext; + char *scontext; int rv = (*options.x_getfilecon) (state.cwd_dir_fd, state.rel_pathname, &scontext); (void) stat_buf; diff --git a/find/print.c b/find/print.c index 88635b54..7e467181 100644 --- a/find/print.c +++ b/find/print.c @@ -1224,7 +1224,7 @@ do_fprintf (struct format_val *dest, case 'Z': /* SELinux security context */ { - security_context_t scontext; + char *scontext; int rv = (*options.x_getfilecon) (state.cwd_dir_fd, state.rel_pathname, &scontext); if (rv < 0) -- 2.28.0