s3: Remove some pointless uses of string_sid_talloc
[ira/wip.git] / source3 / libsmb / libsmb_setget.c
index d0823bd77ec4125b19e6f7a8d6d6851bda4ff01a..791b4cd9e4675ef7018a19b57829604748f56dfa 100644 (file)
@@ -7,17 +7,17 @@
    Copyright (C) Tom Jansen (Ninja ISD) 2002 
    Copyright (C) Derrell Lipman 2003-2008
    Copyright (C) Jeremy Allison 2007, 2008
-   
+
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
-   
+
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
-   
+
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
@@ -39,7 +39,10 @@ smbc_getNetbiosName(SMBCCTX *c)
 void
 smbc_setNetbiosName(SMBCCTX *c, char * netbios_name)
 {
-        c->netbios_name = netbios_name;
+       SAFE_FREE(c->netbios_name);
+       if (netbios_name) {
+               c->netbios_name = SMB_STRDUP(netbios_name);
+       }
 }
 
 /** Get the workgroup used for making connections */
@@ -53,7 +56,10 @@ smbc_getWorkgroup(SMBCCTX *c)
 void
 smbc_setWorkgroup(SMBCCTX *c, char * workgroup)
 {
-        c->workgroup = workgroup;
+       SAFE_FREE(c->workgroup);
+       if (workgroup) {
+               c->workgroup = SMB_STRDUP(workgroup);
+       }
 }
 
 /** Get the username used for making connections */
@@ -67,7 +73,10 @@ smbc_getUser(SMBCCTX *c)
 void
 smbc_setUser(SMBCCTX *c, char * user)
 {
-        c->user = user;
+       SAFE_FREE(c->user);
+       if (user) {
+               c->user = SMB_STRDUP(user);
+       }
 }
 
 /** Get the debug level */
@@ -193,6 +202,32 @@ smbc_setOptionSmbEncryptionLevel(SMBCCTX *c, smbc_smb_encrypt_level level)
         c->internal->smb_encryption_level = level;
 }
 
+/**
+ * Get whether to treat file names as case-sensitive if we can't determine
+ * when connecting to the remote share whether the file system is case
+ * sensitive. This defaults to FALSE since it's most likely that if we can't
+ * retrieve the file system attributes, it's a very old file system that does
+ * not support case sensitivity.
+ */
+smbc_bool
+smbc_getOptionCaseSensitive(SMBCCTX *c)
+{
+        return c->internal->case_sensitive;
+}
+
+/**
+ * Set whether to treat file names as case-sensitive if we can't determine
+ * when connecting to the remote share whether the file system is case
+ * sensitive. This defaults to FALSE since it's most likely that if we can't
+ * retrieve the file system attributes, it's a very old file system that does
+ * not support case sensitivity.
+ */
+void
+smbc_setOptionCaseSensitive(SMBCCTX *c, smbc_bool b)
+{
+        c->internal->case_sensitive = b;
+}
+
 /**
  * Get from how many local master browsers should the list of workgroups be
  * retrieved.  It can take up to 12 minutes or longer after a server becomes a
@@ -633,6 +668,30 @@ smbc_setFunctionFstat(SMBCCTX *c, smbc_fstat_fn fn)
         c->fstat = fn;
 }
 
+smbc_statvfs_fn
+smbc_getFunctionStatVFS(SMBCCTX *c)
+{
+        return c->internal->posix_emu.statvfs_fn;
+}
+
+void
+smbc_setFunctionStatVFS(SMBCCTX *c, smbc_statvfs_fn fn)
+{
+        c->internal->posix_emu.statvfs_fn = fn;
+}
+
+smbc_fstatvfs_fn
+smbc_getFunctionFstatVFS(SMBCCTX *c)
+{
+        return c->internal->posix_emu.fstatvfs_fn;
+}
+
+void
+smbc_setFunctionFstatVFS(SMBCCTX *c, smbc_fstatvfs_fn fn)
+{
+        c->internal->posix_emu.fstatvfs_fn = fn;
+}
+
 smbc_ftruncate_fn
 smbc_getFunctionFtruncate(SMBCCTX *c)
 {