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