Tom Collins wrote:

Rick,

If you can get a patch to me (that fixes the segfault in the users/assign sorting code when a domain doesn't have a dot in it) by the end of the week, I'll work at getting another vpopmail release out (with your patch, and others in my queue).

The fix is in head, and a die is enclosed.


The only thing I did was add

if( i > 1 ) {

and

}

and indent all the lines in between. This skips over shuffling the domain name before sorting. This die is against head, but I don't think anything has changed here since sorting the files was added.


=================================================================================
die -u -r1.51 vpopmail
--- vpopmail    16 Apr 2006 10:54:52 -0000      1.51
+++ vpopmail    21 Jun 2006 04:10:28 -0000
@@ -1707,49 +1707,50 @@
 //  for(j=0;j<i;j++) {
 //    fprintf( stderr, "extract_domain - i: %d part: %s\n", j, parts[j] );
 //  }
-
-  //  Juggle the order of stuff in the domain name
+  if( i > 1 )  {
+    //  Juggle the order of stuff in the domain name

-  //  Save the last two terms
-  t = parts[--i];
-  u = parts[--i];
+    //  Save the last two terms
+    t = parts[--i];
+    u = parts[--i];

-  //  Make room for two elements at the beginning of the name
-  for(j=0;j<i;j++) {
-    parts[j+2]=parts[j];
-  }
+    //  Make room for two elements at the beginning of the name
+    for(j=0;j<i;j++) {
+      parts[j+2]=parts[j];
+    }

-  //  Put the parts you saved back in the beginning of the domain name
+    //  Put the parts you saved back in the beginning of the domain name
 #ifdef SORTTLD
-  parts[0] = t;
-  parts[1] = u;
+    parts[0] = t;
+    parts[1] = u;
 #else
-  parts[0] = u;
-  parts[1] = t;
+    parts[0] = u;
+    parts[1] = t;
 #endif

-  i=i+2;
+    i=i+2;

-  //  Clean out the domain variable
-  for(j=0;j<MAX_BUFF;j++) {
-    domain[j] = 0;
-  }
+    //  Clean out the domain variable
+    for(j=0;j<MAX_BUFF;j++) {
+      domain[j] = 0;
+    }

-  //  Get one last look at the array before assembling it
-//  for(j=0;j<i;j++) {
-//    fprintf( stderr, "extract_domain - modified i: %d part: %s\n",
-//             j, parts[j] );
-//  }
+    //  Get one last look at the array before assembling it
+//    for(j=0;j<i;j++) {
+//      fprintf( stderr, "extract_domain - modified i: %d part: %s\n",
+//               j, parts[j] );
+//    }

-  //  Copy the first term into the domain name
-  strcpy(domain, parts[0] );
+    //  Copy the first term into the domain name
+    strcpy(domain, parts[0] );

-  //  Copy the rest of the terms into the domain name
-  for(j=1;j<i;j++) {
-    strncat( domain, ".", MAX_BUFF );
-    strncat( domain, parts[j], MAX_BUFF );
-  }
+    //  Copy the rest of the terms into the domain name
+    for(j=1;j<i;j++) {
+      strncat( domain, ".", MAX_BUFF );
+      strncat( domain, parts[j], MAX_BUFF );
+    }

+  }

 //  fprintf( stderr, "extract_domain - final result: %s\n", domain );





Reply via email to