From: NurPech Date: Fri, 30 Aug 2013 19:35:17 +0000 (+0200) Subject: fixed devnull handling X-Git-Url: http://git.pk910.de/?p=srvx.git;a=commitdiff_plain;h=b9daa4d2d5659d90b8f3052496eabda6b9f7beb5 fixed devnull handling --- diff --git a/src/mod-hostserv.c b/src/mod-hostserv.c index 24de72d..462bed9 100644 --- a/src/mod-hostserv.c +++ b/src/mod-hostserv.c @@ -1281,17 +1281,10 @@ struct devnull_class hostserv_get_user_priv(struct handle_info *hi) { struct hs_user *huser = hs_get_user(hi, 0); if(huser) { - struct hs_assignment *assignment; - struct hs_secondlevel *slfh; struct devnull_class *devc; - for(assignment = huser->assignments; assignment; assignment = assignment->unext) { - slfh = assignment->secondlevel; - if(slfh->devnull_id) { - devc = devnull_find_id(slfh->devnull_id); - if(!devc) { - slfh->devnull_id = 0; - continue; - } + if(hi->devnull_id != 0) { + devc = devnull_find_id(huser->hi->devnull_id); + if(devc) { if(DEVNULL_HAS_PRIV(devc, CHANLIMIT) && (!DEVNULL_HAS_PRIV(&th, CHANLIMIT) || th.maxchan < devc->maxchan)) th.maxchan = devc->maxchan; if(DEVNULL_HAS_PRIV(devc, MAXSENDQ) && (!DEVNULL_HAS_PRIV(&th, MAXSENDQ) || th.maxsendq < devc->maxsendq)) @@ -1300,6 +1293,26 @@ struct devnull_class hostserv_get_user_priv(struct handle_info *hi) { if(!th.name) th.name = devc->name; } + } else { + struct hs_assignment *assignment; + struct hs_secondlevel *slfh; + for(assignment = huser->assignments; assignment; assignment = assignment->unext) { + slfh = assignment->secondlevel; + if(slfh->devnull_id) { + devc = devnull_find_id(slfh->devnull_id); + if(!devc) { + slfh->devnull_id = 0; + continue; + } + if(DEVNULL_HAS_PRIV(devc, CHANLIMIT) && (!DEVNULL_HAS_PRIV(&th, CHANLIMIT) || th.maxchan < devc->maxchan)) + th.maxchan = devc->maxchan; + if(DEVNULL_HAS_PRIV(devc, MAXSENDQ) && (!DEVNULL_HAS_PRIV(&th, MAXSENDQ) || th.maxsendq < devc->maxsendq)) + th.maxsendq = devc->maxsendq; + th.modes |= devc->modes; + if(!th.name) + th.name = devc->name; + } + } } } return th;