summarylogtreecommitdiffstats
path: root/0003-Remove-Birthdate-src-folders.patch
blob: a7eab30f8593cd44ee2bef335879dfa13f987944 (plain)
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
diff -ura systemd-git-stable/src/basic/time-util.c systemd-git-stable.new/src/basic/time-util.c
--- systemd-git-stable/src/basic/time-util.c	2026-05-17 04:32:46.712471569 +0100
+++ systemd-git-stable.new/src/basic/time-util.c	2026-05-17 04:36:14.580447660 +0100
@@ -1932,13 +1932,9 @@
         usec_t usec = USEC_INFINITY;
 
         if (allow_pre_epoch) {
-                /* For birth dates we use timegm() directly since we need to accept pre-epoch dates.
-                 * timegm() returns (time_t) -1 both on error and for one second before the epoch.
-                 * Initialize wday to -1 beforehand: if it remains -1 after the call, it's a genuine
-                 * error; if timegm() changed it, the date was successfully normalized. */
-                copy_tm.tm_wday = -1;
-                if (timegm(&copy_tm) == (time_t) -1 && copy_tm.tm_wday == -1)
-                        return -EINVAL;
+                /* This part of the function was for birthday surveillance. It therefore must be removed.
+                 * This function does have legitimate uses, however, so we don't delete the whole thing .*/
+                 return 0;
         } else {
                 r = mktime_or_timegm_usec(&copy_tm, /* utc= */ true, &usec);
                 if (r < 0)
diff -ura systemd-git-stable/src/basic/time-util.h systemd-git-stable.new/src/basic/time-util.h
--- systemd-git-stable/src/basic/time-util.h	2026-05-17 04:32:46.712471569 +0100
+++ systemd-git-stable.new/src/basic/time-util.h	2026-05-17 04:38:04.032502711 +0100
@@ -190,17 +190,13 @@
         return parse_calendar_date_full(s, /* allow_pre_epoch= */ false, ret, NULL);
 }
 
+/* this is just an empty value used elsewhere. It does not enable surveillance, but is used
+ * in legitimate functions. */
 #define BIRTH_DATE_UNSET                        \
         (const struct tm) {                     \
                 .tm_year = INT_MIN,             \
         }
 
-#define BIRTH_DATE_IS_SET(tm) ((tm).tm_year != INT_MIN)
-
-static inline int parse_birth_date(const char *s, struct tm *ret) {
-        return parse_calendar_date_full(s, /* allow_pre_epoch= */ true, NULL, ret);
-}
-
 uint64_t sysconf_clock_ticks_cached(void);
 
 
diff -ura systemd-git-stable/src/home/homectl.c systemd-git-stable.new/src/home/homectl.c
--- systemd-git-stable/src/home/homectl.c	2026-05-17 04:32:46.748649255 +0100
+++ systemd-git-stable.new/src/home/homectl.c	2026-05-17 04:39:27.167259372 +0100
@@ -4240,23 +4240,6 @@
                                 return r;
                         break;
 
-                OPTION_LONG_FLAGS(OPTION_OPTIONAL_ARG, "birth-date", "DATE",
-                                  "Set user birth date (YYYY-MM-DD)"):
-                        if (isempty(opts.arg)) {
-                                r = drop_from_identity("birthDate");
-                                if (r < 0)
-                                        return r;
-                        } else {
-                                r = parse_birth_date(opts.arg, /* ret= */ NULL);
-                                if (r < 0)
-                                        return log_error_errno(r, "Invalid birth date (expected YYYY-MM-DD): %s", opts.arg);
-
-                                r = parse_string_field(&arg_identity_extra, "birthDate", opts.arg);
-                                if (r < 0)
-                                        return r;
-                        }
-                        break;
-
                 OPTION_LONG("icon-name", "NAME", "Icon name for user"):
                         r = parse_string_field(match_identity ?: &arg_identity_extra, "iconName", opts.arg);
                         if (r < 0)
