diff options
author | Stef Walter <stef@memberwebs.com> | 2004-07-10 04:33:23 +0000 |
---|---|---|
committer | Stef Walter <stef@memberwebs.com> | 2004-07-10 04:33:23 +0000 |
commit | 6a5396610bd5a37f139e2e6b728fe2928df48d31 (patch) | |
tree | 378743e9ae1fb45e324890cf21a3ff04ec964ab8 /src | |
parent | ac7e532095160a85ca03476aa707ef80a8a8ce5b (diff) |
Initial Public Release
Diffstat (limited to 'src')
-rw-r--r-- | src/clamsmtpd.8 | 47 | ||||
-rw-r--r-- | src/clamsmtpd.c | 232 | ||||
-rw-r--r-- | src/clamsmtpd.h | 38 | ||||
-rw-r--r-- | src/compat.c | 37 | ||||
-rw-r--r-- | src/compat.h | 38 | ||||
-rw-r--r-- | src/sock_any.c | 39 | ||||
-rw-r--r-- | src/sock_any.h | 37 | ||||
-rw-r--r-- | src/usuals.h | 38 | ||||
-rw-r--r-- | src/util.c | 37 | ||||
-rw-r--r-- | src/util.h | 37 |
10 files changed, 498 insertions, 82 deletions
diff --git a/src/clamsmtpd.8 b/src/clamsmtpd.8 index 4d3b55c..00ff1aa 100644 --- a/src/clamsmtpd.8 +++ b/src/clamsmtpd.8 @@ -1,3 +1,39 @@ +.\" +.\" Copyright (c) 2004, Nate Nielsen +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" +.\" * Redistributions of source code must retain the above +.\" copyright notice, this list of conditions and the +.\" following disclaimer. +.\" * 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. +.\" * The names of contributors to this software may not be +.\" used to endorse or promote products derived from this +.\" software without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +.\" "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 +.\" COPYRIGHT OWNER OR CONTRIBUTORS 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. +.\" +.\" +.\" CONTRIBUTORS +.\" Nate Nielsen <nielsen@memberwebs.com> +.\" .Dd July, 2004 .Dt clamsmtpd 8 .Os clamsmtp @@ -13,12 +49,13 @@ .Op Fl l Ar listenaddr .Op Fl m Ar maxconn .Op Fl p Ar pidfile +.Op Fl r .Op Fl t Ar timeout .Ar serveraddr .Sh DESCRIPTION .Nm -is an SMTP filter that allows you to check for viruses via using ClamAV -virus software. It accepts SMTP connections and forwards the SMTP commands +is an SMTP filter that allows you to check for viruses using the ClamAV +anti-virus software. It accepts SMTP connections and forwards the SMTP commands and responses to another SMTP server. .Pp The DATA email body is intercepted and scanned before forwarding. Email with @@ -40,6 +77,12 @@ is listening for connections. .Sh OPTIONS The options are as follows: .Bl -tag -width Fl +.It Fl b +When this flag is set +.Nm +actively rejects messages with viruses. This may cause the sender to receive +a message back notifying them of the virus. In most cases this is not a good +idea since many viruses spoof sender addresses. .It Fl c .Ar clamaddr specifies the address to connect to diff --git a/src/clamsmtpd.c b/src/clamsmtpd.c index 71e5a3f..201f345 100644 --- a/src/clamsmtpd.c +++ b/src/clamsmtpd.c @@ -1,3 +1,40 @@ +/* + * Copyright (c) 2004, Nate Nielsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above + * copyright notice, this list of conditions and the + * following disclaimer. + * * 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. + * * The names of contributors to this software may not be + * used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "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 + * COPYRIGHT OWNER OR CONTRIBUTORS 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. + * + * + * CONTRIBUTORS + * Nate Nielsen <nielsen@memberwebs.com> + * + */ #include <sys/time.h> #include <sys/types.h> @@ -46,10 +83,13 @@ clamsmtp_thread_t; #define SMTP_DATAVIRUS "550 Virus Detected; Content Rejected\r\n" #define SMTP_DATAINTERMED "354 Start mail input; end with <CRLF>.<CRLF>\r\n" #define SMTP_FAILED "451 Local Error\r\n" +#define SMTP_NOTSUPP "502 Command not implemented\r\n" +#define SMTP_DATAVIRUSOK "250 Virus Detected; Discarded Email\r\n" #define SMTP_DATA "DATA\r\n" #define SMTP_DELIMS "\r\n\t :" +#define EHLO_CMD "EHLO" #define FROM_CMD "MAIL FROM" #define TO_CMD "RCPT TO" #define DATA_CMD "DATA" @@ -98,6 +138,7 @@ const char* g_clamname = DEFAULT_CLAMAV; const char* g_header = DEFAULT_HEADER; /* The header to add to email */ const char* g_directory = _PATH_TMP; /* The directory for temp files */ unsigned int g_unique_id = 0x00001000; /* For connection ids */ +int g_bounce = 0; /* Send back a reject line */ /* For main loop and signal handlers */ int g_quit = 0; @@ -113,7 +154,7 @@ pthread_mutexattr_t g_mutexattr; static usage(); static void on_quit(int signal); -static void write_pid(const char* pid); +static void pid_file(const char* pid, int write); static void connection_loop(int sock); static void* thread_main(void* arg); static int smtp_passthru(clamsmtp_context_t* ctx); @@ -145,10 +186,15 @@ int main(int argc, char* argv[]) char* t; /* Parse the arguments nicely */ - while((ch = getopt(argc, argv, "c:d:D:h:l:m:p:t:")) != -1) + while((ch = getopt(argc, argv, "bc:d:D:h:l:m:p:t:")) != -1) { switch(ch) { + /* Actively reject messages */ + case 'b': + g_bounce = 1; + break; + /* Change the CLAM socket */ case 'c': g_clamname = optarg; @@ -226,6 +272,22 @@ int main(int argc, char* argv[]) if(sock_any_pton(g_clamname, &g_clamaddr, 0) == -1) errx(1, "invalid clam socket name: %s", g_clamname); + if(daemonize) + { + /* Fork a daemon nicely here */ + if(daemon(0, 0) == -1) + { + message(NULL, LOG_ERR, "couldn't run as daemon"); + exit(1); + } + + messagex(NULL, LOG_DEBUG, "running as a daemon"); + g_daemonized = 1; + + /* Open the system log */ + openlog("clamsmtpd", 0, LOG_MAIL); + } + /* Create the socket */ sock = socket(SANY_TYPE(addr), SOCK_STREAM, 0); if(sock < 0) @@ -246,25 +308,6 @@ int main(int argc, char* argv[]) messagex(NULL, LOG_DEBUG, "created socket: %s", listensock); - if(daemonize) - { - /* Fork a daemon nicely here */ - if(daemon(0, 0) == -1) - { - message(NULL, LOG_ERR, "couldn't run as daemon"); - exit(1); - } - - messagex(NULL, LOG_DEBUG, "running as a daemon"); - g_daemonized = 1; - - /* Open the system log */ - openlog("clamsmtp", 0, LOG_MAIL); - } - - if(pidfile) - write_pid(pidfile); - /* Handle some signals */ signal(SIGPIPE, SIG_IGN); signal(SIGHUP, SIG_IGN); @@ -274,10 +317,16 @@ int main(int argc, char* argv[]) siginterrupt(SIGINT, 1); siginterrupt(SIGTERM, 1); + if(pidfile) + pid_file(pidfile, 1); + messagex(NULL, LOG_DEBUG, "accepting connections"); connection_loop(sock); + if(pidfile) + pid_file(pidfile, 0); + messagex(NULL, LOG_DEBUG, "stopped"); return 0; @@ -377,7 +426,7 @@ static void connection_loop(int sock) } } - messagex(NULL, LOG_INFO, "waiting for threads to quit"); + messagex(NULL, LOG_DEBUG, "waiting for threads to quit"); /* Quit all threads here */ for(i = 0; i < g_maxthreads; i++) @@ -406,26 +455,37 @@ static void on_quit(int signal) static int usage() { - fprintf(stderr, "clamsmtp [-c clamaddr] [-d debuglevel] [-D tmpdir] [-h header]" + fprintf(stderr, "clamsmtpd [-b] [-c clamaddr] [-d debuglevel] [-D tmpdir] [-h header] " "[-l listenaddr] [-m maxconn] [-p pidfile] [-t timeout] serveraddr\n"); - return 2; + exit(2); } -static void write_pid(const char* pidfile) +static void pid_file(const char* pidfile, int write) { - FILE* f = fopen(pidfile, "w"); - if(f == NULL) + if(write) { - message(NULL, LOG_ERR, "couldn't open pid file: %s", pidfile); + FILE* f = fopen(pidfile, "w"); + if(f == NULL) + { + message(NULL, LOG_ERR, "couldn't open pid file: %s", pidfile); + } + else + { + fprintf(f, "%d\n", (int)getpid()); + + if(ferror(f)) + message(NULL, LOG_ERR, "couldn't write to pid file: %s", pidfile); + + fclose(f); + } + + messagex(NULL, LOG_DEBUG, "wrote pid file: %s", pidfile); } + else { - fprintf(f, "%d\n", (int)getpid()); - - if(ferror(f)) - message(NULL, LOG_ERR, "couldn't write to pid file: %s", pidfile); - - fclose(f); + unlink(pidfile); + messagex(NULL, LOG_DEBUG, "removed pid file: %s", pidfile); } } @@ -456,10 +516,13 @@ static void* thread_main(void* arg) /* Assign a unique id to the connection */ ctx.id = g_unique_id++; + memset(&addr, 0, sizeof(addr)); + SANY_LEN(addr) = sizeof(addr); + /* Get the peer name */ if(getpeername(ctx.client, &SANY_ADDR(addr), &SANY_LEN(addr)) == -1 || sock_any_ntop(&addr, peername, MAXPATHLEN) == -1) - messagex(&ctx, LOG_WARNING, "couldn't get peer address"); + message(&ctx, LOG_WARNING, "couldn't get peer address"); else messagex(&ctx, LOG_INFO, "accepted connection from: %s", peername); @@ -536,54 +599,66 @@ static int smtp_passthru(clamsmtp_context_t* ctx) /* We don't let clients send really long lines */ if(LINE_TOO_LONG(ctx)) { - if(write_data(ctx, &(ctx->server), SMTP_TOOLONG) == -1) + if(write_data(ctx, &(ctx->client), SMTP_TOOLONG) == -1) RETURN(-1); + + continue; } - else + /* Handle the DATA section via our AV checker */ + if(is_first_word(ctx->line, DATA_CMD, KL(DATA_CMD))) { - if(is_first_word(ctx->line, DATA_CMD, KL(DATA_CMD))) - { - /* Send back the intermediate response to the client */ - if(write_data(ctx, &(ctx->client), SMTP_DATAINTERMED) == -1) - RETURN(-1); - - /* - * Now go into avcheck mode. This also handles the eventual - * sending of the data to the server, making the av check - * transparent - */ - if(avcheck_data(ctx, logline) == -1) - RETURN(-1); - - /* Print the log out for this email */ - messagex(ctx, LOG_INFO, "%s", logline); - - /* Reset log line */ - logline[0] = 0; - } + /* Send back the intermediate response to the client */ + if(write_data(ctx, &(ctx->client), SMTP_DATAINTERMED) == -1) + RETURN(-1); - /* All other commands just get passed through to server */ - else - { + /* + * Now go into avcheck mode. This also handles the eventual + * sending of the data to the server, making the av check + * transparent + */ + if(avcheck_data(ctx, logline) == -1) + RETURN(-1); - /* Append recipients to log line */ - if((r = check_first_word(ctx->line, FROM_CMD, KL(FROM_CMD), SMTP_DELIMS)) > 0) - add_to_logline(logline, "from=", ctx->line + r); + /* Print the log out for this email */ + messagex(ctx, LOG_INFO, "%s", logline); - /* Append sender to log line */ - else if((r = check_first_word(ctx->line, TO_CMD, KL(TO_CMD), SMTP_DELIMS)) > 0) - add_to_logline(logline, "to=", ctx->line + r); + /* Reset log line */ + logline[0] = 0; + continue; + } + + /* + * We don't support EHLO (ESMTP) because pipelining + * and other nuances aren't implemented here. In order + * to keep things reliable we just disable it all. + */ + if(is_first_word(ctx->line, EHLO_CMD, KL(EHLO_CMD))) + { + messagex(ctx, LOG_DEBUG, "ESMTP not implemented"); - /* Reset log line */ - else if(is_first_word(ctx->line, RSET_CMD, KL(RSET_CMD))) - logline[0] = 0; + if(write_data(ctx, &(ctx->client), SMTP_NOTSUPP) == -1) + RETURN(-1); - if(write_data(ctx, &(ctx->server), ctx->line) == -1) - RETURN(-1); - } + continue; } + /* Append recipients to log line */ + else if((r = check_first_word(ctx->line, FROM_CMD, KL(FROM_CMD), SMTP_DELIMS)) > 0) + add_to_logline(logline, "from=", ctx->line + r); + + /* Append sender to log line */ + else if((r = check_first_word(ctx->line, TO_CMD, KL(TO_CMD), SMTP_DELIMS)) > 0) + add_to_logline(logline, "to=", ctx->line + r); + + /* Reset log line */ + else if(is_first_word(ctx->line, RSET_CMD, KL(RSET_CMD))) + logline[0] = 0; + + /* All other commands just get passed through to server */ + if(write_data(ctx, &(ctx->server), ctx->line) == -1) + RETURN(-1); + continue; } @@ -721,7 +796,7 @@ static int clam_scan_file(clamsmtp_context_t* ctx, const char* tempname, char* l { int len; - ASSERT(LINE_LENGTH < MAXPATHLEN + 32); + ASSERT(LINE_LENGTH > MAXPATHLEN + 32); strcpy(ctx->line, CLAM_SCAN); strcat(ctx->line, tempname); @@ -813,12 +888,14 @@ static int avcheck_data(clamsmtp_context_t* ctx, char* logline) break; /* - * A virus was found, just send back a simple message to the client. + * A virus was found, normally we just drop the email. But if + * requested we can send a simple message back to our client. * The server doesn't know data was ever sent, and the client can * choose to reset the connection to reuse it if it wants. */ case 1: - if(write_data(ctx, &(ctx->client), SMTP_DATAVIRUS) == -1) + if(write_data(ctx, &(ctx->client), + g_bounce ? SMTP_DATAVIRUS : SMTP_DATAVIRUSOK) == -1) RETURN(-1); break; @@ -1005,7 +1082,8 @@ static int transfer_from_file(clamsmtp_context_t* ctx, const char* filename) */ if(is_blank_line(ctx->line)) { - if(write_data_raw(ctx, &(ctx->server), g_header, strlen(g_header)) == -1) + if(write_data_raw(ctx, &(ctx->server), (char*)g_header, + strlen(g_header)) == -1) RETURN(-1); } @@ -1083,7 +1161,7 @@ static void read_junk(clamsmtp_context_t* ctx, int fd) if(!said && *t) { - messagex(ctx, LOG_WARNING, "received junk data from daemon"); + messagex(ctx, LOG_DEBUG, "received junk data from daemon"); said = 1; } } diff --git a/src/clamsmtpd.h b/src/clamsmtpd.h index 4931e5e..6c08ef4 100644 --- a/src/clamsmtpd.h +++ b/src/clamsmtpd.h @@ -1,3 +1,41 @@ +/* + * Copyright (c) 2004, Nate Nielsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above + * copyright notice, this list of conditions and the + * following disclaimer. + * * 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. + * * The names of contributors to this software may not be + * used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "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 + * COPYRIGHT OWNER OR CONTRIBUTORS 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. + * + * + * CONTRIBUTORS + * Nate Nielsen <nielsen@memberwebs.com> + * + */ + #ifndef __CLAMSMTPD_H__ #define __CLAMSMTPD_H__ diff --git a/src/compat.c b/src/compat.c index baf1e34..54fd760 100644 --- a/src/compat.c +++ b/src/compat.c @@ -1,3 +1,40 @@ +/* + * Copyright (c) 2004, Nate Nielsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above + * copyright notice, this list of conditions and the + * following disclaimer. + * * 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. + * * The names of contributors to this software may not be + * used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "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 + * COPYRIGHT OWNER OR CONTRIBUTORS 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. + * + * + * CONTRIBUTORS + * Nate Nielsen <nielsen@memberwebs.com> + * + */ #include "usuals.h" #include "compat.h" diff --git a/src/compat.h b/src/compat.h index 6c20ae9..0690bfc 100644 --- a/src/compat.h +++ b/src/compat.h @@ -1,4 +1,40 @@ - +/* + * Copyright (c) 2004, Nate Nielsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above + * copyright notice, this list of conditions and the + * following disclaimer. + * * 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. + * * The names of contributors to this software may not be + * used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "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 + * COPYRIGHT OWNER OR CONTRIBUTORS 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. + * + * + * CONTRIBUTORS + * Nate Nielsen <nielsen@memberwebs.com> + * + */ #ifndef _COMPAT_H_ #define _COMPAT_H_ diff --git a/src/sock_any.c b/src/sock_any.c index acac8ee..49e0390 100644 --- a/src/sock_any.c +++ b/src/sock_any.c @@ -1,3 +1,40 @@ +/* + * Copyright (c) 2004, Nate Nielsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above + * copyright notice, this list of conditions and the + * following disclaimer. + * * 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. + * * The names of contributors to this software may not be + * used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "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 + * COPYRIGHT OWNER OR CONTRIBUTORS 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. + * + * + * CONTRIBUTORS + * Nate Nielsen <nielsen@memberwebs.com> + * + */ #include <stdlib.h> #include <errno.h> @@ -13,7 +50,7 @@ int sock_any_pton(const char* addr, struct sockaddr_any* any, int defport) { size_t l; - char buf[256]; /* TODO: Use a constant */ + char buf[256]; char* t; char* t2; diff --git a/src/sock_any.h b/src/sock_any.h index 693bd2a..924bf09 100644 --- a/src/sock_any.h +++ b/src/sock_any.h @@ -1,3 +1,40 @@ +/* + * Copyright (c) 2004, Nate Nielsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above + * copyright notice, this list of conditions and the + * following disclaimer. + * * 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. + * * The names of contributors to this software may not be + * used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "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 + * COPYRIGHT OWNER OR CONTRIBUTORS 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. + * + * + * CONTRIBUTORS + * Nate Nielsen <nielsen@memberwebs.com> + * + */ #ifndef __SOCK_ANY_H__ #define __SOCK_ANY_H__ diff --git a/src/usuals.h b/src/usuals.h index e14ecf5..00410aa 100644 --- a/src/usuals.h +++ b/src/usuals.h @@ -1,4 +1,40 @@ - +/* + * Copyright (c) 2004, Nate Nielsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above + * copyright notice, this list of conditions and the + * following disclaimer. + * * 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. + * * The names of contributors to this software may not be + * used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "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 + * COPYRIGHT OWNER OR CONTRIBUTORS 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. + * + * + * CONTRIBUTORS + * Nate Nielsen <nielsen@memberwebs.com> + * + */ #ifndef __USUALS_H__ #define __USUALS_H__ @@ -1,3 +1,40 @@ +/* + * Copyright (c) 2004, Nate Nielsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above + * copyright notice, this list of conditions and the + * following disclaimer. + * * 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. + * * The names of contributors to this software may not be + * used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "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 + * COPYRIGHT OWNER OR CONTRIBUTORS 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. + * + * + * CONTRIBUTORS + * Nate Nielsen <nielsen@memberwebs.com> + * + */ #include <sys/types.h> @@ -1,3 +1,40 @@ +/* + * Copyright (c) 2004, Nate Nielsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above + * copyright notice, this list of conditions and the + * following disclaimer. + * * 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. + * * The names of contributors to this software may not be + * used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "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 + * COPYRIGHT OWNER OR CONTRIBUTORS 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. + * + * + * CONTRIBUTORS + * Nate Nielsen <nielsen@memberwebs.com> + * + */ #ifndef __UTIL_H__ #define __UTIL_H__ |