this repo has no description
1/*
2 * Darling - libquarantine
3 * Copyright (c) 2016 Lubos Dolezel, All rights reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 3.0 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library.
17 */
18
19#include "quarantine.h"
20#include <limits.h>
21#include <stdlib.h>
22#include <string.h>
23
24const char* _qtn_xattr_name = "com.apple.quarantine";
25
26static const char* error_strings[] = {
27 "Undefined error: 0",
28 "Item not quarantined",
29 "Quarantine is unavailable",
30 "Failed to load a compatible version of libMatch"
31};
32
33struct _qtn_file_s
34{
35 char path[NAME_MAX];
36};
37
38qtn_file_t _qtn_file_alloc()
39{
40 qtn_file_t f = (qtn_file_t) malloc(sizeof(struct _qtn_file_s));
41 memset(f, 0, sizeof(*f));
42 return f;
43}
44
45void _qtn_file_free(qtn_file_t f)
46{
47 free(f);
48}
49
50qtn_file_t _qtn_file_clone(qtn_file_t f)
51{
52 qtn_file_t rv = _qtn_file_alloc();
53 memcpy(rv, f, sizeof(*rv));
54 return rv;
55}
56
57int _qtn_file_init_with_fd(qtn_file_t file, int fd)
58{
59 return QTN_NOT_QUARANTINED;
60}
61
62int _qtn_file_apply_to_fd(qtn_file_t file, int fd)
63{
64 return QTN_NOT_QUARANTINED;
65}
66
67int _qtn_file_apply_to_path(qtn_file_t file, const char* path)
68{
69 return QTN_NOT_QUARANTINED;
70}
71
72int _qtn_file_init_with_path(qtn_file_t file, const char *path)
73{
74 return QTN_NOT_QUARANTINED;
75}
76
77int _qtn_file_init_with_data(qtn_file_t file, const void *data, size_t len)
78{
79 return QTN_NOT_QUARANTINED;
80}
81
82int _qtn_file_to_data(qtn_file_t file, void * data, size_t* len)
83{
84 return QTN_NOT_QUARANTINED;
85}
86
87const char *_qtn_error(int err)
88{
89 if (err >= 0 || -err >= sizeof(error_strings)/sizeof(error_strings[0]))
90 return strerror(err);
91 return error_strings[-err];
92}
93
94int _qtn_file_set_flags(qtn_file_t file, uint32_t flags)
95{
96 return 0;
97}
98
99uint32_t _qtn_file_get_flags(qtn_file_t file)
100{
101 return 0;
102}
103
104int __esp_enabled()
105{
106 return QTN_NOT_QUARANTINED;
107}
108
109int __esp_check_ns(const char *a, void *b)
110{
111 return QTN_NOT_QUARANTINED;
112}
113
114int __esp_notify_ns(const char *a, void *b)
115{
116 return QTN_NOT_QUARANTINED;
117}
118
119struct _qtn_proc_t
120{
121 int dummy;
122};
123
124qtn_proc_t qtn_proc_alloc(void)
125{
126 return (qtn_proc_t) malloc(sizeof(qtn_proc_t));
127}
128
129void qtn_proc_set_identifier(qtn_proc_t proc, const char* ident)
130{
131}
132
133void qtn_proc_set_flags(qtn_proc_t proc, unsigned int flags)
134{
135}
136
137int qtn_proc_apply_to_self(qtn_proc_t proc) {
138 return QTN_NOT_QUARANTINED;
139};
140
141void qtn_proc_free(qtn_proc_t proc)
142{
143 free(proc);
144}
145
146int qtn_file_apply_to_mount_point(qtn_file_t a, const char *b)
147{
148 return 0;
149}
150
151int qtn_file_init_with_mount_point(qtn_file_t a, char b[1024])
152{
153 return 0;
154}
155
156int qtn_proc_init_with_data(qtn_proc_t proc, void* data, size_t data_len) {
157 return 0;
158};