diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2010-05-07 09:32:34 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2010-05-07 12:22:58 -0700 |
commit | 2eab697adba4b1858a530750e9a35fba79a7bf26 (patch) | |
tree | a67e747f860fde87ff61eaace3991b0834248ba4 /os | |
parent | e2e2747f40c4b9e23dba38ea656d4c082e83a794 (diff) |
Constify function prototypes in auth & xdmcp code
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Tested-by: Gaetan Nadon <memsize@videotron.ca>
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'os')
-rw-r--r-- | os/access.c | 10 | ||||
-rw-r--r-- | os/auth.c | 15 | ||||
-rw-r--r-- | os/mitauth.c | 8 | ||||
-rw-r--r-- | os/osdep.h | 23 | ||||
-rw-r--r-- | os/rpcauth.c | 8 | ||||
-rw-r--r-- | os/xdmauth.c | 16 | ||||
-rw-r--r-- | os/xdmcp.c | 38 |
7 files changed, 60 insertions, 58 deletions
diff --git a/os/access.c b/os/access.c index 74c340a43..d057e0425 100644 --- a/os/access.c +++ b/os/access.c @@ -215,11 +215,11 @@ static int ConvertAddr(struct sockaddr * /*saddr*/, pointer * /*addr*/); static int CheckAddr(int /*family*/, - pointer /*pAddr*/, + const void * /*pAddr*/, unsigned /*length*/); static Bool NewHost(int /*family*/, - pointer /*addr*/, + const void * /*addr*/, int /*len*/, int /* addingLocalHosts */); @@ -1316,7 +1316,7 @@ int AddHost (ClientPtr client, int family, unsigned length, /* of bytes in pAddr */ - pointer pAddr) + const void * pAddr) { int rc, len; @@ -1377,7 +1377,7 @@ ForEachHostInFamily (int family, * called when starting or resetting the server */ static Bool NewHost (int family, - pointer addr, + const void * addr, int len, int addingLocalHosts) { @@ -1512,7 +1512,7 @@ GetHosts ( static int CheckAddr ( int family, - pointer pAddr, + const void * pAddr, unsigned length) { int len; @@ -159,9 +159,9 @@ RegisterAuthorizations (void) XID CheckAuthorization ( unsigned int name_length, - char *name, + const char *name, unsigned int data_length, - char *data, + const char *data, ClientPtr client, char **reason) /* failure message. NULL for default msg */ { @@ -256,9 +256,9 @@ AuthorizationFromID ( int RemoveAuthorization ( unsigned short name_length, - char *name, + const char *name, unsigned short data_length, - char *data) + const char *data) { int i; @@ -274,7 +274,8 @@ RemoveAuthorization ( } int -AddAuthorization (unsigned name_length, char *name, unsigned data_length, char *data) +AddAuthorization (unsigned name_length, const char *name, + unsigned data_length, char *data) { int i; @@ -294,9 +295,9 @@ AddAuthorization (unsigned name_length, char *name, unsigned data_length, char * XID GenerateAuthorization( unsigned name_length, - char *name, + const char *name, unsigned data_length, - char *data, + const char *data, unsigned *data_length_return, char **data_return) { diff --git a/os/mitauth.c b/os/mitauth.c index a7968cbd7..1a26dcea4 100644 --- a/os/mitauth.c +++ b/os/mitauth.c @@ -50,7 +50,7 @@ static struct auth { int MitAddCookie ( unsigned short data_length, - char *data, + const char *data, XID id) { struct auth *new; @@ -74,7 +74,7 @@ MitAddCookie ( XID MitCheckCookie ( unsigned short data_length, - char *data, + const char *data, ClientPtr client, char **reason) { @@ -139,7 +139,7 @@ MitFromID ( int MitRemoveCookie ( unsigned short data_length, - char *data) + const char *data) { struct auth *auth, *prev; @@ -167,7 +167,7 @@ static char cookie[16]; /* 128 bits */ XID MitGenerateCookie ( unsigned data_length, - char *data, + const char *data, XID id, unsigned *data_length_return, char **data_return) diff --git a/os/osdep.h b/os/osdep.h index 7b1c69995..1d87592e3 100644 --- a/os/osdep.h +++ b/os/osdep.h @@ -114,7 +114,8 @@ SOFTWARE. #if defined(XDMCP) || defined(HASXDMAUTH) typedef Bool (*ValidatorFunc)(ARRAY8Ptr Auth, ARRAY8Ptr Data, int packet_type); typedef Bool (*GeneratorFunc)(ARRAY8Ptr Auth, ARRAY8Ptr Data, int packet_type); -typedef Bool (*AddAuthorFunc)(unsigned name_length, char *name, unsigned data_length, char *data); +typedef Bool (*AddAuthorFunc)(unsigned name_length, const char *name, + unsigned data_length, char *data); #endif typedef struct _connectionInput { @@ -138,19 +139,19 @@ struct _osComm; #define AuthInitArgs void typedef void (*AuthInitFunc) (AuthInitArgs); -#define AuthAddCArgs unsigned short data_length, char *data, XID id +#define AuthAddCArgs unsigned short data_length, const char *data, XID id typedef int (*AuthAddCFunc) (AuthAddCArgs); -#define AuthCheckArgs unsigned short data_length, char *data, ClientPtr client, char **reason +#define AuthCheckArgs unsigned short data_length, const char *data, ClientPtr client, char **reason typedef XID (*AuthCheckFunc) (AuthCheckArgs); #define AuthFromIDArgs XID id, unsigned short *data_lenp, char **datap typedef int (*AuthFromIDFunc) (AuthFromIDArgs); -#define AuthGenCArgs unsigned data_length, char *data, XID id, unsigned *data_length_return, char **data_return +#define AuthGenCArgs unsigned data_length, const char *data, XID id, unsigned *data_length_return, char **data_return typedef XID (*AuthGenCFunc) (AuthGenCArgs); -#define AuthRemCArgs unsigned short data_length, char *data +#define AuthRemCArgs unsigned short data_length, const char *data typedef int (*AuthRemCFunc) (AuthRemCArgs); #define AuthRstCArgs void @@ -254,29 +255,29 @@ extern void XdmcpUseMsg (void); extern int XdmcpOptions(int argc, char **argv, int i); extern void XdmcpRegisterConnection ( int type, - char *address, + const char *address, int addrlen); extern void XdmcpRegisterAuthorizations (void); -extern void XdmcpRegisterAuthorization (char *name, int namelen); +extern void XdmcpRegisterAuthorization (const char *name, int namelen); extern void XdmcpInit (void); extern void XdmcpReset (void); extern void XdmcpOpenDisplay(int sock); extern void XdmcpCloseDisplay(int sock); extern void XdmcpRegisterAuthentication ( - char *name, + const char *name, int namelen, - char *data, + const char *data, int datalen, ValidatorFunc Validator, GeneratorFunc Generator, AddAuthorFunc AddAuth); struct sockaddr_in; -extern void XdmcpRegisterBroadcastAddress (struct sockaddr_in *addr); +extern void XdmcpRegisterBroadcastAddress (const struct sockaddr_in *addr); #endif #ifdef HASXDMAUTH -extern void XdmAuthenticationInit (char *cookie, int cookie_length); +extern void XdmAuthenticationInit (const char *cookie, int cookie_length); #endif #endif /* _OSDEP_H_ */ diff --git a/os/rpcauth.c b/os/rpcauth.c index 5ddbe210b..ec7c01f9b 100644 --- a/os/rpcauth.c +++ b/os/rpcauth.c @@ -55,7 +55,7 @@ extern bool_t xdr_opaque_auth(XDR *, struct opaque_auth *); static enum auth_stat why; static char * -authdes_ezdecode(char *inmsg, int len) +authdes_ezdecode(const char *inmsg, int len) { struct rpc_msg msg; char cred_area[MAX_AUTH_BYTES]; @@ -127,7 +127,7 @@ CheckNetName ( static char rpc_error[MAXNETNAMELEN+50]; _X_HIDDEN XID -SecureRPCCheck (unsigned short data_length, char *data, +SecureRPCCheck (unsigned short data_length, const char *data, ClientPtr client, char **reason) { char *fullname; @@ -158,7 +158,7 @@ SecureRPCInit (void) } _X_HIDDEN int -SecureRPCAdd (unsigned short data_length, char *data, XID id) +SecureRPCAdd (unsigned short data_length, const char *data, XID id) { if (data_length) AddHost ((pointer) 0, FamilyNetname, data_length, data); @@ -186,7 +186,7 @@ SecureRPCFromID (XID id, unsigned short *data_lenp, char **datap) } _X_HIDDEN int -SecureRPCRemove (unsigned short data_length, char *data) +SecureRPCRemove (unsigned short data_length, const char *data) { return 0; } diff --git a/os/xdmauth.c b/os/xdmauth.c index e19e4f93d..7fab73111 100644 --- a/os/xdmauth.c +++ b/os/xdmauth.c @@ -96,7 +96,7 @@ XdmAuthenticationGenerator (ARRAY8Ptr privateData, ARRAY8Ptr outgoingData, } static Bool -XdmAuthenticationAddAuth (int name_len, char *name, +XdmAuthenticationAddAuth (int name_len, const char *name, int data_len, char *data) { Bool ret; @@ -114,7 +114,7 @@ XdmAuthenticationAddAuth (int name_len, char *name, 'A' <= c && c <= 'F' ? c - 'A' + 10 : -1) static int -HexToBinary (char *in, char *out, int len) +HexToBinary (const char *in, char *out, int len) { int top, bottom; @@ -137,7 +137,7 @@ HexToBinary (char *in, char *out, int len) } void -XdmAuthenticationInit (char *cookie, int cookie_len) +XdmAuthenticationInit (const char *cookie, int cookie_len) { bzero (privateKey.data, 8); if (!strncmp (cookie, "0x", 2) || !strncmp (cookie, "0X", 2)) @@ -188,7 +188,7 @@ static Bool gotClock; #define TwentyFiveMinutes (25 * 60) static Bool -XdmClientAuthCompare (XdmClientAuthPtr a, XdmClientAuthPtr b) +XdmClientAuthCompare (const XdmClientAuthPtr a, const XdmClientAuthPtr b) { int i; @@ -201,7 +201,7 @@ XdmClientAuthCompare (XdmClientAuthPtr a, XdmClientAuthPtr b) } static void -XdmClientAuthDecode (unsigned char *plain, XdmClientAuthPtr auth) +XdmClientAuthDecode (const unsigned char *plain, XdmClientAuthPtr auth) { int i, j; @@ -327,7 +327,7 @@ XdmAuthorizationValidate (unsigned char *plain, int length, } int -XdmAddCookie (unsigned short data_length, char *data, XID id) +XdmAddCookie (unsigned short data_length, const char *data, XID id) { XdmAuthorizationPtr new; unsigned char *rho_bits, *key_bits; @@ -375,7 +375,7 @@ XdmAddCookie (unsigned short data_length, char *data, XID id) } XID -XdmCheckCookie (unsigned short cookie_length, char *cookie, +XdmCheckCookie (unsigned short cookie_length, const char *cookie, ClientPtr xclient, char **reason) { XdmAuthorizationPtr auth; @@ -464,7 +464,7 @@ XdmFromID (XID id, unsigned short *data_lenp, char **datap) } int -XdmRemoveCookie (unsigned short data_length, char *data) +XdmRemoveCookie (unsigned short data_length, const char *data) { XdmAuthorizationPtr auth; XdmAuthKeyPtr key_bits, rho_bits; diff --git a/os/xdmcp.c b/os/xdmcp.c index c1d650d46..cae7d40ae 100644 --- a/os/xdmcp.c +++ b/os/xdmcp.c @@ -132,14 +132,14 @@ static struct multicastinfo { #endif static void XdmcpAddHost( - struct sockaddr *from, + const struct sockaddr *from, int fromlen, ARRAY8Ptr AuthenticationName, ARRAY8Ptr hostname, ARRAY8Ptr status); static void XdmcpSelectHost( - struct sockaddr *host_sockaddr, + const struct sockaddr *host_sockaddr, int host_len, ARRAY8Ptr AuthenticationName); @@ -169,10 +169,10 @@ static void send_keepalive_msg(void); static void recv_alive_msg(unsigned /*length*/); static void XdmcpFatal( - char * /*type*/, + const char * /*type*/, ARRAY8Ptr /*status*/); -static void XdmcpWarning(char * /*str*/); +static void XdmcpWarning(const char * /*str*/); static void get_manager_by_name( int /*argc*/, @@ -210,7 +210,7 @@ static void XdmcpWakeupHandler( static ARRAY8 ManufacturerDisplayID; static void -XdmcpRegisterManufacturerDisplayID (char *name, int length) +XdmcpRegisterManufacturerDisplayID (const char *name, int length) { int i; @@ -332,7 +332,7 @@ static struct sockaddr_in BroadcastAddresses[MAX_BROADCAST]; static int NumBroadcastAddresses; void -XdmcpRegisterBroadcastAddress (struct sockaddr_in *addr) +XdmcpRegisterBroadcastAddress (const struct sockaddr_in *addr) { struct sockaddr_in *bcast; if (NumBroadcastAddresses >= MAX_BROADCAST) @@ -364,9 +364,9 @@ static AuthenticationFuncsPtr AuthenticationFuncsList; void XdmcpRegisterAuthentication ( - char *name, + const char *name, int namelen, - char *data, + const char *data, int datalen, ValidatorFunc Validator, GeneratorFunc Generator, @@ -420,7 +420,7 @@ static ARRAY8Ptr AuthenticationData = &noAuthenticationData; static AuthenticationFuncsPtr AuthenticationFuncs; static void -XdmcpSetAuthentication (ARRAY8Ptr name) +XdmcpSetAuthentication (const ARRAY8Ptr name) { int i; @@ -445,7 +445,7 @@ static long xdmcpGeneration; void XdmcpRegisterConnection ( int type, - char *address, + const char *address, int addrlen) { int i; @@ -528,7 +528,7 @@ XdmcpRegisterAuthorizations (void) } void -XdmcpRegisterAuthorization (char *name, int namelen) +XdmcpRegisterAuthorization (const char *name, int namelen) { ARRAY8 authName; int i; @@ -554,7 +554,7 @@ XdmcpRegisterAuthorization (char *name, int namelen) static ARRAY8 DisplayClass; static void -XdmcpRegisterDisplayClass (char *name, int length) +XdmcpRegisterDisplayClass (const char *name, int length) { int i; @@ -728,7 +728,7 @@ XdmcpWakeupHandler( static void XdmcpSelectHost( - struct sockaddr *host_sockaddr, + const struct sockaddr *host_sockaddr, int host_len, ARRAY8Ptr AuthenticationName) { @@ -748,7 +748,7 @@ XdmcpSelectHost( /*ARGSUSED*/ static void XdmcpAddHost( - struct sockaddr *from, + const struct sockaddr *from, int fromlen, ARRAY8Ptr AuthenticationName, ARRAY8Ptr hostname, @@ -854,7 +854,7 @@ send_packet(void) */ static void -XdmcpDeadSession (char *reason) +XdmcpDeadSession (const char *reason) { ErrorF ("XDM: %s, declaring session dead\n", reason); state = XDM_INIT_STATE; @@ -1448,7 +1448,7 @@ recv_alive_msg (unsigned length) static void XdmcpFatal ( - char *type, + const char *type, ARRAY8Ptr status) { FatalError ("XDMCP fatal error: %s %*.*s\n", type, @@ -1456,15 +1456,15 @@ XdmcpFatal ( } static void -XdmcpWarning(char *str) +XdmcpWarning(const char *str) { ErrorF("XDMCP warning: %s\n", str); } static void get_addr_by_name( - char * argtype, - char * namestr, + const char *argtype, + const char *namestr, int port, int socktype, SOCKADDR_TYPE *addr, |