@ERROR: auth failed on module -- PROBLEM SOLVED!

Paul Slootman paul at debian.org
Sat May 8 11:06:41 GMT 2004


On Fri 07 May 2004, Jonathan Johnson wrote:
> 
> I found that a newline is required after the line containing the
> password, at least in rsync 2.6.2. Without the newline character, I

Try the patch below.

Paul Slootman


--- authenticate.c.orig	2004-04-01 20:05:40.000000000 +0200
+++ authenticate.c	2004-05-08 13:04:59.000000000 +0200
@@ -139,6 +139,7 @@
 	int fd=0;
 	STRUCT_STAT st;
 	int ok = 1;
+	int n;
 	extern int am_root;
 	char *envpw=getenv("RSYNC_PASSWORD");
 
@@ -170,12 +171,15 @@
 	if (envpw) rprintf(FERROR,"RSYNC_PASSWORD environment variable ignored\n");
 
 	buffer[sizeof(buffer)-1]='\0';
-	if (read(fd,buffer,sizeof(buffer)-1) > 0)
+	if ((n = read(fd,buffer,sizeof(buffer)-1)) > 0)
 	{
-		char *p = strtok(buffer,"\n\r");
+		char *p;
 		close(fd);
-		if (p) p = strdup(p);
-		return p;
+		buffer[n] = 0;
+		if ((p = strchr(buffer, '\n')) || (p = strchr(buffer, '\r')))
+			*p = 0;
+		if (*buffer)
+			return strdup(buffer);
 	}	
 
 	return NULL;


More information about the rsync mailing list