Debian Codegraph @

src/Microsoft365/calendar/e-cal-backend-m365-recur-blob.c

raw
1 /*
2 * SPDX-FileCopyrightText: (C) 1999-2008 Novell, Inc. (www.novell.com)
3 * SPDX-FileCopyrightText: (C) 2024 Red Hat (www.redhat.com)
4 * SPDX-FileContributor: Suman Manjunath <[email protected]>
5 * SPDX-License-Identifier: LGPL-2.1-or-later
6 */
7
8 /* Taken from evolution-mapi and adapted/simplified to extract only exceptions (deleted and detached instances) */
9
10 #include "evolution-ews-config.h"
11
12 #include <libecal/libecal.h>
13
14 #include "e-cal-backend-m365-recur-blob.h"
15
16 /* Subset of used/recognized pattern types */
17 #define PatternType_Day 0x0
18 #define PatternType_MonthNth 0x3
19
20 /* Reader/Writer versions */
21 #define READER_VERSION 0x3004
22 #define WRITER_VERSION 0x3004
23 #define READER_VERSION2 0x3006
24 #define WRITER_VERSION2 0x3009
25
26 /* Override flags defining what fields might be found in ExceptionInfo */
27 #define ARO_SUBJECT 0x0001
28 #define ARO_MEETINGTYPE 0x0002
29 #define ARO_REMINDERDELTA 0x0004
30 #define ARO_REMINDER 0x0008
31 #define ARO_LOCATION 0x0010
32 #define ARO_BUSYSTATUS 0x0020
33 #define ARO_ATTACHMENT 0x0040
34 #define ARO_SUBTYPE 0x0080
35 #define ARO_APPTCOLOR 0x0100
36 #define ARO_EXCEPTIONAL_BODY 0x0200
37
38 /* Serialization helper: append len bytes from var to arr. */
39 #define GBA_APPEND(a, v, l) g_byte_array_append ((a), (guint8*)(v), (l))
40
41 /* Serialization helper: append the value of the variable to arr. */
42 #define GBA_APPEND_LVAL(a, v) GBA_APPEND ((a), (&v), (sizeof (v)))
43
44 /* Unserialization helper: read len bytes into buff from ba at offset off. */
45 #define GBA_MEMCPY_OFFSET(arr, off, buf, blen) \
46 G_STMT_START { \
47 g_return_val_if_fail ((off >= 0 && arr->len - off >= blen), FALSE); \
48 memcpy (buf, arr->data + off, blen); \
49 off += blen; \
50 } G_STMT_END
51
52 /* Unserialization helper: dereference and increment pointer. */
53 #define GBA_DEREF_OFFSET(arr, off, lval, valtype) \
54 G_STMT_START { \
55 g_return_val_if_fail ((off >= 0 && arr->len - off >= sizeof (valtype)), FALSE); \
56 lval = *((valtype*)(arr->data+off)); \
57 off += sizeof (valtype); \
58 } G_STMT_END
59
60 /** MS-OXOCAL 2.2.1.44.3 */
61 struct ema_ChangeHighlight {
62 guint32 ChangeHighlightSize;
63 guint32 ChangeHighlightValue;
64 void *Reserved;
65 };
66
67 /** MS-OXOCAL 2.2.1.44.4 */
68 struct ema_ExtendedException {
69 struct ema_ChangeHighlight ChangeHighlight;
70 guint32 ReservedBlockEE1Size;
71 void *ReservedBlockEE1;
72 guint32 StartDateTime;
73 guint32 EndDateTime;
74 guint32 OriginalStartDate;
75 guint16 WideCharSubjectLength;
76 gchar *WideCharSubject;
77 guint16 WideCharLocationLength;
78 gchar *WideCharLocation;
79 guint32 ReservedBlockEE2Size;
80 void *ReservedBlockEE2;
81 };
82
83 /** MS-OXOCAL 2.2.1.44.2 */
84 struct ema_ExceptionInfo {
85 guint32 StartDateTime;
86 guint32 EndDateTime;
87 guint32 OriginalStartDate;
88 guint16 OverrideFlags;
89 guint16 SubjectLength;
90 guint16 SubjectLength2;
91 gchar *Subject;
92 guint32 MeetingType;
93 guint32 ReminderDelta;
94 guint32 ReminderSet;
95 guint16 LocationLength;
96 guint16 LocationLength2;
97 gchar *Location;
98 guint32 BusyStatus;
99 guint32 Attachment;
100 guint32 SubType;
101 guint32 AppointmentColor;
102 };
103
104 /** MS-OXOCAL 2.2.1.44.1 */
105 struct ema_RecurrencePattern {
106 guint16 ReaderVersion;
107 guint16 WriterVersion;
108 guint16 RecurFrequency;
109 guint16 PatternType;
110 guint16 CalendarType;
111 guint32 FirstDateTime;
112 guint32 Period;
113 guint32 SlidingFlag;
114 guint32 PatternTypeSpecific;
115 guint32 N;
116 guint32 EndType;
117 guint32 OccurrenceCount;
118 guint32 FirstDOW;
119 guint32 DeletedInstanceCount;
120 guint32 *DeletedInstanceDates;
121 guint32 ModifiedInstanceCount;
122 guint32 *ModifiedInstanceDates;
123 guint32 StartDate;
124 guint32 EndDate;
125 };
126
127 /** MS-OXOCAL 2.2.1.44.5 */
128 struct ema_AppointmentRecurrencePattern {
129 struct ema_RecurrencePattern RecurrencePattern;
130 guint32 ReaderVersion2;
131 guint32 WriterVersion2;
132 guint32 StartTimeOffset;
133 guint32 EndTimeOffset;
134 guint16 ExceptionCount;
135 struct ema_ExceptionInfo *ExceptionInfo;
136 guint32 ReservedBlock1Size;
137 void *ReservedBlock1;
138 struct ema_ExtendedException *ExtendedException;
139 guint32 ReservedBlock2Size;
140 void *ReservedBlock2;
141 };
142
143 static gboolean
144 gba_to_rp (const GByteArray *gba,
145 ptrdiff_t *off,
146 struct ema_RecurrencePattern *rp)
147 {
148 GBA_DEREF_OFFSET (gba, *off, rp->ReaderVersion, guint16);
149 GBA_DEREF_OFFSET (gba, *off, rp->WriterVersion, guint16);
150 GBA_DEREF_OFFSET (gba, *off, rp->RecurFrequency, guint16);
151 GBA_DEREF_OFFSET (gba, *off, rp->PatternType, guint16);
152 GBA_DEREF_OFFSET (gba, *off, rp->CalendarType, guint16);
153 GBA_DEREF_OFFSET (gba, *off, rp->FirstDateTime, guint32);
154 GBA_DEREF_OFFSET (gba, *off, rp->Period, guint32);
155 GBA_DEREF_OFFSET (gba, *off, rp->SlidingFlag, guint32);
156
157 if (rp->PatternType != PatternType_Day) {
158 GBA_DEREF_OFFSET (gba, *off, rp->PatternTypeSpecific, guint32);
159 if (rp->PatternType == PatternType_MonthNth) {
160 GBA_DEREF_OFFSET (gba, *off, rp->N,
161 guint32);
162 }
163 }
164
165 GBA_DEREF_OFFSET (gba, *off, rp->EndType, guint32);
166 GBA_DEREF_OFFSET (gba, *off, rp->OccurrenceCount, guint32);
167 GBA_DEREF_OFFSET (gba, *off, rp->FirstDOW, guint32);
168
169 GBA_DEREF_OFFSET (gba, *off, rp->DeletedInstanceCount, guint32);
170 if (rp->DeletedInstanceCount) {
171 rp->DeletedInstanceDates = g_new (guint32,
172 rp->DeletedInstanceCount);
173 GBA_MEMCPY_OFFSET(gba, *off, rp->DeletedInstanceDates,
174 sizeof (guint32) * rp->DeletedInstanceCount);
175 }
176
177 GBA_DEREF_OFFSET (gba, *off, rp->ModifiedInstanceCount, guint32);
178 if (rp->ModifiedInstanceCount) {
179 rp->ModifiedInstanceDates = g_new (guint32,
180 rp->ModifiedInstanceCount);
181 GBA_MEMCPY_OFFSET (gba, *off, rp->ModifiedInstanceDates,
182 sizeof (guint32) * rp->ModifiedInstanceCount);
183 }
184
185 GBA_DEREF_OFFSET(gba, *off, rp->StartDate, guint32);
186 GBA_DEREF_OFFSET(gba, *off, rp->EndDate, guint32);
187
188 return TRUE;
189 }
190
191 static gboolean
192 gba_to_ei (const GByteArray *gba,
193 ptrdiff_t *off,
194 struct ema_ExceptionInfo *ei)
195 {
196 GBA_DEREF_OFFSET (gba, *off, ei->StartDateTime, guint32);
197 GBA_DEREF_OFFSET (gba, *off, ei->EndDateTime, guint32);
198 GBA_DEREF_OFFSET (gba, *off, ei->OriginalStartDate, guint32);
199 GBA_DEREF_OFFSET (gba, *off, ei->OverrideFlags, guint16);
200
201 if (ei->OverrideFlags&ARO_SUBJECT) {
202 GBA_DEREF_OFFSET (gba, *off, ei->SubjectLength, guint16);
203 GBA_DEREF_OFFSET (gba, *off, ei->SubjectLength2, guint16);
204 ei->Subject = g_new0 (gchar, ei->SubjectLength2 + 1);
205 GBA_MEMCPY_OFFSET (gba, *off, ei->Subject, ei->SubjectLength2);
206 }
207
208 if (ei->OverrideFlags&ARO_MEETINGTYPE) {
209 GBA_DEREF_OFFSET (gba, *off, ei->MeetingType, guint32);
210 }
211
212 if (ei->OverrideFlags&ARO_REMINDERDELTA) {
213 GBA_DEREF_OFFSET (gba, *off, ei->ReminderDelta, guint32);
214 }
215
216 if (ei->OverrideFlags & ARO_REMINDER) {
217 GBA_DEREF_OFFSET (gba, *off, ei->ReminderSet, guint32);
218 }
219
220 if (ei->OverrideFlags&ARO_LOCATION) {
221 GBA_DEREF_OFFSET (gba, *off, ei->LocationLength, guint16);
222 GBA_DEREF_OFFSET (gba, *off, ei->LocationLength2, guint16);
223 ei->Location = g_new0 (gchar, ei->LocationLength2 + 1);
224 GBA_MEMCPY_OFFSET (gba, *off, ei->Location, ei->LocationLength2);
225 }
226
227 if (ei->OverrideFlags&ARO_BUSYSTATUS) {
228 GBA_DEREF_OFFSET (gba, *off, ei->BusyStatus, guint32);
229 }
230
231 if (ei->OverrideFlags&ARO_ATTACHMENT) {
232 GBA_DEREF_OFFSET (gba, *off, ei->Attachment, guint32);
233 }
234
235 if (ei->OverrideFlags&ARO_SUBTYPE) {
236 GBA_DEREF_OFFSET (gba, *off, ei->SubType, guint32);
237 }
238
239 if (ei->OverrideFlags&ARO_APPTCOLOR) {
240 GBA_DEREF_OFFSET (gba, *off, ei->AppointmentColor, guint32);
241 }
242
243 return TRUE;
244 }
245
246 static gboolean
247 gba_to_ee (const GByteArray *gba, ptrdiff_t *off,
248 struct ema_ExtendedException *ee,
249 struct ema_AppointmentRecurrencePattern *arp, int exnum)
250 {
251 GBA_DEREF_OFFSET (gba, *off, ee->ChangeHighlight.ChangeHighlightSize,
252 guint32);
253
254 if (arp->WriterVersion2 >= 0x3009) {
255 if (ee->ChangeHighlight.ChangeHighlightSize > 0) {
256 int reserved_size = ee->ChangeHighlight.ChangeHighlightSize - sizeof (guint32);
257 GBA_DEREF_OFFSET (gba, *off,
258 ee->ChangeHighlight.ChangeHighlightValue,
259 guint32);
260 if (reserved_size > 0) {
261 ee->ChangeHighlight.Reserved = g_new (gchar, reserved_size);
262 GBA_MEMCPY_OFFSET (gba, *off,
263 &ee->ChangeHighlight.Reserved,
264 reserved_size);
265 }
266 }
267 }
268
269 GBA_DEREF_OFFSET (gba, *off, ee->ReservedBlockEE1Size, guint32);
270 if (ee->ReservedBlockEE1Size) {
271 ee->ReservedBlockEE1 = g_new (gchar, ee->ReservedBlockEE1Size);
272 GBA_MEMCPY_OFFSET (gba, *off, ee->ReservedBlockEE1,
273 ee->ReservedBlockEE1Size);
274 }
275
276 if (arp->ExceptionInfo[exnum].OverrideFlags&(ARO_SUBJECT|ARO_LOCATION)) {
277 GBA_DEREF_OFFSET (gba, *off, ee->StartDateTime, guint32);
278 GBA_DEREF_OFFSET (gba, *off, ee->EndDateTime, guint32);
279 GBA_DEREF_OFFSET (gba, *off, ee->OriginalStartDate, guint32);
280
281 if(arp->ExceptionInfo[exnum].OverrideFlags&ARO_SUBJECT) {
282 GBA_DEREF_OFFSET (gba, *off, ee->WideCharSubjectLength,
283 guint16);
284 ee->WideCharSubject = g_new0(gchar,
285 sizeof(guint16) * (ee->WideCharSubjectLength + 1));
286 GBA_MEMCPY_OFFSET (gba, *off, ee->WideCharSubject,
287 sizeof(guint16) * ee->WideCharSubjectLength);
288 }
289
290 if(arp->ExceptionInfo[exnum].OverrideFlags&ARO_LOCATION) {
291 GBA_DEREF_OFFSET (gba, *off, ee->WideCharLocationLength,
292 guint16);
293 ee->WideCharLocation = g_new0 (gchar,
294 sizeof(guint16) * (ee->WideCharLocationLength + 1));
295 GBA_MEMCPY_OFFSET (gba, *off, ee->WideCharLocation,
296 sizeof (guint16) * ee->WideCharLocationLength);
297 }
298
299 GBA_DEREF_OFFSET (gba, *off, ee->ReservedBlockEE2Size, guint32);
300 if (ee->ReservedBlockEE2Size) {
301 ee->ReservedBlockEE2 = g_new (gchar,
302 ee->ReservedBlockEE2Size);
303 GBA_MEMCPY_OFFSET (gba, *off, ee->ReservedBlockEE2,
304 ee->ReservedBlockEE2Size);
305 }
306 }
307
308 return TRUE;
309 }
310
311 static gboolean
312 gba_to_arp (const GByteArray *gba, ptrdiff_t *off,
313 struct ema_AppointmentRecurrencePattern *arp)
314 {
315 gint i;
316
317 g_return_val_if_fail (gba_to_rp (gba, off, &arp->RecurrencePattern),
318 FALSE);
319 GBA_DEREF_OFFSET (gba, *off, arp->ReaderVersion2, guint32);
320 GBA_DEREF_OFFSET (gba, *off, arp->WriterVersion2, guint32);
321 GBA_DEREF_OFFSET (gba, *off, arp->StartTimeOffset, guint32);
322 GBA_DEREF_OFFSET (gba, *off, arp->EndTimeOffset, guint32);
323
324 GBA_DEREF_OFFSET (gba, *off, arp->ExceptionCount, guint16);
325 if (arp->ExceptionCount) {
326 arp->ExceptionInfo = g_new0 (struct ema_ExceptionInfo,
327 arp->ExceptionCount);
328 for (i = 0; i < arp->ExceptionCount; ++i) {
329 g_return_val_if_fail (gba_to_ei (gba, off, &arp->ExceptionInfo[i]),
330 FALSE);
331 }
332 }
333
334 GBA_DEREF_OFFSET (gba, *off, arp->ReservedBlock1Size, guint32);
335 if (arp->ReservedBlock1Size) {
336 arp->ReservedBlock1 = g_new (gchar, arp->ReservedBlock1Size);
337 GBA_MEMCPY_OFFSET (gba, *off, arp->ReservedBlock1,
338 arp->ReservedBlock1Size);
339 }
340
341 if (arp->ExceptionCount) {
342 arp->ExtendedException = g_new0 (struct ema_ExtendedException,
343 arp->ExceptionCount);
344 for (i = 0; i < arp->ExceptionCount; ++i) {
345 g_return_val_if_fail (gba_to_ee (gba, off, &arp->ExtendedException[i], arp, i),
346 FALSE);
347 }
348 }
349
350 GBA_DEREF_OFFSET (gba, *off, arp->ReservedBlock2Size, guint32);
351 if (arp->ReservedBlock2Size) {
352 arp->ReservedBlock2 = g_new (gchar, arp->ReservedBlock2Size);
353 GBA_MEMCPY_OFFSET (gba, *off, arp->ReservedBlock2,
354 arp->ReservedBlock2Size);
355 }
356
357 return TRUE;
358 }
359
360 static void
361 free_arp_contents (struct ema_AppointmentRecurrencePattern *arp)
362 {
363 gint i;
364
365 if(arp) {
366 if (arp->RecurrencePattern.DeletedInstanceDates)
367 g_free (arp->RecurrencePattern.DeletedInstanceDates);
368 if (arp->RecurrencePattern.ModifiedInstanceDates)
369 g_free (arp->RecurrencePattern.ModifiedInstanceDates);
370 if (arp->ExceptionInfo) {
371 for (i = 0; i < arp->RecurrencePattern.ModifiedInstanceCount; ++i) {
372 if (arp->ExceptionInfo[i].Subject)
373 g_free (arp->ExceptionInfo[i].Subject);
374 if (arp->ExceptionInfo[i].Location)
375 g_free (arp->ExceptionInfo[i].Location);
376 }
377 g_free (arp->ExceptionInfo);
378 }
379 if (arp->ReservedBlock1) {
380 g_free (arp->ReservedBlock1);
381 }
382 if (arp->ExtendedException) {
383 for (i = 0; i < arp->RecurrencePattern.ModifiedInstanceCount; ++i) {
384 if (arp->ExtendedException[i].ChangeHighlight.Reserved)
385 g_free (arp->ExtendedException[i].ChangeHighlight.Reserved);
386 if (arp->ExtendedException[i].ReservedBlockEE1)
387 g_free (arp->ExtendedException[i].ReservedBlockEE1);
388 if (arp->ExtendedException[i].WideCharSubject)
389 g_free (arp->ExtendedException[i].WideCharSubject);
390 if (arp->ExtendedException[i].WideCharLocation)
391 g_free (arp->ExtendedException[i].WideCharLocation);
392 if (arp->ExtendedException[i].ReservedBlockEE2)
393 g_free (arp->ExtendedException[i].ReservedBlockEE2);
394 }
395 g_free (arp->ExtendedException);
396 }
397 if (arp->ReservedBlock2) {
398 g_free (arp->ReservedBlock2);
399 }
400 }
401 }
402
403 static time_t
404 convert_recurrence_minutes_to_timet (uint32_t minutes)
405 {
406 const guint64 TIME_FIXUP_CONSTANT_INT = 11644473600;
407 guint64 secs;
408
409 secs = (guint64) minutes * 60;
410
411 /* adjust by 369 years to make the secs since 1970 */
412 return secs - TIME_FIXUP_CONSTANT_INT;
413 }
414
415 gboolean
416 e_cal_backend_m365_decode_recur_blob (const gchar *base64_blob,
417 ICalComponent *icomp,
418 ICalTimezone *recur_zone,
419 GSList **out_extra_detached) /* ICalComponent * */
420 {
421 struct ema_AppointmentRecurrencePattern arp;
422 struct ema_RecurrencePattern *rp; /* Convenience pointer */
423 gint i;
424 ptrdiff_t off = 0;
425 GByteArray fake_ba;
426 guchar *blob;
427 gsize blob_len = 0;
428
429 blob = g_base64_decode (base64_blob, &blob_len);
430 if (blob == NULL || blob_len == 0) {
431 g_free (blob);
432 return FALSE;
433 }
434
435 fake_ba.data = (guint8 *) blob;
436 fake_ba.len = blob_len;
437
438 memset (&arp, 0, sizeof (struct ema_AppointmentRecurrencePattern));
439
440 if (!gba_to_arp (&fake_ba, &off, &arp)) {
441 free_arp_contents (&arp);
442 g_free (blob);
443 return FALSE;
444 }
445
446 rp = &arp.RecurrencePattern;
447
448 e_cal_util_component_remove_property_by_kind (icomp, I_CAL_EXDATE_PROPERTY, TRUE);
449
450 /* number of exceptions */
451 if (rp->DeletedInstanceCount) {
452 ICalTimezone *utc_zone = i_cal_timezone_get_utc_timezone ();
453
454 for (i = 0; i < rp->DeletedInstanceCount; ++i) {
455 ICalProperty *prop;
456 ICalTime *tt;
457 time_t ictime = convert_recurrence_minutes_to_timet (rp->DeletedInstanceDates[i]);
458
459 tt = i_cal_time_new_from_timet_with_zone (ictime, 1, NULL);
460 i_cal_time_set_timezone (tt, utc_zone);
461
462 prop = i_cal_property_new_exdate (tt);
463 i_cal_component_take_property (icomp, prop);
464 }
465 }
466
467 /* Modified exceptions */
468 if (arp.ExceptionCount && out_extra_detached) {
469 ICalTime *tt;
470 ECalComponentDateTime *edt;
471 ECalComponentRange *rid;
472 const gchar *tzid;
473
474 *out_extra_detached = NULL;
475
476 tzid = recur_zone ? i_cal_timezone_get_tzid (recur_zone) : "UTC";
477
478 for (i = 0; i < arp.ExceptionCount; i++) {
479 ECalComponent *detached;
480 struct ema_ExceptionInfo *ei = &arp.ExceptionInfo[i];
481 struct ema_ExtendedException *ee = &arp.ExtendedException[i];
482
483 detached = e_cal_component_new_from_icalcomponent (i_cal_component_clone (icomp));
484 if (!detached)
485 continue;
486
487 tt = i_cal_time_new_from_timet_with_zone (convert_recurrence_minutes_to_timet (ei->OriginalStartDate), 0, NULL);
488 rid = e_cal_component_range_new_take (E_CAL_COMPONENT_RANGE_SINGLE, e_cal_component_datetime_new_take (tt, g_strdup (tzid)));
489 e_cal_component_set_recurid (detached, rid);
490 e_cal_component_range_free (rid);
491
492 tt = i_cal_time_new_from_timet_with_zone (convert_recurrence_minutes_to_timet (ei->StartDateTime), 0, NULL);
493 edt = e_cal_component_datetime_new_take (tt, g_strdup (tzid));
494 e_cal_component_set_dtstart (detached, edt);
495 e_cal_component_datetime_free (edt);
496
497 tt = i_cal_time_new_from_timet_with_zone (convert_recurrence_minutes_to_timet (ei->EndDateTime), 0, NULL);
498 edt = e_cal_component_datetime_new_take (tt, g_strdup (tzid));
499 e_cal_component_set_dtend (detached, edt);
500 e_cal_component_datetime_free (edt);
501
502 e_cal_component_set_rdates (detached, NULL);
503 e_cal_component_set_rrules (detached, NULL);
504 e_cal_component_set_exdates (detached, NULL);
505 e_cal_component_set_exrules (detached, NULL);
506
507 if (ee->WideCharSubject) {
508 ECalComponentText *txt;
509 gchar *str;
510
511 str = g_convert (ee->WideCharSubject,
512 2 * ee->WideCharSubjectLength,
513 "UTF-8", "UTF-16", NULL, NULL,
514 NULL);
515 txt = e_cal_component_text_new (str ? str : "", NULL);
516 e_cal_component_set_summary (detached, txt);
517 e_cal_component_text_free (txt);
518 g_free (str);
519 } else if (ei->Subject) {
520 ECalComponentText *txt;
521
522 txt = e_cal_component_text_new (ei->Subject, NULL);
523 e_cal_component_set_summary (detached, txt);
524 e_cal_component_text_free (txt);
525 }
526
527 /* Handle MeetingType */
528 /* Handle ReminderDelta */
529 /* Handle Reminder */
530
531 if (ee->WideCharLocation) {
532 gchar *str;
533
534 /* LocationLength */
535 str = g_convert (ee->WideCharLocation,
536 2 * ee->WideCharLocationLength,
537 "UTF-8", "UTF-16", NULL, NULL,
538 NULL);
539 e_cal_component_set_location (detached, str);
540 g_free (str);
541 } else if (ei->Location) {
542 e_cal_component_set_location (detached, ei->Location);
543 }
544
545 /* Handle BusyStatus? */
546 /* Handle Attachment? */
547 /* Handle SubType? */
548 /* Handle AppointmentColor? */
549 /* do we do anything with ChangeHighlight? */
550
551 *out_extra_detached = g_slist_prepend (*out_extra_detached, g_object_ref (e_cal_component_get_icalcomponent (detached)));
552
553 g_clear_object (&detached);
554 }
555
556 *out_extra_detached = g_slist_reverse (*out_extra_detached);
557 }
558
559 free_arp_contents (&arp);
560 g_free (blob);
561
562 return TRUE;
563 }