Commit 64d51869 authored by Ulrich Sibiller's avatar Ulrich Sibiller Committed by Mike Gabriel

whitespace cleanup

empty lines and trailing whitespace
parent e5b4532a
...@@ -210,7 +210,7 @@ TRANS(ParseAddress) (char *address, char **protocol, char **host, char **port) ...@@ -210,7 +210,7 @@ TRANS(ParseAddress) (char *address, char **protocol, char **host, char **port)
strcpy (mybuf, address); strcpy (mybuf, address);
/* Parse the string to get each component */ /* Parse the string to get each component */
/* Get the protocol part */ /* Get the protocol part */
_protocol = mybuf; _protocol = mybuf;
...@@ -287,9 +287,9 @@ TRANS(ParseAddress) (char *address, char **protocol, char **host, char **port) ...@@ -287,9 +287,9 @@ TRANS(ParseAddress) (char *address, char **protocol, char **host, char **port)
} }
#if defined(IPv6) && defined(AF_INET6) #if defined(IPv6) && defined(AF_INET6)
/* hostname in IPv6 [numeric_addr]:0 form? */ /* hostname in IPv6 [numeric_addr]:0 form? */
else if ( (_host_len > 3) && else if ( (_host_len > 3) &&
((strcmp(_protocol, "tcp") == 0) || (strcmp(_protocol, "inet6") == 0)) ((strcmp(_protocol, "tcp") == 0) || (strcmp(_protocol, "inet6") == 0))
&& (*_host == '[') && (*(_host + _host_len - 1) == ']') ) { && (*_host == '[') && (*(_host + _host_len - 1) == ']') ) {
struct sockaddr_in6 sin6; struct sockaddr_in6 sin6;
*(_host + _host_len - 1) = '\0'; *(_host + _host_len - 1) = '\0';
...@@ -451,7 +451,7 @@ TRANS(Open) (int type, char *address) ...@@ -451,7 +451,7 @@ TRANS(Open) (int type, char *address)
if (ciptr == NULL) if (ciptr == NULL)
{ {
if (!(thistrans->flags & TRANS_DISABLED)) if (!(thistrans->flags & TRANS_DISABLED))
{ {
PRMSG (1,"Open: transport open failed for %s/%s:%s\n", PRMSG (1,"Open: transport open failed for %s/%s:%s\n",
protocol, host, port); protocol, host, port);
...@@ -625,7 +625,7 @@ TRANS(ReopenCLTSServer) (int trans_id, int fd, char *port) ...@@ -625,7 +625,7 @@ TRANS(ReopenCLTSServer) (int trans_id, int fd, char *port)
int int
TRANS(GetReopenInfo) (XtransConnInfo ciptr, TRANS(GetReopenInfo) (XtransConnInfo ciptr,
int *trans_id, int *fd, char **port) int *trans_id, int *fd, char **port)
{ {
...@@ -731,7 +731,7 @@ TRANS(SetOption) (XtransConnInfo ciptr, int option, int arg) ...@@ -731,7 +731,7 @@ TRANS(SetOption) (XtransConnInfo ciptr, int option, int arg)
#endif /* F_SETFD */ #endif /* F_SETFD */
break; break;
} }
return ret; return ret;
} }
...@@ -750,10 +750,10 @@ TRANS(NoListen) (char * protocol) ...@@ -750,10 +750,10 @@ TRANS(NoListen) (char * protocol)
{ {
Xtransport *trans; Xtransport *trans;
int i = 0, ret = 0; int i = 0, ret = 0;
if ((trans = TRANS(SelectTransport)(protocol)) == NULL) if ((trans = TRANS(SelectTransport)(protocol)) == NULL)
{ {
PRMSG (1,"TransNoListen: unable to find transport: %s\n", PRMSG (1,"TransNoListen: unable to find transport: %s\n",
protocol, 0, 0); protocol, 0, 0);
return -1; return -1;
...@@ -834,7 +834,7 @@ TRANS(Connect) (XtransConnInfo ciptr, char *address) ...@@ -834,7 +834,7 @@ TRANS(Connect) (XtransConnInfo ciptr, char *address)
if (protocol) free (protocol); if (protocol) free (protocol);
if (host) free (host); if (host) free (host);
if (port) free (port); if (port) free (port);
return ret; return ret;
} }
...@@ -922,7 +922,7 @@ TRANS(IsLocal) (XtransConnInfo ciptr) ...@@ -922,7 +922,7 @@ TRANS(IsLocal) (XtransConnInfo ciptr)
int int
TRANS(GetMyAddr) (XtransConnInfo ciptr, int *familyp, int *addrlenp, TRANS(GetMyAddr) (XtransConnInfo ciptr, int *familyp, int *addrlenp,
Xtransaddr **addrp) Xtransaddr **addrp)
{ {
...@@ -942,7 +942,7 @@ TRANS(GetMyAddr) (XtransConnInfo ciptr, int *familyp, int *addrlenp, ...@@ -942,7 +942,7 @@ TRANS(GetMyAddr) (XtransConnInfo ciptr, int *familyp, int *addrlenp,
} }
int int
TRANS(GetPeerAddr) (XtransConnInfo ciptr, int *familyp, int *addrlenp, TRANS(GetPeerAddr) (XtransConnInfo ciptr, int *familyp, int *addrlenp,
Xtransaddr **addrp) Xtransaddr **addrp)
{ {
...@@ -1008,7 +1008,7 @@ complete_network_count (void) ...@@ -1008,7 +1008,7 @@ complete_network_count (void)
int int
TRANS(MakeAllCOTSServerListeners) (char *port, int *partial, int *count_ret, TRANS(MakeAllCOTSServerListeners) (char *port, int *partial, int *count_ret,
XtransConnInfo **ciptrs_ret) XtransConnInfo **ciptrs_ret)
{ {
...@@ -1089,7 +1089,7 @@ TRANS(MakeAllCOTSServerListeners) (char *port, int *partial, int *count_ret, ...@@ -1089,7 +1089,7 @@ TRANS(MakeAllCOTSServerListeners) (char *port, int *partial, int *count_ret,
if (Xtransports[i].transport_id == TRANS_SOCKET_INET6_INDEX) if (Xtransports[i].transport_id == TRANS_SOCKET_INET6_INDEX)
ipv6_succ = 1; ipv6_succ = 1;
#endif #endif
PRMSG (5, PRMSG (5,
"MakeAllCOTSServerListeners: opened listener for %s, %d\n", "MakeAllCOTSServerListeners: opened listener for %s, %d\n",
trans->TransName, ciptr->fd, 0); trans->TransName, ciptr->fd, 0);
...@@ -1119,12 +1119,12 @@ TRANS(MakeAllCOTSServerListeners) (char *port, int *partial, int *count_ret, ...@@ -1119,12 +1119,12 @@ TRANS(MakeAllCOTSServerListeners) (char *port, int *partial, int *count_ret,
} }
else else
*ciptrs_ret = NULL; *ciptrs_ret = NULL;
return 0; return 0;
} }
int int
TRANS(MakeAllCLTSServerListeners) (char *port, int *partial, int *count_ret, TRANS(MakeAllCLTSServerListeners) (char *port, int *partial, int *count_ret,
XtransConnInfo **ciptrs_ret) XtransConnInfo **ciptrs_ret)
{ {
...@@ -1217,7 +1217,7 @@ TRANS(MakeAllCLTSServerListeners) (char *port, int *partial, int *count_ret, ...@@ -1217,7 +1217,7 @@ TRANS(MakeAllCLTSServerListeners) (char *port, int *partial, int *count_ret,
} }
else else
*ciptrs_ret = NULL; *ciptrs_ret = NULL;
return 0; return 0;
} }
......
...@@ -467,7 +467,7 @@ TRANS(GetPeerNetworkId)( ...@@ -467,7 +467,7 @@ TRANS(GetPeerNetworkId)(
#endif /* ICE_t */ #endif /* ICE_t */
int int
TRANS(GetHostname) ( TRANS(GetHostname) (
char * /* buf */, char * /* buf */,
int /* maxlen */ int /* maxlen */
......
...@@ -53,10 +53,10 @@ from The Open Group. ...@@ -53,10 +53,10 @@ from The Open Group.
#define _XTRANSINT_H_ #define _XTRANSINT_H_
/* /*
* XTRANSDEBUG will enable the PRMSG() macros used in the X Transport * XTRANSDEBUG will enable the PRMSG() macros used in the X Transport
* Interface code. Each use of the PRMSG macro has a level associated with * Interface code. Each use of the PRMSG macro has a level associated with
* it. XTRANSDEBUG is defined to be a level. If the invocation level is =< * it. XTRANSDEBUG is defined to be a level. If the invocation level is =<
* the value of XTRANSDEBUG, then the message will be printed out to stderr. * the value of XTRANSDEBUG, then the message will be printed out to stderr.
* Recommended levels are: * Recommended levels are:
* *
* XTRANSDEBUG=1 Error messages * XTRANSDEBUG=1 Error messages
......
...@@ -51,7 +51,7 @@ from The Open Group. ...@@ -51,7 +51,7 @@ from The Open Group.
/* /*
* *
* The connection code/ideas in lib/X and server/os for SVR4/Intel * The connection code/ideas in lib/X and server/os for SVR4/Intel
* environments was contributed by the following companies/groups: * environments was contributed by the following companies/groups:
* *
* MetroLink Inc * MetroLink Inc
...@@ -63,12 +63,12 @@ from The Open Group. ...@@ -63,12 +63,12 @@ from The Open Group.
* *
* The goal is to have common connection code among all SVR4/Intel vendors. * The goal is to have common connection code among all SVR4/Intel vendors.
* *
* ALL THE ABOVE COMPANIES DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS * ALL THE ABOVE COMPANIES DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
* IN NO EVENT SHALL THESE COMPANIES * BE LIABLE FOR ANY SPECIAL, INDIRECT * IN NO EVENT SHALL THESE COMPANIES * BE LIABLE FOR ANY SPECIAL, INDIRECT
* OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS * OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
* OR PERFORMANCE OF THIS SOFTWARE. * OR PERFORMANCE OF THIS SOFTWARE.
*/ */
...@@ -1102,7 +1102,7 @@ TRANS(ISCOpenServer)(XtransConnInfo ciptr, char *port) ...@@ -1102,7 +1102,7 @@ TRANS(ISCOpenServer)(XtransConnInfo ciptr, char *port)
PRMSG(1,"ISCOpenServer: failed to link %s to %s\n", PRMSG(1,"ISCOpenServer: failed to link %s to %s\n",
server_path, server_unix_path, 0 ); server_path, server_unix_path, 0 );
/* /*
* Don't make this failure fatal since the listener * Don't make this failure fatal since the listener
* is already established, and this just for compatability * is already established, and this just for compatability
*/ */
#else #else
...@@ -1117,7 +1117,7 @@ TRANS(ISCOpenServer)(XtransConnInfo ciptr, char *port) ...@@ -1117,7 +1117,7 @@ TRANS(ISCOpenServer)(XtransConnInfo ciptr, char *port)
PRMSG(1,"ISCOpenServer: failed to link %s to %s\n", PRMSG(1,"ISCOpenServer: failed to link %s to %s\n",
server_path, server_unix_path, 0 ); server_path, server_unix_path, 0 );
/* /*
* Don't make this failure fatal since the listener * Don't make this failure fatal since the listener
* is already established, and this just for compatability * is already established, and this just for compatability
*/ */
#endif /* SVR4 */ #endif /* SVR4 */
...@@ -2210,7 +2210,7 @@ TRANS(LocalReopenServer)(int type, int index, int fd, char *port) ...@@ -2210,7 +2210,7 @@ TRANS(LocalReopenServer)(int type, int index, int fd, char *port)
#ifdef TRANS_CLIENT #ifdef TRANS_CLIENT
static XtransConnInfo static XtransConnInfo
TRANS(LocalOpenCOTSClient)(Xtransport *thistrans, char *protocol, TRANS(LocalOpenCOTSClient)(Xtransport *thistrans, char *protocol,
char *host, char *port) char *host, char *port)
{ {
...@@ -2225,7 +2225,7 @@ TRANS(LocalOpenCOTSClient)(Xtransport *thistrans, char *protocol, ...@@ -2225,7 +2225,7 @@ TRANS(LocalOpenCOTSClient)(Xtransport *thistrans, char *protocol,
#ifdef TRANS_SERVER #ifdef TRANS_SERVER
static XtransConnInfo static XtransConnInfo
TRANS(LocalOpenCOTSServer)(Xtransport *thistrans, char *protocol, TRANS(LocalOpenCOTSServer)(Xtransport *thistrans, char *protocol,
char *host, char *port) char *host, char *port)
{ {
...@@ -2269,7 +2269,7 @@ TRANS(LocalOpenCOTSServer)(Xtransport *thistrans, char *protocol, ...@@ -2269,7 +2269,7 @@ TRANS(LocalOpenCOTSServer)(Xtransport *thistrans, char *protocol,
#ifdef TRANS_CLIENT #ifdef TRANS_CLIENT
static XtransConnInfo static XtransConnInfo
TRANS(LocalOpenCLTSClient)(Xtransport *thistrans, char *protocol, TRANS(LocalOpenCLTSClient)(Xtransport *thistrans, char *protocol,
char *host, char *port) char *host, char *port)
{ {
...@@ -2284,7 +2284,7 @@ TRANS(LocalOpenCLTSClient)(Xtransport *thistrans, char *protocol, ...@@ -2284,7 +2284,7 @@ TRANS(LocalOpenCLTSClient)(Xtransport *thistrans, char *protocol,
#ifdef TRANS_SERVER #ifdef TRANS_SERVER
static XtransConnInfo static XtransConnInfo
TRANS(LocalOpenCLTSServer)(Xtransport *thistrans, char *protocol, TRANS(LocalOpenCLTSServer)(Xtransport *thistrans, char *protocol,
char *host, char *port) char *host, char *port)
{ {
...@@ -2524,7 +2524,7 @@ TRANS(LocalCloseForCloning)(XtransConnInfo ciptr) ...@@ -2524,7 +2524,7 @@ TRANS(LocalCloseForCloning)(XtransConnInfo ciptr)
* MakeAllCOTSServerListeners() will go through the entire Xtransports[] * MakeAllCOTSServerListeners() will go through the entire Xtransports[]
* array defined in Xtrans.c and try to OpenCOTSServer() for each entry. * array defined in Xtrans.c and try to OpenCOTSServer() for each entry.
* We will add duplicate entries to that table so that the OpenCOTSServer() * We will add duplicate entries to that table so that the OpenCOTSServer()
* function will get called once for each type of local transport. * function will get called once for each type of local transport.
* *
* The TransName is in lowercase, so it will never match during a normal * The TransName is in lowercase, so it will never match during a normal
* call to SelectTransport() in Xtrans.c. * call to SelectTransport() in Xtrans.c.
......
...@@ -115,7 +115,7 @@ from the copyright holders. ...@@ -115,7 +115,7 @@ from the copyright holders.
#if defined(MOTOROLA) && defined(SYSV) #if defined(MOTOROLA) && defined(SYSV)
#define NO_TCP_H #define NO_TCP_H
#endif #endif
#ifndef NO_TCP_H #ifndef NO_TCP_H
#if defined(__osf__) || defined(linux) || defined(__GLIBC__) || defined(AIXV5) #if defined(__osf__) || defined(linux) || defined(__GLIBC__) || defined(AIXV5)
...@@ -135,11 +135,11 @@ from the copyright holders. ...@@ -135,11 +135,11 @@ from the copyright holders.
#if (defined(i386) && defined(SYSV)) && !defined(SCO325) && !defined(sun) #if (defined(i386) && defined(SYSV)) && !defined(SCO325) && !defined(sun)
#include <net/errno.h> #include <net/errno.h>
#endif #endif
#if (defined(i386) && defined(SYSV)) && (!defined(ISC) || !defined(I_NREAD) || defined(SCO325)) || defined(_SEQUENT_) #if (defined(i386) && defined(SYSV)) && (!defined(ISC) || !defined(I_NREAD) || defined(SCO325)) || defined(_SEQUENT_)
#include <sys/stropts.h> #include <sys/stropts.h>
#endif #endif
#include <unistd.h> #include <unistd.h>
...@@ -183,6 +183,7 @@ from the copyright holders. ...@@ -183,6 +183,7 @@ from the copyright holders.
#ifndef BACKLOG #ifndef BACKLOG
#define BACKLOG MIN_BACKLOG #define BACKLOG MIN_BACKLOG
#endif #endif
/* /*
* This is the Socket implementation of the X Transport service layer * This is the Socket implementation of the X Transport service layer
* *
...@@ -191,7 +192,7 @@ from the copyright holders. ...@@ -191,7 +192,7 @@ from the copyright holders.
* *
*/ */
typedef struct _Sockettrans2dev { typedef struct _Sockettrans2dev {
char *transname; char *transname;
int family; int family;
int devcotsname; int devcotsname;
...@@ -382,7 +383,7 @@ static char *_NXGetUnixDir(char *dir) ...@@ -382,7 +383,7 @@ static char *_NXGetUnixDir(char *dir)
_NXGetUnixDirError: _NXGetUnixDirError:
strcpy(_NXUnixDir, dir); strcpy(_NXUnixDir, dir);
#ifdef NX_TRANS_TEST #ifdef NX_TRANS_TEST
fprintf(stderr, "_NXGetUnixDir: Returning default X11 Unix directory [%s].\n", _NXUnixDir); fprintf(stderr, "_NXGetUnixDir: Returning default X11 Unix directory [%s].\n", _NXUnixDir);
#endif #endif
...@@ -486,7 +487,7 @@ void TRANS(SocketRejectConnection) (XtransConnInfo ciptr) ...@@ -486,7 +487,7 @@ void TRANS(SocketRejectConnection) (XtransConnInfo ciptr)
/* /*
* If there is one, close it. * If there is one, close it.
*/ */
if ((f = accept(ciptr -> fd, &sa, &sa_l)) >= 0) if ((f = accept(ciptr -> fd, &sa, &sa_l)) >= 0)
{ {
#ifdef NX_TRANS_TEST #ifdef NX_TRANS_TEST
...@@ -1100,6 +1101,7 @@ TRANS(SocketOpenCOTSClientBase) (char *transname, char *protocol, ...@@ -1100,6 +1101,7 @@ TRANS(SocketOpenCOTSClientBase) (char *transname, char *protocol,
if ((ciptr = TRANS(SocketOpen) ( if ((ciptr = TRANS(SocketOpen) (
i, Sockettrans2devtab[i].devcotsname)) != NULL) i, Sockettrans2devtab[i].devcotsname)) != NULL)
break; break;
}
} }
if (i < 0) { if (i < 0) {
if (i == -1) if (i == -1)
...@@ -1125,7 +1127,7 @@ TRANS(SocketOpenCOTSClientBase) (char *transname, char *protocol, ...@@ -1125,7 +1127,7 @@ TRANS(SocketOpenCOTSClientBase) (char *transname, char *protocol,
} }
static XtransConnInfo static XtransConnInfo
TRANS(SocketOpenCOTSClient) (Xtransport *thistrans, char *protocol, TRANS(SocketOpenCOTSClient) (Xtransport *thistrans, char *protocol,
char *host, char *port) char *host, char *port)
{ {
return TRANS(SocketOpenCOTSClientBase)( return TRANS(SocketOpenCOTSClientBase)(
...@@ -1139,7 +1141,7 @@ TRANS(SocketOpenCOTSClient) (Xtransport *thistrans, char *protocol, ...@@ -1139,7 +1141,7 @@ TRANS(SocketOpenCOTSClient) (Xtransport *thistrans, char *protocol,
#ifdef TRANS_SERVER #ifdef TRANS_SERVER
static XtransConnInfo static XtransConnInfo
TRANS(SocketOpenCOTSServer) (Xtransport *thistrans, char *protocol, TRANS(SocketOpenCOTSServer) (Xtransport *thistrans, char *protocol,
char *host, char *port) char *host, char *port)
{ {
...@@ -1206,7 +1208,7 @@ TRANS(SocketOpenCOTSServer) (Xtransport *thistrans, char *protocol, ...@@ -1206,7 +1208,7 @@ TRANS(SocketOpenCOTSServer) (Xtransport *thistrans, char *protocol,
#ifdef TRANS_CLIENT #ifdef TRANS_CLIENT
static XtransConnInfo static XtransConnInfo
TRANS(SocketOpenCLTSClient) (Xtransport *thistrans, char *protocol, TRANS(SocketOpenCLTSClient) (Xtransport *thistrans, char *protocol,
char *host, char *port) char *host, char *port)
{ {
...@@ -1274,7 +1276,7 @@ TRANS(SocketOpenCLTSClient) (Xtransport *thistrans, char *protocol, ...@@ -1274,7 +1276,7 @@ TRANS(SocketOpenCLTSClient) (Xtransport *thistrans, char *protocol,
#ifdef TRANS_SERVER #ifdef TRANS_SERVER
static XtransConnInfo static XtransConnInfo
TRANS(SocketOpenCLTSServer) (Xtransport *thistrans, char *protocol, TRANS(SocketOpenCLTSServer) (Xtransport *thistrans, char *protocol,
char *host, char *port) char *host, char *port)
{ {
...@@ -1435,7 +1437,7 @@ set_sun_path(const char *port, const char *upath, char *path, int abstract) ...@@ -1435,7 +1437,7 @@ set_sun_path(const char *port, const char *upath, char *path, int abstract)
#ifdef TRANS_SERVER #ifdef TRANS_SERVER
static int static int
TRANS(SocketCreateListener) (XtransConnInfo ciptr, TRANS(SocketCreateListener) (XtransConnInfo ciptr,
struct sockaddr *sockname, struct sockaddr *sockname,
int socknamelen, unsigned int flags) int socknamelen, unsigned int flags)
...@@ -1468,7 +1470,7 @@ TRANS(SocketCreateListener) (XtransConnInfo ciptr, ...@@ -1468,7 +1470,7 @@ TRANS(SocketCreateListener) (XtransConnInfo ciptr,
else else
return TRANS_ADDR_IN_USE; return TRANS_ADDR_IN_USE;
} }
if (retry-- == 0) { if (retry-- == 0) {
PRMSG (1, "SocketCreateListener: failed to bind listener\n", PRMSG (1, "SocketCreateListener: failed to bind listener\n",
0, 0, 0); 0, 0, 0);
...@@ -1506,7 +1508,7 @@ TRANS(SocketCreateListener) (XtransConnInfo ciptr, ...@@ -1506,7 +1508,7 @@ TRANS(SocketCreateListener) (XtransConnInfo ciptr,
close (fd); close (fd);
return TRANS_CREATE_LISTENER_FAILED; return TRANS_CREATE_LISTENER_FAILED;
} }
/* Set a flag to indicate that this connection is a listener */ /* Set a flag to indicate that this connection is a listener */
ciptr->flags = 1 | (ciptr->flags & TRANS_KEEPFLAGS); ciptr->flags = 1 | (ciptr->flags & TRANS_KEEPFLAGS);
...@@ -1541,7 +1543,7 @@ TRANS(SocketINETCreateListener) (XtransConnInfo ciptr, char *port, unsigned int ...@@ -1541,7 +1543,7 @@ TRANS(SocketINETCreateListener) (XtransConnInfo ciptr, char *port, unsigned int
#ifdef X11_t #ifdef X11_t
char portbuf[PORTBUFSIZE]; char portbuf[PORTBUFSIZE];
#endif #endif
PRMSG (2, "SocketINETCreateListener(%s)\n", port, 0, 0); PRMSG (2, "SocketINETCreateListener(%s)\n", port, 0, 0);
#ifdef X11_t #ifdef X11_t
...@@ -1582,11 +1584,11 @@ TRANS(SocketINETCreateListener) (XtransConnInfo ciptr, char *port, unsigned int ...@@ -1582,11 +1584,11 @@ TRANS(SocketINETCreateListener) (XtransConnInfo ciptr, char *port, unsigned int
else else
{ {
tmpport = strtol (port, (char**)NULL, 10); tmpport = strtol (port, (char**)NULL, 10);
/* /*
* check that somehow the port address isn't negative or in * check that somehow the port address isn't negative or in
* the range of reserved port addresses. This can happen and * the range of reserved port addresses. This can happen and
* be very bad if the server is suid-root and the user does * be very bad if the server is suid-root and the user does
* something (dumb) like `X :60049`. * something (dumb) like `X :60049`.
*/ */
if (tmpport < 1024 || tmpport > USHRT_MAX) if (tmpport < 1024 || tmpport > USHRT_MAX)
return TRANS_CREATE_LISTENER_FAILED; return TRANS_CREATE_LISTENER_FAILED;
...@@ -1776,6 +1778,7 @@ TRANS(SocketUNIXCreateListener) (XtransConnInfo ciptr, char *port, ...@@ -1776,6 +1778,7 @@ TRANS(SocketUNIXCreateListener) (XtransConnInfo ciptr, char *port,
return 0; return 0;
} }
static int static int
TRANS(SocketUNIXResetListener) (XtransConnInfo ciptr) TRANS(SocketUNIXResetListener) (XtransConnInfo ciptr)
...@@ -1907,7 +1910,7 @@ TRANS(SocketINETAccept) (XtransConnInfo ciptr, int *status) ...@@ -1907,7 +1910,7 @@ TRANS(SocketINETAccept) (XtransConnInfo ciptr, int *status)
#endif #endif
/* /*
* Get this address again because the transport may give a more * Get this address again because the transport may give a more
* specific address now that a connection is established. * specific address now that a connection is established.
*/ */
...@@ -1990,7 +1993,6 @@ TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status) ...@@ -1990,7 +1993,6 @@ TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status)
return NULL; return NULL;
} }
/* /*
* if the socket is abstract, we already modified the address to have a * if the socket is abstract, we already modified the address to have a
* @ instead of the initial NUL, so no need to do that again here. * @ instead of the initial NUL, so no need to do that again here.
...@@ -2010,7 +2012,7 @@ TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status) ...@@ -2010,7 +2012,7 @@ TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status)
*status = TRANS_ACCEPT_BAD_MALLOC; *status = TRANS_ACCEPT_BAD_MALLOC;
return NULL; return NULL;
} }
newciptr->peeraddrlen = ciptr->addrlen; newciptr->peeraddrlen = ciptr->addrlen;
memcpy (newciptr->peeraddr, ciptr->addr, newciptr->addrlen); memcpy (newciptr->peeraddr, ciptr->addr, newciptr->addrlen);
...@@ -2033,7 +2035,7 @@ TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status) ...@@ -2033,7 +2035,7 @@ TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status)
#if defined(IPv6) && defined(AF_INET6) #if defined(IPv6) && defined(AF_INET6)
struct addrlist { struct addrlist {
struct addrinfo * addr; struct addrinfo * addr;
struct addrinfo * firstaddr; struct addrinfo * firstaddr;
char port[PORTBUFSIZE]; char port[PORTBUFSIZE];
char host[MAXHOSTNAMELEN]; char host[MAXHOSTNAMELEN];
}; };
...@@ -2135,7 +2137,7 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port) ...@@ -2135,7 +2137,7 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
while (socketaddr == NULL) { while (socketaddr == NULL) {
if (addrlist->addr == NULL) { if (addrlist->addr == NULL) {
if (resetonce) { if (resetonce) {
/* Already checked entire list - no usable addresses */ /* Already checked entire list - no usable addresses */
PRMSG (1, "SocketINETConnect() no usable address " PRMSG (1, "SocketINETConnect() no usable address "
"for %s:%s\n", host, port, 0); "for %s:%s\n", host, port, 0);
...@@ -2145,7 +2147,7 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port) ...@@ -2145,7 +2147,7 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
resetonce = 1; resetonce = 1;
addrlist->addr = addrlist->firstaddr; addrlist->addr = addrlist->firstaddr;
} }
} }
socketaddr = addrlist->addr->ai_addr; socketaddr = addrlist->addr->ai_addr;
socketaddrlen = addrlist->addr->ai_addrlen; socketaddrlen = addrlist->addr->ai_addrlen;
...@@ -2155,10 +2157,10 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port) ...@@ -2155,10 +2157,10 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
PRMSG (4,"SocketINETConnect() sockname.sin_addr = %s\n", PRMSG (4,"SocketINETConnect() sockname.sin_addr = %s\n",
inet_ntop(addrlist->addr->ai_family,&sin->sin_addr, inet_ntop(addrlist->addr->ai_family,&sin->sin_addr,
ntopbuf,sizeof(ntopbuf)), 0, 0); ntopbuf,sizeof(ntopbuf)), 0, 0);
PRMSG (4,"SocketINETConnect() sockname.sin_port = %d\n", PRMSG (4,"SocketINETConnect() sockname.sin_port = %d\n",
ntohs(sin->sin_port), 0, 0); ntohs(sin->sin_port), 0, 0);
if (Sockettrans2devtab[ciptr->index].family == AF_INET6) { if (Sockettrans2devtab[ciptr->index].family == AF_INET6) {
if (strcmp(Sockettrans2devtab[ciptr->index].transname, if (strcmp(Sockettrans2devtab[ciptr->index].transname,
...@@ -2193,13 +2195,13 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port) ...@@ -2193,13 +2195,13 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
} }
} else if (addrlist->addr->ai_family == AF_INET6) { } else if (addrlist->addr->ai_family == AF_INET6) {
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) socketaddr; struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) socketaddr;
PRMSG (4,"SocketINETConnect() sockname.sin6_addr = %s\n", PRMSG (4,"SocketINETConnect() sockname.sin6_addr = %s\n",
inet_ntop(addrlist->addr->ai_family, inet_ntop(addrlist->addr->ai_family,
&sin6->sin6_addr,ntopbuf,sizeof(ntopbuf)), &sin6->sin6_addr,ntopbuf,sizeof(ntopbuf)),
0, 0); 0, 0);
PRMSG (4,"SocketINETConnect() sockname.sin6_port = %d\n", PRMSG (4,"SocketINETConnect() sockname.sin6_port = %d\n",
ntohs(sin6->sin6_port), 0, 0); ntohs(sin6->sin6_port), 0, 0);
if (Sockettrans2devtab[ciptr->index].family == AF_INET) { if (Sockettrans2devtab[ciptr->index].family == AF_INET) {
if (strcmp(Sockettrans2devtab[ciptr->index].transname, if (strcmp(Sockettrans2devtab[ciptr->index].transname,
...@@ -2237,7 +2239,7 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port) ...@@ -2237,7 +2239,7 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
if (socketaddr == NULL) { if (socketaddr == NULL) {
addrlist->addr = addrlist->addr->ai_next; addrlist->addr = addrlist->addr->ai_next;
} }
} }
} else } else
#endif #endif
{ {
...@@ -2280,8 +2282,10 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port) ...@@ -2280,8 +2282,10 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
ESET(EPROTOTYPE); ESET(EPROTOTYPE);
return TRANS_CONNECT_FAILED; return TRANS_CONNECT_FAILED;
} }
memcpy ((char *) &sockname.sin_addr, (char *) hostp->h_addr, memcpy ((char *) &sockname.sin_addr, (char *) hostp->h_addr,
sizeof (sockname.sin_addr)); sizeof (sockname.sin_addr));
} else { } else {
sockname.sin_addr.s_addr = tmpaddr; sockname.sin_addr.s_addr = tmpaddr;
} }
...@@ -2356,12 +2360,12 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port) ...@@ -2356,12 +2360,12 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
* number of errors that made us quit before, since those * number of errors that made us quit before, since those
* could be caused by trying to use an IPv6 address to contact * could be caused by trying to use an IPv6 address to contact
* a machine with an IPv4-only server or other reasons that * a machine with an IPv4-only server or other reasons that
* only affect one of a set of addresses. * only affect one of a set of addresses.
*/ */
if (olderrno == ECONNREFUSED || olderrno == EINTR if (olderrno == ECONNREFUSED || olderrno == EINTR
#if defined(IPv6) && defined(AF_INET6) #if defined(IPv6) && defined(AF_INET6)
|| (haveIPv6 && ((addrlist->addr->ai_next != NULL) || || (haveIPv6 && ((addrlist->addr->ai_next != NULL) ||
(addrlist->addr != addrlist->firstaddr)) && (addrlist->addr != addrlist->firstaddr)) &&
(olderrno == ENETUNREACH || olderrno == EAFNOSUPPORT || (olderrno == ENETUNREACH || olderrno == EAFNOSUPPORT ||
olderrno == EADDRNOTAVAIL || olderrno == ETIMEDOUT olderrno == EADDRNOTAVAIL || olderrno == ETIMEDOUT
...@@ -2379,16 +2383,16 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port) ...@@ -2379,16 +2383,16 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
PRMSG (2,"SocketINETConnect: Can't connect: errno = %d\n", PRMSG (2,"SocketINETConnect: Can't connect: errno = %d\n",
olderrno,0, 0); olderrno,0, 0);
res = TRANS_CONNECT_FAILED; res = TRANS_CONNECT_FAILED;
} }
} else { } else {
res = 0; res = 0;
/* /*
* Sync up the address fields of ciptr. * Sync up the address fields of ciptr.
*/ */
if (TRANS(SocketINETGetAddr) (ciptr) < 0) if (TRANS(SocketINETGetAddr) (ciptr) < 0)
{ {
PRMSG (1, PRMSG (1,
...@@ -2407,7 +2411,7 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port) ...@@ -2407,7 +2411,7 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
} }
#if defined(IPv6) && defined(AF_INET6) #if defined(IPv6) && defined(AF_INET6)
if (haveIPv6 && res != 0) { if (haveIPv6 && res != 0) {
addrlist->addr = addrlist->addr->ai_next; addrlist->addr = addrlist->addr->ai_next;
} }
#endif #endif
...@@ -2461,7 +2465,7 @@ UnixHostReallyLocal (char *host) ...@@ -2461,7 +2465,7 @@ UnixHostReallyLocal (char *host)
for (j = otherhostaddr; j != NULL && equiv == 0; j = j->ai_next) { for (j = otherhostaddr; j != NULL && equiv == 0; j = j->ai_next) {
if (i->ai_family == j->ai_family) { if (i->ai_family == j->ai_family) {
if (i->ai_family == AF_INET) { if (i->ai_family == AF_INET) {
struct sockaddr_in *sinA struct sockaddr_in *sinA
= (struct sockaddr_in *) i->ai_addr; = (struct sockaddr_in *) i->ai_addr;
struct sockaddr_in *sinB struct sockaddr_in *sinB
= (struct sockaddr_in *) j->ai_addr; = (struct sockaddr_in *) j->ai_addr;
...@@ -2472,9 +2476,9 @@ UnixHostReallyLocal (char *host) ...@@ -2472,9 +2476,9 @@ UnixHostReallyLocal (char *host)
equiv = 1; equiv = 1;
} }
} else if (i->ai_family == AF_INET6) { } else if (i->ai_family == AF_INET6) {
struct sockaddr_in6 *sinA struct sockaddr_in6 *sinA
= (struct sockaddr_in6 *) i->ai_addr; = (struct sockaddr_in6 *) i->ai_addr;
struct sockaddr_in6 *sinB struct sockaddr_in6 *sinB
= (struct sockaddr_in6 *) j->ai_addr; = (struct sockaddr_in6 *) j->ai_addr;
struct in6_addr *A = &sinA->sin6_addr; struct in6_addr *A = &sinA->sin6_addr;
struct in6_addr *B = &sinB->sin6_addr; struct in6_addr *B = &sinB->sin6_addr;
...@@ -2486,7 +2490,7 @@ UnixHostReallyLocal (char *host) ...@@ -2486,7 +2490,7 @@ UnixHostReallyLocal (char *host)
} }
} }
} }
freeaddrinfo(localhostaddr); freeaddrinfo(localhostaddr);
freeaddrinfo(otherhostaddr); freeaddrinfo(otherhostaddr);
return equiv; return equiv;
...@@ -2519,13 +2523,13 @@ UnixHostReallyLocal (char *host) ...@@ -2519,13 +2523,13 @@ UnixHostReallyLocal (char *host)
* from the 1st call, so we must save the address list. * from the 1st call, so we must save the address list.
*/ */
specified_local_addr_list[scount][0] = specified_local_addr_list[scount][0] =
hostp->h_addr_list[scount][0]; hostp->h_addr_list[scount][0];
specified_local_addr_list[scount][1] = specified_local_addr_list[scount][1] =
hostp->h_addr_list[scount][1]; hostp->h_addr_list[scount][1];
specified_local_addr_list[scount][2] = specified_local_addr_list[scount][2] =
hostp->h_addr_list[scount][2]; hostp->h_addr_list[scount][2];
specified_local_addr_list[scount][3] = specified_local_addr_list[scount][3] =
hostp->h_addr_list[scount][3]; hostp->h_addr_list[scount][3];
scount++; scount++;
} }
...@@ -2541,17 +2545,17 @@ UnixHostReallyLocal (char *host) ...@@ -2541,17 +2545,17 @@ UnixHostReallyLocal (char *host)
while (hostp->h_addr_list[j]) while (hostp->h_addr_list[j])
{ {
if ((specified_local_addr_list[i][0] == if ((specified_local_addr_list[i][0] ==
hostp->h_addr_list[j][0]) && hostp->h_addr_list[j][0]) &&
(specified_local_addr_list[i][1] == (specified_local_addr_list[i][1] ==
hostp->h_addr_list[j][1]) && hostp->h_addr_list[j][1]) &&
(specified_local_addr_list[i][2] == (specified_local_addr_list[i][2] ==
hostp->h_addr_list[j][2]) && hostp->h_addr_list[j][2]) &&
(specified_local_addr_list[i][3] == (specified_local_addr_list[i][3] ==
hostp->h_addr_list[j][3])) hostp->h_addr_list[j][3]))
{ {
/* They're equal, so we're done */ /* They're equal, so we're done */
equiv = 1; equiv = 1;
break; break;
} }
...@@ -2578,10 +2582,8 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port) ...@@ -2578,10 +2582,8 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port)
abstract = ciptr->transptr->flags & TRANS_ABSTRACT; abstract = ciptr->transptr->flags & TRANS_ABSTRACT;
#endif #endif
PRMSG (2,"SocketUNIXConnect(%d,%s,%s)\n", ciptr->fd, host, port); PRMSG (2,"SocketUNIXConnect(%d,%s,%s)\n", ciptr->fd, host, port);
/* /*
* Make sure 'host' is really local. If not, we return failure. * Make sure 'host' is really local. If not, we return failure.
* The reason we make this check is because a process may advertise * The reason we make this check is because a process may advertise
...@@ -2618,7 +2620,7 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port) ...@@ -2618,7 +2620,7 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port)
/* /*
* Build the socket name. * Build the socket name.
*/ */
sockname.sun_family = AF_UNIX; sockname.sun_family = AF_UNIX;
#ifdef NX_TRANS_SOCKET #ifdef NX_TRANS_SOCKET
...@@ -2669,11 +2671,11 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port) ...@@ -2669,11 +2671,11 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port)
{ {
int olderrno = errno; int olderrno = errno;
int connected = 0; int connected = 0;
if (!connected) if (!connected)
{ {
errno = olderrno; errno = olderrno;
/* /*
* If the error was ENOENT, the server may be starting up * If the error was ENOENT, the server may be starting up
* and we should try again. * and we should try again.
...@@ -2733,7 +2735,7 @@ SocketUNIXConnectPost: ...@@ -2733,7 +2735,7 @@ SocketUNIXConnectPost:
ciptr->peeraddrlen = namelen; ciptr->peeraddrlen = namelen;
memcpy (ciptr->addr, &sockname, ciptr->addrlen); memcpy (ciptr->addr, &sockname, ciptr->addrlen);
memcpy (ciptr->peeraddr, &sockname, ciptr->peeraddrlen); memcpy (ciptr->peeraddr, &sockname, ciptr->peeraddrlen);
return 0; return 0;
} }
...@@ -2779,7 +2781,7 @@ TRANS(SocketBytesReadable) (XtransConnInfo ciptr, BytesReadable_t *pend) ...@@ -2779,7 +2781,7 @@ TRANS(SocketBytesReadable) (XtransConnInfo ciptr, BytesReadable_t *pend)
* NX _XSelect(), so it is generally possible to let the client * NX _XSelect(), so it is generally possible to let the client
* yield the control to NX and let it handle the I/O on the proxy * yield the control to NX and let it handle the I/O on the proxy
* descriptors even if the application is not explicitly designed * descriptors even if the application is not explicitly designed
* to work as a NX agent. * to work as a NX agent.
*/ */
#ifdef NX_TRANS_DEBUG #ifdef NX_TRANS_DEBUG
...@@ -3002,7 +3004,7 @@ TRANS(SocketDisconnect) (XtransConnInfo ciptr) ...@@ -3002,7 +3004,7 @@ TRANS(SocketDisconnect) (XtransConnInfo ciptr)
PRMSG (2,"SocketDisconnect(%p,%d)\n", ciptr, ciptr->fd, 0); PRMSG (2,"SocketDisconnect(%p,%d)\n", ciptr, ciptr->fd, 0);
#ifdef WIN32 #ifdef WIN32
{ {
int ret = shutdown (ciptr->fd, 2); int ret = shutdown (ciptr->fd, 2);
errno = WSAGetLastError(); errno = WSAGetLastError();
return ret; return ret;
...@@ -3037,7 +3039,6 @@ TRANS(SocketINETClose) (XtransConnInfo ciptr) ...@@ -3037,7 +3039,6 @@ TRANS(SocketINETClose) (XtransConnInfo ciptr)
#ifdef UNIXCONN #ifdef UNIXCONN
static int static int
TRANS(SocketUNIXClose) (XtransConnInfo ciptr) TRANS(SocketUNIXClose) (XtransConnInfo ciptr)
{ {
/* /*
* If this is the server side, then once the socket is closed, * If this is the server side, then once the socket is closed,
...@@ -3302,7 +3303,7 @@ Xtransport TRANS(SocketLocalFuncs) = { ...@@ -3302,7 +3303,7 @@ Xtransport TRANS(SocketLocalFuncs) = {
static char* unix_nolisten[] = { "local" , NULL }; static char* unix_nolisten[] = { "local" , NULL };
# endif # endif
# endif # endif
Xtransport TRANS(SocketUNIXFuncs) = { Xtransport TRANS(SocketUNIXFuncs) = {
/* Socket Interface */ /* Socket Interface */
"unix", "unix",
......
...@@ -140,7 +140,7 @@ TRANS(ConvertAddress)(int *familyp, int *addrlenp, Xtransaddr **addrp) ...@@ -140,7 +140,7 @@ TRANS(ConvertAddress)(int *familyp, int *addrlenp, Xtransaddr **addrp)
{ {
*familyp=FamilyLocal; *familyp=FamilyLocal;
} }
else else
{ {
*familyp=FamilyInternet; *familyp=FamilyInternet;
*addrlenp = sizeof (struct in_addr); *addrlenp = sizeof (struct in_addr);
...@@ -165,7 +165,7 @@ TRANS(ConvertAddress)(int *familyp, int *addrlenp, Xtransaddr **addrp) ...@@ -165,7 +165,7 @@ TRANS(ConvertAddress)(int *familyp, int *addrlenp, Xtransaddr **addrp)
*familyp=FamilyLocal; *familyp=FamilyLocal;
break; break;
} }
#endif /* defined(UNIXCONN) || defined(LOCALCONN)*/ #endif /* defined(UNIXCONN) || defined(LOCALCONN) */
#if (defined(__SCO__) || defined(__UNIXWARE__)) && defined(LOCALCONN) #if (defined(__SCO__) || defined(__UNIXWARE__)) && defined(LOCALCONN)
case 0: case 0:
...@@ -188,7 +188,7 @@ TRANS(ConvertAddress)(int *familyp, int *addrlenp, Xtransaddr **addrp) ...@@ -188,7 +188,7 @@ TRANS(ConvertAddress)(int *familyp, int *addrlenp, Xtransaddr **addrp)
* In the case of a local connection, we need to get the * In the case of a local connection, we need to get the
* host name for authentication. * host name for authentication.
*/ */
char hostnamebuf[256]; char hostnamebuf[256];
int len = TRANS(GetHostname) (hostnamebuf, sizeof hostnamebuf); int len = TRANS(GetHostname) (hostnamebuf, sizeof hostnamebuf);
...@@ -377,7 +377,7 @@ TRANS(GetPeerNetworkId) (XtransConnInfo ciptr) ...@@ -377,7 +377,7 @@ TRANS(GetPeerNetworkId) (XtransConnInfo ciptr)
* Assume that if it does not respond in NAMESERVER_TIMEOUT seconds * Assume that if it does not respond in NAMESERVER_TIMEOUT seconds
* that something is wrong and do not make the user wait. * that something is wrong and do not make the user wait.
* gethostbyaddr will continue after a signal, so we have to * gethostbyaddr will continue after a signal, so we have to
* jump out of it. * jump out of it.
*/ */
nameserver_timedout = 0; nameserver_timedout = 0;
...@@ -469,7 +469,7 @@ is_numeric (char *str) ...@@ -469,7 +469,7 @@ is_numeric (char *str)
* it's not save if the directory has non-root ownership or the sticky * it's not save if the directory has non-root ownership or the sticky
* bit cannot be set and fail. * bit cannot be set and fail.
*/ */
static int static int
trans_mkdir(char *path, int mode) trans_mkdir(char *path, int mode)
{ {
struct stat buf; struct stat buf;
...@@ -492,7 +492,7 @@ trans_mkdir(char *path, int mode) ...@@ -492,7 +492,7 @@ trans_mkdir(char *path, int mode)
if (mode & 01000) { if (mode & 01000) {
PRMSG(1, "mkdir: ERROR: euid != 0," PRMSG(1, "mkdir: ERROR: euid != 0,"
"directory %s will not be created.\n", "directory %s will not be created.\n",
path, 0, 0); path, 0, 0);
#ifdef FAIL_HARD #ifdef FAIL_HARD
return -1; return -1;
#endif #endif
...@@ -522,7 +522,7 @@ trans_mkdir(char *path, int mode) ...@@ -522,7 +522,7 @@ trans_mkdir(char *path, int mode)
} }
return 0; return 0;
} else { } else {
if (S_ISDIR(buf.st_mode)) { if (S_ISDIR(buf.st_mode)) {
int updateOwner = 0; int updateOwner = 0;
...@@ -541,7 +541,7 @@ trans_mkdir(char *path, int mode) ...@@ -541,7 +541,7 @@ trans_mkdir(char *path, int mode)
*/ */
if ((~mode) & 0077 & buf.st_mode) if ((~mode) & 0077 & buf.st_mode)
updateMode = 1; updateMode = 1;
/* /*
* If the directory is not writeable not everybody may * If the directory is not writeable not everybody may
* be able to create sockets. Therefore warn if mode * be able to create sockets. Therefore warn if mode
...@@ -551,7 +551,7 @@ trans_mkdir(char *path, int mode) ...@@ -551,7 +551,7 @@ trans_mkdir(char *path, int mode)
updateMode = 1; updateMode = 1;
status |= WARN_NO_ACCESS; status |= WARN_NO_ACCESS;
} }
/* /*
* If 'sticky' bit is requested fail if owner isn't root * If 'sticky' bit is requested fail if owner isn't root
* as we assume the caller makes certain security implications * as we assume the caller makes certain security implications
...@@ -563,7 +563,7 @@ trans_mkdir(char *path, int mode) ...@@ -563,7 +563,7 @@ trans_mkdir(char *path, int mode)
updateMode = 1; updateMode = 1;
} }
} }
#ifdef HAS_FCHOWN #ifdef HAS_FCHOWN
/* /*
* If fchown(2) and fchmod(2) are available, try to correct the * If fchown(2) and fchmod(2) are available, try to correct the
...@@ -598,7 +598,7 @@ trans_mkdir(char *path, int mode) ...@@ -598,7 +598,7 @@ trans_mkdir(char *path, int mode)
} }
} }
#endif #endif
if (updateOwner && !updatedOwner) { if (updateOwner && !updatedOwner) {
#ifdef FAIL_HARD #ifdef FAIL_HARD
if (status & FAIL_IF_NOT_ROOT) { if (status & FAIL_IF_NOT_ROOT) {
...@@ -610,7 +610,7 @@ trans_mkdir(char *path, int mode) ...@@ -610,7 +610,7 @@ trans_mkdir(char *path, int mode)
PRMSG(1, "mkdir: Owner of %s should be set to root\n", PRMSG(1, "mkdir: Owner of %s should be set to root\n",
path, 0, 0); path, 0, 0);
} }
if (updateMode && !updatedMode) { if (updateMode && !updatedMode) {
#ifdef FAIL_HARD #ifdef FAIL_HARD
if (status & FAIL_IF_NOMODE) { if (status & FAIL_IF_NOMODE) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment