Patch proposal

Tom Jansen t.p.j.jansen at student.utwente.nl
Thu Oct 25 05:32:02 GMT 2001


Hi everyone,

I've been using libsmbclient quite often lately and I must say it works great,
however I believe I have discovered some errors.

The first one is located in lib/debug.c where a possible NULL pointer is used as
an argument to a function that doesn't check for NULL.

The second one was a little harder to track down and is located in
lib/util_sock.c where send() causes a SIGPIPE. SIGPIPE is never caught and I
think that the default errorhandling in write_socket_data() can handle the error
nicely.

I've created two patches that fixed the two problems for me. The patches are
made against the HEAD branch. Both are attached to this message. 
If this is not the correct way to fix it please let me know so I can create a
decent fix. Or at least try :-)

yours,
	Tom
-------------- next part --------------
--- lib/util_sock.c.orig	Thu Oct 25 14:20:57 2001
+++ lib/util_sock.c	Thu Oct 25 14:20:30 2001
@@ -532,7 +532,7 @@
       ret = send(fd,buffer + total,N - total, 0);
     }
 #else /* WITH_SSL */
-    ret = send(fd,buffer + total,N - total,0);
+    ret = send(fd,buffer + total,N - total, MSG_NOSIGNAL);
 #endif /* WITH_SSL */
 
     if (ret == -1) {
-------------- next part --------------
--- lib/debug.c.orig	Thu Oct 25 14:14:42 2001
+++ lib/debug.c	Fri Oct  5 22:51:18 2001
@@ -365,10 +365,10 @@
 		log_overflow = True;
 		DEBUG(0, ("Unable to open new log file %s: %s\n", debugf, strerror(errno)));
 		log_overflow = False;
-		x_fflush(dbf);
+		if (dbf) x_fflush(dbf);
 		ret = False;
 	} else {
-		x_setbuf(new_dbf, NULL);
+	        x_setbuf(new_dbf, NULL);
 		if (dbf)
 			(void) x_fclose(dbf);
 		dbf = new_dbf;


More information about the samba-technical mailing list