- if (name && pass && host && c_class)
- {
- struct ConfItem *aconf = make_conf(CONF_OPERATOR);
- aconf->name = name;
- aconf->passwd = pass;
- conf_parse_userhost(aconf, host);
+ 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);