Browse Source

enable the old account naming scheme to deal with duplicated ip
addresses.
this is not incompatible - previously, it would just create garbage.

Oswald Buddenhagen 19 years ago
parent
commit
9b7c09e4b6
1 changed files with 10 additions and 10 deletions
  1. 10 10
      src/compat/config.c

+ 10 - 10
src/compat/config.c

@@ -248,7 +248,7 @@ write_imap_server( FILE *fp, config_t *cfg )
 		nfasprintf( (char **)&cfg->old_server_name, "tunnel%d", ++tunnels );
 	else {
 		if (sscanf( cfg->host, "%d.%d.%d.%d", &a1, &a2, &a3, &a4 ) == 4)
-			cfg->old_server_name = nfstrdup( cfg->host );
+			hl = nfsnprintf( buf, sizeof(buf), "%s", cfg->host );
 		else {
 			p = strrchr( cfg->host, '.' );
 			if (!p)
@@ -259,16 +259,16 @@ write_imap_server( FILE *fp, config_t *cfg )
 				if (p2)
 					hl = sprintf( buf, "%s", p2 + 1 );
 			}
-			if (boxes) /* !o2o */
-				for (pbox = boxes; pbox != cfg; pbox = pbox->next)
-					if (!memcmp( pbox->server_name, buf, hl + 1 )) {
-						nfasprintf( (char **)&cfg->old_server_name, "%s-%d", buf, ++pbox->old_servers );
-						goto gotsrv;
-					}
-			cfg->old_server_name = nfstrdup( buf );
-			cfg->old_servers = 1;
-		  gotsrv: ;
 		}
+		if (boxes) /* !o2o */
+			for (pbox = boxes; pbox != cfg; pbox = pbox->next)
+				if (!memcmp( pbox->server_name, buf, hl + 1 )) {
+					nfasprintf( (char **)&cfg->old_server_name, "%s-%d", buf, ++pbox->old_servers );
+					goto gotsrv;
+				}
+		cfg->old_server_name = nfstrdup( buf );
+		cfg->old_servers = 1;
+	  gotsrv: ;
 	}
 
 	if (cfg->user)