- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
+ The main author of Bacula is Kern Sibbald, with contributions from
+ many others, a complete list can be found in the file AUTHORS.
+ This program is Free Software; you can redistribute it and/or
+ modify it under the terms of version two of the GNU General Public
+ License as published by the Free Software Foundation and included
+ in the file LICENSE.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
- You should have received a copy of the GNU General Public
- License along with this program; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- MA 02111-1307, USA.
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
- if (!add_address(out, IPADDR::R_DEFAULT, htons(sport), AF_INET, 0, 0, &errstr)) {
- Emsg1(M_ERROR_TERM, 0, _("Can't add default address (%s)\n"), errstr);
- free(errstr);
+ if (!add_address(out, IPADDR::R_DEFAULT, htons(sport), AF_INET, 0, 0, buf, sizeof(buf))) {
+ Emsg1(M_ERROR_TERM, 0, _("Can't add default address (%s)\n"), buf);
- IPADDR *clone;
- /* for duplicates */
- foreach_dlist(jaddr, addrs) {
- if (iaddr->get_sockaddr_len() == jaddr->get_sockaddr_len() &&
- !memcmp(iaddr->get_sockaddr(), jaddr->get_sockaddr(),
- iaddr->get_sockaddr_len()))
- {
- goto skip; /* no price */
- }
- }
- clone = New(IPADDR(*iaddr));
- clone->set_type(type);
- clone->set_port_net(port);
- addrs->append(clone);
+ IPADDR *clone;
+ /* for duplicates */
+ foreach_dlist(jaddr, addrs) {
+ if (iaddr->get_sockaddr_len() == jaddr->get_sockaddr_len() &&
+ !memcmp(iaddr->get_sockaddr(), jaddr->get_sockaddr(),
+ iaddr->get_sockaddr_len()))
+ {
+ goto skip; /* no price */
+ }
+ }
+ clone = New(IPADDR(*iaddr));
+ clone->set_type(type);
+ clone->set_port_net(port);
+ addrs->append(clone);
- if (token != T_IDENTIFIER) {
- scan_err1(lc, _("Expected a identifier [addr|port], got: %s"), lc->str);
- }
- if (strcasecmp("port", lc->str) == 0) {
- next_line = PORTLINE;
- if (exist & PORTLINE) {
- scan_err0(lc, _("Only one port per address block"));
- }
- exist |= PORTLINE;
- } else if (strcasecmp("addr", lc->str) == 0) {
- next_line = ADDRLINE;
- if (exist & ADDRLINE) {
- scan_err0(lc, _("Only one addr per address block"));
- }
- exist |= ADDRLINE;
- } else {
- scan_err1(lc, _("Expected a identifier [addr|port], got: %s"), lc->str);
- }
- token = lex_get_token(lc, T_SKIP_EOL);
- if (token != T_EQUALS) {
- scan_err1(lc, _("Expected a equal =, got: %s"), lc->str);
- }
- token = lex_get_token(lc, T_SKIP_EOL);
- switch (next_line) {
- case PORTLINE:
- if (!
- (token == T_UNQUOTED_STRING || token == T_NUMBER
- || token == T_IDENTIFIER)) {
- scan_err1(lc, _("Expected a number or a string, got: %s"), lc->str);
- }
- bstrncpy(port_str, lc->str, sizeof(port_str));
- break;
- case ADDRLINE:
- if (!(token == T_UNQUOTED_STRING || token == T_IDENTIFIER)) {
- scan_err1(lc, _("Expected an IP number or a hostname, got: %s"),
- lc->str);
- }
- bstrncpy(hostname_str, lc->str, sizeof(hostname_str));
- break;
- case EMPTYLINE:
- scan_err0(lc, _("State machine missmatch"));
- break;
- }
- token = lex_get_token(lc, T_SKIP_EOL);
+ if (token != T_IDENTIFIER) {
+ scan_err1(lc, _("Expected a identifier [addr|port], got: %s"), lc->str);
+ }
+ if (strcasecmp("port", lc->str) == 0) {
+ next_line = PORTLINE;
+ if (exist & PORTLINE) {
+ scan_err0(lc, _("Only one port per address block"));
+ }
+ exist |= PORTLINE;
+ } else if (strcasecmp("addr", lc->str) == 0) {
+ next_line = ADDRLINE;
+ if (exist & ADDRLINE) {
+ scan_err0(lc, _("Only one addr per address block"));
+ }
+ exist |= ADDRLINE;
+ } else {
+ scan_err1(lc, _("Expected a identifier [addr|port], got: %s"), lc->str);
+ }
+ token = lex_get_token(lc, T_SKIP_EOL);
+ if (token != T_EQUALS) {
+ scan_err1(lc, _("Expected a equal =, got: %s"), lc->str);
+ }
+ token = lex_get_token(lc, T_SKIP_EOL);
+ switch (next_line) {
+ case PORTLINE:
+ if (!
+ (token == T_UNQUOTED_STRING || token == T_NUMBER
+ || token == T_IDENTIFIER)) {
+ scan_err1(lc, _("Expected a number or a string, got: %s"), lc->str);
+ }
+ bstrncpy(port_str, lc->str, sizeof(port_str));
+ break;
+ case ADDRLINE:
+ if (!(token == T_UNQUOTED_STRING || token == T_IDENTIFIER)) {
+ scan_err1(lc, _("Expected an IP number or a hostname, got: %s"),
+ lc->str);
+ }
+ bstrncpy(hostname_str, lc->str, sizeof(hostname_str));
+ break;
+ case EMPTYLINE:
+ scan_err0(lc, _("State machine missmatch"));
+ break;
+ }
+ token = lex_get_token(lc, T_SKIP_EOL);
- htons(item->default_value), family, hostname_str, port_str, &errstr)) {
- scan_err3(lc, _("Can't add hostname(%s) and port(%s) to addrlist (%s)"),
- hostname_str, port_str, errstr);
- free(errstr);
- }
+ htons(item->default_value), family, hostname_str, port_str,
+ errmsg, sizeof(errmsg))) {
+ scan_err3(lc, _("Can't add hostname(%s) and port(%s) to addrlist (%s)"),
+ hostname_str, port_str, errmsg);
+ }
- char *errstr;
- if (pass == 1 && !add_address((dlist **) (item->value), IPADDR::R_SINGLE_ADDR,
- htons(item->default_value), AF_INET, lc->str, 0, &errstr)) {
- scan_err2(lc, _("can't add port (%s) to (%s)"), lc->str, errstr);
- free(errstr);
+ if (pass == 1 && !add_address((dlist **)(item->value), IPADDR::R_SINGLE_ADDR,
+ htons(item->default_value), AF_INET, lc->str, 0,
+ errmsg, sizeof(errmsg))) {
+ scan_err2(lc, _("can't add port (%s) to (%s)"), lc->str, errmsg);
- htons(item->default_value), AF_INET, 0, lc->str, &errstr)) {
- scan_err2(lc, _("can't add port (%s) to (%s)"), lc->str, errstr);
- free(errstr);
+ htons(item->default_value), AF_INET, 0, lc->str,
+ errmsg, sizeof(errmsg))) {
+ scan_err2(lc, _("can't add port (%s) to (%s)"), lc->str, errmsg);