<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.26.0">
</HEAD>
<BODY>
On Fri, 2010-05-07 at 09:32 -0700, Alan Coopersmith wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
Signed-off-by: Alan Coopersmith <<A HREF="mailto:alan.coopersmith@oracle.com">alan.coopersmith@oracle.com</A>>
---
include/os.h | 16 ++++++++--------
os/access.c | 10 +++++-----
os/auth.c | 15 ++++++++-------
os/mitauth.c | 8 ++++----
os/osdep.h | 23 ++++++++++++-----------
os/rpcauth.c | 8 ++++----
os/xdmauth.c | 16 ++++++++--------
os/xdmcp.c | 38 +++++++++++++++++++-------------------
8 files changed, 68 insertions(+), 66 deletions(-)
</PRE>
</BLOCKQUOTE>
<BR>
Compiles on AMD64<BR>
Tested-by: Gaetan Nadon <<A HREF="mailto:memsize@videotron.ca">memsize@videotron.ca</A>>
<BLOCKQUOTE TYPE=CITE>
<PRE>
diff --git a/include/os.h b/include/os.h
index 453ab82..3b07bde 100644
--- a/include/os.h
+++ b/include/os.h
@@ -285,7 +285,7 @@ extern _X_EXPORT int AddHost(
ClientPtr        /*client*/,
int /*family*/,
unsigned /*length*/,
- pointer /*pAddr*/);
+ const void */*pAddr*/);
extern _X_EXPORT Bool ForEachHostInFamily (
int         /*family*/,
@@ -369,9 +369,9 @@ extern _X_EXPORT int AuthorizationFromID (
extern _X_EXPORT XID CheckAuthorization(
unsigned int /*namelength*/,
- char * /*name*/,
+ const char * /*name*/,
unsigned int /*datalength*/,
- char * /*data*/,
+ const char * /*data*/,
ClientPtr /*client*/,
char ** /*reason*/
);
@@ -380,22 +380,22 @@ extern _X_EXPORT void ResetAuthorization(void);
extern _X_EXPORT int RemoveAuthorization (
unsigned short        name_length,
- char                *name,
+ const char                *name,
unsigned short        data_length,
- char                *data);
+ const char                *data);
extern _X_EXPORT int AddAuthorization(
unsigned int        /*name_length*/,
- char *                /*name*/,
+ const char *        /*name*/,
unsigned int        /*data_length*/,
char *                /*data*/);
#ifdef XCSECURITY
extern _X_EXPORT XID GenerateAuthorization(
unsigned int /* name_length */,
- char        * /* name */,
+ const char        * /* name */,
unsigned int /* data_length */,
- char        * /* data */,
+ const char        * /* data */,
unsigned int * /* data_length_return */,
char        ** /* data_return */);
#endif
diff --git a/os/access.c b/os/access.c
index 3572da0..5e8d8a5 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 */);
@@ -1315,7 +1315,7 @@ int
AddHost (ClientPtr        client,
         int family,
         unsigned length, /* of bytes in pAddr */
-         pointer pAddr)
+         const void * pAddr)
{
int rc, len;
@@ -1376,7 +1376,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)
{
@@ -1511,7 +1511,7 @@ GetHosts (
static int
CheckAddr (
int                        family,
- pointer                pAddr,
+ const void *        pAddr,
unsigned                length)
{
int        len;
diff --git a/os/auth.c b/os/auth.c
index a852e1c..7685751 100644
--- a/os/auth.c
+++ b/os/auth.c
@@ -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 a7968cb..1a26dce 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 7b1c699..1d87592 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 5ddbe21..ec7c01f 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 e19e4f9..7fab731 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 c1d650d..cae7d40 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,
</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>