File pidentd-3.1a25-send.diff of Package pidentd

--- src/send.c
+++ src/send.c
@@ -75,24 +75,23 @@
 	   const char *req,
 	   const char *what)
 {
-    char buf[1024];
+    char buf[36];		/* 36 = max (24, 11 + longest 'what'(=25))*/
     char nab[64];
 
     
     if (unknown_error_flag || (what[0] == 'X' && what[1] == '-' && !debug))
-	s_snprintf(buf, sizeof(buf), "%s : ERROR : UNKNOWN-ERROR",
-		   req);
+	s_snprintf(buf, sizeof(buf), " : ERROR : UNKNOWN-ERROR");
     else
-	s_snprintf(buf, sizeof(buf), "%s : ERROR : %s",
-		   req, what);
+	s_snprintf(buf, sizeof(buf), " : ERROR : %s", what);
 
+    fd_puts(fp, req);
     fd_puts(fp, buf);
     fd_putc(fp, '\n');
     
     if (result_syslog_level > -1)
 	syslog(result_syslog_level,
-	       "reply to %s: %s",
-	       s_inet_ntox(&cp->rsin, nab, sizeof(nab)),
+	       "reply to %s: %s%s",
+	       s_inet_ntox(&cp->rsin, nab, sizeof(nab)), req,
 	       buf);
 }
 
@@ -140,8 +139,7 @@
 
 	pdes_encrypt(kp, buffer);
 	s_snprintf(buf, sizeof(buf),
-		 "%s : USERID : OTHER%s%s :[%s]",
-		  req,
+		 " : USERID : OTHER%s%s :[%s]",
 		  charset != NULL ? " , " : "",
 		  charset != NULL ? charset : "",
 		  buffer);
@@ -152,8 +150,7 @@
     if (!uidonly_flag && pp != NULL && strlen(pp->pw_name) < sizeof(buf)-128)
     {
 	s_snprintf(buf, sizeof(buf),
-		   "%s : USERID : %s%s%s :%s",
-		   req,
+		   " : USERID : %s%s%s :%s",
 		   opsys,
 		   charset != NULL ? " , " : "",
 		   charset != NULL ? charset : "",
@@ -162,11 +159,11 @@
     else
     {
 	s_snprintf(buf, sizeof(buf),
-		   "%s : USERID : OTHER :%lu",
-		   req,
+		   " : USERID : OTHER :%lu",
 		   (unsigned long) uid);
     }
 
+    fd_puts(fp, req);
     fd_puts(fp, buf);
     fd_putc(fp, '\n');
     
openSUSE Build Service is sponsored by