bugfixes in command "oset"
[srvx.git] / src / mod-hostserv.c
index 234d6100a028cb08bcd1f418fc541cb1b7394a75..a652043519c83565eb9ad0b22d53ab89eee6fa96 100644 (file)
@@ -29,6 +29,8 @@
  *         "manager_can_del_toplevel" "0"; //managers of a toplevel group may delete the whole group
  *         "manager_can_rename_secondlevel" "0"; //managers of a secondlevel group may rename the whole group
  *         "manager_can_del_secondlevel" "0"; //managers of a secondlevel group may delete the whole group
+ *                "manager_toplevel_can_oset" "0"; //managers of a toplevel group can set other user's fakehosts
+ *         "manager_secondlevel_can_oset" "0"; //managers of a secondlevel group can set other user's fakehosts
  *     };
  *  };
  *
@@ -1165,7 +1167,7 @@ static MODCMD_FUNC(cmd_unassign) {
 static MODCMD_FUNC(cmd_oset) {
     struct handle_info *hi;
     char *fakehost;
-       struct hs_assignment *assgn;
+       struct hs_assignment *assignment;
     if(!strchr(argv[1], '.')) {
         if (!(hi = modcmd_get_handle_info(user, argv[1])))
             return 0;
@@ -1179,8 +1181,9 @@ static MODCMD_FUNC(cmd_oset) {
         reply("NSMSG_MUST_AUTH");
         return 0;
     }
+       struct hs_user *hs_user = hs_get_user(hi, 1);
        if(!strcmp(argv[1], "*")) {
-               if(!check_management_access(user->handle_info)) {
+               if(!check_management_access(user->handle_info, NULL, NULL)) {
             reply("HSMSG_ACCESS_DENIED");
             return 0;
         }
@@ -1195,11 +1198,12 @@ static MODCMD_FUNC(cmd_oset) {
            reply("HSMSG_UNKNOWN_FAKEHOST", fhinfo.slfh_name, fhinfo.tlfh_name);
            return 0;
         }
-        struct hs_user *hs_user = hs_get_user(hi, 1);
         if(!check_management_access(user->handle_info, (hostserv_conf.manager_toplevel_can_oset ? fhinfo.tlfh : NULL), (hostserv_conf.manager_secondlevel_can_oset ? fhinfo.slfh : NULL))) {
             reply("HSMSG_ACCESS_DENIED");
             return 0;
         }
+               struct hs_toplevel *tlfh;
+               struct hs_secondlevel *slfh;
         for(assignment = hs_user->assignments; assignment; assignment = assignment->unext) {
             slfh = assignment->secondlevel;
             tlfh = slfh->toplevel;