fix oidentd spoof

remove old unsued spoof functions
This commit is contained in:
kyoshiro 2005-05-13 13:58:24 +00:00
parent 9a005cbb80
commit 103a9f0369
3 changed files with 8 additions and 62 deletions

View File

@ -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

View File

@ -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) {

View File

@ -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