projects
/
srvx.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
75881d1
)
Get rid of ugly goto in opt_fakehost.
author
ThiefMaster
<thiefmaster@gamesurge.net>
Mon, 7 Sep 2009 11:25:49 +0000
(13:25 +0200)
committer
Michael Poole
<mdpoole@troilus.org>
Mon, 15 Feb 2010 20:57:23 +0000
(15:57 -0500)
src/nickserv.c
patch
|
blob
|
history
diff --git
a/src/nickserv.c
b/src/nickserv.c
index 4675b8b8b09a8b022624e7a3f6c7bee672261361..0144fba56f13bc2d0aecd3eb281a6d07652e59b8 100644
(file)
--- a/
src/nickserv.c
+++ b/
src/nickserv.c
@@
-2650,10
+2650,14
@@
static OPTION_FUNC(opt_fakehost)
safestrncpy(mask, argv[1], sizeof(mask));
if ((host = strrchr(mask, '@')) && host != mask) {
safestrncpy(mask, argv[1], sizeof(mask));
if ((host = strrchr(mask, '@')) && host != mask) {
- if(!oper_has_access(user, nickserv, nickserv_conf.set_fakeident_level, 0))
- goto no_access;
- ident = mask;
- *host++ = '\0';
+ // If ident@host was used and the user doesn't have access to set idents, do not change anything.
+ if (!oper_has_access(user, nickserv, nickserv_conf.set_fakeident_level, 0)) {
+ host = NULL;
+ ident = NULL;
+ } else {
+ ident = mask;
+ *host++ = '\0';
+ }
} else {
ident = NULL;
host = mask;
} else {
ident = NULL;
host = mask;
@@
-2664,12
+2668,12
@@
static OPTION_FUNC(opt_fakehost)
return 0;
}
return 0;
}
- if (
(strlen(host) > HOSTLEN) || (host[0] == '.'
)) {
+ if (
host && ((strlen(host) > HOSTLEN) || (host[0] == '.')
)) {
send_message(user, nickserv, "NSMSG_FAKEHOST_INVALID", HOSTLEN);
return 0;
}
send_message(user, nickserv, "NSMSG_FAKEHOST_INVALID", HOSTLEN);
return 0;
}
- if (host[0]) {
+ if (host
&& host
[0]) {
free(hi->fakehost);
if (!strcmp(host, "*"))
hi->fakehost = NULL;
free(hi->fakehost);
if (!strcmp(host, "*"))
hi->fakehost = NULL;
@@
-2693,7
+2697,6
@@
static OPTION_FUNC(opt_fakehost)
apply_fakehost(hi, NULL);
} else {
apply_fakehost(hi, NULL);
} else {
-no_access:
host = generate_fakehost(hi);
ident = generate_fakeident(hi, NULL);
}
host = generate_fakehost(hi);
ident = generate_fakeident(hi, NULL);
}