Parolin 0.7.9 6796
Console (soon DLLs) to do a tar like job
Loading...
Searching...
No Matches
extract_kkk.c
Go to the documentation of this file.
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2
3 #2023 X March 21 19:50 PM Brasília Time
4
5* *
6* Licensa de Copia (C) <2023> <Aurora Boreal> *
7* *
8* Este programa e software livre: voce pode redistribuir isto e/ou *
9* modificar isto sobre os termos do GNU Licensa Geral Pública como 25
10* publicado pela Fundacao de Software Livre, tanto a versão 3 da *
11* Licensa, ou (dependendo da sua opcao) qualquer versao posterior. *
12* *
13* Este programa e distribuido na esperanca que isto vai ser util, *
14* mas SEM QUALQUER GARANTIA; sem ate mesmo a implicada garantia de *
15* COMERCIALIZAcaO ou CABIMENTO PARA UM FIM PARTICULAR. Veja a *
16* Licensa Geral Publica para mais detalhes. *
17* *
18* Você deve ter recebido uma cópia da LICENSA GERAL PUBLICA e a GNU *
19* Licensa Publica Menor junto com este programa *
20* Se não, veja <http://www.gnu.org/licenses/>. *
21* *
22* Suporte: sourceforge.net github.com *
23* *
24* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
25
26* Pereira: arsoftware25@gmail.com ricardo@arsoftware.net.br *
27* xcx: arsoftware10@gmail.com charli@arsoftware.net.br *
28 Yasmin: yasmin@arsoftware.net.br *
29 pereira1001@users.sourceforge.net
30 */
31
33// defines...
34
36
51 char *warning_ar,
52 char *filename_ar,
53 char *folder_feline)
54{
55 strcpy(warning_ar, warning_info);
56 strcpy(filename_ar, extracting_filename_ar);
57 strcpy(folder_feline, creating_folder_maria);
58 return 0;
59}
60
61typedef int (*tar_extractor_t)(char *file_name, int typeflag);
62
64
65#define IS_ABSOLUTE_PATH(P) ISSLASH((P)[0])
66#define IS_PATH_WITH_DIR(P) (strchr(P, '/') != NULL)
67
69// functions...
70
71void extract_archive(void);
72
73bool contains_dot_dot(char const *name);
74
75static int
76prepare_to_extract(char const *file_name, int typeflag, tar_extractor_t *fun);
77
78static int
79extract_file(char *file_name, int typeflag);
80
81void trocadordebackslashtras(char *path);
82
83int rspmakedir(char *path);
84
85int ispathfolder(char *path);
86
87int ispathreadonly(char *path);
88
89int createtestfilename(char *path1);
90
91char *
92strrstr(char *s1, char *s2);
93
94int ispathfile(char *path);
95
96int rspmakedir_v2(char *path);
97
98static int
99extract_skip(char *file_name, int typeflag);
100
101static int
102extract_failure(char *file_name, int typeflag);
103
104static int
105open_output_file(char const *file_name, int typeflag, mode_t mode,
106 int file_created, mode_t *current_mode,
107 mode_t *current_mode_mask, char *constructed_filename_kp);
108
113static int
114extract_failure(__attribute__((unused)) char *file_name, __attribute__((unused)) int typeflag)
115{
116 return 1;
117}
118
123static int
124extract_skip(__attribute__((unused)) char *file_name, __attribute__((unused)) int typeflag)
125{
126 skip_member();
127 return 0;
128}
129
134static int
135extract_dir(char *file_name_in_arp, int typeflag)
136{
137 int status = 0;
138 static char file_name[AMANDA__SIZE + 1] = {0};
139
140 if (AMANDA__SIZE < strlen(file_name_in_arp))
141 {
142 memcpy(file_name, file_name_in_arp, AMANDA__SIZE - 2);
143 strcpy(error_message_k, "Path above wide path limit 32767 characters Unicode, aborting...");
144 fatal_exit_k = 10002;
145 }
146 else
147 {
148 strcpy(file_name, file_name_in_arp);
149 }
150
151 if (typeflag == GNUTYPE_DUMPDIR)
152 skip_member();
153
155 {
156 if (0 == strcmp(".", file_name))
157 {
158 return status;
159 }
160
161 if (0 == strcmp("..", file_name))
162 {
163 return status;
164 }
165
167 file_name,
168 0,
170 true,
171 0,
172 0,
173 0,
175 NULL);
176 return status;
177 }
178
179 char destination_folder_kp[AMANDA__SIZE];
180 {
181 strcpy(destination_folder_kp, extract_folder_final);
182 strcat(destination_folder_kp, file_name);
183 trocadordebackslashtras(destination_folder_kp);
184
186 rspmakedir_v2(destination_folder_kp);
187 }
188 warning_info[0] = 0;
190 strcpy(creating_folder_maria, file_name);
192
194 {
195 HANDLE hFile;
196 FILETIME ftLocal;
197 SYSTEMTIME st;
198 struct tm tm_k;
199
200 __time64_t s = current_stat_info.mtime.tv_sec;
201
202 if (!_gmtime64(&s))
203 {
204 s = time(NULL);
205 }
206 tm_k = 1 ? *_gmtime64(&s) : *_localtime64(&s);
207
208 {
209 int r_temp = size_of_WCHAR_mem_r(destination_folder_kp);
210 WCHAR *ar_temp = (void *)malloc(r_temp);
211 WCHAR *ar_temp2 = (void *)malloc(r_temp);
212 hFile =
213 CreateFileW(permissive_name_m_(amanda_asciitowide_1_(destination_folder_kp, ar_temp), ar_temp2),
214 GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
215 NULL,
216 OPEN_EXISTING,
217 FILE_FLAG_BACKUP_SEMANTICS,
218 NULL);
219 free(ar_temp);
220 free(ar_temp2);
221 }
222
223 if (INVALID_HANDLE_VALUE != hFile)
224 {
225 st.wYear = (WORD)tm_k.tm_year + 1900;
226 st.wMonth = (WORD)tm_k.tm_mon + 1;
227 st.wDayOfWeek = (WORD)tm_k.tm_wday;
228 st.wDay = (WORD)tm_k.tm_mday;
229 st.wHour = (WORD)tm_k.tm_hour;
230 st.wMinute = (WORD)tm_k.tm_min;
231 st.wSecond = (WORD)tm_k.tm_sec;
232 st.wMilliseconds = 0;
233 SystemTimeToFileTime(&st, &ftLocal);
234 SetFileTime(hFile, &ftLocal, NULL, &ftLocal);
235 CloseHandle(hFile);
236 }
237 else
238 {
239 pedro_dprintf(2, "%s: Cannot set filetime on folder\n", file_name);
240 }
241 }
242
243 return status;
244}
245
255static int
256extract_dir_VAL(char *file_name_in_arp)
257{
258 int status = 0;
259 static char file_name[AMANDA__SIZE + 1];
260
261 memset(file_name, 0, sizeof(file_name));
262
263 if (AMANDA__SIZE < strlen(file_name_in_arp))
264 {
265 memcpy(file_name, file_name_in_arp, AMANDA__SIZE - 2);
266 strcpy(error_message_k, "Path came from Linux and is above 32767, aborting...");
267 fatal_exit_k = 10002;
268 }
269 else
270 {
271 strcpy(file_name, file_name_in_arp);
272 }
273
275 {
276 if (0 == strcmp(".", file_name))
277 {
278 return status;
279 }
280
281 if (0 == strcmp("..", file_name))
282 {
283 return status;
284 }
287 file_name,
288 0,
290 true,
291 0,
292 0,
296 return status;
297 }
298
299 static char destination_folder_kp[AMANDA__SIZE];
300
301 {
302 strcpy(destination_folder_kp, extract_folder_final);
303 strcat(destination_folder_kp, file_name);
304 trocadordebackslashtras(destination_folder_kp);
305
307 rspmakedir_v2(destination_folder_kp);
308 }
309 warning_info[0] = 0;
311 strcpy(creating_folder_maria, file_name);
313
315 {
316 HANDLE hFile;
317
319 {
320 FILETIME ftLocal;
321 SYSTEMTIME st;
322 struct tm tm_k;
323
324 __time64_t s;
325
327
329 {
331 }
332
333 if (!_gmtime64(&s))
334 {
335 s = time(NULL);
336 }
337
338 tm_k = 1 ? *_gmtime64(&s) : *_localtime64(&s);
339 {
340 int r_temp = size_of_WCHAR_mem_r(destination_folder_kp);
341 WCHAR *ar_temp = (void *)malloc(r_temp);
342 WCHAR *ar_temp2 = (void *)malloc(r_temp);
343 hFile =
344 CreateFileW(permissive_name_m_(amanda_asciitowide_1_(destination_folder_kp, ar_temp), ar_temp2),
345 GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
346 NULL,
347 OPEN_EXISTING,
348 FILE_FLAG_BACKUP_SEMANTICS,
349 NULL);
350 free(ar_temp);
351 free(ar_temp2);
352 }
353 if (INVALID_HANDLE_VALUE != hFile)
354 {
355 st.wYear = (WORD)tm_k.tm_year + 1900;
356 st.wMonth = (WORD)tm_k.tm_mon + 1;
357 st.wDayOfWeek = (WORD)tm_k.tm_wday;
358 st.wDay = (WORD)tm_k.tm_mday;
359 st.wHour = (WORD)tm_k.tm_hour;
360 st.wMinute = (WORD)tm_k.tm_min;
361 st.wSecond = (WORD)tm_k.tm_sec;
362 st.wMilliseconds = 0;
363 SystemTimeToFileTime(&st, &ftLocal);
364 SetFileTime(hFile, &ftLocal, NULL, &ftLocal);
365 CloseHandle(hFile);
366 }
367 else
368 {
369 pedro_dprintf(2, "%s: Cannot set filetime on folder\n", file_name);
370 }
371 }
372 else
373 {
374 {
375
376 int r_temp = size_of_WCHAR_mem_r(destination_folder_kp);
377 WCHAR *ar_temp = (void *)malloc(r_temp);
378 WCHAR *ar_temp2 = (void *)malloc(r_temp);
379 hFile =
380 CreateFileW(permissive_name_m_(amanda_asciitowide_1_(destination_folder_kp, ar_temp), ar_temp2),
381 GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
382 NULL,
383 OPEN_EXISTING,
384 FILE_FLAG_BACKUP_SEMANTICS,
385 NULL);
386 free(ar_temp);
387 free(ar_temp2);
388 }
389 if (INVALID_HANDLE_VALUE != hFile)
390 {
391 if (!SetFileTime(hFile, &my_VAL_data_arp.CreationTime___junior,
394 {
395 ;
396 }
397
398 CloseHandle(hFile);
399 }
400 else
401 {
402 pedro_dprintf(2, "%s: Cannot set filetime on folder\n", file_name);
403 }
404 }
405 }
406 // assert(0);
407 return status;
408}
409
419int ispathfile(char *path)
420{
421 static char x[AMANDA__SIZE];
422 int ret;
423
424 strcpy(x, path);
425 ret = strlen(x);
426
427 if (!ret)
428 {
429 return 0;
430 }
431
432 {
433 int r_temp = size_of_WCHAR_mem_r(x);
434 WCHAR *ar_temp = (void *)malloc(r_temp);
435 WCHAR *ar_temp2 = (void *)malloc(r_temp);
436 ret = GetFileAttributesW(permissive_name_m_(amanda_asciitowide_1_(x, ar_temp), ar_temp2));
437 free(ar_temp);
438 free(ar_temp2);
439 }
440
441 if ((int)0xffffffff != (int)ret)
442 {
443 if (ret & (0x00000010))
444 {
445 return 0;
446 }
447 else
448 {
449 return 1;
450 }
451 }
452 else
453 {
454 return 0;
455 }
456}
457
468char *
469strrstr(char *s1, char *s2)
470{
471 char *sc2, *psc1, *ps1;
472 if (*s2 == '\0')
473 {
474 return ((char *)s1);
475 }
476 ps1 = s1 + strlen(s1);
477 while (ps1 != s1)
478 {
479 --ps1;
480 for (psc1 = ps1, sc2 = s2;;)
481 {
482 if (*(psc1++) != *(sc2++))
483 {
484 break;
485 }
486 else if (*sc2 == '\0')
487 {
488 return ((char *)ps1);
489 }
490 }
491 }
492 return ((char *)((void *)0));
493}
494
507int stripfilenameandpath_unix_arp(char *path, char *onlypath, char *onlyfilename)
508{
509 char *ptr;
510
511 ptr = strrstr(path, "/");
512
513 if (ptr)
514 {
515 if (onlypath)
516 {
517 strcpy(onlypath, path),
518 onlypath[ptr - path] = 0;
519 }
520
521 if (onlyfilename)
522 {
523 strcpy(onlyfilename, &path[ptr - path + 1]);
524 }
525 }
526 else
527 {
528 if (onlypath)
529 {
530 strcpy(onlypath, "");
531 }
532 if (onlyfilename)
533 {
534 strcpy(onlyfilename, path);
535 }
536 }
537
538 return 0;
539}
540
554int stripfilenameandpath(char *path, char *onlypath, char *onlyfilename)
555{
556 char *ptr;
557
558 ptr = strrstr(path, "\\");
559
560 if (ptr)
561 {
562 if (onlypath)
563 {
564 strcpy(onlypath, path),
565 onlypath[ptr - path] = 0;
566 }
567
568 if (onlyfilename)
569 {
570 strcpy(onlyfilename, &path[ptr - path + 1]);
571 }
572 }
573 else
574 {
575 if (onlypath)
576 {
577 strcpy(onlypath, "");
578 }
579 if (onlyfilename)
580 {
581 strcpy(onlyfilename, path);
582 }
583 }
584
585 return 0;
586}
587
588int __stdcall stripfilenameandpath_amanda_s_smart_ape(char *path, char *onlypath, char *onlyfilename)
589{
590 return stripfilenameandpath(path, onlypath, onlyfilename);
591}
592
593char *strrstr_ends_with(char *str, char *substr)
594{
595 char *ptr_i;
596
597 ptr_i = strrstr(str, substr);
598
599 if (ptr_i)
600 {
601 if (strlen(ptr_i) == strlen(substr))
602 {
603 return ptr_i;
604 }
605 }
606
607 return NULL;
608}
609
619bool __amandacall is_compressed_z(char *filename_in_z)
620{
621 char *whole_path_copy_arp = filename_in_z;
622 char *ptr_arp;
623
624 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.Z2")))
625 {
626 return 1;
627 }
628
629 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.Z2")))
630 {
631 return 1;
632 }
633
634 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.gz")))
635 {
636 return 1;
637 }
638
639 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.gzip2")))
640 {
641 return 1;
642 }
643
644 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.gzip2")))
645 {
646 return 1;
647 }
648
649 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.bzip3")))
650 {
651 return 1;
652 }
653
654 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.bzip3")))
655 {
656 return 1;
657 }
658
659 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.lz")))
660 {
661 return 1;
662 }
663
664 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.lzma")))
665 {
666 return 1;
667 }
668
669 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.xz")))
670 {
671 return 1;
672 }
673
674 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.Z")))
675 {
676 return 1;
677 }
678
679 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.lzo")))
680 {
681 return 1;
682 }
683
684 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.lz4")))
685 {
686 return 1;
687 }
688
689 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.bz2")))
690 {
691 return 1;
692 }
693
694 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.br")))
695 {
696 return 1;
697 }
698
699 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.zst")))
700 {
701 return 1;
702 }
703
704 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.gz")))
705 {
706 return 1;
707 }
708
709 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.lz")))
710 {
711 return 1;
712 }
713
714 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.lzma")))
715 {
716 return 1;
717 }
718
719 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.xz")))
720 {
721 return 1;
722 }
723
724 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.Z")))
725 {
726 return 1;
727 }
728
729 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.lzo")))
730 {
731 return 1;
732 }
733
734 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.lz4")))
735 {
736 return 1;
737 }
738
739 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.bz2")))
740 {
741 return 1;
742 }
743
744 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.br")))
745 {
746 return 1;
747 }
748
749 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.zst")))
750 {
751 return 1;
752 }
753
754 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.gzip2")))
755 {
756 return 1;
757 }
758
759 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.bzip3")))
760 {
761 return 1;
762 }
763
764 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.lzo2")))
765 {
766 return 1;
767 }
768
769 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.br2")))
770 {
771 return 1;
772 }
773
774 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.lz5")))
775 {
776 return 1;
777 }
778
779 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.gzip2")))
780 {
781 return 1;
782 }
783
784 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.bzip3")))
785 {
786 return 1;
787 }
788
789 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.lzo2")))
790 {
791 return 1;
792 }
793
794 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.br2")))
795 {
796 return 1;
797 }
798
799 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.lz5")))
800 {
801 return 1;
802 }
803
804 return 0;
805}
806
821void __amandacall adjust_extension_z(char *filename_in_z, char *filename_out_z)
822{
823 char *ptr_arp;
824 char *whole_path_copy_arp = filename_in_z;
825
826 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.Z2")))
827 {
828 strcat(filename_out_z, ".tar.Z2");
829 return;
830 }
831
832 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.Z2")))
833 {
834 strcat(filename_out_z, ".val.Z2");
835 return;
836 }
837 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.lzo2")))
838 {
839 strcat(filename_out_z, ".tar.lzo2");
840 return;
841 }
842
843 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.br2")))
844 {
845 strcat(filename_out_z, ".tar.br2");
846 return;
847 }
848
849 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.lz5")))
850 {
851 strcat(filename_out_z, ".tar.lz5");
852 return;
853 }
854
855 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.lzo2")))
856 {
857 strcat(filename_out_z, ".val.lzo2");
858 return;
859 }
860 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.br2")))
861 {
862 strcat(filename_out_z, ".val.br2");
863 return;
864 }
865 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.lz5")))
866 {
867 strcat(filename_out_z, ".val.lz5");
868 return;
869 }
870
871 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.gz")))
872 {
873 strcat(filename_out_z, ".tar.gz");
874 return;
875 }
876
877 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.gzip2")))
878 {
879 strcat(filename_out_z, ".tar.gzip2");
880 return;
881 }
882
883 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.gzip2")))
884 {
885 strcat(filename_out_z, ".val.gzip2");
886 return;
887 }
888
889 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.bzip3")))
890 {
891 strcat(filename_out_z, ".tar.bzip3");
892 return;
893 }
894
895 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.bzip3")))
896 {
897 strcat(filename_out_z, ".val.bzip3");
898 return;
899 }
900
901 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.lzma")))
902 {
903 strcat(filename_out_z, ".tar.lzma");
904 return;
905 }
906
907 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.lz")))
908 {
909 strcat(filename_out_z, ".tar.lz");
910 return;
911 }
912
913 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.xz")))
914 {
915 strcat(filename_out_z, ".tar.xz");
916 return;
917 }
918
919 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.Z")))
920 {
921 strcat(filename_out_z, ".tar.Z");
922 return;
923 }
924
925 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.lzo")))
926 {
927 strcat(filename_out_z, ".tar.lzo");
928 return;
929 }
930
931 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.lz4")))
932 {
933 strcat(filename_out_z, ".tar.lz4");
934 return;
935 }
936
937 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.bz2")))
938 {
939 strcat(filename_out_z, ".tar.bz2");
940 return;
941 }
942
943 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.br")))
944 {
945 strcat(filename_out_z, ".tar.br");
946 return;
947 }
948
949 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.zst")))
950 {
951 strcat(filename_out_z, ".tar.zst");
952 return;
953 }
954
955 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.gz")))
956 {
957 strcat(filename_out_z, ".val.gz");
958 return;
959 }
960
961 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.lzma")))
962 {
963 strcat(filename_out_z, ".val.lzma");
964 return;
965 }
966
967 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.lz")))
968 {
969 strcat(filename_out_z, ".val.lz");
970 return;
971 }
972
973 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.xz")))
974 {
975 strcat(filename_out_z, ".val.xz");
976 return;
977 }
978
979 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.Z")))
980 {
981 strcat(filename_out_z, ".val.Z");
982 return;
983 }
984
985 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.lzo")))
986 {
987 strcat(filename_out_z, ".val.lzo");
988 return;
989 }
990
991 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.lz4")))
992 {
993 strcat(filename_out_z, ".val.lz4");
994 return;
995 }
996
997 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.bz2")))
998 {
999 strcat(filename_out_z, ".val.bz2");
1000 return;
1001 }
1002
1003 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.br")))
1004 {
1005 strcat(filename_out_z, ".val.br");
1006 return;
1007 }
1008
1009 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.zst")))
1010 {
1011 strcat(filename_out_z, ".val.zst");
1012 return;
1013 }
1014
1015 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar")))
1016 {
1017 strcat(filename_out_z, ".tar");
1018 return;
1019 }
1020
1021 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val")))
1022 {
1023 strcat(filename_out_z, ".val");
1024 return;
1025 }
1026
1027 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".iso")))
1028 {
1029 strcat(filename_out_z, ".iso");
1030 return;
1031 }
1032
1033 return;
1034}
1035
1047 char *whole_path_arp,
1048 char *new_extension_arp,
1049 char *out_data_arp)
1050{
1051 char *ptr_arp;
1052 static char whole_path_copy_arp[AMANDA__SIZE];
1053
1054 strcpy(whole_path_copy_arp, whole_path_arp);
1055
1056 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".7z")))
1057 {
1058 strcpy(ptr_arp, ".");
1059 strcat(ptr_arp, new_extension_arp);
1060 strcpy(out_data_arp, whole_path_copy_arp);
1061 return;
1062 }
1063
1064 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".zip")))
1065 {
1066 strcpy(ptr_arp, ".");
1067 strcat(ptr_arp, new_extension_arp);
1068 strcpy(out_data_arp, whole_path_copy_arp);
1069 return;
1070 }
1071
1072 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.lz5")))
1073 {
1074 strcpy(ptr_arp, ".");
1075 strcat(ptr_arp, new_extension_arp);
1076 strcpy(out_data_arp, whole_path_copy_arp);
1077 return;
1078 }
1079
1080 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.lz5")))
1081 {
1082 strcpy(ptr_arp, ".");
1083 strcat(ptr_arp, new_extension_arp);
1084 strcpy(out_data_arp, whole_path_copy_arp);
1085 return;
1086 }
1087
1088 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.Z2")))
1089 {
1090 strcpy(ptr_arp, ".");
1091 strcat(ptr_arp, new_extension_arp);
1092 strcpy(out_data_arp, whole_path_copy_arp);
1093 return;
1094 }
1095
1096 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.Z2")))
1097 {
1098 strcpy(ptr_arp, ".");
1099 strcat(ptr_arp, new_extension_arp);
1100 strcpy(out_data_arp, whole_path_copy_arp);
1101 return;
1102 }
1103
1104 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.lzo2")))
1105 {
1106 strcpy(ptr_arp, ".");
1107 strcat(ptr_arp, new_extension_arp);
1108 strcpy(out_data_arp, whole_path_copy_arp);
1109 return;
1110 }
1111
1112 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.lzo2")))
1113 {
1114 strcpy(ptr_arp, ".");
1115 strcat(ptr_arp, new_extension_arp);
1116 strcpy(out_data_arp, whole_path_copy_arp);
1117 return;
1118 }
1119
1120 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.br2")))
1121 {
1122 strcpy(ptr_arp, ".");
1123 strcat(ptr_arp, new_extension_arp);
1124 strcpy(out_data_arp, whole_path_copy_arp);
1125 return;
1126 }
1127
1128 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.br2")))
1129 {
1130 strcpy(ptr_arp, ".");
1131 strcat(ptr_arp, new_extension_arp);
1132 strcpy(out_data_arp, whole_path_copy_arp);
1133 return;
1134 }
1135
1136 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.bzip3")))
1137 {
1138 strcpy(ptr_arp, ".");
1139 strcat(ptr_arp, new_extension_arp);
1140 strcpy(out_data_arp, whole_path_copy_arp);
1141 return;
1142 }
1143
1144 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.bzip3")))
1145 {
1146 strcpy(ptr_arp, ".");
1147 strcat(ptr_arp, new_extension_arp);
1148 strcpy(out_data_arp, whole_path_copy_arp);
1149 return;
1150 }
1151
1152 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.gzip2")))
1153 {
1154 strcpy(ptr_arp, ".");
1155 strcat(ptr_arp, new_extension_arp);
1156 strcpy(out_data_arp, whole_path_copy_arp);
1157 return;
1158 }
1159
1160 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.gzip2")))
1161 {
1162 strcpy(ptr_arp, ".");
1163 strcat(ptr_arp, new_extension_arp);
1164 strcpy(out_data_arp, whole_path_copy_arp);
1165 return;
1166 }
1167 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.gz")))
1168 {
1169 strcpy(ptr_arp, ".");
1170 strcat(ptr_arp, new_extension_arp);
1171 strcpy(out_data_arp, whole_path_copy_arp);
1172 return;
1173 }
1174
1175 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.gzip2")))
1176 {
1177 strcpy(ptr_arp, ".");
1178 strcat(ptr_arp, new_extension_arp);
1179 strcpy(out_data_arp, whole_path_copy_arp);
1180 return;
1181 }
1182
1183 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.gzip2")))
1184 {
1185 strcpy(ptr_arp, ".");
1186 strcat(ptr_arp, new_extension_arp);
1187 strcpy(out_data_arp, whole_path_copy_arp);
1188 return;
1189 }
1190
1191 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.bzip3")))
1192 {
1193 strcpy(ptr_arp, ".");
1194 strcat(ptr_arp, new_extension_arp);
1195 strcpy(out_data_arp, whole_path_copy_arp);
1196 return;
1197 }
1198
1199 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.bzip3")))
1200 {
1201 strcpy(ptr_arp, ".");
1202 strcat(ptr_arp, new_extension_arp);
1203 strcpy(out_data_arp, whole_path_copy_arp);
1204 return;
1205 }
1206
1207 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.lz")))
1208 {
1209 strcpy(ptr_arp, ".");
1210 strcat(ptr_arp, new_extension_arp);
1211 strcpy(out_data_arp, whole_path_copy_arp);
1212 return;
1213 }
1214
1215 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.lzma")))
1216 {
1217 strcpy(ptr_arp, ".");
1218 strcat(ptr_arp, new_extension_arp);
1219 strcpy(out_data_arp, whole_path_copy_arp);
1220 return;
1221 }
1222
1223 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.xz")))
1224 {
1225 strcpy(ptr_arp, ".");
1226 strcat(ptr_arp, new_extension_arp);
1227 strcpy(out_data_arp, whole_path_copy_arp);
1228 return;
1229 }
1230
1231 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.Z")))
1232 {
1233 strcpy(ptr_arp, ".");
1234 strcat(ptr_arp, new_extension_arp);
1235 strcpy(out_data_arp, whole_path_copy_arp);
1236 return;
1237 }
1238
1239 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.lzo")))
1240 {
1241 strcpy(ptr_arp, ".");
1242 strcat(ptr_arp, new_extension_arp);
1243 strcpy(out_data_arp, whole_path_copy_arp);
1244 return;
1245 }
1246
1247 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.lz4")))
1248 {
1249 strcpy(ptr_arp, ".");
1250 strcat(ptr_arp, new_extension_arp);
1251 strcpy(out_data_arp, whole_path_copy_arp);
1252 return;
1253 }
1254
1255 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.bz2")))
1256 {
1257 strcpy(ptr_arp, ".");
1258 strcat(ptr_arp, new_extension_arp);
1259 strcpy(out_data_arp, whole_path_copy_arp);
1260 return;
1261 }
1262
1263 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.br")))
1264 {
1265 strcpy(ptr_arp, ".");
1266 strcat(ptr_arp, new_extension_arp);
1267 strcpy(out_data_arp, whole_path_copy_arp);
1268 return;
1269 }
1270
1271 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar.zst")))
1272 {
1273 strcpy(ptr_arp, ".");
1274 strcat(ptr_arp, new_extension_arp);
1275 strcpy(out_data_arp, whole_path_copy_arp);
1276 return;
1277 }
1278
1279 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.gz")))
1280 {
1281 strcpy(ptr_arp, ".");
1282 strcat(ptr_arp, new_extension_arp);
1283 strcpy(out_data_arp, whole_path_copy_arp);
1284 return;
1285 }
1286
1287 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.lz")))
1288 {
1289 strcpy(ptr_arp, ".");
1290 strcat(ptr_arp, new_extension_arp);
1291 strcpy(out_data_arp, whole_path_copy_arp);
1292 return;
1293 }
1294
1295 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.lzma")))
1296 {
1297 strcpy(ptr_arp, ".");
1298 strcat(ptr_arp, new_extension_arp);
1299 strcpy(out_data_arp, whole_path_copy_arp);
1300 return;
1301 }
1302
1303 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.xz")))
1304 {
1305 strcpy(ptr_arp, ".");
1306 strcat(ptr_arp, new_extension_arp);
1307 strcpy(out_data_arp, whole_path_copy_arp);
1308 return;
1309 }
1310
1311 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.Z")))
1312 {
1313 strcpy(ptr_arp, ".");
1314 strcat(ptr_arp, new_extension_arp);
1315 strcpy(out_data_arp, whole_path_copy_arp);
1316 return;
1317 }
1318
1319 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.lzo")))
1320 {
1321 strcpy(ptr_arp, ".");
1322 strcat(ptr_arp, new_extension_arp);
1323 strcpy(out_data_arp, whole_path_copy_arp);
1324 return;
1325 }
1326
1327 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.lz4")))
1328 {
1329 strcpy(ptr_arp, ".");
1330 strcat(ptr_arp, new_extension_arp);
1331 strcpy(out_data_arp, whole_path_copy_arp);
1332 return;
1333 }
1334
1335 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.bz2")))
1336 {
1337 strcpy(ptr_arp, ".");
1338 strcat(ptr_arp, new_extension_arp);
1339 strcpy(out_data_arp, whole_path_copy_arp);
1340 return;
1341 }
1342
1343 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.br")))
1344 {
1345 strcpy(ptr_arp, ".");
1346 strcat(ptr_arp, new_extension_arp);
1347 strcpy(out_data_arp, whole_path_copy_arp);
1348 return;
1349 }
1350
1351 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val.zst")))
1352 {
1353 strcpy(ptr_arp, ".");
1354 strcat(ptr_arp, new_extension_arp);
1355 strcpy(out_data_arp, whole_path_copy_arp);
1356 return;
1357 }
1358
1359 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".tar")))
1360 {
1361 strcpy(ptr_arp, ".");
1362 strcat(ptr_arp, new_extension_arp);
1363 strcpy(out_data_arp, whole_path_copy_arp);
1364 return;
1365 }
1366
1367 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".val")))
1368 {
1369 strcpy(ptr_arp, ".");
1370 strcat(ptr_arp, new_extension_arp);
1371 strcpy(out_data_arp, whole_path_copy_arp);
1372 return;
1373 }
1374
1375 if ((ptr_arp = strrstr_ends_with(whole_path_copy_arp, ".iso")))
1376 {
1377 strcpy(ptr_arp, ".");
1378 strcat(ptr_arp, new_extension_arp);
1379 strcpy(out_data_arp, whole_path_copy_arp);
1380 return;
1381 }
1382
1383 strcpy(out_data_arp, whole_path_arp);
1384 strcat(out_data_arp, ".");
1385 strcat(out_data_arp, new_extension_arp);
1386 return;
1387}
1388
1389#define e_free free
1390#define e_malloc malloc
1391
1401int createtestfilename(char *path1)
1402{
1403 int ret;
1404 char *path = malloc(AMANDA__SIZE);
1405 strcpy(path, path1);
1406 ret = strlen(path);
1407 if (path[ret - 1] != '\\')
1408 {
1409 path[ret] = '\\';
1410 path[ret + 1] = 0;
1411 }
1412 {
1413 WCHAR *fixo_w_ar = malloc(AMANDA__SIZE_ww);
1414 WCHAR *path_w_ar = malloc(AMANDA__SIZE_ww);
1415
1416 {
1417 int r_temp = size_of_WCHAR_mem_r(path);
1418 WCHAR *ar_temp = (void *)malloc(r_temp);
1419 WCHAR *ar_temp2 = (void *)malloc(r_temp);
1420 wcscpy(path_w_ar, permissive_name_m_(amanda_asciitowide_1_(path, ar_temp), ar_temp2));
1421 free(ar_temp);
1422 free(ar_temp2);
1423 }
1424
1425 ret = GetTempFileNameW(path_w_ar, L"BW_AR_", 0, fixo_w_ar);
1426
1427 if (ret == 0)
1428 {
1429 free(path);
1430 free(fixo_w_ar);
1431 free(path_w_ar);
1432 return 0;
1433 }
1434 else
1435 {
1436
1437 {
1438
1439 WCHAR *ar_temp = (void *)malloc(AMANDA__SIZE_ww);
1440 DeleteFileW(permissive_name_m_(fixo_w_ar, ar_temp));
1441 free(ar_temp);
1442 }
1443
1444 free(fixo_w_ar);
1445 free(path_w_ar);
1446 free(path);
1447 return 1;
1448 }
1449 }
1450}
1451
1466int createtempfilename_and_keep_z(char *path1, char *out_z, WCHAR *signature_z)
1467{
1468 int ret;
1469 char *path = malloc(AMANDA__SIZE);
1470 strcpy(path, path1);
1471 ret = strlen(path);
1472
1473 if (path[ret - 1] != '\\')
1474 {
1475 path[ret] = '\\';
1476 path[ret + 1] = 0;
1477 }
1478 {
1479 WCHAR *fixo_w_ar = malloc(AMANDA__SIZE_ww);
1480 WCHAR *path_w_ar = malloc(AMANDA__SIZE_ww);
1481
1482 {
1483 int r_temp = size_of_WCHAR_mem_r(path);
1484 WCHAR *ar_temp = (void *)malloc(r_temp);
1485 wcscpy(path_w_ar, amanda_asciitowide_1_(path, ar_temp));
1486 free(ar_temp);
1487 }
1488
1489 WCHAR *ar_temp = (void *)malloc(AMANDA__SIZE_ww);
1490 ret = GetTempFileNameW(permissive_name_m_(path_w_ar, ar_temp), signature_z, 0, fixo_w_ar);
1491 free(ar_temp);
1492
1493 if (ret == 0)
1494 {
1495 free(fixo_w_ar);
1496 free(path_w_ar);
1497 free(path);
1498 return 0;
1499 }
1500 else
1501 {
1502 {
1503
1504 WCHAR *ar_temp = (void *)malloc(AMANDA__SIZE_ww);
1505 char *ar_temp2 = (void *)malloc(AMANDA__SIZE);
1506 strcpy(out_z,
1507 valquiria_wide_to_utf8(remove_permissive_name_m_(fixo_w_ar, ar_temp), ar_temp2));
1508 free(ar_temp);
1509 free(ar_temp2);
1510 }
1511
1512 free(fixo_w_ar);
1513 free(path_w_ar);
1514 free(path);
1515 return 1;
1516 }
1517 }
1518}
1519
1528int ispathreadonly(char *path)
1529{
1530 char *x = malloc(AMANDA__SIZE);
1531 int ret;
1532 strcpy(x, path);
1533 ret = strlen(x);
1534 if (!ret)
1535 {
1536 free(x);
1537 return -1;
1538 }
1539
1540 if (ret < 2)
1541 {
1542 free(x);
1543 return -1;
1544 }
1545
1546 if (x[0] == '\\' && x[1] == '\\')
1547 {
1548 goto UNC;
1549 }
1550
1551 if (tolower(x[0]) < 'a')
1552 {
1553 free(x);
1554 return -1;
1555 }
1556
1557 if (tolower(x[0]) > 'z')
1558 {
1559 free(x);
1560 return -1;
1561 }
1562
1563 if (tolower(x[1]) != ':')
1564 {
1565 free(x);
1566 return -1;
1567 }
1568
1569UNC:
1570
1571{
1572 int r_temp = size_of_WCHAR_mem_r(x);
1573 WCHAR *ar_temp = (void *)malloc(r_temp);
1574 WCHAR *ar_temp2 = (void *)malloc(r_temp);
1575 ret = GetFileAttributesW(permissive_name_m_(amanda_asciitowide_1_(x, ar_temp), ar_temp2));
1576 free(ar_temp);
1577 free(ar_temp2);
1578}
1579
1580 if ((int)0xffffffff != (int)ret)
1581 {
1582 if (0x00000010 & ret)
1583 {
1584 if (createtestfilename(x))
1585 {
1586 free(x);
1587 return 0;
1588 }
1589 else
1590 {
1591 free(x);
1592 return 1;
1593 }
1594 }
1595 else
1596 {
1597 free(x);
1598 return -1;
1599 }
1600 }
1601 else
1602 {
1603 free(x);
1604 return -1;
1605 }
1606}
1607
1616int ispathfolder(char *path)
1617{
1618 char *x = malloc(AMANDA__SIZE);
1619 int ret;
1620 strcpy(x, path);
1621 ret = strlen(x);
1622
1623 if (!ret)
1624 {
1625 free(x);
1626 return 0;
1627 }
1628
1629 if (ret < 2)
1630 {
1631 free(x);
1632 return 0;
1633 }
1634
1635 if (x[0] == '\\' && x[1] == '\\')
1636 {
1637 goto UNC;
1638 }
1639
1640 if (tolower(x[0]) < 'a')
1641 {
1642 free(x);
1643 return 0;
1644 }
1645
1646 if (tolower(x[0]) > 'z')
1647 {
1648 free(x);
1649 return 0;
1650 }
1651
1652 if (x[1] != ':')
1653 {
1654 free(x);
1655 return 0;
1656 }
1657
1658UNC:
1659
1660{
1661 int r_temp = size_of_WCHAR_mem_r(x);
1662 WCHAR *ar_temp = (void *)malloc(r_temp);
1663 WCHAR *ar_temp2 = (void *)malloc(r_temp);
1664 ret = GetFileAttributesW(permissive_name_m_(amanda_asciitowide_1_(x,
1665 ar_temp),
1666 ar_temp2));
1667 free(ar_temp);
1668 free(ar_temp2);
1669}
1670
1671 if ((int)0xffffffff != (int)ret)
1672 {
1673 if (ret & (0x00000010))
1674 {
1675 free(x);
1676 return 1;
1677 }
1678 else
1679 {
1680 free(x);
1681 return 0;
1682 }
1683 }
1684 else
1685 {
1686 free(x);
1687 return 0;
1688 }
1689}
1690
1700int rspmakedir(char *path)
1701{
1702 int ret;
1703 int i;
1704 char *temp;
1705 ret = strlen(path);
1706 if (!ret)
1707 {
1708 return 1;
1709 }
1710 temp = e_malloc(ret + 2);
1711 strcpy(temp, path);
1712
1713 if (ret < 2)
1714 {
1715 e_free(temp);
1716 return 7;
1717 }
1718
1719 if (ret != 3)
1720 {
1721 if (temp[ret - 1] == '\\')
1722 {
1723 temp[ret - 1] = 0;
1724 }
1725 }
1726
1727 ret = strlen(temp);
1728 if (temp[0] == '\\' && temp[1] == '\\')
1729 {
1730 goto unc;
1731 }
1732
1733 if (tolower(temp[0]) < 'a' || tolower(temp[0]) > 'z' || temp[1] != ':')
1734 {
1735 e_free(temp);
1736 return 2;
1737 }
1738
1739 if (ret)
1740 {
1741 for (i = 0; i < ret; i++)
1742 {
1743 if (temp[i] == '\\')
1744 {
1745 char temp1;
1746 temp1 = temp[i + 1];
1747 temp[i + 1] = 0;
1748
1749 {
1750 int r_temp = size_of_WCHAR_mem_r(temp);
1751 WCHAR *ar_temp = (void *)malloc(r_temp);
1752 WCHAR *ar_temp2 = (void *)malloc(r_temp);
1753
1754 if (0 == ispathfolder(temp))
1755 CreateDirectoryW(permissive_name_m_(amanda_asciitowide_1_(temp, ar_temp), ar_temp2), ((void *)0));
1756
1757 free(ar_temp);
1758 free(ar_temp2);
1759 }
1760
1761 if (strlen(temp) != 3)
1762 {
1763 static char temp4[AMANDA__SIZE];
1764
1765 strcpy(temp4, temp);
1766
1767 temp4[strlen(temp4) - 1] = 0;
1768 }
1769
1770 temp[i + 1] = temp1;
1771 }
1772 }
1773
1774 {
1775 int r_temp = size_of_WCHAR_mem_r(temp);
1776 WCHAR *ar_temp = (void *)malloc(r_temp);
1777 WCHAR *ar_temp2 = (void *)malloc(r_temp);
1778 if (0 == ispathfolder(temp))
1779 CreateDirectoryW(permissive_name_m_(amanda_asciitowide_1_(temp, ar_temp), ar_temp2), ((void *)0));
1780
1781 free(ar_temp);
1782 free(ar_temp2);
1783 }
1784 }
1785
1786 if (ispathfolder(temp))
1787 {
1788 if (!ispathreadonly(temp))
1789 {
1790 e_free(temp);
1791 return 0;
1792 }
1793 else
1794 {
1795 e_free(temp);
1796 return 15;
1797 }
1798 }
1799 else
1800 {
1801 if (ispathfile(temp))
1802 {
1803 e_free(temp);
1804 return 17;
1805 }
1806 else
1807 {
1808 e_free(temp);
1809 return 4;
1810 }
1811 }
1812 e_free(temp);
1813 return 0;
1814unc:
1815
1816 if (ret)
1817 {
1818 for (i = 0; i < ret; i++)
1819 {
1820 if (i == 0)
1821 {
1822 i = 2;
1823 }
1824
1825 if (temp[i] == '\\')
1826 {
1827 char temp1;
1828 temp1 = temp[i + 1];
1829 temp[i + 1] = 0;
1830
1831 {
1832 int r_temp = size_of_WCHAR_mem_r(temp);
1833 WCHAR *ar_temp = (void *)malloc(r_temp);
1834 WCHAR *ar_temp2 = (void *)malloc(r_temp);
1835
1836 if (0 == ispathfolder(temp))
1837 CreateDirectoryW(permissive_name_m_(amanda_asciitowide_1_(temp, ar_temp), ar_temp2), ((void *)0));
1838
1839 free(ar_temp);
1840 free(ar_temp2);
1841 }
1842
1843 if (strlen(temp) != 3)
1844 {
1845
1846 char *temp4 = malloc(AMANDA__SIZE);
1847
1848 strcpy(temp4, temp);
1849
1850 temp4[strlen(temp4) - 1] = 0;
1851
1852 if (ispathfile(temp4))
1853 {
1854 free(temp4);
1855 e_free(temp);
1856 return 17;
1857 }
1858
1859 free(temp4);
1860 }
1861
1862 temp[i + 1] = temp1;
1863 }
1864 }
1865
1866 {
1867 int r_temp = size_of_WCHAR_mem_r(temp);
1868 WCHAR *ar_temp = (void *)malloc(r_temp);
1869 WCHAR *ar_temp2 = (void *)malloc(r_temp);
1870
1871 if (0 == ispathfolder(temp))
1872 CreateDirectoryW(permissive_name_m_(amanda_asciitowide_1_(temp, ar_temp), ar_temp2), ((void *)0));
1873
1874 free(ar_temp);
1875 free(ar_temp2);
1876 }
1877 }
1878
1879 if (ispathfolder(temp))
1880 {
1881 if (!ispathreadonly(temp))
1882 {
1883 e_free(temp);
1884 return 0;
1885 }
1886 else
1887 {
1888 e_free(temp);
1889 return 15;
1890 }
1891
1892 e_free(temp);
1893 return 0;
1894 }
1895 else
1896 {
1897 if (ispathfile(temp))
1898 {
1899 e_free(temp);
1900 return 17;
1901 }
1902 else
1903 {
1904 e_free(temp);
1905 return 6;
1906 }
1907 }
1908
1909 e_free(temp);
1910 return 0;
1911}
1912
1922int rspmakedir_v2(char *path)
1923{
1924 int ret;
1925 int i;
1926 char *temp;
1927
1928 ret = strlen(path);
1929 if (!ret)
1930 {
1931 return 1;
1932 }
1933
1934 temp = e_malloc(ret + 2);
1935
1936 strcpy(temp, path);
1937
1938 if (ret < 2)
1939 {
1940 e_free(temp);
1941 return 7;
1942 }
1943
1944 if (ret != 3)
1945 {
1946 if (temp[ret - 1] == '\\')
1947 {
1948 temp[ret - 1] = 0;
1949 }
1950 }
1951
1952 ret = strlen(temp);
1953 if (temp[0] == '\\' && temp[1] == '\\')
1954 {
1955 goto unc;
1956 }
1957
1958 if (tolower(temp[0]) < 'a' || tolower(temp[0]) > 'z' || temp[1] != ':')
1959 {
1960 e_free(temp);
1961 return 2;
1962 }
1963
1964 if (ret)
1965 {
1966 for (i = 0; i < ret; i++)
1967 {
1968 if (temp[i] == '\\')
1969 {
1970 char temp1;
1971 temp1 = temp[i + 1];
1972 temp[i + 1] = 0;
1973
1974 {
1975 int r_temp = size_of_WCHAR_mem_r(temp);
1976 WCHAR *ar_temp = (void *)malloc(r_temp);
1977 WCHAR *ar_temp2 = (void *)malloc(r_temp);
1978
1979 if (0 == ispathfolder(temp))
1980 CreateDirectoryW(permissive_name_m_(amanda_asciitowide_1_(temp, ar_temp), ar_temp2), ((void *)0));
1981
1982 free(ar_temp);
1983 free(ar_temp2);
1984 }
1985
1986 if (strlen(temp) != 3)
1987 {
1988 char *temp4 = malloc(AMANDA__SIZE);
1989
1990 strcpy(temp4, temp);
1991
1992 temp4[strlen(temp4) - 1] = 0;
1993 free(temp4);
1994 }
1995
1996 temp[i + 1] = temp1;
1997 }
1998 }
1999
2000 {
2001 int r_temp = size_of_WCHAR_mem_r(temp);
2002 WCHAR *ar_temp = (void *)malloc(r_temp);
2003 WCHAR *ar_temp2 = (void *)malloc(r_temp);
2004
2005 if (0 == ispathfolder(temp))
2006 CreateDirectoryW(permissive_name_m_(amanda_asciitowide_1_(temp, ar_temp), ar_temp2), ((void *)0));
2007
2008 free(ar_temp);
2009 free(ar_temp2);
2010 }
2011 }
2012 e_free(temp);
2013 return 0;
2014unc:
2015
2016 if (ret)
2017 {
2018 for (i = 0; i < ret; i++)
2019 {
2020 if (i == 0)
2021 {
2022 i = 2;
2023 }
2024
2025 if (temp[i] == '\\')
2026 {
2027 char temp1;
2028 temp1 = temp[i + 1];
2029 temp[i + 1] = 0;
2030 {
2031 int r_temp = size_of_WCHAR_mem_r(temp);
2032 WCHAR *ar_temp = (void *)malloc(r_temp);
2033 WCHAR *ar_temp2 = (void *)malloc(r_temp);
2034 if (0 == ispathfolder(temp))
2035 CreateDirectoryW(permissive_name_m_(amanda_asciitowide_1_(temp, ar_temp), ar_temp2), ((void *)0));
2036
2037 free(ar_temp);
2038 free(ar_temp2);
2039 }
2040
2041 if (strlen(temp) != 3)
2042 {
2043 char *temp4 = malloc(AMANDA__SIZE);
2044
2045 strcpy(temp4, temp);
2046
2047 temp4[strlen(temp4) - 1] = 0;
2048
2049 if (ispathfile(temp4))
2050 {
2051 free(temp4);
2052 e_free(temp);
2053 return 17;
2054 }
2055 free(temp4);
2056 }
2057
2058 temp[i + 1] = temp1;
2059 }
2060 }
2061 {
2062 int r_temp = size_of_WCHAR_mem_r(temp);
2063 WCHAR *ar_temp = (void *)malloc(r_temp);
2064 WCHAR *ar_temp2 = (void *)malloc(r_temp);
2065
2066 if (0 == ispathfolder(temp))
2067 CreateDirectoryW(permissive_name_m_(amanda_asciitowide_1_(temp, ar_temp), ar_temp2), ((void *)0));
2068
2069 free(ar_temp);
2070 free(ar_temp2);
2071 }
2072 }
2073
2074 e_free(temp);
2075 return 0;
2076}
2077
2088{
2089 int ret;
2090 char aqui;
2091 int i;
2092
2093 ret = strlen(path);
2094
2095 if (ret)
2096 {
2097 for (i = 0; i < ret; i++)
2098 {
2099 aqui = path[i];
2100 if (aqui == '/')
2101 {
2102 path[i] = '\\';
2103 }
2104 }
2105 }
2106}
2107
2117static int
2118open_output_file(char const *file_name, int typeflag, __attribute__((unused)) mode_t mode,
2119 __attribute__((unused)) int file_created, __attribute__((unused)) mode_t *current_mode,
2120 __attribute__((unused)) mode_t *current_mode_mask, char *constructed_filename_kp)
2121{
2122 constructed_filename_kp[0] = 0;
2123 int fd;
2124
2125 int openflag = (O_WRONLY | O_BINARY | O_CREAT | O_TRUNC);
2126
2127 if (typeflag == CONTTYPE)
2128 {
2129 static int conttype_diagnosed;
2130
2131 if (!conttype_diagnosed)
2132 {
2133 conttype_diagnosed = 1;
2134
2135 pedro_dprintf(2, "Extracting contiguous files as regular files");
2136 /********/ printf("Extracting contiguous files as regular files");
2137 }
2138 }
2139
2140 {
2141 static char destination_file_kp[AMANDA__SIZE];
2142 static char path_to_create_kp[AMANDA__SIZE];
2143
2144 strcpy(destination_file_kp, extract_folder_final);
2145 strcat(destination_file_kp, file_name);
2146 trocadordebackslashtras(destination_file_kp);
2147 assert('\\' != file_name[strlen(file_name) - 1]);
2148 stripfilenameandpath(destination_file_kp, path_to_create_kp, NULL);
2149 assert(strlen(path_to_create_kp) != strlen(destination_file_kp));
2150 rspmakedir_v2(path_to_create_kp);
2151 strcpy(constructed_filename_kp, destination_file_kp);
2152 {
2153 int r_temp = size_of_WCHAR_mem_r(destination_file_kp);
2154 WCHAR *ar_temp = (void *)malloc(r_temp);
2155 WCHAR *ar_temp2 = (void *)malloc(r_temp);
2156 fd = _wopen(permissive_name_m_(amanda_asciitowide_1_(destination_file_kp, ar_temp), ar_temp2), openflag, _S_IWRITE);
2157
2158 free(ar_temp);
2159 free(ar_temp2);
2160 }
2161 }
2162
2163 strcpy(extracting_filename_ar, file_name);
2164
2165 if (-1 == fd)
2166 {
2167 got_a_warning_ar = 1;
2168 sprintf(warning_info, "Cannot open file %s to write", file_name);
2169 }
2170 else
2171 {
2172 warning_info[0] = 0;
2173 }
2174
2175 while (extract_pause__flag)
2176 {
2178 {
2179 break;
2180 }
2181 Sleep(50);
2182 }
2183 creating_folder_maria[0] = 0;
2185
2186 return fd;
2187}
2188
2197static int
2198open_output_file_VAL(char const *file_name,
2199 __attribute__((unused)) int typeflag,
2200 __attribute__((unused)) mode_t mode,
2201 __attribute__((unused)) int file_created,
2202 __attribute__((unused)) mode_t *current_mode,
2203 __attribute__((unused)) mode_t *current_mode_mask,
2204 __attribute__((unused)) char *constructed_filename_kp)
2205{
2206 constructed_filename_kp[0] = 0;
2207 int fd;
2208
2209 int openflag = (O_WRONLY | O_BINARY | O_CREAT | O_TRUNC);
2210
2211 {
2212 static char destination_file_kp[AMANDA__SIZE];
2213 static char path_to_create_kp[AMANDA__SIZE];
2214
2215 memset(destination_file_kp, 0, sizeof(destination_file_kp));
2216 memset(path_to_create_kp, 0, sizeof(path_to_create_kp));
2217
2218 strcpy(destination_file_kp, extract_folder_final);
2219 strcat(destination_file_kp, file_name);
2220 trocadordebackslashtras(destination_file_kp);
2221 assert('\\' != file_name[strlen(file_name) - 1]);
2222 stripfilenameandpath(destination_file_kp, path_to_create_kp, NULL);
2223 assert(strlen(path_to_create_kp) != strlen(destination_file_kp));
2224 rspmakedir_v2(path_to_create_kp);
2225 strcpy(constructed_filename_kp, destination_file_kp);
2226
2227 {
2228 int r_temp = size_of_WCHAR_mem_r(destination_file_kp);
2229 WCHAR *ar_temp = (void *)malloc(r_temp);
2230 WCHAR *ar_temp2 = (void *)malloc(r_temp);
2231 if (!SetFileAttributesW(
2232 permissive_name_m_(amanda_asciitowide_1_(destination_file_kp, ar_temp), ar_temp2),
2234 {
2235 ;
2236 }
2237
2238 free(ar_temp);
2239 free(ar_temp2);
2240 }
2241 {
2242 int r_temp = size_of_WCHAR_mem_r(destination_file_kp);
2243 WCHAR *ar_temp = (void *)malloc(r_temp);
2244 WCHAR *ar_temp2 = (void *)malloc(r_temp);
2245 fd = _wopen(permissive_name_m_(amanda_asciitowide_1_(destination_file_kp, ar_temp), ar_temp2),
2246 openflag, _S_IWRITE);
2247
2248 free(ar_temp);
2249 free(ar_temp2);
2250 }
2251 pedro_dprintf(-1, "val %d abrindo arquivo com perm %s\n", fd, destination_file_kp);
2252
2253 // assert(0);
2254 }
2255
2256 strcpy(extracting_filename_ar, file_name);
2257
2258 if (-1 == fd)
2259 {
2260 got_a_warning_ar = 1;
2261 sprintf(warning_info, "Cannot open file %s to write", file_name);
2262 }
2263 else
2264 {
2265 warning_info[0] = 0;
2266 }
2267
2268 while (extract_pause__flag)
2269 {
2271 {
2272 break;
2273 }
2274 Sleep(50);
2275 }
2276 creating_folder_maria[0] = 0;
2278
2279 return fd;
2280}
2281
2295bool is_encrypted_gnu_tar_arp(char *file_arp_utf_8)
2296{
2297 int64_t filesize_arp = getfilesize_ar(file_arp_utf_8);
2298 int64_t filesize_arp_b;
2299 char buffer_arp[300];
2300 FILE *amanda_file;
2301 int len_arp;
2302
2303 memset(encryption_format_S2_, 0, sizeof(encryption_format_S2_));
2304
2305 strcpy(encryption_format_S2_, " ");
2306
2307 {
2308 int r_temp = size_of_WCHAR_mem_r(file_arp_utf_8);
2309 WCHAR *ar_temp = (void *)malloc(r_temp);
2310 WCHAR *ar_temp2 = (void *)malloc(r_temp);
2311 amanda_file = _wfopen(permissive_name_m_(amanda_asciitowide_1_(file_arp_utf_8, ar_temp), ar_temp2), L"rb");
2312 free(ar_temp);
2313 free(ar_temp2);
2314 }
2315
2316 if (amanda_file)
2317 {
2318 len_arp = fread(&ret_arp_, 1, 4, amanda_file);
2319 pedro_dprintf(-1, "dentro 11\n");
2320 if (4 == len_arp)
2321 {
2322
2323 if (
2324 0x706c6176 == ret_arp_ ||
2325 (0x706c6176 - 1) == ret_arp_ ||
2326 (0x706c6176 - 2) == ret_arp_ ||
2327 (0x706c6176 - 3) == ret_arp_ ||
2328 (0x706c6176 - 4) == ret_arp_ ||
2329 (0x706c6176 - 5) == ret_arp_)
2330 {
2331 pedro_dprintf(-1, "dentro 22\n");
2332 len_arp = fread(buffer_arp, 1, 64, amanda_file);
2333
2334 if (64 == len_arp)
2335 {
2336
2337 len_arp = fread(&filesize_arp_b, 1, 8, amanda_file);
2338
2339 if (8 == len_arp)
2340 {
2341
2342 if (filesize_arp == (filesize_arp_b + 4 + 64 + 8))
2343 {
2344
2345 switch (ret_arp_)
2346 {
2347 case 0x706c6176:
2349 break;
2350
2351 case 0x706c6176 - 1:
2353 break;
2354
2355 case 0x706c6176 - 2:
2357 break;
2358
2359 case 0x706c6176 - 3:
2361 break;
2362
2363 case 0x706c6176 - 4:
2365 break;
2366
2367 case 0x706c6176 - 5:
2369 break;
2370 }
2371
2372 fclose(amanda_file);
2373 return true;
2374 }
2375 }
2376 }
2377 }
2378 else if ((0x706c6176 - 6) == ret_arp_ ||
2379 (0x706c6176 - 7) == ret_arp_ ||
2380 (0x706c6176 - 8) == ret_arp_ ||
2381 (0x706c6176 - 9) == ret_arp_ ||
2382 (0x706c6176 - 10) == ret_arp_ ||
2383 (0x706c6176 - 11) == ret_arp_)
2384 {
2385 switch (ret_arp_)
2386 {
2387
2388 case 0x706c6176 - 6:
2390 strcat(encryption_format_S2_, "+ AES MT");
2391 break;
2392
2393 case 0x706c6176 - 7:
2395 strcat(encryption_format_S2_, "+ RC4 MT");
2396 break;
2397
2398 case 0x706c6176 - 8:
2400 strcat(encryption_format_S2_, " + SERPENT MT");
2401 break;
2402
2403 case 0x706c6176 - 9:
2405 strcat(encryption_format_S2_, "+ MARS MT");
2406 break;
2407
2408 case 0x706c6176 - 10:
2410 strcat(encryption_format_S2_, "+ RC6 MT");
2411 break;
2412
2413 case 0x706c6176 - 11:
2415 strcat(encryption_format_S2_, "+ TWOFISH MT");
2416 break;
2417 }
2418 fclose(amanda_file);
2419 return true;
2420 }
2421 }
2422
2423 fclose(amanda_file);
2424 }
2425
2426 return false;
2427}
2428
2429#define ARCHIVE_LITERAL_LL(x) x##ll
2430#define ARCHIVE_LITERAL_ULL(x) x##ull
2431#define EPOC_TIME ARCHIVE_LITERAL_ULL(116444736000000000)
2432#define WINTIME(sec, nsec) ((Int32x32To64(sec, 10000000) + EPOC_TIME) + \
2433 (((nsec) / 1000) * 10))
2434int __fastcall ricardo_convert_m(int a_m, int b_m, SYSTEMTIME *smtime)
2435{
2436 struct timeval times[2];
2437 ULARGE_INTEGER wintm;
2438 FILETIME fmtime;
2439 SYSTEMTIME l_amanda_fmtime;
2440
2441 times[0].tv_sec = a_m;
2442 times[0].tv_usec = b_m;
2443
2444 wintm.QuadPart = WINTIME(times[0].tv_sec /*+ (60 * 60)*/, times[0].tv_usec);
2445 fmtime.dwLowDateTime = wintm.LowPart;
2446 fmtime.dwHighDateTime = wintm.HighPart;
2447 memset(smtime, 0, sizeof(SYSTEMTIME));
2448 FileTimeToSystemTime(
2449 &fmtime,
2450 &l_amanda_fmtime);
2451
2452 SystemTimeToTzSpecificLocalTime(NULL, &l_amanda_fmtime, smtime);
2453
2454 return 0;
2455}
2456void TimetToFileTime(time_t t, LPFILETIME pft);
2465static int
2466extract_file(char *file_name_in_arp, int typeflag)
2467{
2468 __int64 value_for_ftell = 0;
2469 static char constructed_filename_kp[AMANDA__SIZE + 1];
2470 int fd;
2471 int status;
2472 mode_t mode = 1;
2473 off_t size;
2474 size_t count;
2475 size_t written;
2476 time_t mtime_tv_sec_arp = 0;
2477 union block *data_block;
2478 char file_name[AMANDA__SIZE + 1] = {0};
2479
2480 if (AMANDA__SIZE < strlen(file_name_in_arp))
2481 {
2482 memcpy(file_name, file_name_in_arp, AMANDA__SIZE - 2);
2483 strcpy(error_message_k, "Path above limit of 32767 characters, aborting...");
2484 fatal_exit_k = 10002;
2485 }
2486 else
2487 {
2488 strcpy(file_name, file_name_in_arp);
2489 }
2490
2491 {
2492 int file_created = 0;
2493
2494 if (!mode_is_update_arp)
2495 {
2496
2497 fd = open_output_file(file_name, typeflag, mode,
2498 file_created, NULL,
2499 NULL, constructed_filename_kp);
2500
2501 if (0 > fd)
2502 {
2503 skip_member();
2504 return 1;
2505 }
2506
2507 setmode(fd, O_BINARY);
2508 }
2509 else
2510 {
2512 value_for_ftell = _telli64(fd);
2513 }
2514 }
2515
2519 else
2520 for (size = current_stat_info.stat.st_size; size > 0;)
2521 {
2523
2524 data_block = find_next_block();
2525 if (!data_block)
2526 {
2527 pedro_dprintf(2, "Unexpected EOF in archive");
2528 break;
2529 }
2530
2531 written = available_space_after(data_block);
2532
2533 if (written > (size_t)size)
2534 written = size;
2535 errno = 0;
2536 count = blocking_write(fd, data_block->buffer, written);
2537 size -= written;
2538
2539 set_next_block_after((union block *)(data_block->buffer + written - 1));
2540 if (count != written)
2541 {
2542 break;
2543 }
2544 }
2545
2546 skip_file(size);
2547
2548 mv_end();
2549
2550 status = 0;
2551
2552 if (!mode_is_update_arp)
2553 status = close(fd);
2554 if (!mode_is_update_arp)
2555 {
2556#if 0
2557 //char temp_file_arp[1024];
2558 //time_t s = current_stat_info.mtime.tv_sec;
2559 struct _utimbuf ut = { 0 };
2560 ut.actime = current_stat_info.mtime.tv_sec;
2561 ut.modtime = current_stat_info.mtime.tv_sec;
2562 _wutime(amanda_asciitowide_1_(constructed_filename_kp), &ut);
2563#else
2564 if (is_encrypted_gnu_tar_arp(constructed_filename_kp))
2565 {
2566 int64_t temp_arp;
2567 int64_t temp_2_arp;
2568 static char temp_file_arp[AMANDA__SIZE];
2569 // 4 � wrong password
2570 update_progress_arp(&temp_arp);
2571
2572 strcpy(temp_file_arp, constructed_filename_kp);
2573 strcat(temp_file_arp, ".$_$arp.tmp");
2574
2575 ret_arp_ = decrypt_arp(constructed_filename_kp,
2576 temp_file_arp,
2578 &temp_2_arp,
2580 &cores_used_z);
2581
2582 if (0 == ret_arp_)
2583 {
2584 {
2585 int r_temp = size_of_WCHAR_mem_r(constructed_filename_kp);
2586 WCHAR *ar_temp = (void *)malloc(r_temp);
2587 WCHAR *ar_temp2 = (void *)malloc(r_temp);
2588
2589 _wunlink(permissive_name_m_(amanda_asciitowide_1_(constructed_filename_kp, ar_temp), ar_temp2));
2590
2591 free(ar_temp);
2592 free(ar_temp2);
2593 }
2594 {
2595 int r_temprr1 = size_of_WCHAR_mem_r(temp_file_arp);
2596 WCHAR *ar_temp = (void *)malloc(r_temprr1);
2597 WCHAR *ar_temp2 = (void *)malloc(r_temprr1);
2598 int r_temprr2 = size_of_WCHAR_mem_r(constructed_filename_kp);
2599 WCHAR *ar_temp3 = (void *)malloc(r_temprr2);
2600 WCHAR *ar_temp4 = (void *)malloc(r_temprr2);
2601
2602 _wrename(permissive_name_m_(amanda_utf8towide_2_(temp_file_arp, ar_temp), ar_temp2), permissive_name_m_(amanda_asciitowide_1_(constructed_filename_kp, ar_temp3), ar_temp4));
2603
2604 free(ar_temp);
2605 free(ar_temp2);
2606 free(ar_temp3);
2607 free(ar_temp4);
2608 }
2609 }
2610 else if (4 == ret_arp_)
2611 {
2612 {
2613 int r_temp = size_of_WCHAR_mem_r(constructed_filename_kp);
2614 WCHAR *ar_temp = (void *)malloc(r_temp);
2615 WCHAR *ar_temp2 = (void *)malloc(r_temp);
2616
2617 _wunlink(permissive_name_m_(amanda_asciitowide_1_(constructed_filename_kp, ar_temp), ar_temp2));
2618
2619 free(ar_temp);
2620 free(ar_temp2);
2621 }
2622
2623 {
2624 int r_temp = size_of_WCHAR_mem_r(temp_file_arp);
2625 WCHAR *ar_temp = (void *)malloc(r_temp);
2626 WCHAR *ar_temp2 = (void *)malloc(r_temp);
2627
2628 _wunlink(permissive_name_m_(amanda_asciitowide_1_(temp_file_arp, ar_temp), ar_temp2));
2629
2630 free(ar_temp);
2631 free(ar_temp2);
2632 }
2633
2634 fatal_exit_k = 28000;
2635 strcpy(error_message_k, "Wrong password used");
2636 return 1;
2637 }
2638 else
2639 {
2640 {
2641 int r_temp = size_of_WCHAR_mem_r(constructed_filename_kp);
2642 WCHAR *ar_temp = (void *)malloc(r_temp);
2643 WCHAR *ar_temp2 = (void *)malloc(r_temp);
2644
2645 _wunlink(permissive_name_m_(amanda_asciitowide_1_(constructed_filename_kp, ar_temp), ar_temp2));
2646
2647 free(ar_temp);
2648 free(ar_temp2);
2649 }
2650
2651 {
2652 int r_temp = size_of_WCHAR_mem_r(temp_file_arp);
2653 WCHAR *ar_temp = (void *)malloc(r_temp);
2654 WCHAR *ar_temp2 = (void *)malloc(r_temp);
2655 _wunlink(permissive_name_m_(amanda_asciitowide_1_(temp_file_arp, ar_temp), ar_temp2));
2656 free(ar_temp);
2657 free(ar_temp2);
2658 }
2659
2660 fatal_exit_k = 28001;
2661 strcpy(error_message_k, "Unexpected decryption error");
2662 return 1;
2663 }
2664 }
2665
2666 __time64_t s = current_stat_info.mtime.tv_sec;
2667
2668 if (!_gmtime64(&s))
2669 {
2670 s = time(NULL);
2671 }
2672
2673 HANDLE hFile;
2674
2675 FILETIME ftime = {0};
2676
2677 SYSTEMTIME l_amanda_fmtime = {0};
2678
2679 (void)l_amanda_fmtime;
2680 /*
2681 {
2682 struct tm *tm;
2683 s = s - (60 * 60);
2684
2685 tm = 1 ? gmtime(&s) : localtime(&s);
2686 tm = 1 ? gmtime(&s) : localtime(&s); //it is weird but you need two subsequent calls to make it work
2687 if (!tm)
2688 {
2689 s = time(NULL);
2690 tm = 0 ? gmtime(&s) : localtime(&s);
2691 }
2692 l_amanda_fmtime.wSecond = tm->tm_sec;
2693 l_amanda_fmtime.wMinute = tm->tm_min;
2694 l_amanda_fmtime.wHour = tm->tm_hour;
2695 l_amanda_fmtime.wYear = tm->tm_year + 1900;
2696 l_amanda_fmtime.wMonth = tm->tm_mon + 1;
2697 l_amanda_fmtime.wDay = tm->tm_mday;
2698 }
2699*/
2700 TimetToFileTime(s, &ftime);
2701 // SystemTimeToFileTime(&l_amanda_fmtime, &ftime);
2702 {
2703 int r_temp = size_of_WCHAR_mem_r(constructed_filename_kp);
2704 WCHAR *ar_temp = (void *)malloc(r_temp);
2705 WCHAR *ar_temp2 = (void *)malloc(r_temp);
2706 hFile =
2707 CreateFileW(permissive_name_m_(amanda_asciitowide_1_(constructed_filename_kp, ar_temp), ar_temp2),
2708 GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
2709 NULL,
2710 OPEN_EXISTING,
2711 FILE_FLAG_BACKUP_SEMANTICS,
2712 NULL);
2713
2714 free(ar_temp);
2715 free(ar_temp2);
2716 }
2717 if (INVALID_HANDLE_VALUE != hFile)
2718 {
2719 SetFileTime(hFile, &ftime, NULL, &ftime);
2720 CloseHandle(hFile);
2721 }
2722 else
2723 {
2724 pedro_dprintf(2, "%s: Cannot set filetime on folder\n", file_name);
2725 }
2726#endif
2727 }
2728 else
2729 mtime_tv_sec_arp = current_stat_info.mtime.tv_sec;
2730
2732 {
2734 file_name,
2735 _telli64(fd) - value_for_ftell,
2736 mtime_tv_sec_arp,
2737 false,
2738 value_for_ftell,
2739 0,
2740 0,
2741 mtime_tv_sec_arp,
2742 NULL);
2743 }
2744 return status;
2745}
2746
2755static int
2756extract_file_VAL(char *file_name_in_arp)
2757{
2758 // bool already_set_size_charli = false;
2759 const uint64_t TAMANHO_AMANDA = (1 << 16) * 8;
2760 uint64_t remaining_arp = my_VAL_data_arp.VAL_file_size;
2761 int len_arp;
2762 char *buffer_arp = NULL;
2763 static char file_name[AMANDA__SIZE] = {
2764 0,
2765 };
2766 __time64_t mtime_tv_sec_arp;
2767 __int64 value_for_ftell;
2768 static char constructed_filename_kp[AMANDA__SIZE];
2769 int fd;
2770 int status;
2771 size_t count;
2772 mode_t mode = 1;
2773
2774 if (AMANDA__SIZE < strlen(file_name_in_arp))
2775 {
2776 memset(file_name, 0, sizeof(file_name));
2777 memcpy(file_name, file_name_in_arp, AMANDA__SIZE - 2);
2778 strcpy(error_message_k, "Path is above 32767, aborting...");
2779 fatal_exit_k = 10002;
2780 }
2781 else
2782 {
2783 strcpy(file_name, file_name_in_arp);
2784 }
2785
2786 int file_created = 0;
2787
2788 if (!mode_is_update_arp)
2789 {
2790
2791 fd = open_output_file_VAL(file_name, 0, mode,
2792 file_created, NULL,
2793 NULL, constructed_filename_kp);
2794
2795 if (0 > fd)
2796 {
2798 {
2799 _fseeki64(
2802 SEEK_CUR);
2803 }
2804
2805 pedro_dprintf(2, "Skipping file %s--2--\n", file_name);
2806 return 1;
2807 }
2808 value_for_ftell = 0;
2809 setmode(fd, O_BINARY);
2810 }
2811 else
2812 {
2814 value_for_ftell = _telli64(fd);
2815 }
2816
2817 buffer_arp = malloc(TAMANHO_AMANDA);
2818 assert(buffer_arp);
2819 while (1)
2820 {
2821
2822#if 0
2823 {
2824
2825 int64_t z = -1;
2826 yasmin_charlotte_pereira_dprintf(0, "ve 1 %lli", z);
2827 // z = -z;
2828 int p = z;
2829 yasmin_charlotte_pereira_dprintf(0, "int %d", p);
2830 uint64_t a = p;
2831
2832 uint64_t result = min((int)10000, a);
2833
2834 yasmin_charlotte_pereira_dprintf(0, "veja %llu %llx", a, a);
2835 yasmin_charlotte_pereira_dprintf(0, "veja b %lld", result);
2836 }
2837 exit(30);
2838#endif
2839
2840 while (extract_pause__flag)
2841 {
2842 Sleep(50);
2843
2845 {
2846 fatal_exit_k = 119;
2847 strcpy(error_message_k, "User cancel");
2848 goto exit_now_arp;
2849 }
2850 }
2851
2853 {
2854 fatal_exit_k = 119;
2855 strcpy(error_message_k, "User cancel");
2856 goto exit_now_arp;
2857 }
2858
2859 len_arp = fread(buffer_arp, 1, (int)(min(TAMANHO_AMANDA, remaining_arp)), decoder_file_z);
2860 if (0 > len_arp)
2861 {
2862 fatal_exit_k = 27020;
2863 strcpy(error_message_k, "Cannot read from VAL file");
2864 break;
2865 }
2866
2867 if (0 == len_arp)
2868 {
2869 if (remaining_arp)
2870 {
2871 fatal_exit_k = 27021;
2872 strcpy(error_message_k, "Cannot read from VAL file");
2873 }
2874 break;
2875 }
2876#if 0
2877/*
2878 if (1 < my_VAL_data_arp.VAL_file_size)
2879 {
2880 if (!already_set_size_charli)
2881 {
2882 already_set_size_charli = true;
2883 int64_t charli_int_ = _lseeki64(
2884 fd,
2885 my_VAL_data_arp.VAL_file_size - 1,
2886 SEEK_SET);
2887
2888 yasmin_charlotte_pereira_dprintf(0, "tamanho do arquivo e posicao nele %lld %lld", charli_int_, my_VAL_data_arp.VAL_file_size);
2889 blocking_write(fd, "\0\0", 1);
2890 charli_int_ = _lseeki64(
2891 fd,
2892 0,
2893 SEEK_SET);
2894
2895 yasmin_charlotte_pereira_dprintf(0, "2 tamanho do arquivo e posicao nele %lld %lld", charli_int_, my_VAL_data_arp.VAL_file_size);
2896
2897 // exit(30);
2898 }
2899 }
2900*/
2901#endif
2902 count = blocking_write(fd, buffer_arp, len_arp);
2903
2904 if (0 > (int)count)
2905 {
2906 fatal_exit_k = 27022;
2907 strcpy(error_message_k, "Cannot write to destination file");
2908 break;
2909 }
2910
2911 if ((int)count != (int)len_arp)
2912 {
2913 fatal_exit_k = 27023;
2914 strcpy(error_message_k, "Cannot write to destination file");
2915 break;
2916 }
2917 remaining_arp -= len_arp;
2918 }
2919
2920exit_now_arp:;
2921
2922 free(buffer_arp);
2923 status = 0;
2924
2925 if (!mode_is_update_arp)
2926 status = close(fd);
2927 if (!mode_is_update_arp)
2928 {
2930 {
2931 int64_t temp_arp;
2932 int64_t temp_2_arp;
2933 static char temp_file_arp[AMANDA__SIZE];
2934 update_progress_arp(&temp_arp);
2935 strcpy(temp_file_arp, constructed_filename_kp);
2936 strcat(temp_file_arp, ".$_$arp.tmp");
2937 ret_arp_ = decrypt_arp(constructed_filename_kp,
2938 temp_file_arp,
2940 &temp_2_arp,
2942 &cores_used_z);
2943
2944 if (0 == ret_arp_)
2945 {
2946 {
2947 int r_temp = size_of_WCHAR_mem_r(constructed_filename_kp);
2948 WCHAR *ar_temp = (void *)malloc(r_temp);
2949 WCHAR *ar_temp2 = (void *)malloc(r_temp);
2950
2951 _wunlink(permissive_name_m_(amanda_asciitowide_1_(constructed_filename_kp, ar_temp), ar_temp2));
2952
2953 free(ar_temp);
2954 free(ar_temp2);
2955 }
2956
2957 {
2958 int r_temprr1 = size_of_WCHAR_mem_r(temp_file_arp);
2959 WCHAR *ar_temp = (void *)malloc(r_temprr1);
2960 WCHAR *ar_temp2 = (void *)malloc(r_temprr1);
2961 int r_temprr2 = size_of_WCHAR_mem_r(constructed_filename_kp);
2962 WCHAR *ar_temp3 = (void *)malloc(r_temprr2);
2963 WCHAR *ar_temp4 = (void *)malloc(r_temprr2);
2964
2965 _wrename(permissive_name_m_(amanda_utf8towide_2_(temp_file_arp, ar_temp), ar_temp2), permissive_name_m_v27(amanda_asciitowide_1_(constructed_filename_kp, ar_temp3), ar_temp4));
2966
2967 free(ar_temp);
2968 free(ar_temp2);
2969 free(ar_temp3);
2970 free(ar_temp4);
2971 }
2972 }
2973 else if (4 == ret_arp_)
2974 {
2975
2976 {
2977 int r_temp = size_of_WCHAR_mem_r(constructed_filename_kp);
2978 WCHAR *ar_temp = (void *)malloc(r_temp);
2979 WCHAR *ar_temp2 = (void *)malloc(r_temp);
2980
2981 _wunlink(permissive_name_m_(amanda_asciitowide_1_(constructed_filename_kp, ar_temp), ar_temp2));
2982
2983 free(ar_temp);
2984 free(ar_temp2);
2985 }
2986
2987 {
2988 int r_temp = size_of_WCHAR_mem_r(temp_file_arp);
2989 WCHAR *ar_temp = (void *)malloc(r_temp);
2990 WCHAR *ar_temp2 = (void *)malloc(r_temp);
2991
2992 _wunlink(permissive_name_m_(amanda_asciitowide_1_(temp_file_arp, ar_temp), ar_temp2));
2993
2994 free(ar_temp);
2995 free(ar_temp2);
2996 }
2997
2998 fatal_exit_k = 28000;
2999 strcpy(error_message_k, "Wrong password used");
3000 return 1;
3001 }
3002 else
3003 {
3004 {
3005 int r_temp = size_of_WCHAR_mem_r(constructed_filename_kp);
3006 WCHAR *ar_temp = (void *)malloc(r_temp);
3007 WCHAR *ar_temp2 = (void *)malloc(r_temp);
3008
3009 _wunlink(permissive_name_m_(amanda_asciitowide_1_(constructed_filename_kp, ar_temp), ar_temp2));
3010
3011 free(ar_temp);
3012 free(ar_temp2);
3013 }
3014 {
3015 int r_temp = size_of_WCHAR_mem_r(temp_file_arp);
3016 WCHAR *ar_temp = (void *)malloc(r_temp);
3017 WCHAR *ar_temp2 = (void *)malloc(r_temp);
3018
3019 _wunlink(permissive_name_m_(amanda_asciitowide_1_(temp_file_arp, ar_temp), ar_temp2));
3020
3021 free(ar_temp);
3022 free(ar_temp2);
3023 }
3024 fatal_exit_k = 28001;
3025 strcpy(error_message_k, "Unexpected decryption error");
3026 return 1;
3027 }
3028 }
3029
3031 {
3032 void TimetToFileTime(time_t t, LPFILETIME pft);
3033 __time64_t s;
3034
3037 {
3039 }
3040
3041 if (!_gmtime64(&s))
3042 {
3043 s = time(NULL);
3044 }
3045
3046 HANDLE hFile;
3047 // FILETIME ftLocal;
3048 // SYSTEMTIME st;
3049 // FILETIME ftime = {0};
3050 FILETIME ftime_in = {0};
3051 TimetToFileTime(s, &ftime_in);
3052
3053 /*
3054 FileTimeToLocalFileTime(
3055 &ftime_in,
3056 &ftime);
3057 */
3058 // struct tm tm_k;
3059 // tm_k = 1 ? *_gmtime64(&s) : *_localtime64(&s);
3060 // pedro_dprintf(-1, "time ok %s\n", asctime(_gmtime64(&s)));
3061 {
3062 int r_temp = size_of_WCHAR_mem_r(constructed_filename_kp);
3063 WCHAR *ar_temp = (void *)malloc(r_temp);
3064 WCHAR *ar_temp2 = (void *)malloc(r_temp);
3065
3066 hFile =
3067 CreateFileW(permissive_name_m_(amanda_asciitowide_1_(constructed_filename_kp, ar_temp), ar_temp2),
3068 GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
3069 NULL,
3070 OPEN_EXISTING,
3071 FILE_FLAG_BACKUP_SEMANTICS,
3072 NULL);
3073
3074 free(ar_temp);
3075 free(ar_temp2);
3076 }
3077 if (INVALID_HANDLE_VALUE != hFile)
3078 {
3079 /*
3080 st.wYear = (WORD)tm_k.tm_year + 1900;
3081 st.wMonth = (WORD)tm_k.tm_mon + 1;
3082 st.wDayOfWeek = (WORD)tm_k.tm_wday;
3083 st.wDay = (WORD)tm_k.tm_mday;
3084 st.wHour = (WORD)tm_k.tm_hour;
3085 st.wMinute = (WORD)tm_k.tm_min;
3086 st.wSecond = (WORD)tm_k.tm_sec;
3087 st.wMilliseconds = 0;
3088 SystemTimeToFileTime(&st, &ftLocal);*/
3089 SetFileTime(hFile, &ftime_in, NULL, &ftime_in);
3090 CloseHandle(hFile);
3091 }
3092 else
3093 {
3094 pedro_dprintf(2, "%s: Cannot set filetime on file\n", file_name);
3095 }
3096 }
3097 else
3098 {
3099 HANDLE hFile;
3100 {
3101 int r_temp = size_of_WCHAR_mem_r(constructed_filename_kp);
3102 WCHAR *ar_temp /* */ = (void *)malloc(r_temp);
3103 WCHAR *ar_temp2 /* */ = (void *)malloc(r_temp);
3104
3105 hFile =
3106 CreateFileW(permissive_name_m_(amanda_asciitowide_1_(constructed_filename_kp, ar_temp), ar_temp2),
3107 GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
3108 NULL,
3109 OPEN_EXISTING,
3110 FILE_FLAG_BACKUP_SEMANTICS,
3111 NULL);
3112
3113 free(ar_temp);
3114 free(ar_temp2);
3115 }
3116
3117 if (INVALID_HANDLE_VALUE != hFile)
3118 {
3119 SetFileTime(hFile, &my_VAL_data_arp.CreationTime___junior,
3122
3123 CloseHandle(hFile);
3124 }
3125 else
3126 {
3127 pedro_dprintf(2, "%s: Cannot set filetime on file\n", file_name);
3128 }
3129 }
3130 {
3131 int r_temp = size_of_WCHAR_mem_r(constructed_filename_kp);
3132 WCHAR *ar_temp = (void *)malloc(r_temp);
3133 WCHAR *ar_temp2 = (void *)malloc(r_temp);
3134 if (!SetFileAttributesW(
3135 permissive_name_m_(amanda_asciitowide_1_(constructed_filename_kp, ar_temp), ar_temp2),
3137 {
3138 ;
3139 }
3140
3141 free(ar_temp);
3142 free(ar_temp2);
3143 }
3144 }
3145
3146 mtime_tv_sec_arp = my_VAL_data_arp.VAL_timestamp64;
3147
3149 {
3150 mtime_tv_sec_arp = my_VAL_data_arp.VAL_timestamp;
3151 }
3152
3154 {
3156 }
3157
3159 {
3162 file_name,
3163 _telli64(fd) - value_for_ftell, // correct as usual...
3164 mtime_tv_sec_arp,
3165 false,
3166 value_for_ftell,
3171 }
3172
3173 return status;
3174}
3175
3182static int
3183prepare_to_extract(char const *file_name, int typeflag, tar_extractor_t *fun)
3184{
3185 int rc = 1;
3186 switch (typeflag)
3187 {
3188 case GNUTYPE_SPARSE:
3189 *fun = extract_file;
3190 rc = 1;
3191 break;
3192
3193 case AREGTYPE:
3194 case REGTYPE:
3195 case CONTTYPE:
3197 *fun = extract_dir;
3198 else
3199 {
3200 *fun = extract_file;
3201 rc = 1;
3202 }
3203 break;
3204
3205 case SYMTYPE:
3206 *fun = extract_skip;
3207 break;
3208
3209 case LNKTYPE:
3210 *fun = extract_skip;
3211 break;
3212
3213#if S_IFCHR
3214 case CHRTYPE:
3215 current_stat_info.stat.st_mode |= S_IFCHR;
3216 *fun = extract_skip;
3217 break;
3218#endif
3219
3220#if S_IFBLK
3221 case BLKTYPE:
3222 *fun = extract_skip;
3223 break;
3224#endif
3225
3226#if HAVE_MKFIFO || defined mkfifo
3227 case FIFOTYPE:
3228 *fun = extract_skip;
3229 break;
3230#endif
3231
3232 case DIRTYPE:
3233 case GNUTYPE_DUMPDIR:
3234 *fun = extract_dir;
3235 break;
3236
3237 case GNUTYPE_VOLHDR:
3238 *fun = extract_skip; // untested...
3239 break;
3240
3241 case GNUTYPE_MULTIVOL:
3242 pedro_dprintf(2, "%s: Cannot extract -- file is continued from another volume\n", current_stat_info.file_name);
3243
3244 *fun = extract_skip;
3245 break;
3246
3247 case GNUTYPE_LONGNAME:
3248 case GNUTYPE_LONGLINK:
3249
3250 pedro_dprintf(2, "Unexpected long name header");
3251
3252 *fun = extract_failure;
3253 break;
3254
3255 default:
3256
3257 pedro_dprintf(2, "%s: Unknown file type '%c', extracted as normal file", file_name, typeflag);
3258
3259 *fun = extract_file;
3260 }
3261
3262 if (rc == 0)
3263 return 0;
3264 return 1;
3265}
3266
3272bool contains_dot_dot(char const *name)
3273{
3274 char const *p = name + FILE_SYSTEM_PREFIX_LEN(name);
3275
3276 for (;; p++)
3277 {
3278 if (p[0] == '.' && p[1] == '.' && (ISSLASH(p[2]) || !p[2]))
3279 return 1;
3280
3281 while (!ISSLASH(*p))
3282 {
3283 if (!*p++)
3284 return 0;
3285 }
3286 }
3287}
3288#if 1
3289
3295{
3296 char typeflag;
3297 tar_extractor_t fun = NULL;
3298 bool skip_dotdot_name;
3299
3300 // fatal_exit_hook = extract_finish;
3301
3303
3305 if (skip_dotdot_name)
3306 {
3307 /*
3308 ERROR ((0, 0, _("%s: Member name contains '..'"),
3309 quotearg_colon (current_stat_info.orig_file_name)));*/
3310
3311 pedro_dprintf(2, "%s: Member name contains '..'\n", current_stat_info.orig_file_name);
3312 }
3313
3314 if (!current_stat_info.file_name[0] || skip_dotdot_name)
3315 {
3316 skip_member();
3317 return;
3318 }
3319
3321
3322 if (prepare_to_extract(current_stat_info.file_name, typeflag, &fun))
3323 {
3324 if (fun && (*fun)(current_stat_info.file_name, typeflag))
3325 {
3326 ;
3327 }
3328 }
3329 else
3330 skip_member();
3331}
3332
3333#endif
#define FILE_ATTRIBUTE_ARCHIVE
Definition 7zTypes.h:147
#define wcscpy
Definition SfxSetup.c:32
#define AMANDA__SIZE
Definition arp.h:149
@ ARP_RC4
Definition arp.h:200
@ ARP_SERPENT
Definition arp.h:202
@ ARP_RC4_MT
Definition arp.h:212
@ ARP_SERPENT_MT
Definition arp.h:214
@ ARP_AES
Definition arp.h:198
@ ARP_TWOFISH
Definition arp.h:208
@ ARP_RC6
Definition arp.h:206
@ ARP_MARS
Definition arp.h:204
@ ARP_MARS_MT
Definition arp.h:216
@ ARP_AES_MT
Definition arp.h:210
@ ARP_TWOFISH_MT
Definition arp.h:220
@ ARP_RC6_MT
Definition arp.h:218
wchar_t * permissive_name_m_(const wchar_t *wname, WCHAR *ar_temp)
Definition tar_1_33.c:279
int size_of_WCHAR_mem_r(char *in_string)
Definition tar_1_33.c:694
#define AMANDA__SIZE_ww
Definition be_xml.c:64
void pedro_dprintf(int amanda_level, char *format,...)
Definition pedro.c:43
WCHAR * amanda_asciitowide_1_(char *pUTF8, WCHAR *ar_temp)
Definition tar_1_33.c:677
int stripfilenameandpath(char *path, char *onlypath, char *onlyfilename)
Definition extract_kkk.c:554
int ispathfile(char *path)
Definition extract_kkk.c:419
int encryption_detected_z
Definition extract_kkk.c:35
int rspmakedir(char *path)
Definition extract_kkk.c:1700
int createtestfilename(char *path1)
Definition extract_kkk.c:1401
#define WINTIME(sec, nsec)
Definition extract_kkk.c:2432
void extract_archive(void)
Definition extract_kkk.c:3294
bool is_encrypted_gnu_tar_arp(char *file_arp_utf_8)
Definition extract_kkk.c:2295
int __fastcall ricardo_convert_m(int a_m, int b_m, SYSTEMTIME *smtime)
Definition extract_kkk.c:2434
int ispathreadonly(char *path)
Definition extract_kkk.c:1528
int ispathfolder(char *path)
Definition extract_kkk.c:1616
int createtempfilename_and_keep_z(char *path1, char *out_z, WCHAR *signature_z)
Definition extract_kkk.c:1466
GLOBAL bool absolute_names_option
Definition extract_kkk.c:63
void __amandacall adjust_extension_z(char *filename_in_z, char *filename_out_z)
Definition extract_kkk.c:821
void __stdcall replace_extension_arp(char *whole_path_arp, char *new_extension_arp, char *out_data_arp)
Definition extract_kkk.c:1046
char * strrstr_ends_with(char *str, char *substr)
Definition extract_kkk.c:593
char * strrstr(char *s1, char *s2)
Definition extract_kkk.c:469
#define e_malloc
Definition extract_kkk.c:1390
bool __amandacall is_compressed_z(char *filename_in_z)
Definition extract_kkk.c:619
int __stdcall get_extraction_progress_information_ar(char *warning_ar, char *filename_ar, char *folder_feline)
Definition extract_kkk.c:50
int(* tar_extractor_t)(char *file_name, int typeflag)
Definition extract_kkk.c:61
int rspmakedir_v2(char *path)
Definition extract_kkk.c:1922
#define e_free
Definition extract_kkk.c:1389
void trocadordebackslashtras(char *path)
Definition extract_kkk.c:2087
int __stdcall stripfilenameandpath_amanda_s_smart_ape(char *path, char *onlypath, char *onlyfilename)
Definition extract_kkk.c:588
void TimetToFileTime(time_t t, LPFILETIME pft)
Definition tar_1_33.c:3685
bool contains_dot_dot(char const *name)
Definition extract_kkk.c:3272
int stripfilenameandpath_unix_arp(char *path, char *onlypath, char *onlyfilename)
Definition extract_kkk.c:507
#define assert(condition)
Definition lz4.c:273
#define __attribute__(unused_ric_since_2004)
Definition main_cr.c:84
__int64 getfilesize_ar(char *infile_ar)
Definition tar_1_33.c:2432
mode
Definition automated_benchmarking.py:304
#define O_BINARY
Definition compress42.c:385
#define min(a, b)
Definition compress42.c:304
void yasmin_charlotte_pereira_dprintf(int amanda_level, char *format,...)
Definition pedro.c:35
size_t blocking_write(int fd, void const *buf, size_t count)
Definition sparse_2_k.c:3423
#define FILE_SYSTEM_PREFIX_LEN(P)
Definition sparse_2_k.c:109
enum dump_status sparse_extract_file(int fd, struct tar_stat_info *st, off_t *size)
Definition sparse_2_k.c:2742
void skip_file(off_t size)
Definition tar_1_33.c:4709
#define ISSLASH(C)
Definition sparse_2_k.c:110
bool sparse_member_p(struct tar_stat_info *st)
Definition sparse_2_k.c:2869
Definition 7zMain.c:324
DWORD dwHighDateTime
Definition 7zMain.c:326
DWORD dwLowDateTime
Definition 7zMain.c:325
bool dont_t_free_now_dl
Definition arp.h:175
DWORD VAL_attributes
Definition arp.h:162
time_t VAL_timestamp
Definition arp.h:171
int64_t VAL_file_size
Definition arp.h:170
bool Val_is_using_filetime
Definition arp.h:155
FILETIME LastWriteTime__junior
Definition arp.h:165
FILETIME CreationTime___junior
Definition arp.h:163
FILETIME LastAccessTime_junior
Definition arp.h:164
__time64_t VAL_timestamp64
Definition arp.h:154
int VAL_is_encrypted
Definition arp.h:168
char typeflag
Definition tar.h:33
bool had_trailing_slash
Definition tar.h:291
char * file_name
Definition tar.h:289
struct _stat stat
Definition tar.h:306
bool is_sparse
Definition tar.h:317
char * orig_file_name
Definition tar.h:288
struct timespec mtime
Definition tar.h:311
#define DIRTYPE
Definition tar.h:57
#define BLKTYPE
Definition tar.h:56
#define CONTTYPE
Definition tar.h:59
#define CHRTYPE
Definition tar.h:55
#define FIFOTYPE
Definition tar.h:58
#define GNUTYPE_MULTIVOL
Definition tar.h:181
#define GNUTYPE_DUMPDIR
Definition tar.h:172
#define GNUTYPE_LONGLINK
Definition tar.h:175
#define GNUTYPE_SPARSE
Definition tar.h:184
#define REGTYPE
Definition tar.h:51
#define GNUTYPE_LONGNAME
Definition tar.h:178
#define LNKTYPE
Definition tar.h:53
#define SYMTYPE
Definition tar.h:54
#define GNUTYPE_VOLHDR
Definition tar.h:187
#define AREGTYPE
Definition tar.h:52
#define __amandacall
Definition tar_1_33.c:79
char the_pass_arp[1024+1]
Definition tar_1_33.c:804
wchar_t * permissive_name_m_v27(const wchar_t *wname, WCHAR *ar_temp)
copy of permissive_name_m_, because in some API calls you need to conversions to a wide path this is ...
Definition tar_1_33.c:376
bool extract_cancel_flag
Definition tar_1_33.c:629
FILE * decoder_file_z
Definition tar_1_33.c:556
void set_next_block_after(union block *block)
Definition tar_1_33.c:5178
#define GLOBAL
Definition tar_1_33.c:3287
void add_more_one_is_amanda_update_(char *filename_k_ar, __int64 size_of_file_arp, time_t mtime_tv_sec_arp, int is_directory_arp, __int64 position_on_file_arp, DWORD VAL_attributes, int VAL_is_encrypted, __time64_t VAL_timestamp64, VAL_data *VAL_data__arp)
Definition tar_1_33.c:1977
char extract_folder_final[AMANDA__SIZE]
Definition tar_1_33.c:3184
char encryption_format_S2_[300]
Definition tar_1_33.c:124
int decrypt_arp(char *inputfile, char *outputfile, char *key, int64_t *the_arp_file_size, char *encryption_method_i, int *cores_S2)
Definition tar_1_33.c:1471
@ AAKP_EXTRACT_PROCESS
Definition tar_1_33.c:2111
size_t available_space_after(union block *pointer)
Definition tar_1_33.c:5169
int ret_arp_
Definition tar_1_33.c:592
void mv_begin_read(struct tar_stat_info *st)
Definition tar_1_33.c:4751
tar_list_function_ar my_func_ar_
Definition tar_1_33.c:2947
char * valquiria_wide_to_utf8(WCHAR *pUSC2_maria, char *ar_temp_char)
Definition tar_1_33.c:766
char error_message_k[AMANDA__SIZE]
Definition tar_1_33.c:176
int cores_used_z
Definition tar_1_33.c:157
bool extract_pause__flag
Definition tar_1_33.c:628
bool mode_is_update_arp
Definition tar_1_33.c:636
int our_update_file_open__arp
Definition tar_1_33.c:641
GLOBAL struct tar_stat_info current_stat_info
Definition tar_1_33.c:3295
union block * find_next_block(void)
Definition tar_1_33.c:6798
void mv_end(void)
Definition tar_1_33.c:4691
wchar_t * remove_permissive_name_m_(wchar_t *wname, WCHAR *ar_temp)
as the name says it will convert a wide characters (up to 32767 characters) path to a standard path (...
Definition tar_1_33.c:236
void skip_member(void)
Definition tar_1_33.c:4761
int got_a_warning_ar
Definition tar_1_33.c:2400
void update_progress_arp(int64_t *bytes_read_arp__)
Definition tar_1_33.c:1418
union block * current_header
Definition tar_1_33.c:3201
char extracting_filename_ar[AMANDA__SIZE]
Definition tar_1_33.c:2405
char warning_info[AMANDA__SIZE]
Definition tar_1_33.c:2406
void mv_size_left(off_t size)
Definition tar_1_33.c:4699
char encryption_method__i[300]
Definition tar_1_33.c:138
VAL_data my_VAL_data_arp
Definition tar_1_33.c:587
WCHAR * amanda_utf8towide_2_(char *pUTF8, WCHAR *ar_temp)
Definition tar_1_33.c:729
char creating_folder_maria[AMANDA__SIZE]
Definition tar_1_33.c:649
int fatal_exit_k
Definition tar_1_33.c:3217
Definition tar.h:373
struct posix_header header
Definition tar.h:375
char buffer[BLOCKSIZE]
Definition tar.h:374
__int64 _telli64(int handle)
size_t size
Definition platform.h:559
int __stdcall status(int newvalue)
Definition bzip2dll.c:513
int
Definition lzoconf.h:340
#define SEEK_CUR
Definition zconf.h:499
#define s1(x)
Definition Sha256.c:142
#define a(i)
Definition sha256.c:41
lzma_index ** i
Definition index.h:629
#define NULL
Definition getopt1.c:37
char name[NAME_LEN_MAX+1]
Name of the filter.
Definition string_conversion.c:450
const char * str
Table column heading string.
Definition list.c:109
signature_z[3]
Definition zlib_interface.c:37
ret
Definition zlib_interface.c:30