Constify string for authorization protocol names
gcc was warning from storing string constants in a char *name field: auth.c:64:1: warning: initialization discards qualifiers from pointer target type auth.c:72:1: warning: initialization discards qualifiers from pointer target type auth.c:81:1: warning: initialization discards qualifiers from pointer target type Making the field const requires changing AuthorizationFromID to take a const char ** pointer for the name argument which it sets to point to the matching name entry. Changing that argument requires changing its sole caller in the security extension to pass the address of a const char * variable to it, which it can do, since the only thing it does with the returned name is to pass it back to the RemoveAuthorization function that already expects a const char *name. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
01834e99e4
commit
9999819601
|
@ -171,7 +171,8 @@ SecurityDeleteAuthorization(
|
||||||
{
|
{
|
||||||
SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr)value;
|
SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr)value;
|
||||||
unsigned short name_len, data_len;
|
unsigned short name_len, data_len;
|
||||||
char *name, *data;
|
const char *name;
|
||||||
|
char *data;
|
||||||
int status;
|
int status;
|
||||||
int i;
|
int i;
|
||||||
OtherClientsPtr pEventClient;
|
OtherClientsPtr pEventClient;
|
||||||
|
|
|
@ -405,7 +405,7 @@ extern _X_EXPORT void InitAuthorization(char * /*filename*/);
|
||||||
extern _X_EXPORT int AuthorizationFromID (
|
extern _X_EXPORT int AuthorizationFromID (
|
||||||
XID id,
|
XID id,
|
||||||
unsigned short *name_lenp,
|
unsigned short *name_lenp,
|
||||||
char **namep,
|
const char **namep,
|
||||||
unsigned short *data_lenp,
|
unsigned short *data_lenp,
|
||||||
char **datap);
|
char **datap);
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ from The Open Group.
|
||||||
|
|
||||||
struct protocol {
|
struct protocol {
|
||||||
unsigned short name_length;
|
unsigned short name_length;
|
||||||
char *name;
|
const char *name;
|
||||||
AuthAddCFunc Add; /* new authorization data */
|
AuthAddCFunc Add; /* new authorization data */
|
||||||
AuthCheckFunc Check; /* verify client authorization data */
|
AuthCheckFunc Check; /* verify client authorization data */
|
||||||
AuthRstCFunc Reset; /* delete all authorization data entries */
|
AuthRstCFunc Reset; /* delete all authorization data entries */
|
||||||
|
@ -236,7 +236,7 @@ int
|
||||||
AuthorizationFromID (
|
AuthorizationFromID (
|
||||||
XID id,
|
XID id,
|
||||||
unsigned short *name_lenp,
|
unsigned short *name_lenp,
|
||||||
char **namep,
|
const char **namep,
|
||||||
unsigned short *data_lenp,
|
unsigned short *data_lenp,
|
||||||
char **datap)
|
char **datap)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue