From 103a9f036909cb2717a8bb479fc9a71b22d7483f Mon Sep 17 00:00:00 2001 From: kyoshiro Date: Fri, 13 May 2005 13:58:24 +0000 Subject: [PATCH] fix oidentd spoof remove old unsued spoof functions --- src/irc.c | 10 ++++++++-- src/util.c | 58 ------------------------------------------------------ src/util.h | 2 -- 3 files changed, 8 insertions(+), 62 deletions(-) diff --git a/src/irc.c b/src/irc.c index f766d8f..b0898f0 100644 --- a/src/irc.c +++ b/src/irc.c @@ -1829,6 +1829,7 @@ void oidentd_dump(list_t *connl) FILE *f; char *home; char tmpbuf[256]; + int err; home = getenv("HOME"); if (!home) @@ -1855,16 +1856,21 @@ void oidentd_dump(list_t *connl) remoteip = connection_remoteip(CONN(ls)); remoteport = connection_remoteport(CONN(ls)); - fprintf(f, "to %s lport %d from %s fport %d {\n", + fprintf(f, "to %s fport %d from %s lport %d {\n", remoteip, remoteport, localip, localport); - fprintf(f, "\treply %s\n", l->user); + fprintf(f, "\treply \"%s\"\n", l->user); fprintf(f, "}\n"); free(localip); free(remoteip); } } fclose(f); + err = chmod(tmpbuf, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); + if (err) { + mylog(LOG_WARN, "Unable to set modes for '%s': %s", tmpbuf, + strerror(errno)); + } } #endif diff --git a/src/util.c b/src/util.c index b015c59..d00c7f2 100644 --- a/src/util.c +++ b/src/util.c @@ -558,64 +558,6 @@ char *strmaydup(char *s) } -/* returns 1 on error */ -int ident_spoof(char *user) -{ - char *h; - char buf[1024]; - mode_t ou; - FILE *of; - int cnt = 0; - - /* get home dir or return an error */ - h = getenv("HOME"); - if (h == NULL) - return 1; - - /* first we set umask correctly */ - ou = umask(0022); - - snprintf(buf, 1024, "%s/.ispoof", h); - of = fopen(buf, "w"); - if (of) { - fprintf(of, "%s\n", user); - fclose(of); - cnt++; - } - snprintf(buf, 1024, "%s/.oidentd.conf", h); - of = fopen(buf, "w"); - if (of) { - fprintf(of, "global { reply \"%s\" }\n", user); - fclose(of); - cnt++; - } - - /* restore old umask */ - umask(ou); - - return (cnt == 2); -} - -/* returns 1 on error */ -int ident_nospoof() -{ - char *h; - char buf[1024]; - int e, cnt; - - /* get home dir or return an error */ - h = getenv("HOME"); - if (h == NULL) - return 1; - - snprintf(buf, 1024, "%s/.ispoof", h); - e = unlink(buf); - cnt = (e == -1 && errno != ENOENT ? 1 : 0); - snprintf(buf, 1024, "%s/.oidentd.conf", h); - e = unlink(buf); - return cnt+(e == -1 && errno != ENOENT ? 1 : 0); -} - void strucase(char *s) { while (*s) { diff --git a/src/util.h b/src/util.h index a512c4c..549aba3 100644 --- a/src/util.h +++ b/src/util.h @@ -96,8 +96,6 @@ int is_valid_nick(char *str); int is_valid_username(char *str); char *strmaydup(char *s); -int ident_spoof(char *user); -int ident_nospoof(); void strucase(char *s); int ischannel(char p); #endif