From 46770c9588b8a067572d25c5b2bb062354ec0752 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Wed, 27 May 2015 09:48:34 -0600 Subject: [PATCH] The error string returned by alias_add should be const. --- plugins/sudoers/alias.c | 2 +- plugins/sudoers/gram.c | 8 ++++---- plugins/sudoers/gram.y | 8 ++++---- plugins/sudoers/parse.h | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/plugins/sudoers/alias.c b/plugins/sudoers/alias.c index 2823c9392..f68aa0540 100644 --- a/plugins/sudoers/alias.c +++ b/plugins/sudoers/alias.c @@ -120,7 +120,7 @@ alias_put(struct alias *a) * Add an alias to the aliases redblack tree. * Returns NULL on success and an error string on failure. */ -char * +const char * alias_add(char *name, int type, struct member *members) { static char errbuf[512]; diff --git a/plugins/sudoers/gram.c b/plugins/sudoers/gram.c index adc21bea0..33e01e1fd 100644 --- a/plugins/sudoers/gram.c +++ b/plugins/sudoers/gram.c @@ -1736,7 +1736,7 @@ break; case 84: #line 562 "gram.y" { - char *s; + const char *s; if ((s = alias_add(yyvsp[-2].string, HOSTALIAS, yyvsp[0].member)) != NULL) { sudoerserror(s); YYERROR; @@ -1753,7 +1753,7 @@ break; case 89: #line 582 "gram.y" { - char *s; + const char *s; if ((s = alias_add(yyvsp[-2].string, CMNDALIAS, yyvsp[0].member)) != NULL) { sudoerserror(s); YYERROR; @@ -1770,7 +1770,7 @@ break; case 94: #line 602 "gram.y" { - char *s; + const char *s; if ((s = alias_add(yyvsp[-2].string, RUNASALIAS, yyvsp[0].member)) != NULL) { sudoerserror(s); YYERROR; @@ -1780,7 +1780,7 @@ break; case 97: #line 615 "gram.y" { - char *s; + const char *s; if ((s = alias_add(yyvsp[-2].string, USERALIAS, yyvsp[0].member)) != NULL) { sudoerserror(s); YYERROR; diff --git a/plugins/sudoers/gram.y b/plugins/sudoers/gram.y index d1d032f10..30029fb16 100644 --- a/plugins/sudoers/gram.y +++ b/plugins/sudoers/gram.y @@ -560,7 +560,7 @@ hostaliases : hostalias ; hostalias : ALIAS '=' hostlist { - char *s; + const char *s; if ((s = alias_add($1, HOSTALIAS, $3)) != NULL) { sudoerserror(s); YYERROR; @@ -580,7 +580,7 @@ cmndaliases : cmndalias ; cmndalias : ALIAS '=' cmndlist { - char *s; + const char *s; if ((s = alias_add($1, CMNDALIAS, $3)) != NULL) { sudoerserror(s); YYERROR; @@ -600,7 +600,7 @@ runasaliases : runasalias ; runasalias : ALIAS '=' userlist { - char *s; + const char *s; if ((s = alias_add($1, RUNASALIAS, $3)) != NULL) { sudoerserror(s); YYERROR; @@ -613,7 +613,7 @@ useraliases : useralias ; useralias : ALIAS '=' userlist { - char *s; + const char *s; if ((s = alias_add($1, USERALIAS, $3)) != NULL) { sudoerserror(s); YYERROR; diff --git a/plugins/sudoers/parse.h b/plugins/sudoers/parse.h index df3440e68..b2dca4956 100644 --- a/plugins/sudoers/parse.h +++ b/plugins/sudoers/parse.h @@ -185,7 +185,7 @@ extern struct defaults_list defaults; /* alias.c */ bool no_aliases(void); -char *alias_add(char *name, int type, struct member *members); +const char *alias_add(char *name, int type, struct member *members); int alias_compare(const void *a1, const void *a2); struct alias *alias_get(char *name, int type); struct alias *alias_remove(char *name, int type); -- 2.40.0