diff options
author | Hans-Joerg Hoexer <hshoexer@cvs.openbsd.org> | 2005-10-16 19:52:20 +0000 |
---|---|---|
committer | Hans-Joerg Hoexer <hshoexer@cvs.openbsd.org> | 2005-10-16 19:52:20 +0000 |
commit | c8d991155a42105277bbe41681f637d23b687a06 (patch) | |
tree | 6261a889e96a28ca022d6302e43060086c38dc1b /sbin/ipsecctl | |
parent | d6408728177f6e20d5477447cbe314dabfadf869 (diff) |
cleanup messages generated by err(3)
Diffstat (limited to 'sbin/ipsecctl')
-rw-r--r-- | sbin/ipsecctl/ike.c | 6 | ||||
-rw-r--r-- | sbin/ipsecctl/ipsecctl.c | 16 | ||||
-rw-r--r-- | sbin/ipsecctl/parse.y | 52 | ||||
-rw-r--r-- | sbin/ipsecctl/pfkey.c | 30 |
4 files changed, 52 insertions, 52 deletions
diff --git a/sbin/ipsecctl/ike.c b/sbin/ipsecctl/ike.c index c22167f44bb..e705d934ab1 100644 --- a/sbin/ipsecctl/ike.c +++ b/sbin/ipsecctl/ike.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ike.c,v 1.4 2005/09/22 15:07:29 hshoexer Exp $ */ +/* $OpenBSD: ike.c,v 1.5 2005/10/16 19:52:19 hshoexer Exp $ */ /* * Copyright (c) 2005 Hans-Joerg Hoexer <hshoexer@openbsd.org> * @@ -241,7 +241,7 @@ ike_section_qmids(struct ipsec_addr *src, struct ipsec_addr *dst, FILE *fd) if (src->netaddress) { mask = inet_ntoa(src->v4mask.mask); if ((network = strdup(src->name)) == NULL) - err(1, "strdup"); + err(1, "ike_section_qmids: strdup"); if ((p = strrchr(network, '/')) != NULL) *p = '\0'; @@ -261,7 +261,7 @@ ike_section_qmids(struct ipsec_addr *src, struct ipsec_addr *dst, FILE *fd) if (dst->netaddress) { mask = inet_ntoa(dst->v4mask.mask); if ((network = strdup(dst->name)) == NULL) - err(1, "strdup"); + err(1, "ike_section_qmids: strdup"); if ((p = strrchr(network, '/')) != NULL) *p = '\0'; diff --git a/sbin/ipsecctl/ipsecctl.c b/sbin/ipsecctl/ipsecctl.c index b4fe59975cb..722d22a7761 100644 --- a/sbin/ipsecctl/ipsecctl.c +++ b/sbin/ipsecctl/ipsecctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipsecctl.c,v 1.26 2005/08/22 17:26:46 hshoexer Exp $ */ +/* $OpenBSD: ipsecctl.c,v 1.27 2005/10/16 19:52:19 hshoexer Exp $ */ /* * Copyright (c) 2004, 2005 Hans-Joerg Hoexer <hshoexer@openbsd.org> * @@ -331,13 +331,13 @@ ipsecctl_get_rules(struct ipsecctl *ipsec) mib[3] = NET_KEY_SPD_DUMP; if (sysctl(mib, 4, NULL, &need, NULL, 0) == -1) - err(1, "sysctl"); + err(1, "ipsecctl_get_rules: sysctl"); if (need == 0) return; if ((buf = malloc(need)) == NULL) - err(1, "malloc"); + err(1, "ipsecctl_get_rules: malloc"); if (sysctl(mib, 4, buf, &need, NULL, 0) == -1) - err(1, "sysctl"); + err(1, "ipsecctl_get_rules: sysctl"); lim = buf + need; for (next = buf; next < lim; next += msg->sadb_msg_len * @@ -348,7 +348,7 @@ ipsecctl_get_rules(struct ipsecctl *ipsec) rule = calloc(1, sizeof(struct ipsec_rule)); if (rule == NULL) - err(1, "malloc"); + err(1, "ipsecctl_get_rules: malloc"); rule->nr = ipsec->rule_nr++; rule->type |= RULE_FLOW; @@ -432,16 +432,16 @@ ipsecctl_show_sas(int opts) /* When the SADB is empty we get ENOENT, no need to err(). */ if (sysctl(mib, 5, NULL, &need, NULL, 0) == -1 && errno != ENOENT) - err(1, "sysctl"); + err(1, "ipsecctl_show_sas: sysctl"); if (need == 0) { if (opts & IPSECCTL_OPT_SHOWALL) printf("No entries\n"); return; } if ((buf = malloc(need)) == NULL) - err(1, "malloc"); + err(1, "ipsecctl_show_sas: malloc"); if (sysctl(mib, 5, buf, &need, NULL, 0) == -1) - err(1, "sysctl"); + err(1, "ipsecctl_show_sas: sysctl"); lim = buf + need; for (next = buf; next < lim; next += msg->sadb_msg_len * PFKEYV2_CHUNK) { diff --git a/sbin/ipsecctl/parse.y b/sbin/ipsecctl/parse.y index 8d34bab0d4c..cd70c48e387 100644 --- a/sbin/ipsecctl/parse.y +++ b/sbin/ipsecctl/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.24 2005/08/22 17:26:46 hshoexer Exp $ */ +/* $OpenBSD: parse.y,v 1.25 2005/10/16 19:52:19 hshoexer Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -415,7 +415,7 @@ transforms : /* empty */ { /* We create just an empty transform */ if ((xfs = calloc(1, sizeof(struct ipsec_transforms))) == NULL) - err(1, "calloc"); + err(1, "transforms: calloc"); $$ = xfs; } | AUTHXF STRING ENCXF STRING { @@ -452,7 +452,7 @@ mmxfs : /* empty */ { /* We create just an empty transform */ if ((xfs = calloc(1, sizeof(struct ipsec_transforms))) == NULL) - err(1, "calloc"); + err(1, "mmxfs: calloc"); $$ = xfs; } | MAIN transforms { $$ = $2; } @@ -464,7 +464,7 @@ qmxfs : /* empty */ { /* We create just an empty transform */ if ((xfs = calloc(1, sizeof(struct ipsec_transforms))) == NULL) - err(1, "calloc"); + err(1, "qmxfs: calloc"); $$ = xfs; } | QUICK transforms { $$ = $2; } @@ -938,12 +938,12 @@ parsekey(unsigned char *hexkey, size_t len) key = calloc(1, sizeof(struct ipsec_key)); if (key == NULL) - err(1, "calloc"); + err(1, "parsekey: calloc"); key->len = len / 2; key->data = calloc(key->len, sizeof(u_int8_t)); if (key->data == NULL) - err(1, "calloc"); + err(1, "parsekey: calloc"); for (i = 0; i < (int)key->len; i++) key->data[i] = x2i(hexkey + 2 * i); @@ -959,17 +959,17 @@ parsekeyfile(char *filename) unsigned char *hex; if (stat(filename, &sb) < 0) - err(1, "stat %s", filename); + err(1, "parsekeyfile: stat %s", filename); if ((sb.st_size > KEYSIZE_LIMIT) || (sb.st_size == 0)) errx(1, "key too %s", sb.st_size ? "large" : "small"); if ((hex = calloc(sb.st_size, sizeof(unsigned char))) == NULL) - err(1, "calloc"); + err(1, "parsekeyfile: calloc"); if ((fd = open(filename, O_RDONLY)) < 0) - err(1, "open"); + err(1, "parsekeyfile: open"); if (read(fd, hex, sb.st_size) < sb.st_size) - err(1, "read"); + err(1, "parsekeyfile: read"); close(fd); return (parsekey(hex, sb.st_size)); } @@ -984,10 +984,10 @@ host(const char *s) ipa = calloc(1, sizeof(struct ipsec_addr)); if (ipa == NULL) - err(1, "calloc"); + err(1, "host: calloc"); if ((ipa->name = strdup(s)) == NULL) - err(1, "strdup"); + err(1, "host: strdup"); if (strrchr(s, '/') != NULL) { bits = inet_net_pton(AF_INET, s, &ipa->v4, sizeof(ipa->v4)); @@ -1027,12 +1027,12 @@ copyhost(const struct ipsec_addr *src) dst = calloc(1, sizeof(struct ipsec_addr)); if (dst == NULL) - err(1, "calloc"); + err(1, "copyhost: calloc"); memcpy(dst, src, sizeof(struct ipsec_addr)); if ((dst->name = strdup(src->name)) == NULL) - err(1, "strdup"); + err(1, "copyhost: strdup"); return dst; } @@ -1057,7 +1057,7 @@ transforms(const char *authname, const char *encname) xfs = calloc(1, sizeof(struct ipsec_transforms)); if (xfs == NULL) - err(1, "calloc"); + err(1, "transforms: calloc"); if (authname) { xfs->authxf = parse_xf(authname, authxfs); @@ -1083,7 +1083,7 @@ copytransforms(const struct ipsec_transforms *xfs) newxfs = calloc(1, sizeof(struct ipsec_transforms)); if (newxfs == NULL) - err(1, "calloc"); + err(1, "copytransforms: calloc"); memcpy(newxfs, xfs, sizeof(struct ipsec_transforms)); return (newxfs); @@ -1169,7 +1169,7 @@ create_sa(u_int8_t protocol, struct ipsec_addr *src, struct ipsec_addr *dst, r = calloc(1, sizeof(struct ipsec_rule)); if (r == NULL) - err(1, "calloc"); + err(1, "create_sa: calloc"); r->type |= RULE_SA; r->proto = protocol; @@ -1194,7 +1194,7 @@ reverse_sa(struct ipsec_rule *rule, u_int32_t spi, struct ipsec_key *authkey, reverse = calloc(1, sizeof(struct ipsec_rule)); if (reverse == NULL) - err(1, "calloc"); + err(1, "reverse_sa: calloc"); reverse->type |= RULE_SA; reverse->proto = rule->proto; @@ -1217,7 +1217,7 @@ create_flow(u_int8_t dir, struct ipsec_addr *src, struct ipsec_addr *dst, r = calloc(1, sizeof(struct ipsec_rule)); if (r == NULL) - err(1, "calloc"); + err(1, "create_flow: calloc"); r->type |= RULE_FLOW; @@ -1255,7 +1255,7 @@ create_flow(u_int8_t dir, struct ipsec_addr *src, struct ipsec_addr *dst, r->proto = proto; r->auth = calloc(1, sizeof(struct ipsec_auth)); if (r->auth == NULL) - err(1, "calloc"); + err(1, "create_flow: calloc"); r->auth->srcid = srcid; r->auth->dstid = dstid; r->auth->idtype = ID_FQDN; /* XXX For now only FQDN. */ @@ -1284,7 +1284,7 @@ reverse_rule(struct ipsec_rule *rule) reverse = calloc(1, sizeof(struct ipsec_rule)); if (reverse == NULL) - err(1, "calloc"); + err(1, "reverse_rule: calloc"); reverse->type |= RULE_FLOW; @@ -1303,13 +1303,13 @@ reverse_rule(struct ipsec_rule *rule) reverse->auth = calloc(1, sizeof(struct ipsec_auth)); if (reverse->auth == NULL) - err(1, "calloc"); + err(1, "reverse_rule: calloc"); if (rule->auth->dstid && (reverse->auth->dstid = strdup(rule->auth->dstid)) == NULL) - err(1, "strdup"); + err(1, "reverse_rule: strdup"); if (rule->auth->srcid && (reverse->auth->srcid = strdup(rule->auth->srcid)) == NULL) - err(1, "strdup"); + err(1, "reverse_rule: strdup"); reverse->auth->idtype = rule->auth->idtype; reverse->auth->type = rule->auth->type; @@ -1325,7 +1325,7 @@ create_ike(struct ipsec_addr *src, struct ipsec_addr *dst, struct ipsec_addr * r = calloc(1, sizeof(struct ipsec_rule)); if (r == NULL) - err(1, "calloc"); + err(1, "create_ike: calloc"); r->type = RULE_IKE; @@ -1356,7 +1356,7 @@ create_ike(struct ipsec_addr *src, struct ipsec_addr *dst, struct ipsec_addr * r->qmxfs = qmxfs; r->auth = calloc(1, sizeof(struct ipsec_auth)); if (r->auth == NULL) - err(1, "calloc"); + err(1, "create_ike: calloc"); r->auth->srcid = srcid; r->auth->dstid = dstid; r->auth->idtype = ID_FQDN; /* XXX For now only FQDN. */ diff --git a/sbin/ipsecctl/pfkey.c b/sbin/ipsecctl/pfkey.c index ff2814d5978..c3c722c0e98 100644 --- a/sbin/ipsecctl/pfkey.c +++ b/sbin/ipsecctl/pfkey.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfkey.c,v 1.23 2005/08/22 17:26:46 hshoexer Exp $ */ +/* $OpenBSD: pfkey.c,v 1.24 2005/10/16 19:52:19 hshoexer Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> * Copyright (c) 2003, 2004 Markus Friedl <markus@openbsd.org> @@ -178,7 +178,7 @@ pfkey_flow(int sd, u_int8_t satype, u_int8_t action, u_int8_t direction, sa_srcid = calloc(len, sizeof(u_int8_t)); if (sa_srcid == NULL) - err(1, "calloc"); + err(1, "pfkey_flow: calloc"); sa_srcid->sadb_ident_type = auth->idtype; sa_srcid->sadb_ident_len = len / 8; @@ -192,7 +192,7 @@ pfkey_flow(int sd, u_int8_t satype, u_int8_t action, u_int8_t direction, sa_dstid = calloc(len, sizeof(u_int8_t)); if (sa_dstid == NULL) - err(1, "calloc"); + err(1, "pfkey_flow: calloc"); sa_dstid->sadb_ident_type = auth->idtype; sa_dstid->sadb_ident_len = len / 8; @@ -532,7 +532,7 @@ pfkey_reply(int sd) } len = hdr.sadb_msg_len * PFKEYV2_CHUNK; if ((data = malloc(len)) == NULL) - err(1, NULL); + err(1, "pfkey_reply: malloc"); if (read(sd, data, len) != len) { warn("PF_KEY short read"); bzero(data, len); @@ -580,7 +580,7 @@ pfkey_parse(struct sadb_msg *msg, struct ipsec_rule *rule) rule->local = calloc(1, sizeof(struct ipsec_addr)); if (rule->local == NULL) - err(1, "malloc"); + err(1, "pfkey_parse: malloc"); switch (sa->sa_family) { case AF_INET: @@ -603,7 +603,7 @@ pfkey_parse(struct sadb_msg *msg, struct ipsec_rule *rule) rule->peer = calloc(1, sizeof(struct ipsec_addr)); if (rule->peer == NULL) - err(1, "malloc"); + err(1, "pfkey_parse: malloc"); switch (sa->sa_family) { case AF_INET: @@ -627,12 +627,12 @@ pfkey_parse(struct sadb_msg *msg, struct ipsec_rule *rule) rule->auth = calloc(1, sizeof(struct ipsec_auth)); if (rule->auth == NULL) - err(1, "calloc"); + err(1, "pfkey_parse: calloc"); } rule->auth->srcid = calloc(1, len); if (rule->auth->srcid == NULL) - err(1, "calloc"); + err(1, "pfkey_parse: calloc"); strlcpy(rule->auth->srcid, (char *)(sident + 1), len); break; @@ -646,12 +646,12 @@ pfkey_parse(struct sadb_msg *msg, struct ipsec_rule *rule) rule->auth = calloc(1, sizeof(struct ipsec_auth)); if (rule->auth == NULL) - err(1, "calloc"); + err(1, "pfkey_parse: calloc"); } rule->auth->dstid = calloc(1, len); if (rule->auth->dstid == NULL) - err(1, "calloc"); + err(1, "pfkey_parse: calloc"); strlcpy(rule->auth->dstid, (char *)(sident + 1), len); break; @@ -706,7 +706,7 @@ pfkey_parse(struct sadb_msg *msg, struct ipsec_rule *rule) rule->src = calloc(1, sizeof(struct ipsec_addr)); if (rule->src == NULL) - err(1, "calloc"); + err(1, "pfkey_parse: calloc"); } switch (sa->sa_family) { @@ -728,7 +728,7 @@ pfkey_parse(struct sadb_msg *msg, struct ipsec_rule *rule) rule->dst = calloc(1, sizeof(struct ipsec_addr)); if (rule->dst == NULL) - err(1, "calloc"); + err(1, "pfkey_parse: calloc"); } switch (sa->sa_family) { @@ -752,7 +752,7 @@ pfkey_parse(struct sadb_msg *msg, struct ipsec_rule *rule) rule->src = calloc(1, sizeof(struct ipsec_addr)); if (rule->src == NULL) - err(1, "calloc"); + err(1, "pfkey_parse: calloc"); } switch (sa->sa_family) { @@ -776,7 +776,7 @@ pfkey_parse(struct sadb_msg *msg, struct ipsec_rule *rule) rule->dst = calloc(1, sizeof(struct ipsec_addr)); if (rule->dst == NULL) - err(1, "calloc"); + err(1, "pfkey_parse: calloc"); } switch (sa->sa_family) { @@ -921,7 +921,7 @@ int pfkey_init(void) { if ((fd = socket(PF_KEY, SOCK_RAW, PF_KEY_V2)) == -1) - err(1, "failed to open PF_KEY socket"); + err(1, "pfkey_init: failed to open PF_KEY socket"); return 0; } |