diff -ura systemd-git-stable/src/shared/user-record.c systemd-git-stable.new/src/shared/user-record.c
--- systemd-git-stable/src/shared/user-record.c	2026-05-17 04:32:46.842474845 +0100
+++ systemd-git-stable.new/src/shared/user-record.c	2026-05-17 04:41:48.312790109 +0100
@@ -46,7 +46,6 @@
                 .nice_level = INT_MAX,
                 .not_before_usec = UINT64_MAX,
                 .not_after_usec = UINT64_MAX,
-                .birth_date = BIRTH_DATE_UNSET,
                 .locked = -1,
                 .storage = _USER_STORAGE_INVALID,
                 .access_mode = MODE_INVALID,
@@ -418,28 +417,6 @@
         return 0;
 }
 
-static int json_dispatch_birth_date(const char *name, sd_json_variant *variant, sd_json_dispatch_flags_t flags, void *userdata) {
-        struct tm *ret = ASSERT_PTR(userdata);
-        const char *s;
-        int r;
-
-        if (sd_json_variant_is_null(variant)) {
-                *ret = BIRTH_DATE_UNSET;
-                return 0;
-        }
-
-        if (!sd_json_variant_is_string(variant))
-                return json_log(variant, flags, SYNTHETIC_ERRNO(EINVAL), "JSON field '%s' is not a string.", strna(name));
-
-        s = sd_json_variant_string(variant);
-
-        r = parse_birth_date(s, ret);
-        if (r < 0)
-                return json_log(variant, flags, r, "JSON field '%s' is not a valid ISO 8601 date (expected YYYY-MM-DD).", strna(name));
-
-        return 0;
-}
-
 static int json_dispatch_home_directory(const char *name, sd_json_variant *variant, sd_json_dispatch_flags_t flags, void *userdata) {
         char **s = userdata;
         const char *n;
@@ -1525,8 +1502,7 @@
                        /* Personally Identifiable Information (PII) — avoid leaking in logs */
                        "realName",
                        "location",
-                       "emailAddress",
-                       "birthDate")
+                       "emailAddress")
                 sd_json_variant_sensitive(sd_json_variant_by_key(v, key));
 
         /* Check if we have the special sections and if they match our flags set */
@@ -1621,7 +1597,6 @@
                 { "emailAddress",               SD_JSON_VARIANT_STRING,        sd_json_dispatch_string,              offsetof(UserRecord, email_address),                 SD_JSON_STRICT },
                 { "iconName",                   SD_JSON_VARIANT_STRING,        sd_json_dispatch_string,              offsetof(UserRecord, icon_name),                     SD_JSON_STRICT },
                 { "location",                   SD_JSON_VARIANT_STRING,        sd_json_dispatch_string,              offsetof(UserRecord, location),                      0              },
-                { "birthDate",                  SD_JSON_VARIANT_STRING,        json_dispatch_birth_date,             offsetof(UserRecord, birth_date),                    0              },
                 { "disposition",                SD_JSON_VARIANT_STRING,        json_dispatch_user_disposition,       offsetof(UserRecord, disposition),                   0              },
                 { "lastChangeUSec",             _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64,              offsetof(UserRecord, last_change_usec),              0              },
                 { "lastPasswordChangeUSec",     _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint64,              offsetof(UserRecord, last_password_change_usec),     0              },
diff -ura systemd-git-stable/src/shared/user-record.h systemd-git-stable.new/src/shared/user-record.h
--- systemd-git-stable/src/shared/user-record.h	2026-05-17 04:32:46.842474845 +0100
+++ systemd-git-stable.new/src/shared/user-record.h	2026-05-17 04:42:17.936555001 +0100
@@ -268,7 +268,6 @@
         char *password_hint;
         char *icon_name;
         char *location;
-        struct tm birth_date;
 
         char *blob_directory;
         Hashmap *blob_manifest;
diff -ura systemd-git-stable/src/shared/user-record-show.c systemd-git-stable.new/src/shared/user-record-show.c
--- systemd-git-stable/src/shared/user-record-show.c	2026-05-17 04:32:46.842474845 +0100
+++ systemd-git-stable.new/src/shared/user-record-show.c	2026-05-17 04:42:54.320406108 +0100
@@ -342,8 +342,6 @@
                 printf("       Email: %s\n", hr->email_address);
         if (hr->location)
                 printf("    Location: %s\n", hr->location);
