File: 1045_fix-posixaccount-shadowExpire.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 (76 lines) | stat: -rw-r--r-- 2,798 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
Author: "Daniel Teichmann" <daniel.teichmann@das-netzwerkteam.de>
Description: debian/patches/: Add 0003-fix-posixaccount-shadowExpire.patch which fixes shadowExpire always being set to 0. (User can't login then) (Closes: #1053806)

--- a/plugins/personal/posix/class_posixAccount.inc
+++ b/plugins/personal/posix/class_posixAccount.inc
@@ -213,14 +213,14 @@
     foreach (array("shadowMin", "shadowMax", "shadowWarning", "shadowInactive",
           "shadowExpire") as $val){
 
-      if ($this->$val != 0){
+      if ($this->$val != 0 && $this->$val !== "") {
         $oval= "activate_".$val;
         $this->$oval= "1";
       }
     }
 
     /* Convert shadowExpire for usage */
-    if ($this->shadowExpire == 0){
+    if ($this->shadowExpire == 0 || $this->shadowExpire == "") {
       $this->shadowExpire= "";
     } else {
       $this->shadowExpire= date('d.m.Y', intval($this->shadowExpire) * 60 * 60 * 24);
@@ -830,6 +830,9 @@
     }
 
     foreach(array("shadowMin","shadowMax","shadowWarning","shadowInactive","shadowExpire") as $attr){
+      if (is_string($this->$attr) && empty($this->$attr)) {
+        continue;
+      }
       $this->$attr = (int) $this->$attr;
     }
     /* Call parents save to prepare $this->attrs */
@@ -1178,7 +1181,7 @@
     /* Adjust shadow checkboxes */
     foreach (array("shadowMin", "shadowMax", "shadowWarning", "shadowInactive",
           "shadowExpire") as $val){
-      if ($this->$val != 0){
+      if ($this->$val != 0 && $this->$val !== "") {
         $oval= "activate_".$val;
         $this->$oval= "1";
       }
@@ -1190,7 +1193,7 @@
     }
 
     /* Convert shadowExpire for usage */
-    if ($this->shadowExpire == 0){
+    if ($this->shadowExpire == 0 || $this->shadowExpire == "") {
       $this->shadowExpire= "";
     } else {
       $this->shadowExpire= date('d.m.Y', $this->shadowExpire * 60 * 60 * 24);
@@ -1364,14 +1367,14 @@
     foreach (array("shadowMin", "shadowMax", "shadowWarning", "shadowInactive",
                 "shadowExpire") as $val){
 
-        if ($this->$val != 0){
+        if ($this->$val != 0 && $this->$val !== "") {
             $oval= "activate_".$val;
             $this->$oval= "1";
         }
     }
 
     /* Convert shadowExpire for usage */
-    if ($this->shadowExpire == 0){
+    if ($this->shadowExpire == 0 || $this->shadowExpire == "") {
       $this->shadowExpire= "";
     } else {
       $this->shadowExpire= date('d.m.Y', $this->shadowExpire * 60 * 60 * 24);
@@ -1599,7 +1602,7 @@
     /* Adjust shadow checkboxes */
     foreach (array("shadowMin", "shadowMax", "shadowWarning", "shadowInactive",
           "shadowExpire") as $val){
-      if ($this->$val != 0){
+      if ($this->$val != 0 && $this->$val !== "") {
         $oval= "activate_".$val;
         $this->$oval= "1";
       }