1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

dtlogin: start to resolve static analysis warnings

Also convert some K&R function declarations to ansi
This commit is contained in:
Peter Howkins 2014-12-23 17:49:11 +00:00
parent 29294e0373
commit e54c164fe1
13 changed files with 215 additions and 317 deletions

View file

@ -199,9 +199,7 @@ static struct AuthProtocol AuthProtocols[] = {
#define NUM_AUTHORIZATION (sizeof (AuthProtocols) / sizeof (AuthProtocols[0]))
static struct AuthProtocol *
findProtocol (name_length, name)
unsigned short name_length;
char *name;
findProtocol (unsigned short name_length, const char *name)
{
int i;
@ -214,13 +212,14 @@ findProtocol (name_length, name)
return (struct AuthProtocol *) 0;
}
ValidAuthorization (name_length, name)
#if NeedWidePrototypes
unsigned int name_length;
int
ValidAuthorization (unsigned int name_length, char *name)
#else
unsigned short name_length;
int
ValidAuthorization (unsigned short name_length, char *name)
#endif /* NeedWidePrototypes */
char *name;
{
if (findProtocol (name_length, name))
return TRUE;
@ -228,9 +227,7 @@ ValidAuthorization (name_length, name)
}
static Xauth *
GenerateAuthorization (name_length, name)
unsigned short name_length;
char *name;
GenerateAuthorization (unsigned short name_length, char *name)
{
struct AuthProtocol *a;
Xauth *auth = 0;
@ -266,16 +263,13 @@ char *name;
return auth;
}
void
SetProtoDisplayAuthorization (pdpy,
authorizationNameLen, authorizationName)
struct protoDisplay *pdpy;
#if NeedWidePrototypes
unsigned int authorizationNameLen;
void
SetProtoDisplayAuthorization (struct protoDisplay *pdpy, unsigned int authorizationNameLen, char *authorizationName)
#else
unsigned short authorizationNameLen;
void
SetProtoDisplayAuthorization (struct protoDisplay *pdpy, unsigned short authorizationNameLen, char *authorizationName)
#endif /* NeedWidePrototypes */
char *authorizationName;
{
struct AuthProtocol *a;
Xauth *auth;
@ -310,9 +304,7 @@ SetProtoDisplayAuthorization (pdpy,
}
void
CleanUpFileName (src, dst, len)
char *src, *dst;
int len;
CleanUpFileName (char *src, char *dst, int len)
{
while (*src) {
if (--len <= 0)
@ -336,9 +328,8 @@ CleanUpFileName (src, dst, len)
static char authdir1[] = "authdir";
static char authdir2[] = "authfiles";
static
MakeServerAuthFile (d)
struct display *d;
static int
MakeServerAuthFile (struct display *d)
{
int len;
#ifdef SYSV
@ -397,10 +388,8 @@ MakeServerAuthFile (d)
return TRUE;
}
SaveServerAuthorizations (d, auths, count)
struct display *d;
Xauth **auths;
int count;
int
SaveServerAuthorizations (struct display *d, Xauth **auths, int count)
{
FILE *auth_file;
int mask;
@ -450,8 +439,7 @@ SaveServerAuthorizations (d, auths, count)
}
void
SetLocalAuthorization (d)
struct display *d;
SetLocalAuthorization (struct display *d)
{
Xauth *auth, **auths;
int i, j;
@ -509,8 +497,7 @@ SetLocalAuthorization (d)
* to allow root in. This is bogus and should be fixed.
*/
void
SetAuthorization (d)
struct display *d;
SetAuthorization (struct display *d)
{
register Xauth **auth = d->authorizations;
int i;
@ -528,10 +515,8 @@ SetAuthorization (d)
}
}
static
openFiles (name, new_name, oldp, newp)
char *name, *new_name;
FILE **oldp, **newp;
static int
openFiles (char *name, char *new_name, FILE **oldp, FILE **newp)
{
int mask;
int null_data = 0;
@ -563,10 +548,8 @@ FILE **oldp, **newp;
return 1;
}
static
binaryEqual (a, b, len)
char *a, *b;
unsigned short len;
int
binaryEqual (char *a, char *b, unsigned short len)
{
while (len-- > 0)
if (*a++ != *b++)
@ -574,10 +557,8 @@ unsigned short len;
return 1;
}
static
dumpBytes (len, data)
unsigned short len;
char *data;
int
dumpBytes (unsigned short len, char *data)
{
unsigned short i;
@ -587,9 +568,8 @@ char *data;
Debug ("\n");
}
static
dumpAuth (auth)
Xauth *auth;
static void
dumpAuth (Xauth *auth)
{
Debug ("family: %d\n", auth->family);
Debug ("addr: ");
@ -615,14 +595,14 @@ struct addrList {
static struct addrList *addrs;
static
initAddrs ()
static void
initAddrs (void)
{
addrs = 0;
}
static
doneAddrs ()
static void
doneAddrs (void)
{
struct addrList *a, *n;
for (a = addrs; a; a = n) {
@ -635,11 +615,10 @@ doneAddrs ()
}
}
static checkEntry ();
static int checkEntry (Xauth *auth);
static void
saveEntry (auth)
Xauth *auth;
saveEntry (Xauth *auth)
{
struct addrList *new;
@ -690,9 +669,8 @@ saveEntry (auth)
addrs = new;
}
static
checkEntry (auth)
Xauth *auth;
static int
checkEntry (Xauth *auth)
{
struct addrList *a;
@ -734,13 +712,8 @@ writeAuth (file, auth)
return 1;
}
static
writeAddr (family, addr_length, addr, file, auth)
int family;
int addr_length;
char *addr;
FILE *file;
Xauth *auth;
static void
writeAddr (int family, int addr_length, char *addr, FILE *file, Xauth *auth)
{
auth->family = (unsigned short) family;
auth->address_length = addr_length;
@ -750,10 +723,8 @@ writeAddr (family, addr_length, addr, file, auth)
saveEntry (auth);
}
static
DefineLocal (file, auth)
FILE *file;
Xauth *auth;
static void
DefineLocal (FILE *file, Xauth *auth)
{
char displayname[100];
@ -804,10 +775,7 @@ DefineLocal (file, auth)
#ifdef USL
/* Deal with different SIOCGIFCONF ioctl semantics on UnixWare */
static int
ifioctl (fd, cmd, arg)
int fd;
int cmd;
char *arg;
ifioctl (int fd, int cmd, char *arg)
{
struct strioctl ioc;
int ret;
@ -846,11 +814,8 @@ ifioctl (fd, cmd, arg)
#include <netinet/in.h>
#include <netinet/in_var.h>
static
DefineSelf (fd, file, auth)
int fd;
FILE *file;
Xauth *auth;
static void
DefineSelf (int fd, FILE *file, Xauth *auth)
{
/*
* The Wolongong drivers used by NCR SVR4/MP-RAS don't understand the
@ -922,7 +887,7 @@ DefineSelf (fd, file, auth)
/* Define this host for access control. Find all the hosts the OS knows about
* for this fd and add them to the selfhosts list.
*/
static
static void
#ifdef __osf__
DefineSelf (fd, file, auth, addr_family)
#else
@ -1026,7 +991,7 @@ DefineSelf (fd, file, auth)
/* Define this host for access control. Find all the hosts the OS knows about
* for this fd and add them to the selfhosts list.
*/
static
static void
DefineSelf (fd, file, auth)
int fd;
{
@ -1070,7 +1035,7 @@ DefineSelf (fd, file, auth)
#endif /* WINTCP */
static
static void
setAuthNumber (auth, name)
Xauth *auth;
char *name;
@ -1101,11 +1066,8 @@ setAuthNumber (auth, name)
}
}
static
writeLocalAuth (file, auth, name)
FILE *file;
Xauth *auth;
char *name;
static void
writeLocalAuth (FILE *file, Xauth *auth, char *name)
{
int fd;
@ -1134,12 +1096,7 @@ writeLocalAuth (file, auth, name)
#ifdef XDMCP
static void
writeRemoteAuth (file, auth, peer, peerlen, name)
FILE *file;
Xauth *auth;
XdmcpNetaddr peer;
int peerlen;
char *name;
writeRemoteAuth (FILE *file, Xauth *auth, XdmcpNetaddr peer, int peerlen, char *name)
{
int family = FamilyLocal;
char *addr;
@ -1165,9 +1122,7 @@ writeRemoteAuth (file, auth, peer, peerlen, name)
#endif /* XDMCP */
void
SetUserAuthorization (d, verify)
struct display *d;
struct verify_info *verify;
SetUserAuthorization (struct display *d, struct verify_info *verify)
{
FILE *old, *new;
char home_name[1024], backup_name[1024], new_name[1024];
@ -1341,9 +1296,7 @@ SetUserAuthorization (d, verify)
}
void
RemoveUserAuthorization (d, verify)
struct display *d;
struct verify_info *verify;
RemoveUserAuthorization (struct display *d, struct verify_info *verify)
{
char *home;
Xauth **auths, *entry;

View file

@ -68,11 +68,10 @@
# include <ctype.h>
# include <errno.h>
char *
Print8Address (ARRAY8Ptr Address);
static char *Print8Address (ARRAY8Ptr Address);
static
static int
FormatBytes (
unsigned char *data,
int length,
@ -93,7 +92,7 @@ FormatBytes (
return 1;
}
static
static int
FormatARRAY8 (
ARRAY8Ptr a,
char *buf,
@ -110,6 +109,7 @@ typedef struct _IndirectUsers {
static IndirectUsersPtr indirectUsers;
int
RememberIndirectClient (
ARRAY8Ptr clientAddress,
CARD16 connectionType)
@ -132,6 +132,7 @@ RememberIndirectClient (
return 1;
}
void
ForgetIndirectClient (
ARRAY8Ptr clientAddress,
CARD16 connectionType)
@ -156,6 +157,7 @@ ForgetIndirectClient (
}
}
int
IsIndirectClient (
ARRAY8Ptr clientAddress,
CARD16 connectionType)
@ -171,7 +173,7 @@ IsIndirectClient (
extern char *NetaddrPort();
static
static int
FormatChooserArgument (
char *buf,
int len)
@ -323,7 +325,7 @@ RegisterIndirectChoice (
}
#ifdef notdef
static
static void
RemoveIndirectChoice (clientAddress, connectionType)
ARRAY8Ptr clientAddress;
CARD16 connectionType;
@ -372,6 +374,7 @@ AddChooserHost (
}
}
int
ProcessChooserSocket (
int fd)
{
@ -424,7 +427,8 @@ ProcessChooserSocket (
close (client_fd);
}
RunChooser (
void
RunChooser (
struct display *d)
{
char **args, **parseArgs(), **systemEnv();
@ -479,7 +483,7 @@ ProcessChooserSocket (
exit (REMANAGE_DISPLAY);
}
char *
static char *
Print8Address (
ARRAY8Ptr Address)
{

View file

@ -160,6 +160,8 @@ static struct _app_resources {
int connectionType;
} app_resources;
static int FromHex (char *s, char *d, int len);
#define offset(field) XtOffsetOf(struct _app_resources, field)
#define XtRARRAY8 "ARRAY8"
@ -213,9 +215,7 @@ static XdmcpBuffer buffer;
/* ARGSUSED */
static void
PingHosts (closure, id)
XtPointer closure;
XtIntervalId *id;
PingHosts (XtPointer closure, XtIntervalId *id)
{
HostAddr *hosts;
@ -233,19 +233,19 @@ PingHosts (closure, id)
char **NameTable;
int NameTableSize;
static int
HostnameCompare (a, b)
#if defined(__STDC__)
const void *a, *b;
static int
HostnameCompare (const void *a, const void *b)
#else
char *a, *b;
static int
HostnameCompare (char *a, char *b)
#endif
{
return strcmp (*(char **)a, *(char **)b);
}
static void
RebuildTable (size)
RebuildTable (int size)
{
char **newTable = 0;
HostName *names;
@ -296,8 +296,7 @@ RebuildTable (size)
}
static void
RebuildTableAdd (size)
int size;
RebuildTableAdd (int size)
{
char **newTable = 0;
HostName *names;
@ -336,10 +335,7 @@ RebuildTableAdd (size)
static int
AddHostname (hostname, status, addr, willing)
ARRAY8Ptr hostname, status;
struct sockaddr *addr;
int willing;
AddHostname (ARRAY8Ptr hostname, ARRAY8Ptr status, struct sockaddr *addr, int willing)
{
HostName *new, **names, *name;
ARRAY8 hostAddr;
@ -445,9 +441,8 @@ AddHostname (hostname, status, addr, willing)
return 1;
}
static
DisposeHostname (host)
HostName *host;
static void
DisposeHostname (HostName *host)
{
XdmcpDisposeARRAY8 (&host->hostname);
XdmcpDisposeARRAY8 (&host->hostaddr);
@ -456,9 +451,8 @@ DisposeHostname (host)
free ((char *) host);
}
static
RemoveHostname (host)
HostName *host;
static int
RemoveHostname (HostName *host)
{
HostName **prev, *hosts;
@ -475,10 +469,12 @@ RemoveHostname (host)
DisposeHostname (host);
NameTableSize--;
RebuildTable (NameTableSize);
return 1;
}
static
EmptyHostnames ()
static void
EmptyHostnames (void)
{
HostName *hosts, *next;
@ -494,10 +490,7 @@ EmptyHostnames ()
/* ARGSUSED */
static void
ReceivePacket (closure, source, id)
XtPointer closure;
int *source;
XtInputId *id;
ReceivePacket (XtPointer closure, int *source, XtInputId *id)
{
XdmcpHeader header;
ARRAY8 authenticationName;
@ -554,10 +547,8 @@ ReceivePacket (closure, source, id)
}
}
RegisterHostaddr (addr, len, type)
struct sockaddr *addr;
int len;
xdmOpCode type;
int
RegisterHostaddr (struct sockaddr *addr, int len, xdmOpCode type)
{
HostAddr *host, **prev;
@ -577,6 +568,7 @@ RegisterHostaddr (addr, len, type)
;
*prev = host;
host->next = NULL;
return 1;
}
/*
@ -585,9 +577,8 @@ RegisterHostaddr (addr, len, type)
* The special name "BROADCAST" looks up all the broadcast
* addresses on the local host.
*/
RegisterHostname (name)
char *name;
int
RegisterHostname (char *name)
{
struct hostent *hostent;
struct sockaddr_in in_addr;
@ -678,13 +669,13 @@ RegisterHostname (name)
RegisterHostaddr ((struct sockaddr *)&in_addr, sizeof (in_addr),
QUERY);
}
return 1;
}
static ARRAYofARRAY8 AuthenticationNames;
RegisterAuthenticationName (name, namelen)
char *name;
int namelen;
static int
RegisterAuthenticationName (char *name, int namelen)
{
ARRAY8Ptr authName;
if (!XdmcpReallocARRAYofARRAY8 (&AuthenticationNames,
@ -694,10 +685,12 @@ RegisterAuthenticationName (name, namelen)
if (!XdmcpAllocARRAY8 (authName, namelen))
return 0;
memmove( authName->data, name, namelen);
return 1;
}
InitXDMCP (argv)
char **argv;
int
InitXDMCP (char **argv)
{
int soopts = 1;
XdmcpHeader header;
@ -740,8 +733,7 @@ InitXDMCP (argv)
}
void
Choose (h)
HostName *h;
Choose (HostName *h)
{
if (app_resources.xdmAddress)
{
@ -801,11 +793,7 @@ Choose (h)
/* ARGSUSED */
void
DoAccept (w, event, params, num_params)
Widget w;
XEvent *event;
String *params;
Cardinal *num_params;
DoAccept (Widget w, XEvent *event, String *params, Cardinal *num_params)
{
HostName *h;
XmStringTable selectedItem;
@ -846,11 +834,7 @@ DoAccept (w, event, params, num_params)
/* ARGSUSED */
static void
DoCheckWilling (w, event, params, num_params)
Widget w;
XEvent *event;
String *params;
Cardinal *num_params;
DoCheckWilling (Widget w, XEvent *event, String *params, Cardinal *num_params)
{
HostName *h;
XmStringTable selectedItem;
@ -889,22 +873,14 @@ DoCheckWilling (w, event, params, num_params)
/* ARGSUSED */
void
DoCancel (w, event, params, num_params)
Widget w;
XEvent *event;
String *params;
Cardinal *num_params;
DoCancel (Widget w, XEvent *event, String *params, Cardinal *num_params)
{
exit (OBEYSESS_DISPLAY);
}
/* ARGSUSED */
void
DoPing (w, event, params, num_params)
Widget w;
XEvent *event;
String *params;
Cardinal *num_params;
DoPing (Widget w, XEvent *event, String *params, Cardinal *num_params)
{
EmptyHostnames ();
pingTry = 0;
@ -918,8 +894,8 @@ static XtActionsRec app_actions[] = {
"Ping", DoPing,
};
main (argc, argv)
char **argv;
int
main (int argc, char **argv)
{
Arg position[3];
Dimension width, height;
@ -1018,17 +994,15 @@ XtPopup(login_shell, XtGrabNone);
#endif
InitXDMCP (argv + 1);
XtMainLoop ();
exit(0);
/*NOTREACHED*/
return 0;
}
/* Converts the hex string s of length len into the byte array d.
Returns 0 if s was a legal hex string, 1 otherwise.
*/
int
FromHex (s, d, len)
char *s, *d;
int len;
static int
FromHex (char *s, char *d, int len)
{
int t;
int ret = len&1; /* odd-length hex strings are illegal */
@ -1052,11 +1026,7 @@ FromHex (s, d, len)
/*ARGSUSED*/
static void
CvtStringToARRAY8 (args, num_args, fromVal, toVal)
XrmValuePtr args;
Cardinal *num_args;
XrmValuePtr fromVal;
XrmValuePtr toVal;
CvtStringToARRAY8 (XrmValuePtr args, Cardinal *num_args, XrmValuePtr fromVal, XrmValuePtr toVal)
{
static ARRAY8Ptr dest;
char *s;

View file

@ -371,6 +371,7 @@ ScanServers( void )
{
ParseDisplay (servers, acceptableTypes, NumTypes, &puser);
}
return 1;
}
static void
@ -1204,6 +1205,7 @@ StartDisplay(
d->status = running;
break;
}
return 1;
}
static void
@ -1484,6 +1486,7 @@ SetTitle( char *name, char *ptr )
free(p);
#endif
return 1;
}

View file

@ -213,6 +213,12 @@ TrimErrorFile( void )
(f2 = open(errorLogFile, O_RDWR)) < 0 ) {
Debug("TrimErrorLog(): Cannot open file %s, error number = %d\n",
errorLogFile, errno);
if(f1 >= 0) {
close(f1);
}
if(f2 >= 0) {
close(f2);
}
return;
}
@ -225,6 +231,8 @@ TrimErrorFile( void )
if ( (status = lseek(f2, deleteBytes, SEEK_SET)) < 0 ) {
Debug("TrimErrorLog(): Cannot lseek() in file %s, error number = %d\n",
errorLogFile, errno);
close(f1);
close(f2);
return;
}

View file

@ -372,6 +372,8 @@ ParseDisplay( char *source,
freeSomeArgs (args, argv - args);
return 1;
}
static struct displayMatch {

View file

@ -58,7 +58,7 @@ static int PathInZList(char *path, char *fplist, int listlen);
static int SeparateParts( char **path );
static
static void
DebugFontPath(char *note, char **path, int nelems)
{
int i;
@ -182,6 +182,8 @@ ApplyFontPathMods( struct display *d, Display *dpy )
if (fph) free(fph);
if (fpt) free(fpt);
XFreeFontPath(fontPath);
return 1;
}
/* ___________________________________________________________________

View file

@ -164,8 +164,8 @@ longtochars (l, c)
c[3] = l & 0xff;
}
static
InitXdmcpWrapper ()
static void
InitXdmcpWrapper (void)
{
long sum[2];
unsigned char tmpkey[8];
@ -194,25 +194,22 @@ InitXdmcpWrapper ()
static unsigned long int next = 1;
static int
xdm_rand()
xdm_rand(void)
{
next = next * 1103515245 + 12345;
return (unsigned int)(next/65536) % 32768;
}
static void
xdm_srand(seed)
unsigned int seed;
xdm_srand(unsigned int seed)
{
next = seed;
}
#endif /* no HASXDMAUTH */
#ifdef USE_ENCRYPT
static
bitsToBytes (bits, bytes)
unsigned long bits[2];
char bytes[64];
static void
bitsToBytes (unsigned long bits[2], char bytes[64])
{
int bit, byte;
int i;
@ -233,7 +230,8 @@ char bytes[64];
#if defined(linux) || defined(CSRG_BASED) || defined(sun)
#define READ_LIMIT (sizeof (long) * 2)
static sumFile (char *name, long sum[2])
static int
sumFile (char *name, long sum[2])
{
long buf[2];
int fd;
@ -272,10 +270,8 @@ static sumFile (char *name, long sum[2])
#else /* linux || CSRG_BASED */
static
sumFile (name, sum)
char *name;
long sum[2];
static int
sumFile (char *name, long sum[2])
{
long buf[1024*2];
int cnt;
@ -311,9 +307,8 @@ long sum[2];
}
#endif /* linux || CSRG_BASED */
GenerateAuthData (auth, len)
char *auth;
int len;
void
GenerateAuthData (char *auth, int len)
{
long ldata[2];

View file

@ -164,4 +164,6 @@ DisposeProtoDisplay( struct protoDisplay *pdpy )
XauDisposeAuth (pdpy->xdmcpAuthorization);
free ((char *) pdpy->address);
free ((char *) pdpy);
return 1;
}

View file

@ -49,8 +49,8 @@ char * qualifyWithFirst
char * searchPath
)
{
char * paths = strdup(searchPath);
char * savepaths = paths;
char * paths = NULL;
char * savepaths = NULL;
char * path;
char * chance;
FILE * f;
@ -60,6 +60,9 @@ FILE * f;
if (filename == NULL || searchPath == NULL)
return NULL;
paths = strdup(searchPath);
savepaths = paths;
while (1) {
/* if there is a :, zero it */

View file

@ -480,6 +480,8 @@ GetResource( char *name, char *class, int valueType, char **valuep,
break;
}
return 1;
}
XrmOptionDescRec configTable [] = {
@ -863,9 +865,14 @@ char * newname;
strncpy(newname, tempName, tempLen);
strcpy(newname+tempLen, name);
free (langString);
free (tempName);
return(newname);
}
}
default:
/* special is of an unknown value */
return(NULL);
}
}

View file

@ -693,8 +693,7 @@ LoadXloginResources( struct display *d )
*p = '_';
}
if ( strlen(language) > 0 )
free(language);
free(language);
Debug("LoadXloginResources - loading resource db from %s\n", resources);
@ -1761,6 +1760,7 @@ AbortClient( int pid )
signal (SIGALRM, SIG_DFL);
sig = SIGKILL;
}
return 1;
}
int
@ -1797,6 +1797,7 @@ source( struct verify_info *verify, char *file )
return 0;
}
/* returns 0 on failure, -1 on out of mem, and 1 on success */
int
execute(char **argv, char **environ )
{
@ -1877,6 +1878,8 @@ execute(char **argv, char **environ )
;
session_execve (newargv[0], newargv, environ);
}
return 1;
}

View file

@ -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;
}