Text   |  XML   |  ReML   |   Visible Warnings:

Null Test After Dereference  at master-settings.c:1600

No properties have been set. | edit properties
Jump to warning location ↓ warning details...
Show Events | Options

master_settings_read

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/master/master-settings.c)expand/collapse
Show more  
 1530  bool master_settings_read(const char *path, bool nochecks, bool nofixes)
 1531  {
 1532          struct settings_parse_ctx ctx;
 1533          struct server_settings *server, *prev;
 1534          const struct settings *def;
 1535          struct auth_settings *auth;
 1536          struct namespace_settings *ns;
 1537          pool_t temp;
 1538   
 1539          memset(&ctx, 0, sizeof(ctx));
 1540   
 1541          p_clear(settings_pool);
 1542   
 1543          ctx.type = SETTINGS_TYPE_ROOT;
 1544          ctx.protocol = MAIL_PROTOCOL_ANY;
 1545          ctx.server = ctx.root =
 1546                  create_new_server("default",
 1547                                    &default_settings, &default_settings);
 1548          ctx.auth = &ctx.server->auth_defaults;
 1549   
 1550          if (!settings_read(path, NULL, parse_setting, parse_section, &ctx))
 1551                  return FALSE;
 1552   
 1553          if (ctx.level != 0) {
 1554                  i_error("Missing '}'");
 1555                  return FALSE;
 1556          }
 1557   
 1558          /* If server sections were defined, skip the root */
 1559          if (ctx.root->next != NULL)
 1560                  ctx.root = ctx.root->next;
 1561   
 1562          if (!nochecks && !nofixes) {
 1563                  def = settings_is_active(ctx.root->imap) ?
 1564                          ctx.root->imap : ctx.root->pop3;
 1565   
 1566                  path = t_strconcat(def->base_dir, "/master.pid", NULL);
 1567                  pid_file_check_running(path);
 1568          }
 1569   
 1570          prev = NULL;
 1571          for (server = ctx.root; server != NULL; server = server->next) {
 1572                  if ((*server->imap->protocols == '\0' ||
 1573                       *server->pop3->protocols == '\0') && !nochecks) {
 1574                          i_error("protocols: No protocols given "
 1575                                  "in configuration file");
 1576                          return FALSE;
 1577                  }
 1578                  /* --exec-mail is used if nochecks=TRUE. Allow it regardless 
 1579                     of what's in protocols setting. */
 1580                  if (!settings_is_active(server->imap) && !nochecks) {
 1581                          if (strcmp(server->imap->protocols, "none") == 0) {
 1582                                  server->imap->protocol = MAIL_PROTOCOL_ANY;
 1583                                  if (!settings_fix(server->imap, nochecks,
 1584                                                    nofixes))
 1585                                          return FALSE;
 1586                                  server->defaults = server->imap;
 1587                          }
 1588                          server->imap = NULL;
 1589                  } else {
 1590                          if (!settings_fix(server->imap, nochecks, nofixes))
 1591                                  return FALSE;
 1592                          server->defaults = server->imap;
 1593                  }
 1594   
 1595                  if (!settings_is_active(server->pop3) && !nochecks)
 1596                          server->pop3 = NULL;
 1597                  else {
 1598                          if (!settings_fix(server->pop3, nochecks, nofixes))
 1599                                  return FALSE;
 1600                          if (server->defaults == NULL)
 1601                                  server->defaults = server->pop3;
 1602                  }
 1603   
 1604                  if (server->defaults == NULL) {
 1605                          if (prev == NULL)
 1606                                  ctx.root = server->next;
 1607                          else 
 1608                                  prev->next = server->next;
 1609                  } else {
 1610                          auth = server->auths;
 1611                          if (auth == NULL) {
 1612                                  i_error("Missing auth section for server %s",
 1613                                          server->name);
 1614                                  return FALSE;
 1615                          }
 1616   
 1617                          if (!nochecks) {
 1618                                  for (; auth != NULL; auth = auth->next) {
 1619                                          if (!auth_settings_verify(auth))
 1620                                                  return FALSE;
 1621                                  }
 1622                                  ns = server->namespaces;
 1623                                  for (; ns != NULL; ns = ns->next) {
 1624                                          if (!namespace_settings_verify(server, ns))
 1625                                                  return FALSE;
 1626                                  }
 1627                          }
 1628                          prev = server;
 1629                  }
 1630          }
 1631   
 1632          if (ctx.root == NULL) {
 1633                  /* We aren't actually checking them separately, but if it 
 1634                     contains only invalid protocols we'll get here.. */
 1635                  i_error("Invalid protocols given in configuration file");
 1636                  return FALSE;
 1637          }
 1638   
 1639          if (!nochecks)
 1640                  settings_warn_needed_fds(ctx.root);
 1641   
 1642          /* settings ok, swap them */
 1643          temp = settings_pool;
 1644          settings_pool = settings2_pool;
 1645          settings2_pool = temp;
 1646   
 1647          settings_root = ctx.root;
 1648          return TRUE;
 1649  }
Show more  




Change Warning 12149.25585 : Null Test After Dereference

Priority:
State:
Finding:
Owner:
Note: