- if (aconf->name != NULL && aconf->passwd != NULL && aconf->host != NULL)
- {
- aconf->next = GlobalConfList;
- GlobalConfList = aconf;
- }
- else
- {
- log_write(LS_CONFIG, L_ERROR, 0, "operator blocks need a name, password, and host.");
- MyFree(aconf->name);
- MyFree(aconf->passwd);
- MyFree(aconf->host);
- MyFree(aconf);
- aconf = NULL;
+ struct ConfItem *aconf = NULL;
+ struct SLink *link;
+
+ if (name == NULL)
+ parse_error("Missing name in operator block");
+ else if (pass == NULL)
+ parse_error("Missing password in operator block");
+ /* Do not check password length because it may be crypted. */
+ else if (hosts == NULL)
+ parse_error("Missing host(s) in operator block");
+ else if (c_class == NULL)
+ parse_error("Invalid or missing class in operator block");
+ else if (!FlagHas(&privs_dirty, PRIV_PROPAGATE)
+ && !FlagHas(&c_class->privs_dirty, PRIV_PROPAGATE))
+ parse_error("Operator block for %s and class %s have no LOCAL setting", name, c_class->cc_name);
+ else for (link = hosts; link != NULL; link = link->next) {
+ aconf = make_conf(CONF_OPERATOR);
+ DupString(aconf->name, name);
+ DupString(aconf->passwd, pass);
+ conf_parse_userhost(aconf, link->value.cp);
+ aconf->conn_class = c_class;
+ memcpy(&aconf->privs, &privs, sizeof(aconf->privs));
+ memcpy(&aconf->privs_dirty, &privs_dirty, sizeof(aconf->privs_dirty));