source: vendor/current/source3/libsmb/libsmb_setget.c

Last change on this file was 988, checked in by Silvan Scherrer, 9 years ago

Samba Server: update vendor to version 4.4.3

File size: 24.8 KB
Line 
1/*
2 Unix SMB/Netbios implementation.
3 SMB client library implementation
4 Copyright (C) Andrew Tridgell 1998
5 Copyright (C) Richard Sharpe 2000, 2002
6 Copyright (C) John Terpstra 2000
7 Copyright (C) Tom Jansen (Ninja ISD) 2002
8 Copyright (C) Derrell Lipman 2003-2008
9 Copyright (C) Jeremy Allison 2007, 2008
10
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 3 of the License, or
14 (at your option) any later version.
15
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program. If not, see <http://www.gnu.org/licenses/>.
23*/
24
25#include "includes.h"
26#define __LIBSMBCLIENT_INTERNAL__
27#include "libsmbclient.h"
28#include "libsmb_internal.h"
29
30
31/** Get the netbios name used for making connections */
32char *
33smbc_getNetbiosName(SMBCCTX *c)
34{
35 return c->netbios_name;
36}
37
38/** Set the netbios name used for making connections */
39void
40smbc_setNetbiosName(SMBCCTX *c, char * netbios_name)
41{
42 SAFE_FREE(c->netbios_name);
43 if (netbios_name) {
44 c->netbios_name = SMB_STRDUP(netbios_name);
45 }
46}
47
48/** Get the workgroup used for making connections */
49char *
50smbc_getWorkgroup(SMBCCTX *c)
51{
52 return c->workgroup;
53}
54
55/** Set the workgroup used for making connections */
56void
57smbc_setWorkgroup(SMBCCTX *c, char * workgroup)
58{
59 SAFE_FREE(c->workgroup);
60 if (workgroup) {
61 c->workgroup = SMB_STRDUP(workgroup);
62 }
63}
64
65/** Get the username used for making connections */
66char *
67smbc_getUser(SMBCCTX *c)
68{
69 return c->user;
70}
71
72/** Set the username used for making connections */
73void
74smbc_setUser(SMBCCTX *c, char * user)
75{
76 SAFE_FREE(c->user);
77 if (user) {
78 c->user = SMB_STRDUP(user);
79 }
80}
81
82/** Get the debug level */
83int
84smbc_getDebug(SMBCCTX *c)
85{
86 return c->debug;
87}
88
89/** Set the debug level */
90void
91smbc_setDebug(SMBCCTX *c, int debug)
92{
93 char buf[32];
94 TALLOC_CTX *frame = talloc_stackframe();
95 snprintf(buf, sizeof(buf), "%d", debug);
96 c->debug = debug;
97 lp_set_cmdline("log level", buf);
98 TALLOC_FREE(frame);
99}
100
101/**
102 * Get the timeout used for waiting on connections and response data
103 * (in milliseconds)
104 */
105int
106smbc_getTimeout(SMBCCTX *c)
107{
108 return c->timeout;
109}
110
111/**
112 * Set the timeout used for waiting on connections and response data
113 * (in milliseconds)
114 */
115void
116smbc_setTimeout(SMBCCTX *c, int timeout)
117{
118 c->timeout = timeout;
119}
120
121/**
122 * Get the TCP port used to connect.
123 */
124uint16_t
125smbc_getPort(SMBCCTX *c)
126{
127 return c->internal->port;
128}
129
130/**
131 * Set the TCP port used to connect.
132 */
133void
134smbc_setPort(SMBCCTX *c, uint16_t port)
135{
136 c->internal->port = port;
137}
138
139
140/** Get whether to log to standard error instead of standard output */
141smbc_bool
142smbc_getOptionDebugToStderr(SMBCCTX *c)
143{
144 smbc_bool ret;
145 TALLOC_CTX *frame = talloc_stackframe();
146
147 /* Because this is a global concept, it is better to check
148 * what is really set, rather than what we wanted set
149 * (particularly as you cannot go back to stdout). */
150 ret = debug_get_output_is_stderr();
151 TALLOC_FREE(frame);
152 return ret;
153}
154
155/** Set whether to log to standard error instead of standard output.
156 * This option is 'sticky' - once set to true, it cannot be set to
157 * false again, as it is global to the process, as once we have been
158 * told that it is not safe to safe to write to stdout, we shouldn't
159 * go back as we don't know it was this context that set it that way.
160 */
161void
162smbc_setOptionDebugToStderr(SMBCCTX *c, smbc_bool b)
163{
164 TALLOC_CTX *frame = talloc_stackframe();
165 if (b) {
166 /*
167 * We do not have a unique per-thread debug state? For
168 * now, we'll just leave it up to the user. If any one
169 * context spefies debug to stderr then all will be (and
170 * will stay that way, as it is unsafe to flip back if
171 * stdout is in use for other things)
172 */
173 setup_logging("libsmbclient", DEBUG_STDERR);
174 }
175 TALLOC_FREE(frame);
176}
177
178/**
179 * Get whether to use new-style time attribute names, e.g. WRITE_TIME rather
180 * than the old-style names such as M_TIME. This allows also setting/getting
181 * CREATE_TIME which was previously unimplemented. (Note that the old C_TIME
182 * was supposed to be CHANGE_TIME but was confused and sometimes referred to
183 * CREATE_TIME.)
184 */
185smbc_bool
186smbc_getOptionFullTimeNames(SMBCCTX *c)
187{
188 return c->internal->full_time_names;
189}
190
191/**
192 * Set whether to use new-style time attribute names, e.g. WRITE_TIME rather
193 * than the old-style names such as M_TIME. This allows also setting/getting
194 * CREATE_TIME which was previously unimplemented. (Note that the old C_TIME
195 * was supposed to be CHANGE_TIME but was confused and sometimes referred to
196 * CREATE_TIME.)
197 */
198void
199smbc_setOptionFullTimeNames(SMBCCTX *c, smbc_bool b)
200{
201 c->internal->full_time_names = b;
202}
203
204/**
205 * Get the share mode to use for files opened with SMBC_open_ctx(). The
206 * default is SMBC_SHAREMODE_DENY_NONE.
207 */
208smbc_share_mode
209smbc_getOptionOpenShareMode(SMBCCTX *c)
210{
211 return c->internal->share_mode;
212}
213
214/**
215 * Set the share mode to use for files opened with SMBC_open_ctx(). The
216 * default is SMBC_SHAREMODE_DENY_NONE.
217 */
218void
219smbc_setOptionOpenShareMode(SMBCCTX *c, smbc_share_mode share_mode)
220{
221 c->internal->share_mode = share_mode;
222}
223
224/** Retrieve a previously set user data handle */
225void *
226smbc_getOptionUserData(SMBCCTX *c)
227{
228 return c->internal->user_data;
229}
230
231/** Save a user data handle */
232void
233smbc_setOptionUserData(SMBCCTX *c, void *user_data)
234{
235 c->internal->user_data = user_data;
236}
237
238/** Get the encoded value for encryption level. */
239smbc_smb_encrypt_level
240smbc_getOptionSmbEncryptionLevel(SMBCCTX *c)
241{
242 return c->internal->smb_encryption_level;
243}
244
245/** Set the encoded value for encryption level. */
246void
247smbc_setOptionSmbEncryptionLevel(SMBCCTX *c, smbc_smb_encrypt_level level)
248{
249 c->internal->smb_encryption_level = level;
250}
251
252/**
253 * Get whether to treat file names as case-sensitive if we can't determine
254 * when connecting to the remote share whether the file system is case
255 * sensitive. This defaults to FALSE since it's most likely that if we can't
256 * retrieve the file system attributes, it's a very old file system that does
257 * not support case sensitivity.
258 */
259smbc_bool
260smbc_getOptionCaseSensitive(SMBCCTX *c)
261{
262 return c->internal->case_sensitive;
263}
264
265/**
266 * Set whether to treat file names as case-sensitive if we can't determine
267 * when connecting to the remote share whether the file system is case
268 * sensitive. This defaults to FALSE since it's most likely that if we can't
269 * retrieve the file system attributes, it's a very old file system that does
270 * not support case sensitivity.
271 */
272void
273smbc_setOptionCaseSensitive(SMBCCTX *c, smbc_bool b)
274{
275 c->internal->case_sensitive = b;
276}
277
278/**
279 * Get from how many local master browsers should the list of workgroups be
280 * retrieved. It can take up to 12 minutes or longer after a server becomes a
281 * local master browser, for it to have the entire browse list (the list of
282 * workgroups/domains) from an entire network. Since a client never knows
283 * which local master browser will be found first, the one which is found
284 * first and used to retrieve a browse list may have an incomplete or empty
285 * browse list. By requesting the browse list from multiple local master
286 * browsers, a more complete list can be generated. For small networks (few
287 * workgroups), it is recommended that this value be set to 0, causing the
288 * browse lists from all found local master browsers to be retrieved and
289 * merged. For networks with many workgroups, a suitable value for this
290 * variable is probably somewhere around 3. (Default: 3).
291 */
292int
293smbc_getOptionBrowseMaxLmbCount(SMBCCTX *c)
294{
295 return c->options.browse_max_lmb_count;
296}
297
298/**
299 * Set from how many local master browsers should the list of workgroups be
300 * retrieved. It can take up to 12 minutes or longer after a server becomes a
301 * local master browser, for it to have the entire browse list (the list of
302 * workgroups/domains) from an entire network. Since a client never knows
303 * which local master browser will be found first, the one which is found
304 * first and used to retrieve a browse list may have an incomplete or empty
305 * browse list. By requesting the browse list from multiple local master
306 * browsers, a more complete list can be generated. For small networks (few
307 * workgroups), it is recommended that this value be set to 0, causing the
308 * browse lists from all found local master browsers to be retrieved and
309 * merged. For networks with many workgroups, a suitable value for this
310 * variable is probably somewhere around 3. (Default: 3).
311 */
312void
313smbc_setOptionBrowseMaxLmbCount(SMBCCTX *c, int count)
314{
315 c->options.browse_max_lmb_count = count;
316}
317
318/**
319 * Get whether to url-encode readdir entries.
320 *
321 * There is a difference in the desired return strings from
322 * smbc_readdir() depending upon whether the filenames are to
323 * be displayed to the user, or whether they are to be
324 * appended to the path name passed to smbc_opendir() to call
325 * a further smbc_ function (e.g. open the file with
326 * smbc_open()). In the former case, the filename should be
327 * in "human readable" form. In the latter case, the smbc_
328 * functions expect a URL which must be url-encoded. Those
329 * functions decode the URL. If, for example, smbc_readdir()
330 * returned a file name of "abc%20def.txt", passing a path
331 * with this file name attached to smbc_open() would cause
332 * smbc_open to attempt to open the file "abc def.txt" since
333 * the %20 is decoded into a space.
334 *
335 * Set this option to True if the names returned by
336 * smbc_readdir() should be url-encoded such that they can be
337 * passed back to another smbc_ call. Set it to False if the
338 * names returned by smbc_readdir() are to be presented to the
339 * user.
340 *
341 * For backwards compatibility, this option defaults to False.
342 */
343smbc_bool
344smbc_getOptionUrlEncodeReaddirEntries(SMBCCTX *c)
345{
346 return c->options.urlencode_readdir_entries;
347}
348
349/**
350 * Set whether to url-encode readdir entries.
351 *
352 * There is a difference in the desired return strings from
353 * smbc_readdir() depending upon whether the filenames are to
354 * be displayed to the user, or whether they are to be
355 * appended to the path name passed to smbc_opendir() to call
356 * a further smbc_ function (e.g. open the file with
357 * smbc_open()). In the former case, the filename should be
358 * in "human readable" form. In the latter case, the smbc_
359 * functions expect a URL which must be url-encoded. Those
360 * functions decode the URL. If, for example, smbc_readdir()
361 * returned a file name of "abc%20def.txt", passing a path
362 * with this file name attached to smbc_open() would cause
363 * smbc_open to attempt to open the file "abc def.txt" since
364 * the %20 is decoded into a space.
365 *
366 * Set this option to True if the names returned by
367 * smbc_readdir() should be url-encoded such that they can be
368 * passed back to another smbc_ call. Set it to False if the
369 * names returned by smbc_readdir() are to be presented to the
370 * user.
371 *
372 * For backwards compatibility, this option defaults to False.
373 */
374void
375smbc_setOptionUrlEncodeReaddirEntries(SMBCCTX *c, smbc_bool b)
376{
377 c->options.urlencode_readdir_entries = b;
378}
379
380/**
381 * Get whether to use the same connection for all shares on a server.
382 *
383 * Some Windows versions appear to have a limit to the number
384 * of concurrent SESSIONs and/or TREE CONNECTions. In
385 * one-shot programs (i.e. the program runs and then quickly
386 * ends, thereby shutting down all connections), it is
387 * probably reasonable to establish a new connection for each
388 * share. In long-running applications, the limitation can be
389 * avoided by using only a single connection to each server,
390 * and issuing a new TREE CONNECT when the share is accessed.
391 */
392smbc_bool
393smbc_getOptionOneSharePerServer(SMBCCTX *c)
394{
395 return c->options.one_share_per_server;
396}
397
398/**
399 * Set whether to use the same connection for all shares on a server.
400 *
401 * Some Windows versions appear to have a limit to the number
402 * of concurrent SESSIONs and/or TREE CONNECTions. In
403 * one-shot programs (i.e. the program runs and then quickly
404 * ends, thereby shutting down all connections), it is
405 * probably reasonable to establish a new connection for each
406 * share. In long-running applications, the limitation can be
407 * avoided by using only a single connection to each server,
408 * and issuing a new TREE CONNECT when the share is accessed.
409 */
410void
411smbc_setOptionOneSharePerServer(SMBCCTX *c, smbc_bool b)
412{
413 c->options.one_share_per_server = b;
414}
415
416/** Get whether to enable use of kerberos */
417smbc_bool
418smbc_getOptionUseKerberos(SMBCCTX *c)
419{
420 return c->flags & SMB_CTX_FLAG_USE_KERBEROS ? True : False;
421}
422
423/** Set whether to enable use of kerberos */
424void
425smbc_setOptionUseKerberos(SMBCCTX *c, smbc_bool b)
426{
427 if (b) {
428 c->flags |= SMB_CTX_FLAG_USE_KERBEROS;
429 } else {
430 c->flags &= ~SMB_CTX_FLAG_USE_KERBEROS;
431 }
432}
433
434/** Get whether to fallback after kerberos */
435smbc_bool
436smbc_getOptionFallbackAfterKerberos(SMBCCTX *c)
437{
438 return c->flags & SMB_CTX_FLAG_FALLBACK_AFTER_KERBEROS ? True : False;
439}
440
441/** Set whether to fallback after kerberos */
442void
443smbc_setOptionFallbackAfterKerberos(SMBCCTX *c, smbc_bool b)
444{
445 if (b) {
446 c->flags |= SMB_CTX_FLAG_FALLBACK_AFTER_KERBEROS;
447 } else {
448 c->flags &= ~SMB_CTX_FLAG_FALLBACK_AFTER_KERBEROS;
449 }
450}
451
452/** Get whether to automatically select anonymous login */
453smbc_bool
454smbc_getOptionNoAutoAnonymousLogin(SMBCCTX *c)
455{
456 return c->flags & SMBCCTX_FLAG_NO_AUTO_ANONYMOUS_LOGON ? True : False;
457}
458
459/** Set whether to automatically select anonymous login */
460void
461smbc_setOptionNoAutoAnonymousLogin(SMBCCTX *c, smbc_bool b)
462{
463 if (b) {
464 c->flags |= SMBCCTX_FLAG_NO_AUTO_ANONYMOUS_LOGON;
465 } else {
466 c->flags &= ~SMBCCTX_FLAG_NO_AUTO_ANONYMOUS_LOGON;
467 }
468}
469
470/** Get whether to enable use of the winbind ccache */
471smbc_bool
472smbc_getOptionUseCCache(SMBCCTX *c)
473{
474 return c->flags & SMB_CTX_FLAG_USE_CCACHE ? True : False;
475}
476
477/** Set whether to enable use of the winbind ccache */
478void
479smbc_setOptionUseCCache(SMBCCTX *c, smbc_bool b)
480{
481 if (b) {
482 c->flags |= SMB_CTX_FLAG_USE_CCACHE;
483 } else {
484 c->flags &= ~SMB_CTX_FLAG_USE_CCACHE;
485 }
486}
487
488/** Get indication whether the password supplied is the NT hash */
489smbc_bool
490smbc_getOptionUseNTHash(SMBCCTX *c)
491{
492 return (c->flags & SMB_CTX_FLAG_USE_NT_HASH) != 0;
493}
494
495/** Set indication that the password supplied is the NT hash */
496void
497smbc_setOptionUseNTHash(SMBCCTX *c, smbc_bool b)
498{
499 if (b) {
500 c->flags |= SMB_CTX_FLAG_USE_NT_HASH;
501 } else {
502 c->flags &= ~SMB_CTX_FLAG_USE_NT_HASH;
503 }
504}
505
506/** Get the function for obtaining authentication data */
507smbc_get_auth_data_fn
508smbc_getFunctionAuthData(SMBCCTX *c)
509{
510 smbc_get_auth_data_fn ret;
511 TALLOC_CTX *frame = talloc_stackframe();
512 ret = c->callbacks.auth_fn;
513 TALLOC_FREE(frame);
514 return ret;
515}
516
517/** Set the function for obtaining authentication data */
518void
519smbc_setFunctionAuthData(SMBCCTX *c, smbc_get_auth_data_fn fn)
520{
521 c->internal->auth_fn_with_context = NULL;
522 c->callbacks.auth_fn = fn;
523}
524
525/** Get the new-style authentication function which includes the context. */
526smbc_get_auth_data_with_context_fn
527smbc_getFunctionAuthDataWithContext(SMBCCTX *c)
528{
529 return c->internal->auth_fn_with_context;
530}
531
532/** Set the new-style authentication function which includes the context. */
533void
534smbc_setFunctionAuthDataWithContext(SMBCCTX *c,
535 smbc_get_auth_data_with_context_fn fn)
536{
537 c->callbacks.auth_fn = NULL;
538 c->internal->auth_fn_with_context = fn;
539}
540
541/** Get the function for checking if a server is still good */
542smbc_check_server_fn
543smbc_getFunctionCheckServer(SMBCCTX *c)
544{
545 return c->callbacks.check_server_fn;
546}
547
548/** Set the function for checking if a server is still good */
549void
550smbc_setFunctionCheckServer(SMBCCTX *c, smbc_check_server_fn fn)
551{
552 c->callbacks.check_server_fn = fn;
553}
554
555/** Get the function for removing a server if unused */
556smbc_remove_unused_server_fn
557smbc_getFunctionRemoveUnusedServer(SMBCCTX *c)
558{
559 return c->callbacks.remove_unused_server_fn;
560}
561
562/** Set the function for removing a server if unused */
563void
564smbc_setFunctionRemoveUnusedServer(SMBCCTX *c,
565 smbc_remove_unused_server_fn fn)
566{
567 c->callbacks.remove_unused_server_fn = fn;
568}
569
570/** Get the function for adding a cached server */
571smbc_add_cached_srv_fn
572smbc_getFunctionAddCachedServer(SMBCCTX *c)
573{
574 return c->callbacks.add_cached_srv_fn;
575}
576
577/** Set the function for adding a cached server */
578void
579smbc_setFunctionAddCachedServer(SMBCCTX *c, smbc_add_cached_srv_fn fn)
580{
581 c->callbacks.add_cached_srv_fn = fn;
582}
583
584/** Get the function for server cache lookup */
585smbc_get_cached_srv_fn
586smbc_getFunctionGetCachedServer(SMBCCTX *c)
587{
588 return c->callbacks.get_cached_srv_fn;
589}
590
591/** Set the function for server cache lookup */
592void
593smbc_setFunctionGetCachedServer(SMBCCTX *c, smbc_get_cached_srv_fn fn)
594{
595 c->callbacks.get_cached_srv_fn = fn;
596}
597
598/** Get the function for server cache removal */
599smbc_remove_cached_srv_fn
600smbc_getFunctionRemoveCachedServer(SMBCCTX *c)
601{
602 return c->callbacks.remove_cached_srv_fn;
603}
604
605/** Set the function for server cache removal */
606void
607smbc_setFunctionRemoveCachedServer(SMBCCTX *c,
608 smbc_remove_cached_srv_fn fn)
609{
610 c->callbacks.remove_cached_srv_fn = fn;
611}
612
613/**
614 * Get the function for server cache purging. This function tries to
615 * remove all cached servers (e.g. on disconnect)
616 */
617smbc_purge_cached_fn
618smbc_getFunctionPurgeCachedServers(SMBCCTX *c)
619{
620 return c->callbacks.purge_cached_fn;
621}
622
623/** Set the function to store private data of the server cache */
624void smbc_setServerCacheData(SMBCCTX *c, struct smbc_server_cache * cache)
625{
626 c->internal->server_cache = cache;
627}
628
629/** Get the function to store private data of the server cache */
630struct smbc_server_cache * smbc_getServerCacheData(SMBCCTX *c)
631{
632 return c->internal->server_cache;
633}
634
635
636/**
637 * Set the function for server cache purging. This function tries to
638 * remove all cached servers (e.g. on disconnect)
639 */
640void
641smbc_setFunctionPurgeCachedServers(SMBCCTX *c, smbc_purge_cached_fn fn)
642{
643 c->callbacks.purge_cached_fn = fn;
644}
645
646/**
647 * Callable functions for files.
648 */
649
650smbc_open_fn
651smbc_getFunctionOpen(SMBCCTX *c)
652{
653 return c->open;
654}
655
656void
657smbc_setFunctionOpen(SMBCCTX *c, smbc_open_fn fn)
658{
659 c->open = fn;
660}
661
662smbc_creat_fn
663smbc_getFunctionCreat(SMBCCTX *c)
664{
665 return c->creat;
666}
667
668void
669smbc_setFunctionCreat(SMBCCTX *c, smbc_creat_fn fn)
670{
671 c->creat = fn;
672}
673
674smbc_read_fn
675smbc_getFunctionRead(SMBCCTX *c)
676{
677 return c->read;
678}
679
680void
681smbc_setFunctionRead(SMBCCTX *c, smbc_read_fn fn)
682{
683 c->read = fn;
684}
685
686smbc_write_fn
687smbc_getFunctionWrite(SMBCCTX *c)
688{
689 return c->write;
690}
691
692void
693smbc_setFunctionWrite(SMBCCTX *c, smbc_write_fn fn)
694{
695 c->write = fn;
696}
697
698smbc_splice_fn
699smbc_getFunctionSplice(SMBCCTX *c)
700{
701 return c->internal->smb.splice_fn;
702}
703
704void
705smbc_setFunctionSplice(SMBCCTX *c, smbc_splice_fn fn)
706{
707 c->internal->smb.splice_fn = fn;
708}
709
710smbc_unlink_fn
711smbc_getFunctionUnlink(SMBCCTX *c)
712{
713 return c->unlink;
714}
715
716void
717smbc_setFunctionUnlink(SMBCCTX *c, smbc_unlink_fn fn)
718{
719 c->unlink = fn;
720}
721
722smbc_rename_fn
723smbc_getFunctionRename(SMBCCTX *c)
724{
725 return c->rename;
726}
727
728void
729smbc_setFunctionRename(SMBCCTX *c, smbc_rename_fn fn)
730{
731 c->rename = fn;
732}
733
734smbc_lseek_fn
735smbc_getFunctionLseek(SMBCCTX *c)
736{
737 return c->lseek;
738}
739
740void
741smbc_setFunctionLseek(SMBCCTX *c, smbc_lseek_fn fn)
742{
743 c->lseek = fn;
744}
745
746smbc_stat_fn
747smbc_getFunctionStat(SMBCCTX *c)
748{
749 return c->stat;
750}
751
752void
753smbc_setFunctionStat(SMBCCTX *c, smbc_stat_fn fn)
754{
755 c->stat = fn;
756}
757
758smbc_fstat_fn
759smbc_getFunctionFstat(SMBCCTX *c)
760{
761 return c->fstat;
762}
763
764void
765smbc_setFunctionFstat(SMBCCTX *c, smbc_fstat_fn fn)
766{
767 c->fstat = fn;
768}
769
770smbc_statvfs_fn
771smbc_getFunctionStatVFS(SMBCCTX *c)
772{
773 return c->internal->posix_emu.statvfs_fn;
774}
775
776void
777smbc_setFunctionStatVFS(SMBCCTX *c, smbc_statvfs_fn fn)
778{
779 c->internal->posix_emu.statvfs_fn = fn;
780}
781
782smbc_fstatvfs_fn
783smbc_getFunctionFstatVFS(SMBCCTX *c)
784{
785 return c->internal->posix_emu.fstatvfs_fn;
786}
787
788void
789smbc_setFunctionFstatVFS(SMBCCTX *c, smbc_fstatvfs_fn fn)
790{
791 c->internal->posix_emu.fstatvfs_fn = fn;
792}
793
794smbc_ftruncate_fn
795smbc_getFunctionFtruncate(SMBCCTX *c)
796{
797 return c->internal->posix_emu.ftruncate_fn;
798}
799
800void
801smbc_setFunctionFtruncate(SMBCCTX *c, smbc_ftruncate_fn fn)
802{
803 c->internal->posix_emu.ftruncate_fn = fn;
804}
805
806smbc_close_fn
807smbc_getFunctionClose(SMBCCTX *c)
808{
809 return c->close_fn;
810}
811
812void
813smbc_setFunctionClose(SMBCCTX *c, smbc_close_fn fn)
814{
815 c->close_fn = fn;
816}
817
818
819/**
820 * Callable functions for directories.
821 */
822
823smbc_opendir_fn
824smbc_getFunctionOpendir(SMBCCTX *c)
825{
826 return c->opendir;
827}
828
829void
830smbc_setFunctionOpendir(SMBCCTX *c, smbc_opendir_fn fn)
831{
832 c->opendir = fn;
833}
834
835smbc_closedir_fn
836smbc_getFunctionClosedir(SMBCCTX *c)
837{
838 return c->closedir;
839}
840
841void
842smbc_setFunctionClosedir(SMBCCTX *c, smbc_closedir_fn fn)
843{
844 c->closedir = fn;
845}
846
847smbc_readdir_fn
848smbc_getFunctionReaddir(SMBCCTX *c)
849{
850 return c->readdir;
851}
852
853void
854smbc_setFunctionReaddir(SMBCCTX *c, smbc_readdir_fn fn)
855{
856 c->readdir = fn;
857}
858
859smbc_getdents_fn
860smbc_getFunctionGetdents(SMBCCTX *c)
861{
862 return c->getdents;
863}
864
865void
866smbc_setFunctionGetdents(SMBCCTX *c, smbc_getdents_fn fn)
867{
868 c->getdents = fn;
869}
870
871smbc_mkdir_fn
872smbc_getFunctionMkdir(SMBCCTX *c)
873{
874 return c->mkdir;
875}
876
877void
878smbc_setFunctionMkdir(SMBCCTX *c, smbc_mkdir_fn fn)
879{
880 c->mkdir = fn;
881}
882
883smbc_rmdir_fn
884smbc_getFunctionRmdir(SMBCCTX *c)
885{
886 return c->rmdir;
887}
888
889void
890smbc_setFunctionRmdir(SMBCCTX *c, smbc_rmdir_fn fn)
891{
892 c->rmdir = fn;
893}
894
895smbc_telldir_fn
896smbc_getFunctionTelldir(SMBCCTX *c)
897{
898 return c->telldir;
899}
900
901void
902smbc_setFunctionTelldir(SMBCCTX *c, smbc_telldir_fn fn)
903{
904 c->telldir = fn;
905}
906
907smbc_lseekdir_fn
908smbc_getFunctionLseekdir(SMBCCTX *c)
909{
910 return c->lseekdir;
911}
912
913void
914smbc_setFunctionLseekdir(SMBCCTX *c, smbc_lseekdir_fn fn)
915{
916 c->lseekdir = fn;
917}
918
919smbc_fstatdir_fn
920smbc_getFunctionFstatdir(SMBCCTX *c)
921{
922 return c->fstatdir;
923}
924
925void
926smbc_setFunctionFstatdir(SMBCCTX *c, smbc_fstatdir_fn fn)
927{
928 c->fstatdir = fn;
929}
930
931smbc_notify_fn
932smbc_getFunctionNotify(SMBCCTX *c)
933{
934 return c->internal->smb.notify_fn;
935}
936
937void
938smbc_setFunctionNotify(SMBCCTX *c, smbc_notify_fn fn)
939{
940 c->internal->smb.notify_fn = fn;
941}
942
943
944/**
945 * Callable functions applicable to both files and directories.
946 */
947
948smbc_chmod_fn
949smbc_getFunctionChmod(SMBCCTX *c)
950{
951 return c->chmod;
952}
953
954void
955smbc_setFunctionChmod(SMBCCTX *c, smbc_chmod_fn fn)
956{
957 c->chmod = fn;
958}
959
960smbc_utimes_fn
961smbc_getFunctionUtimes(SMBCCTX *c)
962{
963 return c->utimes;
964}
965
966void
967smbc_setFunctionUtimes(SMBCCTX *c, smbc_utimes_fn fn)
968{
969 c->utimes = fn;
970}
971
972smbc_setxattr_fn
973smbc_getFunctionSetxattr(SMBCCTX *c)
974{
975 return c->setxattr;
976}
977
978void
979smbc_setFunctionSetxattr(SMBCCTX *c, smbc_setxattr_fn fn)
980{
981 c->setxattr = fn;
982}
983
984smbc_getxattr_fn
985smbc_getFunctionGetxattr(SMBCCTX *c)
986{
987 return c->getxattr;
988}
989
990void
991smbc_setFunctionGetxattr(SMBCCTX *c, smbc_getxattr_fn fn)
992{
993 c->getxattr = fn;
994}
995
996smbc_removexattr_fn
997smbc_getFunctionRemovexattr(SMBCCTX *c)
998{
999 return c->removexattr;
1000}
1001
1002void
1003smbc_setFunctionRemovexattr(SMBCCTX *c, smbc_removexattr_fn fn)
1004{
1005 c->removexattr = fn;
1006}
1007
1008smbc_listxattr_fn
1009smbc_getFunctionListxattr(SMBCCTX *c)
1010{
1011 return c->listxattr;
1012}
1013
1014void
1015smbc_setFunctionListxattr(SMBCCTX *c, smbc_listxattr_fn fn)
1016{
1017 c->listxattr = fn;
1018}
1019
1020
1021/**
1022 * Callable functions related to printing
1023 */
1024
1025smbc_print_file_fn
1026smbc_getFunctionPrintFile(SMBCCTX *c)
1027{
1028 return c->print_file;
1029}
1030
1031void
1032smbc_setFunctionPrintFile(SMBCCTX *c, smbc_print_file_fn fn)
1033{
1034 c->print_file = fn;
1035}
1036
1037smbc_open_print_job_fn
1038smbc_getFunctionOpenPrintJob(SMBCCTX *c)
1039{
1040 return c->open_print_job;
1041}
1042
1043void
1044smbc_setFunctionOpenPrintJob(SMBCCTX *c,
1045 smbc_open_print_job_fn fn)
1046{
1047 c->open_print_job = fn;
1048}
1049
1050smbc_list_print_jobs_fn
1051smbc_getFunctionListPrintJobs(SMBCCTX *c)
1052{
1053 return c->list_print_jobs;
1054}
1055
1056void
1057smbc_setFunctionListPrintJobs(SMBCCTX *c,
1058 smbc_list_print_jobs_fn fn)
1059{
1060 c->list_print_jobs = fn;
1061}
1062
1063smbc_unlink_print_job_fn
1064smbc_getFunctionUnlinkPrintJob(SMBCCTX *c)
1065{
1066 return c->unlink_print_job;
1067}
1068
1069void
1070smbc_setFunctionUnlinkPrintJob(SMBCCTX *c,
1071 smbc_unlink_print_job_fn fn)
1072{
1073 c->unlink_print_job = fn;
1074}
1075
Note: See TracBrowser for help on using the repository browser.