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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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