fixed coding fails in the last 2 commits
[srvx.git] / src / opserv.c
index c4844b7604a67c8b53cd0767445bb72a1d3db4c2..69a21fc9d87dc8cf7b75542e418e5495638b8786 100644 (file)
@@ -2848,7 +2848,7 @@ static int
 devnull_class_read(const char *name, void *data, UNUSED_ARG(void *extra))
 {
     struct record_data *rd = data;
-    const char *nameb = name, *str;
+    const char *str;
     unsigned long modes, maxchan, maxsendq;
     unsigned int id, ii;
 
@@ -4745,28 +4745,26 @@ struct devnull_class *devnull_find_name(const char *name) {
 
 int devnull_user_has_priv(struct handle_info *hi, int devnull_priv) {
     if(devnull_check_priv_func) {
-        int ext_privs = ((struct devnull_class (*)(struct handle_info *))devnull_check_priv_func)(hi, devnull_priv);
-        if((ext_privs & devnull_priv))
-            return (ext_privs & devnull_priv);
+        struct devnull_class ext_class = ((struct devnull_class (*)(struct handle_info *))devnull_check_priv_func)(hi);
+        if((ext_class.modes & devnull_priv))
+            return (ext_class.modes & devnull_priv);
     }
     
-    if(!hi->devnull)
+    if(!hi->devnull_id)
         return 0;
-    struct devnull_class *th;
-    if(!(th = dict_find(opserv_devnull_classes, hi->devnull, NULL)))
+    struct devnull_class *th = devnull_find_id(hi->devnull_id);
+    if(!th)
         return 0;
-    
     return (th->modes & devnull_priv);
 }
 
 struct devnull_class devnull_user_get_class(struct handle_info *hi) {
     struct devnull_class th;
-    th.name = NULL;
-    th.modes = 0;
+    memset(&th, 0, sizeof(th));
     
-    if(hi->devnull) {
+    if(hi->devnull_id) {
         struct devnull_class *thp;
-        if((thp = dict_find(opserv_devnull_classes, hi->devnull, NULL))) {
+        if((thp = devnull_find_id(hi->devnull_id))) {
             if(DEVNULL_HAS_PRIV(thp, CHANLIMIT) && (!DEVNULL_HAS_PRIV(&th, CHANLIMIT) || th.maxchan < thp->maxchan))
                 th.maxchan = thp->maxchan;
             if(DEVNULL_HAS_PRIV(thp, MAXSENDQ) && (!DEVNULL_HAS_PRIV(&th, MAXSENDQ) || th.maxsendq < thp->maxsendq))