Просмотр исходного кода

* Move hubs to CONF binary area

Bryan Drewery 14 лет назад
Родитель
Сommit
95f7f96f0b
2 измененных файлов с 11 добавлено и 7 удалено
  1. 8 4
      src/binary.c
  2. 3 3
      src/settings.h

+ 8 - 4
src/binary.c

@@ -50,9 +50,9 @@
 settings_t settings = {
   SETTINGS_HEADER,
   /* -- STATIC -- */
-  "", "", "", "", "", "", "", "", "",
+  "", "", "", "", "", "", "", "",
   /* -- DYNAMIC -- */
-  "", "", "", "", "", "", "", "", "",
+  "", "", "", "", "", "", "", "", "", "",
   /* -- PADDING */
   ""
 };
@@ -482,7 +482,6 @@ static void edpack(settings_t *incfg, const char *in_hash, int what)
   dofield(incfg->dcc_prefix);
   dofield(incfg->features);
   dofield(incfg->owners);
-  dofield(incfg->hubs);
 
   dohash(incfg->salt1);
   dohash(incfg->salt2);
@@ -490,6 +489,7 @@ static void edpack(settings_t *incfg, const char *in_hash, int what)
 
   /* -- DYNAMIC -- */
   dofield(incfg->dynamic_initialized);
+  dofield(incfg->hubs);
   dofield(incfg->bots);
   dofield(incfg->uid);
   dofield(incfg->autocron);
@@ -518,11 +518,11 @@ tellconfig(settings_t *incfg)
   dofield(incfg->dcc_prefix);
   dofield(incfg->features);
   dofield(incfg->owners);
-  dofield(incfg->hubs);
 //  dofield(incfg->salt1);
 //  dofield(incfg->salt2);
   // -- DYNAMIC --
   dofield(incfg->dynamic_initialized);
+  dofield(incfg->hubs);
   dofield(incfg->bots);
   dofield(incfg->uid);
   dofield(incfg->autocron);
@@ -674,6 +674,7 @@ void conf_to_bin(conf_t *in, bool move, int die)
 {
   conf_bot *bot = NULL;
   char *newbin = NULL;
+  char *hubs = strdup(settings.hubs);
 
   clear_settings();
   sdprintf("converting conf to bin\n");
@@ -699,6 +700,9 @@ void conf_to_bin(conf_t *in, bool move, int die)
                            bot->net.ip6 ? bot->net.ip6 : "");
     }
 
+  simple_snprintf(settings.hubs, sizeof(settings.hubs), "%s", hubs);
+  free(hubs);
+
   newbin = binname;
 //  tellconfig(&settings); 
   write_settings(newbin, -1, 1);

+ 3 - 3
src/settings.h

@@ -18,13 +18,13 @@ typedef struct settings_struct {
   char packname[65];
   char shellhash[65];
   char owners[513];
-  char hubs[513];
   char salt1[33];
   char salt2[17];
   char dcc_prefix[17];
   char features[17];
   /* -- DYNAMIC -- */
   char dynamic_initialized[17];
+  char hubs[513];
   char bots[1025];
   char uid[17];
   char autocron[17];         /* should the bot auto crontab itself? */
@@ -46,10 +46,10 @@ typedef struct settings_struct {
 extern char s1_3[3],s1_2[3],s1_1[3],s2_7[3],s1_9[3],s1_13[3],s1_14[3],s2_2[3],s1_10[3],s2_4[3],s1_4[3],s2_3[3],s2_1[3],s2_6[3],s1_7[3],s1_12[3],s2_5[3],s1_5[3],s1_6[3],s1_11[3],s2_8[3],s1_8[3],s1_16[3],s1_15[3];
 
 #define SIZE_PACK sizeof(settings.hash) + sizeof(settings.packname) + sizeof(settings.shellhash) + \
-sizeof(settings.owners) + sizeof(settings.hubs) + \
+sizeof(settings.owners) + \
 sizeof(settings.salt1) + sizeof(settings.salt2) + sizeof(settings.dcc_prefix) + sizeof(settings.features)
 
-#define SIZE_CONF sizeof(settings.dynamic_initialized) + sizeof(settings.bots) + sizeof(settings.uid) + \
+#define SIZE_CONF sizeof(settings.dynamic_initialized) + sizeof(settings.hubs) + sizeof(settings.bots) + sizeof(settings.uid) + \
 sizeof(settings.autocron) + \
 sizeof(settings.username) + sizeof(settings.homedir) + \
 sizeof(settings.portmin) + sizeof(settings.portmin) + sizeof(settings.datadir)