Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Oct 2000 17:03:22 +0200 (CEST)
From:      Andre Albsmeier <andre.albsmeier@mchp.siemens.de>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   ports/21957: [PATCH] optionally do not open TCP port in xfstt
Message-ID:  <200010131503.e9DF3Mk48055@curry.mchp.siemens.de>

next in thread | raw e-mail | index | archive | help

>Number:         21957
>Category:       ports
>Synopsis:       [PATCH] optionally do not open TCP port in xfstt
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Oct 13 08:10:01 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Andre Albsmeier
>Release:        FreeBSD 4.1.1-STABLE i386
>Organization:
>Environment:

All systems using the xfstt port

>Description:

When using xfstt there is always a TCP port created to serve
clients. When running xfstt only to serve the localhost you
don't need (and probably don't want) this since it communicates
perfectly over unix domain sockets.

>How-To-Repeat:

run xfstt and then "netstat -a -f inet" and find the line
with port 7101

>Fix:

The path below adds an option --notcp. I haven't updated the
manpage (only the --help output) but can do so if desired.

It fits perfectly in x11-servers/Xfstt/files/patch-ae

Note: I have sent this suggestion to sjc@debian.org who is
listed as being responsible for xfstt in the distfile. I have
also sent it to the maintainer but both didn't respond. Anyway,
I have now made this PR since others might be interested in it
or even someone likes to commit it to the ports tree.


--- xfstt.cpp.ORI	Tue Sep 26 15:57:32 2000
+++ xfstt.cpp	Tue Sep 26 16:26:22 2000
@@ -73,6 +73,7 @@
 char* fontdir = TTFONTDIR;
 char* cachedir = TTCACHEDIR;
 int defaultres = 0;
+int NoTCP = 0;
 
 uid_t newuid = (uid_t)(-2);
 gid_t newgid = (uid_t)(-2);
@@ -95,6 +96,7 @@
 	printf( "\t--sync     put ttf-fonts in \"%s\" in database\n", fontdir);
 	printf( "\t--gslist   print ghostscript style ttf fontlist\n ");
 	printf( "\t--port     change port number from default 7101\n");
+	printf( "\t--notcp    don't open TCP socket, use unix domain only\n");
 	printf( "\t--dir      use other font directory than "TTFONTDIR"\n");
 	printf( "\t--cache    use other font cache directory than "TTCACHEDIR"\n");
 	printf( "\t--res      force default resolution to this value\n");
@@ -654,7 +656,7 @@
 		listen( sd_unix, 1);	// only one connection
 	}
 
-	if( !sd_inet) {
+	if( !NoTCP && !sd_inet) {
 		// prepare inet connection
 		sd_inet = socket( PF_INET, SOCK_STREAM, IPPROTO_TCP);
 
@@ -670,7 +672,8 @@
 	fd_set sdlist;
 	FD_ZERO( &sdlist);
 	FD_SET( sd_unix, &sdlist);
-	FD_SET( sd_inet, &sdlist);
+	if( !NoTCP )
+		FD_SET( sd_inet, &sdlist);
 	int maxsd = (sd_inet > sd_unix) ? sd_inet : sd_unix;
 	select( maxsd+1, &sdlist, 0L, 0L, 0L);
 
@@ -678,7 +681,7 @@
 	unsigned int saLength = sizeof(struct sockaddr);
 	if( FD_ISSET( sd_unix, &sdlist))
 		sd = accept( sd_unix, (struct sockaddr*)&s_unix, &saLength);
-	else if( FD_ISSET( sd_inet, &sdlist))
+	else if( !NoTCP && FD_ISSET( sd_inet, &sdlist))
 		sd = accept( sd_inet, (struct sockaddr*)&s_inet, &saLength);
 	dprintf2( "accept( saLength = %d) = %d\n", saLength, sd);
 
@@ -1606,6 +1609,8 @@
 			inetdConnection = 1;
 		} else if( !strcmp( argv[i], "--multi")) {
 			multiConnection = 1;
+		} else if( !strcmp( argv[i], "--notcp")) {
+			NoTCP = 1;
 		} else if( !strcmp( argv[i], "--once")) {
 			multiConnection = 0;
 		} else if( !strcmp( argv[i], "--unstrap")) {


>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200010131503.e9DF3Mk48055>