From a64c5173a79fe18b4d2ae28d824b785a888ddada Mon Sep 17 00:00:00 2001 From: Valery Yatsko Date: Sun, 20 Apr 2008 08:44:04 +0400 Subject: [PATCH] strlcat -> rb_strlcat --- extensions/ip_cloaking_old.c | 2 +- extensions/m_identify.c | 4 +-- extensions/m_omode.c | 4 +-- include/irc_string.h | 4 --- modules/core/m_join.c | 2 +- modules/m_etrace.c | 4 +-- modules/m_map.c | 8 ++--- modules/m_privs.c | 14 ++++---- modules/m_rehash.c | 4 +-- modules/m_scan.c | 4 +-- src/channel.c | 2 +- src/irc_string.c | 62 ------------------------------------ src/s_conf.c | 2 +- src/supported.c | 8 ++--- 14 files changed, 29 insertions(+), 95 deletions(-) diff --git a/extensions/ip_cloaking_old.c b/extensions/ip_cloaking_old.c index 6c186b6..ea2c6bc 100644 --- a/extensions/ip_cloaking_old.c +++ b/extensions/ip_cloaking_old.c @@ -102,7 +102,7 @@ do_host_cloak(const char *inbuf, char *outbuf, int ipmask) /* try to avoid truncation -- jilles */ while (len1 + strlen(rest) >= HOSTLEN && (next = strchr(rest + 1, '.')) != NULL) rest = next; - strlcat(outbuf, rest, HOSTLEN); + rb_strlcat(outbuf, rest, HOSTLEN); } else rb_snprintf(outbuf, HOSTLEN, "%X%X.%s", diff --git a/extensions/m_identify.c b/extensions/m_identify.c index f74921c..76533c2 100644 --- a/extensions/m_identify.c +++ b/extensions/m_identify.c @@ -71,8 +71,8 @@ char *reconstruct_parv(int parc, const char *parv[]) rb_strlcpy(tmpbuf, parv[0], BUFSIZE); for (i = 1; i < parc; i++) { - strlcat(tmpbuf, " ", BUFSIZE); - strlcat(tmpbuf, parv[i], BUFSIZE); + rb_strlcat(tmpbuf, " ", BUFSIZE); + rb_strlcat(tmpbuf, parv[i], BUFSIZE); } return tmpbuf; } diff --git a/extensions/m_omode.c b/extensions/m_omode.c index 3c33f16..cb2b0d3 100644 --- a/extensions/m_omode.c +++ b/extensions/m_omode.c @@ -105,8 +105,8 @@ mo_omode(struct Client *client_p, struct Client *source_p, int parc, const char for (i = 2; i < parc; i++) { if (i != 2) - strlcat(params, " ", sizeof params); - strlcat(params, parv[i], sizeof params); + rb_strlcat(params, " ", sizeof params); + rb_strlcat(params, parv[i], sizeof params); } sendto_wallops_flags(UMODE_WALLOP, &me, diff --git a/include/irc_string.h b/include/irc_string.h index 123c8b6..51ea0fd 100644 --- a/include/irc_string.h +++ b/include/irc_string.h @@ -91,10 +91,6 @@ int inetpton(int af, const char *src, void *dst); const char *inetntop_sock(struct sockaddr *src, char *dst, unsigned int size); int inetpton_sock(const char *src, struct sockaddr *dst); -#ifndef HAVE_STRLCAT -size_t strlcat(char *dst, const char *src, size_t siz); -#endif - /* * clean_string - cleanup control and high ascii characters * -Dianora diff --git a/modules/core/m_join.c b/modules/core/m_join.c index 2d62410..f664644 100644 --- a/modules/core/m_join.c +++ b/modules/core/m_join.c @@ -205,7 +205,7 @@ m_join(struct Client *client_p, struct Client *source_p, int parc, const char *p if(*jbuf) (void) strcat(jbuf, ","); - (void) strlcat(jbuf, name, sizeof(jbuf)); + (void) rb_strlcat(jbuf, name, sizeof(jbuf)); } if(parc > 2) diff --git a/modules/m_etrace.c b/modules/m_etrace.c index 92d2ca4..9e2998d 100644 --- a/modules/m_etrace.c +++ b/modules/m_etrace.c @@ -417,8 +417,8 @@ mo_masktrace(struct Client *client_p, struct Client *source_p, int parc, char buf[512]; rb_strlcpy(buf, mask, sizeof(buf)); if(!EmptyString(gecos)) { - strlcat(buf, " ", sizeof(buf)); - strlcat(buf, gecos, sizeof(buf)); + rb_strlcat(buf, " ", sizeof(buf)); + rb_strlcat(buf, gecos, sizeof(buf)); } report_operspy(source_p, "MASKTRACE", buf); diff --git a/modules/m_map.c b/modules/m_map.c index d86fe67..cbcfad8 100644 --- a/modules/m_map.c +++ b/modules/m_map.c @@ -92,12 +92,12 @@ dump_map(struct Client *client_p, struct Client *root_p, char *pbuf) rb_dlink_node *ptr; *pbuf = '\0'; - strlcat(pbuf, root_p->name, BUFSIZE); + rb_strlcat(pbuf, root_p->name, BUFSIZE); if (has_id(root_p)) { - strlcat(pbuf, "[", BUFSIZE); - strlcat(pbuf, root_p->id, BUFSIZE); - strlcat(pbuf, "]", BUFSIZE); + rb_strlcat(pbuf, "[", BUFSIZE); + rb_strlcat(pbuf, root_p->id, BUFSIZE); + rb_strlcat(pbuf, "]", BUFSIZE); } len = strlen(buf); buf[len] = ' '; diff --git a/modules/m_privs.c b/modules/m_privs.c index a11d7b5..e4479f6 100644 --- a/modules/m_privs.c +++ b/modules/m_privs.c @@ -107,17 +107,17 @@ static void show_privs(struct Client *source_p, struct Client *target_p) if (target_p->flags2 & p->mode) { if (buf[0] != '\0') - strlcat(buf, " ", sizeof buf); - strlcat(buf, p->name, sizeof buf); + rb_strlcat(buf, " ", sizeof buf); + rb_strlcat(buf, p->name, sizeof buf); } p++; } if (IsOper(target_p)) { if (buf[0] != '\0') - strlcat(buf, " ", sizeof buf); - strlcat(buf, "operator:", sizeof buf); - strlcat(buf, target_p->localClient->opername, sizeof buf); + rb_strlcat(buf, " ", sizeof buf); + rb_strlcat(buf, "operator:", sizeof buf); + rb_strlcat(buf, target_p->localClient->opername, sizeof buf); } p = &auth_client_table[0]; while (p->name != NULL) @@ -125,8 +125,8 @@ static void show_privs(struct Client *source_p, struct Client *target_p) if (target_p->flags2 & p->mode) { if (buf[0] != '\0') - strlcat(buf, " ", sizeof buf); - strlcat(buf, p->name, sizeof buf); + rb_strlcat(buf, " ", sizeof buf); + rb_strlcat(buf, p->name, sizeof buf); } p++; } diff --git a/modules/m_rehash.c b/modules/m_rehash.c index dc81c43..ff0a08a 100644 --- a/modules/m_rehash.c +++ b/modules/m_rehash.c @@ -285,8 +285,8 @@ do_rehash(struct Client *source_p, const char *type) for (x = 0; rehash_commands[x].cmd != NULL && rehash_commands[x].handler != NULL; x++) { - strlcat(cmdbuf, " ", sizeof(cmdbuf)); - strlcat(cmdbuf, rehash_commands[x].cmd, sizeof(cmdbuf)); + rb_strlcat(cmdbuf, " ", sizeof(cmdbuf)); + rb_strlcat(cmdbuf, rehash_commands[x].cmd, sizeof(cmdbuf)); } sendto_one_notice(source_p, ":rehash one of:%s", cmdbuf); } diff --git a/modules/m_scan.c b/modules/m_scan.c index bee5e47..ecb10e9 100644 --- a/modules/m_scan.c +++ b/modules/m_scan.c @@ -181,8 +181,8 @@ scan_umodes(struct Client *client_p, struct Client *source_p, int parc, rb_strlcpy(buf, "UMODES", sizeof buf); for (i = 2; i < parc; i++) { - strlcat(buf, " ", sizeof buf); - strlcat(buf, parv[i], sizeof buf); + rb_strlcat(buf, " ", sizeof buf); + rb_strlcat(buf, parv[i], sizeof buf); } report_operspy(source_p, "SCAN", buf); } diff --git a/src/channel.c b/src/channel.c index 1fb8863..d03744e 100644 --- a/src/channel.c +++ b/src/channel.c @@ -1161,7 +1161,7 @@ channel_modes(struct Channel *chptr, struct Client *client_p) *mbuf = '\0'; rb_strlcpy(final, buf1, sizeof final); - strlcat(final, buf2, sizeof final); + rb_strlcat(final, buf2, sizeof final); return final; } diff --git a/src/irc_string.c b/src/irc_string.c index 4728deb..8fae82a 100644 --- a/src/irc_string.c +++ b/src/irc_string.c @@ -725,68 +725,6 @@ inetpton(af, src, dst) /* NOTREACHED */ } -/* - * strlcat and strlcpy were ripped from openssh 2.5.1p2 - * They had the following Copyright info: - * - * - * Copyright (c) 1998 Todd C. Miller - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED `AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - - -#ifndef HAVE_STRLCAT -size_t -strlcat(char *dst, const char *src, size_t siz) -{ - char *d = dst; - const char *s = src; - size_t n = siz, dlen; - - while(n-- != 0 && *d != '\0') - d++; - dlen = d - dst; - n = siz - dlen; - - if(n == 0) - return (dlen + strlen(s)); - while(*s != '\0') - { - if(n != 1) - { - *d++ = *s; - n--; - } - s++; - } - *d = '\0'; - return (dlen + (s - src)); /* count does not include NUL */ -} -#endif - char * strip_colour(char *string) { diff --git a/src/s_conf.c b/src/s_conf.c index 632d481..cfa4cb2 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -314,7 +314,7 @@ verify_access(struct Client *client_p, const char *username) else { rb_strlcpy(non_ident, "~", sizeof(non_ident)); - strlcat(non_ident, username, sizeof(non_ident)); + rb_strlcat(non_ident, username, sizeof(non_ident)); aconf = find_address_conf(client_p->host, client_p->sockhost, non_ident, client_p->username, (struct sockaddr *) &client_p->localClient->ip, diff --git a/src/supported.c b/src/supported.c index 001a192..b062d55 100644 --- a/src/supported.c +++ b/src/supported.c @@ -162,12 +162,12 @@ show_isupport(struct Client *client_p) nchars = extra_space, nparams = 0, buf[0] = '\0'; } if (nparams > 0) - strlcat(buf, " ", sizeof buf), nchars++; - strlcat(buf, item->name, sizeof buf); + rb_strlcat(buf, " ", sizeof buf), nchars++; + rb_strlcat(buf, item->name, sizeof buf); if (!EmptyString(value)) { - strlcat(buf, "=", sizeof buf); - strlcat(buf, value, sizeof buf); + rb_strlcat(buf, "=", sizeof buf); + rb_strlcat(buf, value, sizeof buf); } nchars += l; nparams++;