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