File: 1024_fix-mess-of-using-and-comparing-int-and-string-values.patch

package info (click to toggle)
gosa 2.8~git20230203.10abe45%2Bdfsg-1%2Bdeb12u2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 32,364 kB
  • sloc: php: 32,085; javascript: 10,836; pascal: 3,775; xml: 3,135; sh: 852; python: 162; makefile: 45; perl: 2
file content (58 lines) | stat: -rw-r--r-- 1,766 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
--- a/plugins/personal/posix/class_posixAccount.inc
+++ b/plugins/personal/posix/class_posixAccount.inc
@@ -155,7 +155,9 @@
       $this->initially_was_account= $this->is_account;
 
       /* Fill group */
-      $this->primaryGroup= $this->gidNumber;
+      if ($this->gidNumber !== "") {
+          $this->primaryGroup= intval($this->gidNumber);
+      }
 
       /* Generate status text */
       $current= date("U");
@@ -634,10 +636,10 @@
       /*Save primary group settings */
       if($this->acl_is_writeable("primaryGroup") && isset($_POST['primaryGroup'])){
         $data= get_post('primaryGroup');
-        if ($this->primaryGroup != $data){
+        if ($this->primaryGroup != intval($data)){
           $this->is_modified= TRUE;
         }
-        $this->primaryGroup= get_post('primaryGroup');
+        $this->primaryGroup= intval(get_post('primaryGroup'));
       }
 
       /* Get seelcted shadow checkboxes */
@@ -934,7 +936,7 @@
     }
 
     /* Check ID's if they are forced by user */
-    if ($this->force_ids == "1"){
+    if ($this->force_ids == 1){
 
       /* Valid uid/gid? */
       if (!tests::is_id($this->uidNumber)){
@@ -1239,11 +1241,11 @@
         $this->is_modified= TRUE;
       }
       $this->force_ids= $data;
-      $data= get_post('primaryGroup');
+      $data= intval(get_post('primaryGroup'));
       if ($this->primaryGroup != $data){
         $this->is_modified= TRUE;
       }
-      $this->primaryGroup= get_post('primaryGroup');
+      $this->primaryGroup= intval(get_post('primaryGroup'));
     }
   }
 
@@ -1354,7 +1356,7 @@
 
     /* Fill group */
     if(isset($source['gidNumber'][0])){
-      $this->primaryGroup= $source['gidNumber'][0];
+      $this->primaryGroup= intval($source['gidNumber'][0]);
     }