···11+project(NetFS)
22+33+set(DYLIB_COMPAT_VERSION "1.0.0")
44+set(DYLIB_CURRENT_VERSION "1.0.0")
55+66+add_framework(NetFS
77+ FAT
88+ CURRENT_VERSION
99+ VERSION "A"
1010+1111+ SOURCES
1212+ src/NetFS.m
1313+1414+ DEPENDENCIES
1515+ system
1616+ objc
1717+ Foundation
1818+)
+85
src/frameworks/NetFS/include/NetFS/NetFS.h
···11+/*
22+ This file is part of Darling.
33+44+ Copyright (C) 2021 Lubos Dolezel
55+66+ Darling is free software: you can redistribute it and/or modify
77+ it under the terms of the GNU General Public License as published by
88+ the Free Software Foundation, either version 3 of the License, or
99+ (at your option) any later version.
1010+1111+ Darling is distributed in the hope that it will be useful,
1212+ but WITHOUT ANY WARRANTY; without even the implied warranty of
1313+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1414+ GNU General Public License for more details.
1515+1616+ You should have received a copy of the GNU General Public License
1717+ along with Darling. If not, see <http://www.gnu.org/licenses/>.
1818+*/
1919+2020+#ifndef _NetFS_H_
2121+#define _NetFS_H_
2222+2323+#include <sys/types.h>
2424+2525+void* GetCompleteMountURL(void);
2626+void* GetURLFromURLRemountInfo(void);
2727+void* GetURLRemountInfo(void);
2828+void* GetURLRemountInfoSize(void);
2929+void* MountCompleteURL(void);
3030+void* MountServerURL(void);
3131+void* MountURLWithAuthentication(void);
3232+void* NetFSCFStringtoCString(void);
3333+void* NetFSClearAllURLApprovals(void);
3434+void* NetFSCopyHostAndPort(void);
3535+void* NetFSCopyNormalizedURLString(void);
3636+void* NetFSCopyURLForRemountingVolume(void);
3737+void* NetFSGetMountInfo(void);
3838+void* NetFSGetMountInfoByFSID(void);
3939+void* NetFSGetSupportedSchemes(void);
4040+void* NetFSGetURLApprovalState(void);
4141+void* NetFSInterface_AddRef(void);
4242+void* NetFSInterface_Release(void);
4343+void* NetFSLogToMessageTracer(void);
4444+void* NetFSMountURLAsync(void);
4545+void* NetFSMountURLCancel(void);
4646+void* NetFSMountURLProbe(void);
4747+void* NetFSMountURLSync(void);
4848+void* NetFSMountURLWithAuthenticationSync(void);
4949+void* NetFSQueryInterface(void);
5050+void* NetFSSetURLApprovalState(void);
5151+void* NetFS_CreateInterface(void);
5252+void* PremountHomeDirectoryWithAuthentication(void);
5353+void* RemountInfoQueryInterface(void);
5454+void* UnmountServerURL(void);
5555+void* netfs_Cancel(void);
5656+void* netfs_CancelAsyncMount(void);
5757+void* netfs_CloseSession(void);
5858+void* netfs_ConnectToServerAsync(void);
5959+void* netfs_ConnectToServerSync(void);
6060+void* netfs_CreateSessionRef(void);
6161+void* netfs_CreateURL(void);
6262+void* netfs_EnumerateShares(void);
6363+void* netfs_GetServerInfo(void);
6464+void* netfs_Mount(void);
6565+void* netfs_MountURLWithAuthenticationAsync(void);
6666+void* netfs_MountURLWithAuthenticationSync(void);
6767+void* netfs_OpenSession(void);
6868+void* netfs_ParseURL(void);
6969+void* netfs_log_message_tracer(void);
7070+void* netfs_log_message_tracer_auth_type(void);
7171+void* netfs_log_message_tracer_automounted(void);
7272+void* netfs_log_message_tracer_executable_name(void);
7373+void* netfs_log_message_tracer_result(void);
7474+void* netfs_log_message_tracer_result_on_fail(void);
7575+void* netfs_log_message_tracer_scheme(void);
7676+7777+int NetFSUnmountHomeDirectory(const char* home, const char* path, uid_t uid, int flags /* unsure */);
7878+int NetFSMountHomeDirectoryWithAuthentication(const char* url, const char* home, const char* path, uid_t uid, size_t mount_dir_length, const char* mount_dir, const char* username, const char* authenticator, int flags, unsigned int* out_was_remounted);
7979+8080+enum {
8181+ // no clue what the real value is
8282+ kNetFSAllowKerberos = 1,
8383+};
8484+8585+#endif
+25
src/frameworks/NetFS/include/NetFS/URLMount.h
···11+/**
22+ * This file is part of Darling.
33+ *
44+ * Copyright (C) 2021 Darling developers
55+ *
66+ * Darling is free software: you can redistribute it and/or modify
77+ * it under the terms of the GNU General Public License as published by
88+ * the Free Software Foundation, either version 3 of the License, or
99+ * (at your option) any later version.
1010+ *
1111+ * Darling is distributed in the hope that it will be useful,
1212+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1313+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1414+ * GNU General Public License for more details.
1515+ *
1616+ * You should have received a copy of the GNU General Public License
1717+ * along with Darling. If not, see <http://www.gnu.org/licenses/>.
1818+ */
1919+2020+#ifndef _NETFS_URLMOUNT_H_
2121+#define _NETFS_URLMOUNT_H_
2222+2323+#include <NetFS/NetFS.h>
2424+2525+#endif // _NETFS_URLMOUNT_H_
+346
src/frameworks/NetFS/src/NetFS.m
···11+/*
22+ This file is part of Darling.
33+44+ Copyright (C) 2021 Lubos Dolezel
55+66+ Darling is free software: you can redistribute it and/or modify
77+ it under the terms of the GNU General Public License as published by
88+ the Free Software Foundation, either version 3 of the License, or
99+ (at your option) any later version.
1010+1111+ Darling is distributed in the hope that it will be useful,
1212+ but WITHOUT ANY WARRANTY; without even the implied warranty of
1313+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1414+ GNU General Public License for more details.
1515+1616+ You should have received a copy of the GNU General Public License
1717+ along with Darling. If not, see <http://www.gnu.org/licenses/>.
1818+*/
1919+2020+2121+#include <NetFS/NetFS.h>
2222+#include <stdlib.h>
2323+#include <stdio.h>
2424+2525+static int verbose = 0;
2626+2727+__attribute__((constructor))
2828+static void initme(void) {
2929+ verbose = getenv("STUB_VERBOSE") != NULL;
3030+}
3131+3232+void* GetCompleteMountURL(void)
3333+{
3434+ if (verbose) puts("STUB: GetCompleteMountURL called");
3535+ return NULL;
3636+}
3737+3838+void* GetURLFromURLRemountInfo(void)
3939+{
4040+ if (verbose) puts("STUB: GetURLFromURLRemountInfo called");
4141+ return NULL;
4242+}
4343+4444+void* GetURLRemountInfo(void)
4545+{
4646+ if (verbose) puts("STUB: GetURLRemountInfo called");
4747+ return NULL;
4848+}
4949+5050+void* GetURLRemountInfoSize(void)
5151+{
5252+ if (verbose) puts("STUB: GetURLRemountInfoSize called");
5353+ return NULL;
5454+}
5555+5656+void* MountCompleteURL(void)
5757+{
5858+ if (verbose) puts("STUB: MountCompleteURL called");
5959+ return NULL;
6060+}
6161+6262+void* MountServerURL(void)
6363+{
6464+ if (verbose) puts("STUB: MountServerURL called");
6565+ return NULL;
6666+}
6767+6868+void* MountURLWithAuthentication(void)
6969+{
7070+ if (verbose) puts("STUB: MountURLWithAuthentication called");
7171+ return NULL;
7272+}
7373+7474+void* NetFSCFStringtoCString(void)
7575+{
7676+ if (verbose) puts("STUB: NetFSCFStringtoCString called");
7777+ return NULL;
7878+}
7979+8080+void* NetFSClearAllURLApprovals(void)
8181+{
8282+ if (verbose) puts("STUB: NetFSClearAllURLApprovals called");
8383+ return NULL;
8484+}
8585+8686+void* NetFSCopyHostAndPort(void)
8787+{
8888+ if (verbose) puts("STUB: NetFSCopyHostAndPort called");
8989+ return NULL;
9090+}
9191+9292+void* NetFSCopyNormalizedURLString(void)
9393+{
9494+ if (verbose) puts("STUB: NetFSCopyNormalizedURLString called");
9595+ return NULL;
9696+}
9797+9898+void* NetFSCopyURLForRemountingVolume(void)
9999+{
100100+ if (verbose) puts("STUB: NetFSCopyURLForRemountingVolume called");
101101+ return NULL;
102102+}
103103+104104+void* NetFSGetMountInfo(void)
105105+{
106106+ if (verbose) puts("STUB: NetFSGetMountInfo called");
107107+ return NULL;
108108+}
109109+110110+void* NetFSGetMountInfoByFSID(void)
111111+{
112112+ if (verbose) puts("STUB: NetFSGetMountInfoByFSID called");
113113+ return NULL;
114114+}
115115+116116+void* NetFSGetSupportedSchemes(void)
117117+{
118118+ if (verbose) puts("STUB: NetFSGetSupportedSchemes called");
119119+ return NULL;
120120+}
121121+122122+void* NetFSGetURLApprovalState(void)
123123+{
124124+ if (verbose) puts("STUB: NetFSGetURLApprovalState called");
125125+ return NULL;
126126+}
127127+128128+void* NetFSInterface_AddRef(void)
129129+{
130130+ if (verbose) puts("STUB: NetFSInterface_AddRef called");
131131+ return NULL;
132132+}
133133+134134+void* NetFSInterface_Release(void)
135135+{
136136+ if (verbose) puts("STUB: NetFSInterface_Release called");
137137+ return NULL;
138138+}
139139+140140+void* NetFSLogToMessageTracer(void)
141141+{
142142+ if (verbose) puts("STUB: NetFSLogToMessageTracer called");
143143+ return NULL;
144144+}
145145+146146+void* NetFSMountURLAsync(void)
147147+{
148148+ if (verbose) puts("STUB: NetFSMountURLAsync called");
149149+ return NULL;
150150+}
151151+152152+void* NetFSMountURLCancel(void)
153153+{
154154+ if (verbose) puts("STUB: NetFSMountURLCancel called");
155155+ return NULL;
156156+}
157157+158158+void* NetFSMountURLProbe(void)
159159+{
160160+ if (verbose) puts("STUB: NetFSMountURLProbe called");
161161+ return NULL;
162162+}
163163+164164+void* NetFSMountURLSync(void)
165165+{
166166+ if (verbose) puts("STUB: NetFSMountURLSync called");
167167+ return NULL;
168168+}
169169+170170+void* NetFSMountURLWithAuthenticationSync(void)
171171+{
172172+ if (verbose) puts("STUB: NetFSMountURLWithAuthenticationSync called");
173173+ return NULL;
174174+}
175175+176176+void* NetFSQueryInterface(void)
177177+{
178178+ if (verbose) puts("STUB: NetFSQueryInterface called");
179179+ return NULL;
180180+}
181181+182182+void* NetFSSetURLApprovalState(void)
183183+{
184184+ if (verbose) puts("STUB: NetFSSetURLApprovalState called");
185185+ return NULL;
186186+}
187187+188188+void* NetFS_CreateInterface(void)
189189+{
190190+ if (verbose) puts("STUB: NetFS_CreateInterface called");
191191+ return NULL;
192192+}
193193+194194+void* PremountHomeDirectoryWithAuthentication(void)
195195+{
196196+ if (verbose) puts("STUB: PremountHomeDirectoryWithAuthentication called");
197197+ return NULL;
198198+}
199199+200200+void* RemountInfoQueryInterface(void)
201201+{
202202+ if (verbose) puts("STUB: RemountInfoQueryInterface called");
203203+ return NULL;
204204+}
205205+206206+void* UnmountServerURL(void)
207207+{
208208+ if (verbose) puts("STUB: UnmountServerURL called");
209209+ return NULL;
210210+}
211211+212212+void* netfs_Cancel(void)
213213+{
214214+ if (verbose) puts("STUB: netfs_Cancel called");
215215+ return NULL;
216216+}
217217+218218+void* netfs_CancelAsyncMount(void)
219219+{
220220+ if (verbose) puts("STUB: netfs_CancelAsyncMount called");
221221+ return NULL;
222222+}
223223+224224+void* netfs_CloseSession(void)
225225+{
226226+ if (verbose) puts("STUB: netfs_CloseSession called");
227227+ return NULL;
228228+}
229229+230230+void* netfs_ConnectToServerAsync(void)
231231+{
232232+ if (verbose) puts("STUB: netfs_ConnectToServerAsync called");
233233+ return NULL;
234234+}
235235+236236+void* netfs_ConnectToServerSync(void)
237237+{
238238+ if (verbose) puts("STUB: netfs_ConnectToServerSync called");
239239+ return NULL;
240240+}
241241+242242+void* netfs_CreateSessionRef(void)
243243+{
244244+ if (verbose) puts("STUB: netfs_CreateSessionRef called");
245245+ return NULL;
246246+}
247247+248248+void* netfs_CreateURL(void)
249249+{
250250+ if (verbose) puts("STUB: netfs_CreateURL called");
251251+ return NULL;
252252+}
253253+254254+void* netfs_EnumerateShares(void)
255255+{
256256+ if (verbose) puts("STUB: netfs_EnumerateShares called");
257257+ return NULL;
258258+}
259259+260260+void* netfs_GetServerInfo(void)
261261+{
262262+ if (verbose) puts("STUB: netfs_GetServerInfo called");
263263+ return NULL;
264264+}
265265+266266+void* netfs_Mount(void)
267267+{
268268+ if (verbose) puts("STUB: netfs_Mount called");
269269+ return NULL;
270270+}
271271+272272+void* netfs_MountURLWithAuthenticationAsync(void)
273273+{
274274+ if (verbose) puts("STUB: netfs_MountURLWithAuthenticationAsync called");
275275+ return NULL;
276276+}
277277+278278+void* netfs_MountURLWithAuthenticationSync(void)
279279+{
280280+ if (verbose) puts("STUB: netfs_MountURLWithAuthenticationSync called");
281281+ return NULL;
282282+}
283283+284284+void* netfs_OpenSession(void)
285285+{
286286+ if (verbose) puts("STUB: netfs_OpenSession called");
287287+ return NULL;
288288+}
289289+290290+void* netfs_ParseURL(void)
291291+{
292292+ if (verbose) puts("STUB: netfs_ParseURL called");
293293+ return NULL;
294294+}
295295+296296+void* netfs_log_message_tracer(void)
297297+{
298298+ if (verbose) puts("STUB: netfs_log_message_tracer called");
299299+ return NULL;
300300+}
301301+302302+void* netfs_log_message_tracer_auth_type(void)
303303+{
304304+ if (verbose) puts("STUB: netfs_log_message_tracer_auth_type called");
305305+ return NULL;
306306+}
307307+308308+void* netfs_log_message_tracer_automounted(void)
309309+{
310310+ if (verbose) puts("STUB: netfs_log_message_tracer_automounted called");
311311+ return NULL;
312312+}
313313+314314+void* netfs_log_message_tracer_executable_name(void)
315315+{
316316+ if (verbose) puts("STUB: netfs_log_message_tracer_executable_name called");
317317+ return NULL;
318318+}
319319+320320+void* netfs_log_message_tracer_result(void)
321321+{
322322+ if (verbose) puts("STUB: netfs_log_message_tracer_result called");
323323+ return NULL;
324324+}
325325+326326+void* netfs_log_message_tracer_result_on_fail(void)
327327+{
328328+ if (verbose) puts("STUB: netfs_log_message_tracer_result_on_fail called");
329329+ return NULL;
330330+}
331331+332332+void* netfs_log_message_tracer_scheme(void)
333333+{
334334+ if (verbose) puts("STUB: netfs_log_message_tracer_scheme called");
335335+ return NULL;
336336+}
337337+338338+int NetFSUnmountHomeDirectory(const char* home, const char* path, uid_t uid, int flags) {
339339+ if (verbose) puts("STUB: NetFSUnmountHomeDirectory called");
340340+ return -1;
341341+};
342342+343343+int NetFSMountHomeDirectoryWithAuthentication(const char* url, const char* home, const char* path, uid_t uid, size_t mount_dir_length, const char* mount_dir, const char* username, const char* authenticator, int flags, unsigned int* out_was_remounted) {
344344+ if (verbose) puts("STUB: NetFSMountHomeDirectoryWithAuthentication called");
345345+ return -1;
346346+};