summaryrefslogtreecommitdiff
path: root/server/subscr.c
diff options
context:
space:
mode:
authorGravatar Garry Zacheiss <zacheiss@mit.edu>2001-02-28 19:47:05 +0000
committerGravatar Garry Zacheiss <zacheiss@mit.edu>2001-02-28 19:47:05 +0000
commit3136c7a82f39c2d461b473b3fc7f014c61021681 (patch)
treee9ca3d97960f13a59bc57e926b4ac206d3bde33b /server/subscr.c
parent050c6c0229d7ca5b508e0f4f73433ef9390d8b57 (diff)
Fix a couple of small memory leaks, and make zephyrd not mistreat people
who were trying to subscribe to acl'ed classes they weren't on the acl for.
Diffstat (limited to 'server/subscr.c')
-rw-r--r--server/subscr.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/server/subscr.c b/server/subscr.c
index 600dd26..eb3ba27 100644
--- a/server/subscr.c
+++ b/server/subscr.c
@@ -164,26 +164,24 @@ add_subscriptions(who, subs, notice, server)
&& subs->dest.recip->string[0] != '@') {
syslog(LOG_WARNING, "subscr unauth %s recipient %s",
sender->string, subs->dest.recip->string);
- free_subscriptions(subs);
- free_string(sender);
- return ZSRV_CLASSRESTRICTED;
+ free_subscription(subs); /* free this one - denied */
+ continue; /* the for loop */
}
acl = class_get_acl(subs->dest.classname);
if (acl && !realm) {
if (!access_check(sender->string, acl, SUBSCRIBE)) {
syslog(LOG_WARNING, "subscr unauth %s class %s",
sender->string, subs->dest.classname->string);
- free_subscriptions(subs);
- free_string(sender);
- return ZSRV_CLASSRESTRICTED;
+ free_subscription(subs); /* free this one - denied */
+ continue; /* the for loop */
}
if (wildcard_instance == subs->dest.inst) {
if (!access_check(sender->string, acl, INSTWILD)) {
syslog(LOG_WARNING,
"subscr unauth %s class %s wild inst",
sender->string, subs->dest.classname->string);
- free_subscriptions(subs);
- return ZSRV_CLASSRESTRICTED;
+ free_subscription(subs); /* free this one - denied */
+ continue; /* the for loop */
}
}
}
@@ -194,6 +192,8 @@ add_subscriptions(who, subs, notice, server)
free_subscriptions(subs);
free_string(sender);
return(retval);
+ } else {
+ free_subscription(subs); /* free this one, will get from ADD */
}
} else {
retval = triplet_register(who, &subs->dest, NULL);