[OpenAFS-devel] [PATCH] fix crash in bucoord on 64-bit machines

Christopher Allen Wing wingc@engin.umich.edu
Fri, 30 Jun 2006 16:58:32 -0400 (EDT)


[ this message is Bcc:ed to openafs-bugs ]


The function bucoord/dump.c::bc_StartDmpRst() is called with incorrect 
argument types in bucoord/commands.c.  It takes two pointer variables:

 	struct sockaddr_in *adestServer
 	struct bc_dumpSchedule *dsptr


However, in bucoord/commands.c, bc_VolRestoreCmd(), bc_DiskRestoreCmd(), 
bc_VolsetRestoreCmd(), and bc_DumpCmd() were passing '0' as arguments 
instead of NULL.  Because there is no prototype for bc_StartDmpRst() this 
results in a crash on 64-bit Linux.  (when running 'volrestore' from an 
interactive backup session)

One instance of this problem was fixed in the CVS delta:

 	backup-dump-parameter-fix-20060411

however, there were several other instances left unfixed.


Here is a patch which fixes the crash by passing NULL instead of 0 to the 
pointer arguments.  I did not address the underlying problem, which is the 
lack of prototypes in this part of the source.  I won't be able to get 
around to it today but I might have an opportunity over the weekend or 
next week.


Thanks,

Chris Wing
wingc@engin.umich.edu



--- openafs-1.4.x-20060630/src/bucoord/commands.c.orig	2006-04-11 15:28:20.000000000 -0400
+++ openafs-1.4.x-20060630/src/bucoord/commands.c	2006-06-30 16:30:53.000000000 -0400
@@ -1243,7 +1243,7 @@
  		       &destServ, destPartition, fromDate, newExt, oldFlag,
  		       /*parentDump */ 0, /*dumpLevel */ 0,
  		       bc_Restorer, ports, portCount,
-		       /*dumpSched */ 0, /*append */ 0, dontExecute);
+		       /*dumpSched */ NULL, /*append */ 0, dontExecute);
      if (code)
  	com_err(whoami, code, "; Failed to queue restore");

@@ -1406,7 +1406,7 @@
  		       &destServ, destPartition, fromDate, newExt, oldFlag,
  		       /*parentDump */ 0, /*dumpLevel */ 0,
  		       bc_Restorer, ports, portCount,
-		       /*dumpSched */ 0, /*append */ 0, dontExecute);
+		       /*dumpSched */ NULL, /*append */ 0, dontExecute);
      if (code)
  	com_err(whoami, code, "; Failed to queue restore");

@@ -1564,11 +1564,11 @@

      /* Perform the call to start the restore */
      code = bc_StartDmpRst(bc_globalConfig, "disk", "restore", volsToRestore,
-			  /*destserver */ 0, /*destpartition */ 0, fromDate,
+			  /*destserver */ NULL, /*destpartition */ 0, fromDate,
  			  newExt, oldFlag,
  			  /*parentDump */ 0, /*dumpLevel */ 0,
  			  bc_Restorer, ports, portCount,
-			  /*dumpSched */ 0, /*append */ 0, dontExecute);
+			  /*dumpSched */ NULL, /*append */ 0, dontExecute);
      if (code)
  	com_err(whoami, code, "; Failed to queue restore");

@@ -1962,7 +1962,7 @@
  	return (0);

      code = bc_StartDmpRst(bc_globalConfig, dumpPath, vsName, volsToDump,
-			  /*destServer */ 0, /*destPartition */ 0,
+			  /*destServer */ NULL, /*destPartition */ 0,
  			  /*fromDate */ 0,
  			  /*newExt */ NULL, /*oldFlag */ 0,
  			  parent, level, bc_Dumper, portp, /*portCount */ 1,