-        if (BIRTH_DATE_IS_SET(hr->birth_date))
-                printf("  Birth Date: %04d-%02d-%02d\n", hr->birth_date.tm_year + 1900, hr->birth_date.tm_mon + 1, hr->birth_date.tm_mday);
         if (hr->password_hint)
                 printf(" Passw. Hint: %s\n", hr->password_hint);
         if (hr->icon_name)
diff -ura systemd-git-stable/src/test/test-time-util.c systemd-git-stable.new/src/test/test-time-util.c
--- systemd-git-stable/src/test/test-time-util.c	2026-05-17 04:32:46.865808766 +0100
+++ systemd-git-stable.new/src/test/test-time-util.c	2026-05-17 04:43:33.554283627 +0100
@@ -1309,36 +1309,4 @@
         ASSERT_ERROR(parse_calendar_date("06-15-2023", &usec), EINVAL); /* wrong order */
 }
 
-TEST(parse_birth_date) {
-        struct tm tm;
-
-        /* Valid dates */
-        ASSERT_OK(parse_birth_date("2000-06-15", &tm));
-        ASSERT_EQ(tm.tm_year, 100);  /* 2000 - 1900 */
-        ASSERT_EQ(tm.tm_mon, 5);     /* June, 0-indexed */
-        ASSERT_EQ(tm.tm_mday, 15);
-
-        /* Pre-epoch dates */
-        ASSERT_OK(parse_birth_date("1960-03-25", &tm));
-        ASSERT_EQ(tm.tm_year, 60);
-        ASSERT_EQ(tm.tm_mon, 2);
-        ASSERT_EQ(tm.tm_mday, 25);
-
-        /* NULL ret is allowed (validation only) */
-        ASSERT_OK(parse_birth_date("2000-01-01", NULL));
-
-        /* Non-date fields should not be relied upon */
-        ASSERT_OK(parse_birth_date("2000-06-15", &tm));
-        ASSERT_FALSE(BIRTH_DATE_IS_SET(BIRTH_DATE_UNSET));
-
-        /* Non-normalized dates */
-        ASSERT_ERROR(parse_birth_date("2023-02-29", &tm), EINVAL);
-        ASSERT_ERROR(parse_birth_date("2023-04-31", &tm), EINVAL);
-
-        /* Malformed input */
-        ASSERT_ERROR(parse_birth_date("", &tm), EINVAL);
-        ASSERT_ERROR(parse_birth_date("not-a-date", &tm), EINVAL);
-        ASSERT_ERROR(parse_birth_date("2023-06-15T00:00:00", &tm), EINVAL);
-}
-
 DEFINE_TEST_MAIN_WITH_INTRO(LOG_INFO, intro);
diff -ura systemd-git-stable/src/test/test-user-record.c systemd-git-stable.new/src/test/test-user-record.c
--- systemd-git-stable/src/test/test-user-record.c	2026-05-17 04:32:46.869142184 +0100
+++ systemd-git-stable.new/src/test/test-user-record.c	2026-05-17 04:44:08.921493770 +0100
@@ -96,15 +96,6 @@
              SD_JSON_BUILD_PAIR_OBJECT("privileged",
                                     SD_JSON_BUILD_PAIR_UNSIGNED("notInHardCodedList", 99999)));
         ASSERT_TRUE(user_record_self_changes_allowed(curr, new));
-
-        /* birthDate is NOT self-modifiable (admin-only) */
-        USER(&curr,
-             SD_JSON_BUILD_PAIR_STRING("userName", "test"),
-             SD_JSON_BUILD_PAIR_STRING("birthDate", "1990-01-01"));
-        USER(&new,
-             SD_JSON_BUILD_PAIR_STRING("userName", "test"),
-             SD_JSON_BUILD_PAIR_STRING("birthDate", "1990-06-15"));
-        ASSERT_FALSE(user_record_self_changes_allowed(curr, new));
 }
 
 DEFINE_TEST_MAIN(LOG_INFO);