xmcd (2.6-23) cddb_d/cddb_ext.c

Summary

 cddb_d/cddb_ext.c |   53 +++--------------------------------------------------
 1 file changed, 3 insertions(+), 50 deletions(-)

    
download this patch

Patch contents

--- xmcd-2.6.orig/cddb_d/cddb_ext.c
+++ xmcd-2.6/cddb_d/cddb_ext.c
@@ -72,12 +72,7 @@
 cddb_init(cddb_client_t *clp)
 {
 	char		*cp,
-			*path,
-			**ap,
-			hname[MAXHOSTNAMELEN],
-			tmpuser[STR_BUF_SZ],
-			tmphost[MAXHOSTNAMELEN];
-	struct hostent	*he;
+			*path;
 
 	DBGPRN(errfp, "\nlibcddb: %s %s %s\n",
 #ifdef SYNCHRONOUS
@@ -108,7 +103,7 @@
 	 * common.cfg file
 	 */
 	if (app_data.cddb_filemode == NULL)
-		app_data.cddb_filemode = "0666";
+		app_data.cddb_filemode = "0664";
 	if (app_data.hist_filemode == NULL)
 		app_data.hist_filemode = "0644";
 
@@ -116,44 +111,6 @@
 	SOCKSINIT(clp->prog);
 #endif
 
-	if (clp->host[0] == '\0') {
-#ifndef NOREMOTE
-		/* Try to determine host name */
-		if (gethostname(hname, MAXHOSTNAMELEN-1) < 0 ||
-		    (he = gethostbyname(hname)) == NULL) {
-			(void) strcpy(clp->host, "unknown");
-		}
-		else {
-			/* Look for a a fully-qualified hostname
-			 * (with domain)
-			 */
-			if (strchr(he->h_name, '.') != NULL) {
-				(void) strncpy(clp->host, he->h_name,
-					       MAXHOSTNAMELEN-1);
-			}
-			else {
-				for (ap = he->h_aliases; *ap != NULL; ap++) {
-					if (strchr(*ap, '.') != NULL) {
-					    (void) strncpy(clp->host, *ap,
-							   MAXHOSTNAMELEN-1);
-					    break;
-					}
-				}
-			}
-
-			if (clp->host[0] == '\0')
-				(void) strcpy(clp->host, hname);
-
-			clp->host[MAXHOSTNAMELEN-1] = '\0';
-		}
-#else
-		(void) strcpy(clp->host, "unknown");
-#endif
-	}
-
-	if (clp->user[0] == '\0')
-		(void) strcpy(clp->user, "unknown");
-
 	/* Load XMCD_CDDBPATH environment variable, if specified */
 	if ((cp = (char *) getenv("XMCD_CDDBPATH")) != NULL) {
 		if ((int) strlen(cp) >= MAX_ENV_LEN) {
@@ -210,12 +167,8 @@
 			cddb_proxy.port = HTTP_DFLT_PORT;
 	}
 
-	cddb_http_xlat(cddb_clinfo->user, tmpuser);
-	cddb_http_xlat(cddb_clinfo->host, tmphost);
-
 	(void) sprintf(http_hellostr,
-		"hello=%.64s+%.64s+%s+v%s%sPL%d",
-		tmpuser, tmphost,
+		"hello=unknown+localhost+%s+v%s%sPL%d",
 		cddb_clinfo->prog, VERSION, VERSION_EXT, PATCHLEVEL);
 	(void) sprintf(http_extinfo,
 #ifdef NO_MASQUERADE