Explorar o código

* modules_k/permissions: subnet matching fix (credits to anonymous)
(cherry picked from commit f5a29762b6155209721ba0dfc3f30b4a9764c191)

Juha Heinanen %!s(int64=15) %!d(string=hai) anos
pai
achega
ccef7b8729
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      modules_k/permissions/hash.c

+ 1 - 1
modules_k/permissions/hash.c

@@ -565,7 +565,7 @@ int find_group_in_subnet_table(struct subnet* table,
 
 
     i = 0;
     i = 0;
     while (i < count) {
     while (i < count) {
-	subnet = ip_addr << table[i].mask;
+	subnet = htonl(ntohl(ip_addr) >> table[i].mask);
 	if ((table[i].subnet == subnet) &&
 	if ((table[i].subnet == subnet) &&
 	    ((table[i].port == port) || (table[i].port == 0)))
 	    ((table[i].port == port) || (table[i].port == 0)))
 	    return table[i].grp;
 	    return table[i].grp;