dtlogin: start to resolve static analysis warnings
Also convert some K&R function declarations to ansi
This commit is contained in:
@@ -118,6 +118,16 @@ extern Time_t time ();
|
||||
extern ARRAY8Ptr ChooseAuthentication ();
|
||||
extern int SelectConnectionTypeIndex ();
|
||||
|
||||
void query_respond (from, fromlen, length);
|
||||
void forward_respond (struct sockaddr *from, int fromlen, int length);
|
||||
void request_respond (struct sockaddr *from, int fromlen, int length);
|
||||
void send_willing (struct sockaddr *from, int fromlen, ARRAY8Ptr authenticationName, ARRAY8Ptr status);
|
||||
void send_unwilling (struct sockaddr *from, int fromlen, ARRAY8Ptr authenticationName, ARRAY8Ptr status);
|
||||
void send_accept (struct sockaddr *to, int tolen, CARD32 sessionID, ARRAY8Ptr authenticationName, ARRAY8Ptr authenticationData, ARRAY8Ptr authorizationName, ARRAY8Ptr authorizationData);
|
||||
void manage (struct sockaddr *from, int fromlen, int length);
|
||||
void send_decline (struct sockaddr *to, int tolen, ARRAY8Ptr authenticationName, ARRAY8Ptr authenticationData, ARRAY8Ptr status);
|
||||
|
||||
|
||||
int xdmcpFd = -1;
|
||||
int chooserFd = -1;
|
||||
|
||||
@@ -126,7 +136,8 @@ int WellKnownSocketsMax;
|
||||
|
||||
#define pS(s) ((s) ? ((char *) (s)) : "empty string")
|
||||
|
||||
void DestroyWellKnownSockets ()
|
||||
void
|
||||
DestroyWellKnownSockets (void)
|
||||
{
|
||||
if (xdmcpFd != -1)
|
||||
{
|
||||
@@ -140,7 +151,8 @@ void DestroyWellKnownSockets ()
|
||||
}
|
||||
}
|
||||
|
||||
AnyWellKnownSockets ()
|
||||
int
|
||||
AnyWellKnownSockets (void)
|
||||
{
|
||||
return xdmcpFd != -1 || chooserFd != -1;
|
||||
}
|
||||
@@ -149,10 +161,7 @@ static XdmcpBuffer buffer;
|
||||
|
||||
/*ARGSUSED*/
|
||||
static int
|
||||
sendForward (connectionType, address, closure)
|
||||
CARD16 connectionType;
|
||||
ARRAY8Ptr address;
|
||||
char *closure;
|
||||
sendForward (CARD16 connectionType, ARRAY8Ptr address, char *closure)
|
||||
{
|
||||
#ifdef AF_INET
|
||||
struct sockaddr_in in_addr;
|
||||
@@ -193,10 +202,7 @@ extern char *NetaddrAddress();
|
||||
extern char *NetaddrPort();
|
||||
|
||||
static void
|
||||
ClientAddress (from, addr, port, type)
|
||||
struct sockaddr *from;
|
||||
ARRAY8Ptr addr, port; /* return */
|
||||
CARD16 *type; /* return */
|
||||
ClientAddress (struct sockaddr *from, ARRAY8Ptr addr, ARRAY8Ptr port, CARD16 *type)
|
||||
{
|
||||
int length, family;
|
||||
char *data;
|
||||
@@ -216,11 +222,7 @@ ClientAddress (from, addr, port, type)
|
||||
}
|
||||
|
||||
static void
|
||||
all_query_respond (from, fromlen, authenticationNames, type)
|
||||
struct sockaddr *from;
|
||||
int fromlen;
|
||||
ARRAYofARRAY8Ptr authenticationNames;
|
||||
xdmOpCode type;
|
||||
all_query_respond (struct sockaddr *from, int fromlen, ARRAYofARRAY8Ptr authenticationNames, xdmOpCode type)
|
||||
{
|
||||
ARRAY8Ptr authenticationName;
|
||||
ARRAY8 status;
|
||||
@@ -253,10 +255,7 @@ all_query_respond (from, fromlen, authenticationNames, type)
|
||||
}
|
||||
|
||||
static void
|
||||
indirect_respond (from, fromlen, length)
|
||||
struct sockaddr *from;
|
||||
int fromlen;
|
||||
int length;
|
||||
indirect_respond (struct sockaddr *from, int fromlen, int length)
|
||||
{
|
||||
ARRAYofARRAY8 queryAuthenticationNames;
|
||||
ARRAY8 clientAddress;
|
||||
@@ -308,7 +307,7 @@ indirect_respond (from, fromlen, length)
|
||||
}
|
||||
|
||||
static void
|
||||
ProcessRequestSocket ()
|
||||
ProcessRequestSocket (void)
|
||||
{
|
||||
XdmcpHeader header;
|
||||
struct sockaddr_in addr;
|
||||
@@ -360,7 +359,7 @@ ProcessRequestSocket ()
|
||||
* dtlogin changes to WaitForSomething () merged in to support command line
|
||||
* login.
|
||||
*/
|
||||
void WaitForSomething ()
|
||||
void WaitForSomething (void)
|
||||
{
|
||||
FD_TYPE reads;
|
||||
struct timeval timeout, *ptimeout;
|
||||
@@ -411,9 +410,7 @@ void WaitForSomething ()
|
||||
static ARRAY8 Hostname;
|
||||
|
||||
void
|
||||
registerHostname (name, namelen)
|
||||
char *name;
|
||||
int namelen;
|
||||
registerHostname (char *name, int namelen)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -424,11 +421,7 @@ registerHostname (name, namelen)
|
||||
}
|
||||
|
||||
static void
|
||||
direct_query_respond (from, fromlen, length, type)
|
||||
struct sockaddr *from;
|
||||
int fromlen;
|
||||
int length;
|
||||
xdmOpCode type;
|
||||
direct_query_respond (struct sockaddr *from, int fromlen, int length, xdmOpCode type)
|
||||
{
|
||||
ARRAYofARRAY8 queryAuthenticationNames;
|
||||
int expectedLen;
|
||||
@@ -444,37 +437,26 @@ direct_query_respond (from, fromlen, length, type)
|
||||
XdmcpDisposeARRAYofARRAY8 (&queryAuthenticationNames);
|
||||
}
|
||||
|
||||
query_respond (from, fromlen, length)
|
||||
struct sockaddr *from;
|
||||
int fromlen;
|
||||
int length;
|
||||
void
|
||||
query_respond (struct sockaddr *from, int fromlen, int length)
|
||||
{
|
||||
Debug ("Query respond %d\n", length);
|
||||
direct_query_respond (from, fromlen, length, QUERY);
|
||||
}
|
||||
|
||||
broadcast_respond (from, fromlen, length)
|
||||
struct sockaddr *from;
|
||||
int fromlen;
|
||||
int length;
|
||||
void
|
||||
broadcast_respond (struct sockaddr *from, int fromlen, int length)
|
||||
{
|
||||
direct_query_respond (from, fromlen, length, BROADCAST_QUERY);
|
||||
}
|
||||
|
||||
/* computes an X display name */
|
||||
|
||||
#if NeedWidePrototypes
|
||||
char *
|
||||
NetworkAddressToName(connectionType, connectionAddress, displayNumber)
|
||||
#if NeedWidePrototypes
|
||||
int connectionType;
|
||||
NetworkAddressToName(int connectionType, ARRAY8Ptr connectionAddress, int displayNumber)
|
||||
#else
|
||||
CARD16 connectionType;
|
||||
#endif
|
||||
ARRAY8Ptr connectionAddress;
|
||||
#if NeedWidePrototypes
|
||||
int displayNumber;
|
||||
#else
|
||||
CARD16 displayNumber;
|
||||
char *
|
||||
NetworkAddressToName(CARD16 connectionType, ARRAY8Ptr connectionAddress, CARD16 displayNumber)
|
||||
#endif
|
||||
{
|
||||
switch (connectionType)
|
||||
@@ -551,10 +533,8 @@ NetworkAddressToName(connectionType, connectionAddress, displayNumber)
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
forward_respond (from, fromlen, length)
|
||||
struct sockaddr *from;
|
||||
int fromlen;
|
||||
int length;
|
||||
void
|
||||
forward_respond (struct sockaddr *from, int fromlen, int length)
|
||||
{
|
||||
ARRAY8 clientAddress;
|
||||
ARRAY8 clientPort;
|
||||
@@ -660,11 +640,8 @@ badAddress:
|
||||
XdmcpDisposeARRAYofARRAY8 (&authenticationNames);
|
||||
}
|
||||
|
||||
send_willing (from, fromlen, authenticationName, status)
|
||||
struct sockaddr *from;
|
||||
int fromlen;
|
||||
ARRAY8Ptr authenticationName;
|
||||
ARRAY8Ptr status;
|
||||
void
|
||||
send_willing (struct sockaddr *from, int fromlen, ARRAY8Ptr authenticationName, ARRAY8Ptr status)
|
||||
{
|
||||
XdmcpHeader header;
|
||||
|
||||
@@ -685,11 +662,8 @@ send_willing (from, fromlen, authenticationName, status)
|
||||
XdmcpFlush (xdmcpFd, &buffer, from, fromlen);
|
||||
}
|
||||
|
||||
send_unwilling (from, fromlen, authenticationName, status)
|
||||
struct sockaddr *from;
|
||||
int fromlen;
|
||||
ARRAY8Ptr authenticationName;
|
||||
ARRAY8Ptr status;
|
||||
void
|
||||
send_unwilling (struct sockaddr *from, int fromlen, ARRAY8Ptr authenticationName, ARRAY8Ptr status)
|
||||
{
|
||||
XdmcpHeader header;
|
||||
|
||||
@@ -712,7 +686,8 @@ static unsigned long globalSessionID;
|
||||
|
||||
#define NextSessionID() (++globalSessionID)
|
||||
|
||||
void init_session_id()
|
||||
void
|
||||
init_session_id(void)
|
||||
{
|
||||
/* Set randomly so we are unlikely to reuse id's from a previous
|
||||
* incarnation so we don't say "Alive" to those displays.
|
||||
@@ -726,10 +701,8 @@ static ARRAY8 noValidAddr = { (CARD16) 16, (CARD8Ptr) "No valid address" };
|
||||
static ARRAY8 noValidAuth = { (CARD16) 22, (CARD8Ptr) "No valid authorization" };
|
||||
static ARRAY8 noAuthentic = { (CARD16) 29, (CARD8Ptr) "XDM has no authentication key" };
|
||||
|
||||
request_respond (from, fromlen, length)
|
||||
struct sockaddr *from;
|
||||
int fromlen;
|
||||
int length;
|
||||
void
|
||||
request_respond (struct sockaddr *from, int fromlen, int length)
|
||||
{
|
||||
CARD16 displayNumber;
|
||||
ARRAY16 connectionTypes;
|
||||
@@ -875,14 +848,8 @@ abort:
|
||||
XdmcpDisposeARRAY8 (&manufacturerDisplayID);
|
||||
}
|
||||
|
||||
send_accept (to, tolen, sessionID,
|
||||
authenticationName, authenticationData,
|
||||
authorizationName, authorizationData)
|
||||
struct sockaddr *to;
|
||||
int tolen;
|
||||
CARD32 sessionID;
|
||||
ARRAY8Ptr authenticationName, authenticationData;
|
||||
ARRAY8Ptr authorizationName, authorizationData;
|
||||
void
|
||||
send_accept (struct sockaddr *to, int tolen, CARD32 sessionID, ARRAY8Ptr authenticationName, ARRAY8Ptr authenticationData, ARRAY8Ptr authorizationName, ARRAY8Ptr authorizationData)
|
||||
{
|
||||
XdmcpHeader header;
|
||||
|
||||
@@ -902,12 +869,9 @@ send_accept (to, tolen, sessionID,
|
||||
XdmcpWriteARRAY8 (&buffer, authorizationData);
|
||||
XdmcpFlush (xdmcpFd, &buffer, to, tolen);
|
||||
}
|
||||
|
||||
send_decline (to, tolen, authenticationName, authenticationData, status)
|
||||
struct sockaddr *to;
|
||||
int tolen;
|
||||
ARRAY8Ptr authenticationName, authenticationData;
|
||||
ARRAY8Ptr status;
|
||||
|
||||
void
|
||||
send_decline (struct sockaddr *to, int tolen, ARRAY8Ptr authenticationName, ARRAY8Ptr authenticationData, ARRAY8Ptr status)
|
||||
{
|
||||
XdmcpHeader header;
|
||||
|
||||
@@ -925,10 +889,8 @@ send_decline (to, tolen, authenticationName, authenticationData, status)
|
||||
XdmcpFlush (xdmcpFd, &buffer, to, tolen);
|
||||
}
|
||||
|
||||
manage (from, fromlen, length)
|
||||
struct sockaddr *from;
|
||||
int fromlen;
|
||||
int length;
|
||||
void
|
||||
manage (struct sockaddr *from, int fromlen, int length)
|
||||
{
|
||||
CARD32 sessionID;
|
||||
CARD16 displayNumber;
|
||||
@@ -1079,20 +1041,15 @@ abort:
|
||||
if (class) free ((char*) class);
|
||||
}
|
||||
|
||||
void SendFailed (d, reason)
|
||||
struct display *d;
|
||||
char *reason;
|
||||
void
|
||||
SendFailed (struct display *d, char *reason)
|
||||
{
|
||||
Debug ("Display start failed, sending Failed\n");
|
||||
send_failed (d->from, d->fromlen, d->name, d->sessionID, reason);
|
||||
}
|
||||
|
||||
send_failed (from, fromlen, name, sessionID, reason)
|
||||
struct sockaddr *from;
|
||||
int fromlen;
|
||||
char *name;
|
||||
CARD32 sessionID;
|
||||
char *reason;
|
||||
void
|
||||
send_failed (struct sockaddr *from, int fromlen, char *name, CARD32 sessionID, char *reason)
|
||||
{
|
||||
static char buf[256];
|
||||
XdmcpHeader header;
|
||||
@@ -1112,10 +1069,8 @@ send_failed (from, fromlen, name, sessionID, reason)
|
||||
XdmcpFlush (xdmcpFd, &buffer, from, fromlen);
|
||||
}
|
||||
|
||||
send_refuse (from, fromlen, sessionID)
|
||||
struct sockaddr *from;
|
||||
int fromlen;
|
||||
CARD32 sessionID;
|
||||
void
|
||||
send_refuse (struct sockaddr *from, int fromlen, CARD32 sessionID)
|
||||
{
|
||||
XdmcpHeader header;
|
||||
|
||||
@@ -1128,10 +1083,8 @@ send_refuse (from, fromlen, sessionID)
|
||||
XdmcpFlush (xdmcpFd, &buffer, from, fromlen);
|
||||
}
|
||||
|
||||
send_alive (from, fromlen, length)
|
||||
struct sockaddr *from;
|
||||
int fromlen;
|
||||
int length;
|
||||
void
|
||||
send_alive (struct sockaddr *from, int fromlen, int length)
|
||||
{
|
||||
CARD32 sessionID;
|
||||
CARD16 displayNumber;
|
||||
@@ -1170,14 +1123,13 @@ send_alive (from, fromlen, length)
|
||||
}
|
||||
}
|
||||
|
||||
char *
|
||||
NetworkAddressToHostname (connectionType, connectionAddress)
|
||||
#if NeedWidePrototypes
|
||||
int connectionType;
|
||||
char *
|
||||
NetworkAddressToHostname (int connectionType, ARRAY8Ptr connectionAddress)
|
||||
#else
|
||||
CARD16 connectionType;
|
||||
char *
|
||||
NetworkAddressToHostname (CARD16 connectionType, ARRAY8Ptr connectionAddress)
|
||||
#endif
|
||||
ARRAY8Ptr connectionAddress;
|
||||
{
|
||||
char *name = 0;
|
||||
|
||||
@@ -1221,11 +1173,8 @@ NetworkAddressToHostname (connectionType, connectionAddress)
|
||||
return name;
|
||||
}
|
||||
|
||||
static
|
||||
HostnameToNetworkAddress (name, connectionType, connectionAddress)
|
||||
char *name;
|
||||
CARD16 connectionType;
|
||||
ARRAY8Ptr connectionAddress;
|
||||
static int
|
||||
HostnameToNetworkAddress (char *name, CARD16 connectionType, ARRAY8Ptr connectionAddress)
|
||||
{
|
||||
switch (connectionType)
|
||||
{
|
||||
@@ -1254,12 +1203,8 @@ ARRAY8Ptr connectionAddress;
|
||||
* the same rules as XOpenDisplay (algorithm cribbed from there)
|
||||
*/
|
||||
|
||||
static
|
||||
NameToNetworkAddress(name, connectionTypep, connectionAddress, displayNumber)
|
||||
char *name;
|
||||
CARD16Ptr connectionTypep;
|
||||
ARRAY8Ptr connectionAddress;
|
||||
CARD16Ptr displayNumber;
|
||||
static int
|
||||
NameToNetworkAddress(char *name, CARD16Ptr connectionTypep, ARRAY8Ptr connectionAddress, CARD16Ptr displayNumber)
|
||||
{
|
||||
char *colon, *display_number;
|
||||
char hostname[1024];
|
||||
@@ -1311,3 +1256,4 @@ CARD16Ptr displayNumber;
|
||||
*connectionTypep = connectionType;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user