tree-wide: replace last occurrences of security_context_t
PATCH 1/1 tree-wide: replace last occurrences of security_context_t
Follow-up of: 9eb9c9327563014ad6a807814e7975424642d5b9 ("Get rid of security_context_t and fix const declarations.")
--- mcstrans/src/mcscolor.c | 8 +++--- mcstrans/src/mcstrans.c | 12 ++++----- mcstrans/src/mcstrans.h | 4 +-- mcstrans/src/mcstransd.c | 6 ++--- mcstrans/utils/transcon.c | 2 +- mcstrans/utils/untranscon.c | 2 +- policycoreutils/newrole/newrole.c | 40 ++++++++++++++--------------- policycoreutils/run_init/run_init.c | 4 +-- policycoreutils/secon/secon.c | 19 +++++++------- sandbox/seunshare.c | 10 ++++---- 10 files changed, 54 insertions(+), 53 deletions(-)
mcstrans/src/mcscolor.c +4 -4
@@ -44,7 +44,7 @@ static setab_t *clist[N_COLOR];static setab_t *cend[N_COLOR ];static semnemonic_t *mnemonics; -static security_context_t my_context; +static char *my_context;void finish_context_colors (void ) {setab_t *cur, *next;
@@ -76,7 +76,7 @@ void finish_context_colors(void) { }static int check_dominance (const char *pattern,const char *raw) { -security_context_t ctx; +char *ctx;context_t con;struct av_decision avd;int rc =-1 ;
@@ -109,7 +109,7 @@ static int check_dominance(const char *pattern, const char *raw) {if (!raw) goto out; - rc =security_compute_av_raw (ctx, (security_context_t )raw, context_class, context_contains_perm, &avd); + rc =security_compute_av_raw (ctx, raw, context_class, context_contains_perm, &avd);if (rc) goto out;
@@ -282,7 +282,7 @@ static int parse_components(context_t con, char **components) {/* Look up colors. */ -int raw_color (const security_context_t raw,char **color_str) { +int raw_color (const char *raw,char **color_str) {#define CHARS_PER_COLOR 16context_t con;uint32_t i, j, mask =0 ;
mcstrans/src/mcstrans.c +6 -6
@@ -7,8 +7,8 @@int init_translations(void); void finish_context_translations(void); -int trans_context(const security_context_t, security_context_t *); -int untrans_context(const security_context_t, security_context_t *); +int trans_context(const char *, char **); +int untrans_context(const char *, char **); */
@@ -888,7 +888,7 @@ init_translations(void) { }char * -extract_range (const security_context_t incon) { +extract_range (const char *incon) {context_t con =context_new (incon);if (!con) {syslog (LOG_ERR ,"extract_range context_new(%s) failed: %s" , incon,strerror (errno));
@@ -911,7 +911,7 @@ extract_range(const security_context_t incon) { }char * -new_context_str (const security_context_t incon,const char *range) { +new_context_str (const char *incon,const char *range) {char *rcon =NULL ;context_t con =context_new (incon);if (!con) {
@@ -1489,7 +1489,7 @@ err: }int -trans_context (const security_context_t incon,security_context_t *rcon) { +trans_context (const char *incon,char **rcon) {char *trans =NULL ; *rcon =NULL ;
@@ -1612,7 +1612,7 @@ trans_context(const security_context_t incon, security_context_t *rcon) { }int -untrans_context (const security_context_t incon,security_context_t *rcon) { +untrans_context (const char *incon,char **rcon) {char *raw =NULL ; *rcon =NULL ;
mcstrans/src/mcstrans.h +2 -2
@@ -4,6 +4,6 @@extern int init_translations (void );extern void finish_context_translations (void ); -extern int trans_context (const security_context_t ,security_context_t *); -extern int untrans_context (const security_context_t ,security_context_t *); +extern int trans_context (const char *,char **); +extern int untrans_context (const char *,char **);
mcstrans/src/mcstransd.c +3 -3
@@ -45,12 +45,12 @@extern int init_translations (void );extern void finish_context_translations (void ); -extern int trans_context (const security_context_t ,security_context_t *); -extern int untrans_context (const security_context_t ,security_context_t *); +extern int trans_context (const char *,char **); +extern int untrans_context (const char *,char **);extern int init_colors (void );extern void finish_context_colors (void ); -extern int raw_color (const security_context_t ,char **); +extern int raw_color (const char *,char **);#define SETRANSD_PATHNAME "/sbin/mcstransd"
mcstrans/utils/transcon.c +1 -1
@@ -14,7 +14,7 @@ static __attribute__((__noreturn__)) void usage(const char *progname) }int main (int argc,char **argv) { -security_context_t scon; +char *scon;if ( argc !=2 )usage (argv[0 ]);if (init_translations ()==0 ) {if (trans_context (argv[1 ],&scon) ==0 ) {
mcstrans/utils/untranscon.c +1 -1
@@ -13,7 +13,7 @@ static __attribute__((__noreturn__)) void usage(const char *progname)exit (1 ); }int main (int argc,char **argv) { -security_context_t scon; +char *scon;if ( argc !=2 )usage (argv[0 ]);if (init_translations ()==0 ) {if (untrans_context (argv[1 ],&scon) ==0 ) {
policycoreutils/newrole/newrole.c +20 -20
@@ -643,8 +643,8 @@ static int transition_to_caller_uid()#ifdef AUDIT_LOG_PRIV /* Send audit message */ static -int send_audit_message (int success,security_context_t old_context, -security_context_t new_context,const char *ttyn) +int send_audit_message (int success,const char *old_context, +const char *new_context,const char *ttyn) {char *msg =NULL ;int rc;
@@ -677,9 +677,9 @@ int send_audit_message(int success, security_context_t old_context,#else static inline int send_audit_message (int success __attribute__ ((unused)), -security_context_t old_context +const char *old_context __attribute__ ((unused)), -security_context_t new_context +const char *new_context __attribute__ ((unused)),const char *ttyn __attribute__ ((unused))) {
@@ -695,14 +695,14 @@ static inline* This function will not fail if it can not relabel the tty when selinux is * in permissive mode. */ -static int relabel_tty (const char *ttyn,security_context_t new_context, -security_context_t * tty_context, -security_context_t * new_tty_context) +static int relabel_tty (const char *ttyn,const char *new_context, +char **tty_context, +char **new_tty_context) {int fd, rc;int enforcing =security_getenforce (); -security_context_t tty_con =NULL ; -security_context_t new_tty_con =NULL ; +char *tty_con =NULL ; +char *new_tty_con =NULL ;if (!ttyn)return 0 ;
@@ -775,11 +775,11 @@ static int relabel_tty(const char *ttyn, security_context_t new_context,* Returns zero on success, non-zero otherwise */ static int restore_tty_label (int fd,const char *ttyn, -security_context_t tty_context, -security_context_t new_tty_context) +const char *tty_context, +const char *new_tty_context) {int rc =0 ; -security_context_t chk_tty_context =NULL ; +char *chk_tty_context =NULL ;if (!ttyn) goto skip_relabel;
@@ -816,8 +816,8 @@ static int restore_tty_label(int fd, const char *ttyn,* Returns zero on success, non-zero otherwise. */ static int parse_command_line_arguments (int argc,char **argv,char *ttyn, -security_context_t old_context, -security_context_t * new_context, +const char *old_context, +char **new_context,int *preserve_environment) {int flag_index;/* flag index in argv[] */
@@ -827,8 +827,8 @@ static int parse_command_line_arguments(int argc, char **argv, char *ttyn,char *type_ptr =NULL ;/* stores malloc'd data from get_default_type */ char *level_s =NULL ;/* level spec'd by user in argv[] */ char *range_ptr =NULL ; -security_context_t new_con =NULL ; -security_context_t tty_con =NULL ; +char *new_con =NULL ; +char *tty_con =NULL ;context_t context =NULL ;/* manipulatable form of new_context */ const struct option long_options[] = { {"role" ,1 ,0 ,'r' },
@@ -1021,10 +1021,10 @@ static int set_signal_handles(void)int main (int argc,char *argv[]) { -security_context_t new_context =NULL ;/* target security context */ -security_context_t old_context =NULL ;/* original securiy context */ -security_context_t tty_context =NULL ;/* current context of tty */ -security_context_t new_tty_context =NULL ;/* new context of tty */ +char *new_context =NULL ;/* target security context */ +char *old_context =NULL ;/* original securiy context */ +char *tty_context =NULL ;/* current context of tty */ +char *new_tty_context =NULL ;/* new context of tty */ struct passwd pw;/* struct derived from passwd file line */ char *ttyn =NULL ;/* tty path */
policycoreutils/run_init/run_init.c +2 -2
@@ -303,7 +303,7 @@ int authenticate_user(void)* out: The CONTEXT associated with the context. * return: 0 on success, -1 on failure. */ -int get_init_context (security_context_t * context) +int get_init_context (char **context) {FILE *fp;
@@ -354,7 +354,7 @@ int main(int argc, char *argv[])extern char *optarg;/* used by getopt() for arg strings */ extern int opterr;/* controls getopt() error messages */ -security_context_t new_context;/* context for the init script context */ +char *new_context;/* context for the init script context */ #ifdef USE_NLS setlocale (LC_ALL ,"" );
policycoreutils/secon/secon.c +10 -9
@@ -341,7 +341,7 @@ static void cmd_line(int argc, char *argv[])errx (EXIT_FAILURE ,"SELinux is not enabled" ); } -static int my_getXcon_raw (pid_t pid,security_context_t * con,const char *val) +static int my_getXcon_raw (pid_t pid,char **con,const char *val) {char buf[4096 ];FILE *fp =NULL ;
@@ -371,23 +371,23 @@ static int my_getXcon_raw(pid_t pid, security_context_t * con, const char *val)return (0 ); } -static int my_getpidexeccon_raw (pid_t pid,security_context_t * con) +static int my_getpidexeccon_raw (pid_t pid,char **con) {return (my_getXcon_raw (pid, con,"exec" )); } -static int my_getpidfscreatecon_raw (pid_t pid,security_context_t * con) +static int my_getpidfscreatecon_raw (pid_t pid,char **con) {return (my_getXcon_raw (pid, con,"fscreate" )); } -static int my_getpidkeycreatecon_raw (pid_t pid,security_context_t * con) +static int my_getpidkeycreatecon_raw (pid_t pid,char **con) {return (my_getXcon_raw (pid, con,"keycreate" )); } -static security_context_t get_scon (void ) +static char *get_scon (void ) {static char dummy_NIL[1 ] ="" ; -security_context_t con =NULL , con_tmp; +char *con =NULL , *con_tmp;int ret =-1 ;switch (opts->from_type) {
@@ -620,9 +620,10 @@ static void disp__con_val(const char *name, const char *val, done = TRUE; } -static void disp_con (security_context_t scon_raw) +static void disp_con (const char *scon_raw) { -security_context_t scon_trans, scon; +char *scon_trans; +const char *scon;context_t con =NULL ;char *color_str =NULL ;struct context_color_t color = { .valid =0 };
@@ -748,7 +749,7 @@ static void disp_con(security_context_t scon_raw)int main (int argc,char *argv[]) { -security_context_t scon_raw =NULL ; +char *scon_raw =NULL ;cmd_line (argc, argv);
sandbox/seunshare.c +5 -5
@@ -431,13 +431,13 @@ static int cleanup_tmpdir(const char *tmpdir, const char *src,* to clean it up. */ static char *create_tmpdir (const char *src,struct stat *src_st, -struct stat *out_st,struct passwd *pwd,security_context_t execcon) +struct stat *out_st,struct passwd *pwd,const char *execcon) {char *tmpdir =NULL ;char *cmdbuf =NULL ;int fd_t =-1 , fd_s =-1 ;struct stat tmp_st; -security_context_t con =NULL ; +char *con =NULL ;/* get selinux context */ if (execcon) {
@@ -549,10 +549,10 @@ good:#define PROC_BASE "/proc"static int -killall (security_context_t execcon) +killall (const char *execcon) {DIR *dir; -security_context_t scon; +char *scon;struct dirent *de;pid_t *pid_table, pid, self;int i;
@@ -615,7 +615,7 @@ killall (security_context_t execcon)int main (int argc,char **argv) {int status =-1 ; -security_context_t execcon =NULL ; +const char *execcon =NULL ;int clflag;/* holds codes for command line flags */ int kill_all =0 ;
Signature · 1 line
2.26.0.rc2
Quoted 410 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Christian Göttsche
Sent: Monday, March 23, 2020 1:32 PM
To: [email protected]
Subject: [PATCH] tree-wide: replace last occurrences ofsecurity_context_tFollow-up of:
9eb9c9327563014ad6a807814e7975424642d5b9("Get rid ofsecurity_context_tand fix const declarations.")Signed-off-by Christian Göttsche <[email protected]>--- mcstrans/src/mcscolor.c | 8 +++--- mcstrans/src/mcstrans.c | 12 ++++----- mcstrans/src/mcstrans.h | 4 +-- mcstrans/src/mcstransd.c | 6 ++--- mcstrans/utils/transcon.c | 2 +- mcstrans/utils/untranscon.c | 2 +- policycoreutils/newrole/newrole.c | 40 ++++++++++++++--------------- policycoreutils/run_init/run_init.c | 4 +-- policycoreutils/secon/secon.c | 19 +++++++------- sandbox/seunshare.c | 10 ++++---- 10 files changed, 54 insertions(+), 53 deletions(-)mcstrans/src/mcscolor.c index renamed from mcstrans/src/mcscolor.c +0
-0
4ee0db50..a3838850100644mcstrans/src/mcscolor.c +5
-4@@ -44,7 +44,7 @@ static setab_t *clist[N_COLOR]; static setab_t *cend[N_COLOR ];static semnemonic_t *mnemonics; -static security_context_t my_context; +static char *my_context;void finish_context_colors (void ) {setab_t *cur, *next;@@ -76,7 +76,7 @@ void finish_context_colors(void) { }static int check_dominance (const char *pattern,const char *raw) { -security_context_t ctx; +char *ctx;context_t con;struct av_decision avd;int rc =-1 ;@@ -109,7 +109,7 @@ static int check_dominance(const char *pattern, const char *raw) {if (!raw) goto out; - rc =security_compute_av_raw (ctx, (security_context_t )raw, context_class, context_contains_perm, &avd); + rc =security_compute_av_raw (ctx, raw, context_class, +context_contains_perm, &avd);if (rc) goto out;@@ -282,7 +282,7 @@ static int parse_components(context_t con, char **components) {/* Look up colors. */ -int raw_color (const security_context_t raw,char **color_str) { +int raw_color (const char *raw,char **color_str) {#define CHARS_PER_COLOR 16context_t con;mcstrans/src/mcscolor.c +0
-0uint32_t i, j, mask =0 ;mcstrans/src/mcstrans.c index renamed from mcstrans/src/mcstrans.c +0
-0
96bdbdff..4a073ca4100644mcstrans/src/mcstrans.c +3
-3@@ -7,8 +7,8 @@int init_translations(void); void finish_context_translations(void); -int trans_context(const security_context_t, security_context_t *); -int untrans_context(const security_context_t, security_context_t *); +int trans_context(const char *, char **); int untrans_context(const +char *, char **); */ @@ -888,7 +888,7 @@ init_translations(void) { }char * -extract_range (const security_context_t incon) { +extract_range (const char *incon) {context_t con =context_new (incon);if (!con) { syslog(LOG_ERR, "extract_range context_new(%s) failed: %s",incon, strerror(errno)); @@ -911,7 +911,7 @@
extract_range(const security_context_t incon){ }char *
mcstrans/src/mcstrans.c +3
-3-new_context_str(const security_context_t incon, const char *range) { +new_context_str(const char *incon, const char *range) { char *rcon = NULL;context_t con =context_new (incon);if (!con) {@@ -1489,7 +1489,7 @@ err: }int -trans_context (const security_context_t incon,security_context_t *rcon) { +trans_context (const char *incon,char **rcon) {char *trans =NULL ; *rcon =NULL ;@@ -1612,7 +1612,7 @@ trans_context(const security_context_t incon, security_context_t *rcon) { }int -untrans_context (const security_context_t incon,security_context_t *rcon) { +untrans_context (const char *incon,char **rcon) {char *raw =NULL ; *rcon =NULL ;mcstrans/src/mcstrans.h index renamed from mcstrans/src/mcstrans.h +0
-0
a2f68c18..e5cda93b100644mcstrans/src/mcstrans.h +2
-1@@ -4,6 +4,6 @@extern int init_translations (void );extern void finish_context_translations (void ); -extern int trans_context (const security_context_t ,security_context_t *); -extern int untrans_context (const security_context_t ,security_context_t *); +extern int trans_context (const char *,char **);extern int +untrans_context (const char *,char **);mcstrans/src/mcstransd.c index renamed from mcstrans/src/mcstransd.c +0
-085899493..07c052fd 100644
mcstrans/src/mcstransd.c +3
-1@@ -45,12 +45,12 @@extern int init_translations (void );extern void finish_context_translations (void ); -extern int trans_context (const security_context_t ,security_context_t *); -extern int untrans_context (const security_context_t ,security_context_t *); +extern int trans_context (const char *,char **);extern int +untrans_context (const char *,char **);extern int init_colors (void ); extern void finish_context_colors(void); -extern int raw_color(constsecurity_context_t ,char **); +extern int raw_color (const char *,char **);#define SETRANSD_PATHNAME "/sbin/mcstransd"mcstrans/utils/transcon.c index renamed from mcstrans/utils/transcon.c +0
-0
f4ded53e..4bf1bd56100644mcstrans/utils/transcon.c +1
-1@@ -14,7 +14,7 @@ static __attribute__((__noreturn__)) void usage(const char *progname) }int main (int argc,char **argv) { -security_context_t scon; +char *scon;if ( argc !=2 )usage (argv[0 ]);if (init_translations ()==0 ) { if(trans_context(argv[1],&scon) == 0) { diff --git
a/mcstrans/utils/untranscon.cb/mcstrans/utils/untranscon.cindex 85cea294..81668746 100644mcstrans/utils/untranscon.c +1
-1@@ -13,7 +13,7 @@ static __attribute__((__noreturn__)) void usage(const char *progname)exit (1 ); }int main (int argc,char **argv) { -security_context_t scon; +char *scon;if ( argc !=2 )usage (argv[0 ]);if (init_translations ()==0 ) {
if(untrans_context(argv[1],&scon) == 0){ diff --gita/policycoreutils/newrole/newrole.cb/policycoreutils/newrole/newrole.cindexe70051b1..36e2ba9c100644policycoreutils/newrole/newrole.c +0
-0@@ -643,8 +643,8 @@ static int transition_to_caller_uid() #ifdef
AUDIT_LOG_PRIV
/* Send audit message */
staticpolicycoreutils/newrole/newrole.c +2
-2-int send_audit_message (int success,security_context_t old_context, -security_context_t new_context,const char *ttyn) +int send_audit_message (int success,const char *old_context, +const char *new_context,const char *ttyn) {char *msg =NULL ;int rc;@@ -677,9 +677,9 @@ int send_audit_message(int success, security_context_t
old_context, #else static inline
int send_audit_message(int success__attribute__((unused)),policycoreutils/newrole/newrole.c +10
-10- security_context_t old_context + const char *old_context __attribute__ ((unused)), - security_context_t new_context + const char *new_context __attribute__ ((unused)), const char *ttyn __attribute__ ((unused))) {@@ -695,14 +695,14 @@ static inline* This function will not fail if it can not relabel the tty when selinux is * in permissive mode. */ -static int relabel_tty (const char *ttyn,security_context_t new_context, -security_context_t * tty_context, -security_context_t * new_tty_context) +static int relabel_tty (const char *ttyn,const char *new_context, +char **tty_context, +char **new_tty_context) {int fd, rc;int enforcing =security_getenforce (); -security_context_t tty_con =NULL ; -security_context_t new_tty_con =NULL ; +char *tty_con =NULL ; +char *new_tty_con =NULL ;if (!ttyn)return 0 ;@@ -775,11 +775,11 @@ static int relabel_tty(const char *ttyn,security_context_t new_context, * Returns zero on success, non-zero otherwise */ static int restore_tty_label (int fd,const char *ttyn, -security_context_t tty_context, -security_context_t new_tty_context) +const char *tty_context, +const char *new_tty_context) {int rc =0 ; -security_context_t chk_tty_context =NULL ; +char *chk_tty_context =NULL ;if (!ttyn)policycoreutils/newrole/newrole.c +4
-4goto skip_relabel;@@ -816,8 +816,8 @@ static int restore_tty_label(int fd, const char *ttyn,* Returns zero on success, non-zero otherwise. */ static int parse_command_line_arguments (int argc,char **argv,char *ttyn, -security_context_t old_context, -security_context_t * new_context, +const char *old_context, +char **new_context,int *preserve_environment) {int flag_index;/* flag index in argv[] */ @@ -827,8 +827,8 @@ static int parse_command_line_arguments(int argc, char **argv, char *ttyn, char *type_ptr =NULL ;/* stores malloc'd data from get_default_type */ char *level_s =NULL ;/* level spec'd by user in argv[] */ char *range_ptr =NULL ; -security_context_t new_con =NULL ; -security_context_t tty_con =NULL ; +char *new_con =NULL ; +char *tty_con =NULL ;context_t context =NULL ;/* manipulatable form of new_context */ const struct option long_options[] = {policycoreutils/newrole/newrole.c +4
-4{"role", 1, 0, 'r'},@@ -1021,10 +1021,10 @@ static int set_signal_handles(void)int main(int argc, char *argv[]) { -security_context_t new_context =NULL ;/* target security context */ -security_context_t old_context =NULL ;/* original securiy context */ -security_context_t tty_context =NULL ;/* current context of tty */ -security_context_t new_tty_context =NULL ;/* new context of tty */ + char *new_context =NULL ;/* target security context */ +char *old_context =NULL ;/* original securiy context */ +char *tty_context =NULL ;/* current context of tty */ +char *new_tty_context =NULL ;/* new context of tty */ policycoreutils/newrole/newrole.c +0
-0struct passwd pw;/* struct derived from passwd file line */ char *ttyn =NULL ;/* tty path */ policycoreutils/run_init/run_init.c +1
-2@@ -303,7 +303,7 @@ int authenticate_user(void)* out: The CONTEXT associated with the context. * return: 0 on success, -1 on failure. */ -int get_init_context (security_context_t * context) +int get_init_context (char **context) {FILE *fp;@@ -354,7 +354,7 @@ int main(int argc, char *argv[])extern char *optarg;/* used by getopt() for arg strings */ extern int opterr;/* controls getopt() error messages */ -security_context_t new_context;/* context for the init script context */
policycoreutils/run_init/run_init.c +1
-0+char *new_context;/* context for the init script context */ #ifdef USE_NLS setlocale (LC_ALL ,"" );policycoreutils/secon/secon.c index renamed from policycoreutils/secon/secon.c +0
-0
477057a6..d257a9a1100644policycoreutils/secon/secon.c +9
-6@@ -341,7 +341,7 @@ static void cmd_line(int argc, char *argv[])errx (EXIT_FAILURE ,"SELinux is not enabled" ); } -static int my_getXcon_raw (pid_t pid,security_context_t * con,const char *val) +static int my_getXcon_raw (pid_t pid,char **con,const char *val) {char buf[4096 ];FILE *fp =NULL ;@@ -371,23 +371,23 @@ static int my_getXcon_raw(pid_t pid, security_context_t * con, const char *val)return (0 ); } -static int my_getpidexeccon_raw (pid_t pid,security_context_t * con) +static int my_getpidexeccon_raw (pid_t pid,char **con) { return (my_getXcon_raw(pid, con, "exec")); } -static intmy_getpidfscreatecon_raw (pid_t pid,security_context_t * con) +static int my_getpidfscreatecon_raw(pid_t pid, char **con) { return (my_getXcon_raw(pid, con, "fscreate")); } -static intmy_getpidkeycreatecon_raw (pid_t pid,security_context_t * con) +static int my_getpidkeycreatecon_raw(pid_t pid, char **con) {return (my_getXcon_raw (pid, con,"keycreate" )); } -static security_context_t get_scon (void ) +static char *get_scon (void ) {static char dummy_NIL[1 ] ="" ; -security_context_t con =NULL , con_tmp; +char *con =NULL , *con_tmp;int ret =-1 ;switch (opts->from_type) {@@ -620,9 +620,10 @@ static void disp__con_val(const char *name, const char *val, done = TRUE; } -static void disp_con (security_context_t scon_raw) +static void disp_con (const char *scon_raw) { -security_context_t scon_trans, scon; +char *scon_trans; +const char *scon;context_t con =NULL ;char *color_str =NULL ;struct
context_color_tcolor = { .valid = 0 }; @@ -748,7 +749,7 @@ static
voiddisp_con(security_context_t scon_raw)int
main(int argc, char *argv[])
{policycoreutils/secon/secon.c +1
-1-security_context_t scon_raw =NULL ; +char *scon_raw =NULL ;cmd_line (argc, argv);sandbox/seunshare.c index renamed from sandbox/seunshare.c +0
-0
9707a456..d626e98d100644sandbox/seunshare.c +2
-2@@ -431,13 +431,13 @@ static int cleanup_tmpdir(const char *tmpdir, const char*src, * to clean it up. */ static char *create_tmpdir (const char *src,struct stat *src_st, -struct stat *out_st,struct passwd *pwd,security_context_t execcon) +struct stat *out_st,struct passwd *pwd,const char *execcon) {char *tmpdir =NULL ;char *cmdbuf =NULL ;int fd_t =-1 , fd_s =-1 ;struct stat tmp_st; -security_context_t con =NULL ; +char *con =NULL ;/* get selinux context */ sandbox/seunshare.c +3
-4if (execcon) {@@ -549,10 +549,10 @@ good:#define PROC_BASE "/proc"static int -killall (security_context_t execcon) +killall (const char *execcon) {DIR *dir; -security_context_t scon; +char *scon;struct dirent *de;pid_t *pid_table, pid, self;int i;@@ -615,7 +615,7 @@ killall (security_context_t execcon)int main (int argc,char **argv) {int status =-1 ; -security_context_t execcon =NULL ; +const char *execcon =NULL ;int clflag;/* holds codes for command line flags */ int kill_all =0 ; --
Quoted 1 line
2.26.0.rc2
Nice, I also see you also made updates to correct const * issues with the Existing API like, for example, like send_audit_message().
Quoted 416 lines · William C
Quoted 411 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Christian Göttsche
Sent: Monday, March 23, 2020 1:32 PM
To: [email protected]
Subject: [PATCH] tree-wide: replace last occurrences ofsecurity_context_tFollow-up of:
9eb9c9327563014ad6a807814e7975424642d5b9("Get rid ofsecurity_context_tand fix const declarations.")Signed-off-by Christian Göttsche <[email protected]>--- mcstrans/src/mcscolor.c | 8 +++--- mcstrans/src/mcstrans.c | 12 ++++----- mcstrans/src/mcstrans.h | 4 +-- mcstrans/src/mcstransd.c | 6 ++--- mcstrans/utils/transcon.c | 2 +- mcstrans/utils/untranscon.c | 2 +- policycoreutils/newrole/newrole.c | 40 ++++++++++++++--------------- policycoreutils/run_init/run_init.c | 4 +-- policycoreutils/secon/secon.c | 19 +++++++------- sandbox/seunshare.c | 10 ++++---- 10 files changed, 54 insertions(+), 53 deletions(-)mcstrans/src/mcscolor.c index renamed from mcstrans/src/mcscolor.c +0
-0
4ee0db50..a3838850100644mcstrans/src/mcscolor.c +5
-4@@ -44,7 +44,7 @@ static setab_t *clist[N_COLOR]; static setab_t *cend[N_COLOR ];static semnemonic_t *mnemonics; -static security_context_t my_context; +static char *my_context;void finish_context_colors (void ) {setab_t *cur, *next;@@ -76,7 +76,7 @@ void finish_context_colors(void) { }static int check_dominance (const char *pattern,const char *raw) { -security_context_t ctx; +char *ctx;context_t con;struct av_decision avd;int rc =-1 ;@@ -109,7 +109,7 @@ static int check_dominance(const char *pattern, const char *raw) {if (!raw) goto out; - rc =security_compute_av_raw (ctx, (security_context_t )raw, context_class, context_contains_perm, &avd); + rc =security_compute_av_raw (ctx, raw, context_class, +context_contains_perm, &avd);if (rc) goto out;@@ -282,7 +282,7 @@ static int parse_components(context_t con, char **components) {/* Look up colors. */ -int raw_color (const security_context_t raw,char **color_str) { +int raw_color (const char *raw,char **color_str) {#define CHARS_PER_COLOR 16context_t con;uint32_t i, j, mask = 0;mcstrans/src/mcstrans.c index renamed from mcstrans/src/mcstrans.c +0
-0
96bdbdff..4a073ca4100644mcstrans/src/mcstrans.c +3
-3@@ -7,8 +7,8 @@int init_translations(void); void finish_context_translations(void); -int trans_context(const security_context_t, security_context_t *); -int untrans_context(const security_context_t, security_context_t *); +int trans_context(const char *, char **); int untrans_context(const +char *, char **); */ @@ -888,7 +888,7 @@ init_translations(void) { }char * -extract_range (const security_context_t incon) { +extract_range (const char *incon) {context_t con =context_new (incon);if (!con) { syslog(LOG_ERR, "extract_range context_new(%s) failed: %s",incon, strerror(errno)); @@ -911,7 +911,7 @@
extract_range(const security_context_t incon){ }char *
mcstrans/src/mcstrans.c +3
-3-new_context_str(const security_context_t incon, const char *range) { +new_context_str(const char *incon, const char *range) { char *rcon = NULL;context_t con =context_new (incon);if (!con) {@@ -1489,7 +1489,7 @@ err: }int -trans_context (const security_context_t incon,security_context_t *rcon) { +trans_context (const char *incon,char **rcon) {char *trans =NULL ; *rcon =NULL ;@@ -1612,7 +1612,7 @@ trans_context(const security_context_t incon, security_context_t *rcon) { }int -untrans_context (const security_context_t incon,security_context_t *rcon) { +untrans_context (const char *incon,char **rcon) {char *raw =NULL ; *rcon =NULL ;mcstrans/src/mcstrans.h index renamed from mcstrans/src/mcstrans.h +0
-0
a2f68c18..e5cda93b100644mcstrans/src/mcstrans.h +2
-1@@ -4,6 +4,6 @@extern int init_translations (void );extern void finish_context_translations (void ); -extern int trans_context (const security_context_t ,security_context_t *); -extern int untrans_context (const security_context_t ,security_context_t *); +extern int trans_context (const char *,char **);extern int +untrans_context (const char *,char **);mcstrans/src/mcstransd.c index renamed from mcstrans/src/mcstransd.c +0
-085899493..07c052fd 100644
mcstrans/src/mcstransd.c +3
-1@@ -45,12 +45,12 @@extern int init_translations (void );extern void finish_context_translations (void ); -extern int trans_context (const security_context_t ,security_context_t *); -extern int untrans_context (const security_context_t ,security_context_t *); +extern int trans_context (const char *,char **);extern int +untrans_context (const char *,char **);extern int init_colors (void ); extern void finish_context_colors(void); -extern int raw_color(constsecurity_context_t ,char **); +extern int raw_color (const char *,char **);#define SETRANSD_PATHNAME "/sbin/mcstransd"mcstrans/utils/transcon.c index renamed from mcstrans/utils/transcon.c +0
-0
f4ded53e..4bf1bd56100644mcstrans/utils/transcon.c +1
-1@@ -14,7 +14,7 @@ static __attribute__((__noreturn__)) void usage(const char *progname) }int main (int argc,char **argv) { -security_context_t scon; +char *scon;if ( argc !=2 )usage (argv[0 ]);if (init_translations ()==0 ) { if(trans_context(argv[1],&scon) == 0) { diff --git
a/mcstrans/utils/untranscon.cb/mcstrans/utils/untranscon.cindex 85cea294..81668746 100644mcstrans/utils/untranscon.c +1
-1@@ -13,7 +13,7 @@ static __attribute__((__noreturn__)) void usage(const char *progname)exit (1 ); }int main (int argc,char **argv) { -security_context_t scon; +char *scon;if ( argc !=2 )usage (argv[0 ]);if (init_translations ()==0 ) {if(untrans_context(argv[1],&scon) == 0) { diff --git
a/policycoreutils/newrole/newrole.cb/policycoreutils/newrole/newrole.cindexe70051b1..36e2ba9c100644policycoreutils/newrole/newrole.c +0
-0@@ -643,8 +643,8 @@ static int transition_to_caller_uid() #ifdef
AUDIT_LOG_PRIV
/* Send audit message */
staticpolicycoreutils/newrole/newrole.c +2
-2-int send_audit_message (int success,security_context_t old_context, -security_context_t new_context,const char *ttyn) +int send_audit_message (int success,const char *old_context, +const char *new_context,const char *ttyn) {char *msg =NULL ;int rc;@@ -677,9 +677,9 @@ int send_audit_message(int success, security_context_t
old_context, #else static inline
int send_audit_message(int success__attribute__((unused)),policycoreutils/newrole/newrole.c +10
-10- security_context_t old_context + const char *old_context __attribute__ ((unused)), - security_context_t new_context + const char *new_context __attribute__ ((unused)), const char *ttyn __attribute__ ((unused))) {@@ -695,14 +695,14 @@ static inline* This function will not fail if it can not relabel the tty when selinux is * in permissive mode. */ -static int relabel_tty (const char *ttyn,security_context_t new_context, -security_context_t * tty_context, -security_context_t * new_tty_context) +static int relabel_tty (const char *ttyn,const char *new_context, +char **tty_context, +char **new_tty_context) {int fd, rc;int enforcing =security_getenforce (); -security_context_t tty_con =NULL ; -security_context_t new_tty_con =NULL ; +char *tty_con =NULL ; +char *new_tty_con =NULL ;if (!ttyn)return 0 ;@@ -775,11 +775,11 @@ static int relabel_tty(const char *ttyn,security_context_t new_context, * Returns zero on success, non-zero otherwise */ static int restore_tty_label (int fd,const char *ttyn, -security_context_t tty_context, -security_context_t new_tty_context) +const char *tty_context, +const char *new_tty_context) {int rc =0 ; -security_context_t chk_tty_context =NULL ; +char *chk_tty_context =NULL ;if (!ttyn)goto skip_relabel;policycoreutils/newrole/newrole.c +4
-4@@ -816,8 +816,8 @@ static int restore_tty_label(int fd, const char *ttyn,* Returns zero on success, non-zero otherwise. */ static int parse_command_line_arguments (int argc,char **argv,char *ttyn, -security_context_t old_context, -security_context_t * new_context, +const char *old_context, +char **new_context,int *preserve_environment) {int flag_index;/* flag index in argv[] */ @@ -827,8 +827,8 @@ static int parse_command_line_arguments(int argc, char **argv, char *ttyn, char *type_ptr =NULL ;/* stores malloc'd data from get_default_type */ char *level_s =NULL ;/* level spec'd by user in argv[] */ char *range_ptr =NULL ; -security_context_t new_con =NULL ; -security_context_t tty_con =NULL ; +char *new_con =NULL ; +char *tty_con =NULL ;context_t context =NULL ;/* manipulatable form of new_context */ const struct option long_options[] = {{"role", 1, 0, 'r'},policycoreutils/newrole/newrole.c +4
-4@@ -1021,10 +1021,10 @@ static int set_signal_handles(void)int main(int argc, char *argv[]) { -security_context_t new_context =NULL ;/* target security context */ -security_context_t old_context =NULL ;/* original securiy context */ -security_context_t tty_context =NULL ;/* current context of tty */ -security_context_t new_tty_context =NULL ;/* new context of tty */ + char *new_context =NULL ;/* target security context */ +char *old_context =NULL ;/* original securiy context */ +char *tty_context =NULL ;/* current context of tty */ +char *new_tty_context =NULL ;/* new context of tty */ struct passwd pw; /* struct derived from passwd file line */
char *ttyn = NULL; /* tty path */policycoreutils/run_init/run_init.c +1
-2@@ -303,7 +303,7 @@ int authenticate_user(void)* out: The CONTEXT associated with the context. * return: 0 on success, -1 on failure. */ -int get_init_context (security_context_t * context) +int get_init_context (char **context) {FILE *fp;@@ -354,7 +354,7 @@ int main(int argc, char *argv[])extern char *optarg;/* used by getopt() for arg strings */ extern int opterr;/* controls getopt() error messages */ -security_context_t new_context;/* context for the init script context */
policycoreutils/run_init/run_init.c +1
-0+char *new_context;/* context for the init script context */ #ifdef USE_NLS setlocale (LC_ALL ,"" );policycoreutils/secon/secon.c index renamed from policycoreutils/secon/secon.c +0
-0
477057a6..d257a9a1100644policycoreutils/secon/secon.c +9
-6@@ -341,7 +341,7 @@ static void cmd_line(int argc, char *argv[])errx (EXIT_FAILURE ,"SELinux is not enabled" ); } -static int my_getXcon_raw (pid_t pid,security_context_t * con,const char *val) +static int my_getXcon_raw (pid_t pid,char **con,const char *val) {char buf[4096 ];FILE *fp =NULL ;@@ -371,23 +371,23 @@ static int my_getXcon_raw(pid_t pid, security_context_t * con, const char *val)return (0 ); } -static int my_getpidexeccon_raw (pid_t pid,security_context_t * con) +static int my_getpidexeccon_raw (pid_t pid,char **con) { return (my_getXcon_raw(pid, con, "exec")); } -static intmy_getpidfscreatecon_raw (pid_t pid,security_context_t * con) +static int my_getpidfscreatecon_raw(pid_t pid, char **con) { return (my_getXcon_raw(pid, con, "fscreate")); } -static intmy_getpidkeycreatecon_raw (pid_t pid,security_context_t * con) +static int my_getpidkeycreatecon_raw(pid_t pid, char **con) {return (my_getXcon_raw (pid, con,"keycreate" )); } -static security_context_t get_scon (void ) +static char *get_scon (void ) {static char dummy_NIL[1 ] ="" ; -security_context_t con =NULL , con_tmp; +char *con =NULL , *con_tmp;int ret =-1 ;switch (opts->from_type) {@@ -620,9 +620,10 @@ static void disp__con_val(const char *name, const char *val, done = TRUE; } -static void disp_con (security_context_t scon_raw) +static void disp_con (const char *scon_raw) { -security_context_t scon_trans, scon; +char *scon_trans; +const char *scon;context_t con =NULL ;char *color_str =NULL ;struct context_color_t color = { .valid = 0 }; @@ -748,7 +749,7 @@ staticvoid
disp_con(security_context_t scon_raw)int
main(int argc, char *argv[])
{policycoreutils/secon/secon.c +1
-1-security_context_t scon_raw =NULL ; +char *scon_raw =NULL ;cmd_line (argc, argv);sandbox/seunshare.c index renamed from sandbox/seunshare.c +0
-0
9707a456..d626e98d100644sandbox/seunshare.c +2
-2@@ -431,13 +431,13 @@ static int cleanup_tmpdir(const char *tmpdir, const char*src, * to clean it up. */ static char *create_tmpdir (const char *src,struct stat *src_st, -struct stat *out_st,struct passwd *pwd,security_context_t execcon) +struct stat *out_st,struct passwd *pwd,const char *execcon) {char *tmpdir =NULL ;char *cmdbuf =NULL ;int fd_t =-1 , fd_s =-1 ;struct stat tmp_st; -security_context_t con =NULL ; +char *con =NULL ;/* get selinux context */ if (execcon) {sandbox/seunshare.c +3
-4@@ -549,10 +549,10 @@ good:#define PROC_BASE "/proc"static int -killall (security_context_t execcon) +killall (const char *execcon) {DIR *dir; -security_context_t scon; +char *scon;struct dirent *de;pid_t *pid_table, pid, self;int i;@@ -615,7 +615,7 @@ killall (security_context_t execcon)int main (int argc,char **argv) {int status =-1 ; -security_context_t execcon =NULL ; +const char *execcon =NULL ;int clflag;/* holds codes for command line flags */ int kill_all =0 ; --Quoted 1 line
2.26.0.rc2
Nice, I also see you also made updates to correct const * issues with the Existing API like, for example, like
send_audit_message().
Quoted 1 line
Acked-by William Roberts <[email protected]>