summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrob rob@31f1291d-b8d6-0310-a050-a5561fc1590b <rob rob@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2006-08-22 09:28:08 +0000
committerrob rob@31f1291d-b8d6-0310-a050-a5561fc1590b <rob rob@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2006-08-22 09:28:08 +0000
commitd933cd62cb7b88620aa6de431a41e565f96cf056 (patch)
tree52208b5dbe510d0cfa652acbd3f51ef6b0866256 /src
parentd222e75a6dc2a6eb5c48ce6f7a121286b5da7142 (diff)
BUILD : 1.7.15 (1139) BUGS : N/A NOTES : Applied pelxus3 fixs from ThaPrince
git-svn-id: svn://svn.anope.org/anope/trunk@1139 31f1291d-b8d6-0310-a050-a5561fc1590b git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@862 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src')
-rw-r--r--src/log.c7
-rw-r--r--src/misc.c97
-rw-r--r--src/protocol/plexus3.c20
3 files changed, 111 insertions, 13 deletions
diff --git a/src/log.c b/src/log.c
index 60568b4a9..c8c808437 100644
--- a/src/log.c
+++ b/src/log.c
@@ -31,7 +31,7 @@ static int get_logname(char *name, int count, struct tm *tm)
time(&t);
tm = localtime(&t);
}
-
+
/* fix bug 577 */
strftime(timestamp, sizeof(timestamp), "%Y%m%d", tm);
snprintf(name, count, "logs/%s.%s", log_filename, timestamp);
@@ -93,7 +93,7 @@ int open_log(void)
if (logfile)
return 0;
-
+
/* if removed again.. get_logname is always 1 */
get_logname(name, sizeof(name), NULL);
logfile = fopen(name, "a");
@@ -320,7 +320,8 @@ void fatal_sockerror(const char *fmt, ...)
fprintf(stderr, "%s FATAL: %s: %s\n", buf, buf2,
ano_sockstrerror(errno_save));
if (servsock >= 0)
- anope_cmd_global(NULL, "FATAL ERROR! %s: %s", buf2, strerror(errno_save));
+ anope_cmd_global(NULL, "FATAL ERROR! %s: %s", buf2,
+ strerror(errno_save));
exit(1);
}
diff --git a/src/misc.c b/src/misc.c
index 3592f7f65..68db04148 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -1210,6 +1210,103 @@ char **buildStringList(char *src, int *number)
return list;
}
+/*
+* strlcat and strlcpy were ripped from openssh 2.5.1p2
+* They had the following Copyright info:
+*
+*
+* Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
+* 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
+
+#ifndef HAVE_STRLCPY
+size_t strlcpy(char *dst, const char *src, size_t siz)
+{
+ char *d = dst;
+ const char *s = src;
+ size_t n = siz;
+
+ /* Copy as many bytes as will fit */
+ if(n != 0 && --n != 0)
+ {
+ do
+ {
+ if((*d++ = *s++) == 0)
+ break;
+ }
+ while(--n != 0);
+ }
+
+ /* Not enough room in dst, add NUL and traverse rest of src */
+ if(n == 0)
+ {
+ if(siz != 0)
+ *d = '\0'; /* NUL-terminate dst */
+ while(*s++)
+ ;
+ }
+
+ return s - src - 1; /* count does not include NUL */
+}
+#endif
+
+
+
+
#ifdef _WIN32
char *GetWindowsVersion(void)
{
diff --git a/src/protocol/plexus3.c b/src/protocol/plexus3.c
index 8a51b5221..016a12dbf 100644
--- a/src/protocol/plexus3.c
+++ b/src/protocol/plexus3.c
@@ -45,9 +45,9 @@ IRCDVar myIrcd[] = {
"+a", /* Mode to set for chan admin */
"-a", /* Mode to unset for chan admin */
"+rd", /* Mode On Reg */
- "N", /* Mode on ID for Roots */
- NULL, /* Mode on ID for Admins */
- NULL, /* Mode on ID for Opers */
+ "N", /* Mode on ID for Roots */
+ NULL, /* Mode on ID for Admins */
+ NULL, /* Mode on ID for Opers */
"-r+d", /* Mode on UnReg */
"+d", /* Mode on Nick Change */
1, /* Supports SGlines */
@@ -1559,18 +1559,18 @@ void
plexus_cmd_svid_umode3 (User * u, char *ts)
{
char modes[512];
- int len;
- strncpy(modes,ircd->modeonreg,512);
- len = strlen(ircd->modeonreg);
+
+ strlcpy(modes, "+r", sizeof(modes));
+
if(ircd->rootmodeonid && is_services_root(u)) {
- strncat(modes,ircd->rootmodeonid,512-len);
+ strlcat(modes, ircd->rootmodeonid, sizeof(modes));
} else if(ircd->adminmodeonid && is_services_admin(u)) {
- strncat(modes,ircd->adminmodeonid,512-len);
+ strlcat(modes, ircd->adminmodeonid, sizeof(modes));
} else if(ircd->opermodeonid && is_services_oper(u)) {
- strncat(modes,ircd->opermodeonid,512-len);
+ strlcat(modes, ircd->opermodeonid, sizeof(modes));
}
if (u->svid != u->timestamp) {
- strncat(modes,"d",1);
+ strlcat(modes, "d", sizeof(modes));
common_svsmode (u, modes, ts);
} else {
common_svsmode (u, modes, NULL);