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