[SCM] Samba Shared Repository - branch v3-2-stable updated - initial-v3-2-test-2702-gbf03cba

Karolin Seeger ks at sernet.de
Tue Mar 4 08:37:06 GMT 2008


The branch, v3-2-stable has been updated
       via  bf03cba57d3cfe07b8d848aa3b5a165bb198b7aa (commit)
       via  4279cc49ff73d4503df2fd0c6176c3f90f67066c (commit)
       via  7c2a0be9cb2916c07074d8d56d698721b02bcfc3 (commit)
       via  046653403fadfa2d42decce7048eca6321b321c6 (commit)
       via  0621dfe10f1fd3d8ce04a039d2d44d6c67407746 (commit)
       via  8bf707c13794539029be2229f0c587b713b4fd20 (commit)
       via  938c6aef24c696be9bd247e43c7c5ec1f792dbd6 (commit)
       via  9b4bd6473ed3f93c1bbfae3f82d0a100e832df48 (commit)
       via  b7f10bd31dec8047ea996c4738a6db5535c9261a (commit)
       via  eb4d6dda1091199af7e62fb584525deb382978e2 (commit)
       via  7b05e264d58c65af37af457947548611fc77edce (commit)
       via  dca8a612e94095e38df50f0fe567c75ceb8124fe (commit)
       via  7bc53f57dcb1c3bb80cb20796ebfc743c22a76e3 (commit)
       via  59292c0da8880afd7bac82f6a5bba009f3827ea0 (commit)
       via  a94313e06a030e1a1afff18c797e700eb6b25248 (commit)
      from  4170259e5f83c281966a80916e4ece6937e08988 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-stable


- Log -----------------------------------------------------------------
commit bf03cba57d3cfe07b8d848aa3b5a165bb198b7aa
Author: Günther Deschner <gd at samba.org>
Date:   Sat Mar 1 00:32:36 2008 +0100

    Fix init_registry_data for subkeyless top-level keys.
    
    On a fresh install with no existing registry.tdb, make sure we are able to
    create our initial top-level entries.
    
    Michael, Volker, please check.
    
    Guenther
    (cherry picked from commit 956bc602062825493e1c357e2388fee1e5514b50)

commit 4279cc49ff73d4503df2fd0c6176c3f90f67066c
Author: Derrell Lipman <derrell.lipman at unwireduniverse.com>
Date:   Mon Mar 3 22:56:32 2008 -0500

    use constant name less likely to cause conflict
    (cherry picked from commit fd18b01016d1dc4b08983975353e62084fdc323c)

commit 7c2a0be9cb2916c07074d8d56d698721b02bcfc3
Author: Derrell Lipman <derrell.lipman at unwireduniverse.com>
Date:   Mon Mar 3 18:25:49 2008 -0500

    Missed a few 'deprecated' markers
    (cherry picked from commit 76ba37ac46b4a77fe228ca90635fa19140541ccd)

commit 046653403fadfa2d42decce7048eca6321b321c6
Author: Derrell Lipman <derrell.lipman at unwireduniverse.com>
Date:   Mon Mar 3 18:13:33 2008 -0500

    Continued revamping of libsmbclient.
    
    - James suggested using gcc's "deprecated" attribute to mark the context
      structure fields to generate warnings.  This creates a scenario with the
      best of all worlds.  I'm able to move to an organization that more easily
      allows future enhancements, while avoiding any mandatory changes by
      applications.  Thanks, James!
    
    - Updated WHATSNEW.txt so that it accurately reflects the current state of
      affairs.
    
    Derrell
    (cherry picked from commit a67f96fbe9683b46c2149f7cb439d13f7f0e6ecd)

commit 0621dfe10f1fd3d8ce04a039d2d44d6c67407746
Author: Derrell Lipman <derrell.lipman at unwireduniverse.com>
Date:   Sun Mar 2 16:21:48 2008 -0500

    Remove use of deprecated function
    (cherry picked from commit 93580bce833453ba512ee436d6dfdbdcd2c53777)

commit 8bf707c13794539029be2229f0c587b713b4fd20
Author: Derrell Lipman <derrell.lipman at unwireduniverse.com>
Date:   Sun Mar 2 16:13:25 2008 -0500

    fixed missing white space
    (cherry picked from commit 71e86f13b0ace3841c6712084728c79db74ff803)

commit 938c6aef24c696be9bd247e43c7c5ec1f792dbd6
Author: Derrell Lipman <derrell.lipman at unwireduniverse.com>
Date:   Sat Mar 1 23:08:19 2008 -0500

    Update WHATSNEW for libsmbclient changes
    (cherry picked from commit f07407a32e178a47c8f9b3e3703aa5a20f0a4f06)

commit 9b4bd6473ed3f93c1bbfae3f82d0a100e832df48
Author: Derrell Lipman <derrell.lipman at unwireduniverse.com>
Date:   Sat Mar 1 21:19:52 2008 -0500

    Return NULL, not 0, from a function which returns a pointer.
    (cherry picked from commit 23cb9c49e3724cecaa66655ef64c3111bf14c552)

commit b7f10bd31dec8047ea996c4738a6db5535c9261a
Author: Derrell Lipman <derrell.lipman at unwireduniverse.com>
Date:   Sat Mar 1 21:19:15 2008 -0500

    change variable name from f to fn for function pointers
    (cherry picked from commit 1fd65359f6cd07539cfe43146ac367a48708a678)

commit eb4d6dda1091199af7e62fb584525deb382978e2
Author: Derrell Lipman <derrell.lipman at unwireduniverse.com>
Date:   Sat Mar 1 20:56:54 2008 -0500

    Comment was in wrong place
    (cherry picked from commit dec70fa3c0424c148016cc667a3c159e16d8a944)

commit 7b05e264d58c65af37af457947548611fc77edce
Author: Derrell Lipman <derrell.lipman at unwireduniverse.com>
Date:   Sat Mar 1 20:55:21 2008 -0500

    Mark smbc_option_{get,set} as deprecated
    (cherry picked from commit a8b4b773d4647f28e7b92c5968469721d34eb550)

commit dca8a612e94095e38df50f0fe567c75ceb8124fe
Author: Derrell Lipman <derrell.lipman at unwireduniverse.com>
Date:   Sat Mar 1 20:44:21 2008 -0500

    Additional revamped libsmbclient documentation
    
    - Ensured that all public functions have documentation in libsmbclient.h
    - Reformatted for "proper" indentation
    - Re-added temporarily-disabled alternate authentication function capability
    
    Derrell
    (cherry picked from commit 64b7150d92849a1e1e2416b9dcc12fae8d6bea99)

commit 7bc53f57dcb1c3bb80cb20796ebfc743c22a76e3
Author: Derrell Lipman <derrell.lipman at unwireduniverse.com>
Date:   Fri Feb 29 13:34:35 2008 -0500

    Modified revamp of the libsmbclient interface.
    
    Given the tacit (if that) approval by some people, and clear disapproval by
    others for my proposed clean-up and reorganization of libsmbclient, I've come
    up with a slightly different approach.  This commit changes back to the
    original libsmbclient.h SMBCCTX structure which will maintain ABI
    compatibility.  I retain, here, the setter and getter functions which all new
    code should use.  Older programs already compiled should continue to work
    fine.  Older programs being recompiled will encounter compile-time errors
    (intentionally!) so that the code can be corrected to use the setter/getter
    interfaces.
    
    Although this doesn't clean up the interface in the way I had wanted, the code
    reorganization and requirement for new programs to use the setters and getters
    allows future progress to be made on libsmbclient without further muddying up
    the interface, while retaining the ABI compatibility that was the big issue
    causing disapproval.  I hope that this compromise is adequate.
    
    Derrell
    (cherry picked from commit 56429a3d60b2a48963342f6340b3c01469a892c6)

commit 59292c0da8880afd7bac82f6a5bba009f3827ea0
Author: Derrell Lipman <derrell.lipman at unwireduniverse.com>
Date:   Thu Feb 28 11:23:20 2008 -0500

    Initial revamp of the libsmbclient interface.
    
    The libsmbclient interface has suffered from difficulty of improvement and
    feature enrichment without causing ABI breakage.  Although there were a number
    of issues, the primary ones were:
    
    (a) the user of the library would manually manipulate the context structure
        members, meaning that nothing in the context structure could change other
        than adding stuff at the end;
    
    (b) there were three methods of setting options: setting bits in a flags field
        within the context structure, setting explicit options variables within an
        options structure in the context structure, and by calling the
        smbc_option_set() function;
    
    (c) the authentication callback did not traditionally provide enough
        information to the callee which required adding an option for a callback
        with a different signature, and now there are requests for even more
        information at the callback, requiring yet a third signature and option to
        set it (if we implement that feature).
    
    This commit provides a reorganization of the code which fixes (a) and (b).
    The context structure is now entirely opaque, and there are setter and getter
    functions for manipulating it.  This makes maintaining ABI consistency much,
    much easier.
    
    Additionally, the options setting/getting has been unified into a single
    mechanism using smbc_option_set() and smbc_option_get().
    
    Yet to be completed is a refactoring of the authentication callback (c).
    
    The test programs in examples/libsmbclient have been modified (if necessary;
    some applications require no changes at all) for the new API and a few have
    been minimally tested.
    
    Derrell
    (cherry picked from commit d4b4bae8ded824d06ad5ab0e219f71187ee5c771)

commit a94313e06a030e1a1afff18c797e700eb6b25248
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Mar 3 18:12:26 2008 +0100

    Zero out the out policy handler in lsa_Close
    
    ... after a REALLY long session staring at sniffs we can now join XP to
    v3-2-test again...
    
    Apparently not doing this makes XP keep an internal handle to LSA open which
    confuses the hell out of it.
    
    Karolin, this needs to be in v3-2-stable :-)
    
    Volker
    (cherry picked from commit 2c42fc21d8bede226e411623aecd69038477373b)

-----------------------------------------------------------------------

Summary of changes:
 WHATSNEW.txt                            |   60 +
 examples/libsmbclient/Makefile          |    4 +-
 examples/libsmbclient/smbwrapper/smbw.c |   10 +-
 examples/libsmbclient/testacl.c         |    2 +-
 examples/libsmbclient/testacl2.c        |    2 +-
 examples/libsmbclient/testacl3.c        |    2 +-
 examples/libsmbclient/testbrowse.c      |   19 +-
 examples/libsmbclient/testbrowse2.c     |   17 +-
 examples/libsmbclient/testsmbc.c        |    2 +-
 source/Makefile.in                      |   13 +-
 source/include/libsmb_internal.h        |  446 ++-
 source/include/libsmbclient.h           | 1017 ++++-
 source/libsmb/libsmb_cache.c            |  129 +-
 source/libsmb/libsmb_compat.c           |  379 +-
 source/libsmb/libsmb_context.c          |  612 +++
 source/libsmb/libsmb_dir.c              | 1942 +++++++++
 source/libsmb/libsmb_file.c             |  864 ++++
 source/libsmb/libsmb_misc.c             |   73 +
 source/libsmb/libsmb_path.c             |  400 ++
 source/libsmb/libsmb_printjob.c         |  336 ++
 source/libsmb/libsmb_server.c           |  686 +++
 source/libsmb/libsmb_setget.c           |  905 ++++
 source/libsmb/libsmb_stat.c             |  302 ++
 source/libsmb/libsmb_xattr.c            | 2301 ++++++++++
 source/libsmb/libsmbclient.c            | 7233 -------------------------------
 source/registry/reg_backend_db.c        |   19 +-
 source/rpc_server/srv_lsa_nt.c          |    1 +
 27 files changed, 10062 insertions(+), 7714 deletions(-)
 create mode 100644 source/libsmb/libsmb_context.c
 create mode 100644 source/libsmb/libsmb_dir.c
 create mode 100644 source/libsmb/libsmb_file.c
 create mode 100644 source/libsmb/libsmb_misc.c
 create mode 100644 source/libsmb/libsmb_path.c
 create mode 100644 source/libsmb/libsmb_printjob.c
 create mode 100644 source/libsmb/libsmb_server.c
 create mode 100644 source/libsmb/libsmb_setget.c
 create mode 100644 source/libsmb/libsmb_stat.c
 create mode 100644 source/libsmb/libsmb_xattr.c
 delete mode 100644 source/libsmb/libsmbclient.c


Changeset truncated at 500 lines:

diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index c18ba8b..0b35554 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -105,6 +105,63 @@ See examples/scripts/mount/mount.smbfs as an example for a wrapper which
 calls mount.cifs instead of smbmount/mount.smbfs.
 
 
+Modified API for libsmbclient
+==============================================================================
+
+Maintaining ABI compatibility for libsmbclient has become increasingly
+difficult to accomplish, while also keeping the code organization such that it
+is easily readable.  Towards the goal of maintaining ABI compatibility and
+also keeping the code easy to maintain and enhance, the API has been enhanced.
+In particular, the fields in the SMBCCTX context structure are no longer
+intended to be read/write by the user, and are marked as deprecated.  An
+application that previously accessed the members of the SMBCCTX context
+structure will now encounter warnings if recompiled.  This is intentional, to
+encourage implementation of the small changes required for the new interface.
+The number of changes is expected to be quite small for the vast majority of
+applications, and no changes need be made for many applications.  The changes
+required for KDE (konqueror) to conform to the new interface, for example, are
+only four lines in only one file.
+
+Instead of the application manually changing or reading values in the context
+structure, there are now setter and getter functions for each configurable
+member in that structure.  Similarly, the smbc_option_get() and
+smbc_option_set() functions are deprecated in favor of the setter/getter
+interface.  The setters and getters are all documented in libsmbclient.h
+under these comment blocks:
+
+  Getters and setters for CONFIGURATION
+  Getters and setters for OPTIONS
+  Getters and setters for FUNCTIONS
+  Callable functions for files
+  Callable functions for directories
+  Callable functions applicable to both files and directories
+
+Example changes that may be required to eliminate "deprecated" warnings:
+
+  /* Set the debug level */
+  context->debug = 99;
+changes to:
+  smbc_setDebug(context, 99);
+
+  /* Specify the authentication callback function */
+  context->callbacks.auth_fn = auth_smbc_get_data;
+changes to:
+  smbc_setFunctionAuthData(context, auth_smbc_get_data);
+
+  /* Specify the new-style authentication callback with context parameter */
+  smbc_option_set("auth_function", auth_smbc_get_data_with_ctx);
+changes to:
+  smbc_setFunctionAuthDataWithContext(context, auth_smbc_get_data_with_ctx);
+
+  /* Set kerberos flags */
+  context->flags = (SMB_CTX_FLAG_USE_KERBEROS |
+                    SMB_CTX_FLAG_FALLBACK_AFTER_KERBEROS);
+changes to:
+  smbc_setOptionUseKerberos(context, 1);
+  smbc_setOptionFallbackAfterKerberos(context, 1);
+
+
+
 
 ######################################################################
 Changes
@@ -249,6 +306,9 @@ o   Volker Lendecke <vl at samba.org>
     * Speed up the smbclient "get" command
     * Add the aio_fork module
 
+o   Derrell Lipman <derrell at samba.org>
+    * Modified libsmbclient API for more easily maintaining ABI compatibility
+      while adding new features to libsmbclient.
 
 o   Stefan Metzmacher <metze at samba.org>
     * Refactor Winbind internal parent-child interface tables
diff --git a/examples/libsmbclient/Makefile b/examples/libsmbclient/Makefile
index e2d8b68..a50e80a 100644
--- a/examples/libsmbclient/Makefile
+++ b/examples/libsmbclient/Makefile
@@ -1,14 +1,14 @@
 #
 CC = gcc
 
-SAMBA_INCL = ../../source/include
+SAMBA_INCL  = -I/usr/local/samba/include
 EXTLIB_INCL = -I/usr/include/gtk-1.2 \
 	      -I/usr/include/glib-1.2 \
 	      -I/usr/lib/glib/include
 EXTLIB_INCL = `gtk-config --cflags`
 
 DEFS = -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
-CFLAGS = -O0 -g -I$(SAMBA_INCL) $(EXTLIB_INCL) $(DEFS)
+CFLAGS = -O0 -g $(SAMBA_INCL) $(EXTLIB_INCL) $(DEFS)
 
 LDFLAGS = -L/usr/local/samba/lib \
 	  -lldap -lkrb5 -lgssapi_krb5
diff --git a/examples/libsmbclient/smbwrapper/smbw.c b/examples/libsmbclient/smbwrapper/smbw.c
index b88290f..e2e44c1 100644
--- a/examples/libsmbclient/smbwrapper/smbw.c
+++ b/examples/libsmbclient/smbwrapper/smbw.c
@@ -174,11 +174,11 @@ static void do_init(StartupType startupType)
                 exit(1);
         }
         
-        smbw_ctx->debug = debug_level;
-        smbw_ctx->callbacks.auth_fn = get_auth_data_fn;
-        smbw_ctx->options.browse_max_lmb_count = 0;
-        smbw_ctx->options.urlencode_readdir_entries = 1;
-        smbw_ctx->options.one_share_per_server = 1;
+        smbc_setDebug(smbw_ctx, debug_level);
+        smbc_setFunctionAuthData(smbw_ctx, get_auth_data_fn);
+        smbc_setOptionBrowseMaxLmbCount(smbw_ctx, 0);
+        smbc_setOptionUrlEncodeReaddirEntries(smbw_ctx, 1);
+        smbc_setOptionOneSharePerServer(smbw_ctx, 1);
         
         if (smbc_init_context(smbw_ctx) == NULL) {
                 fprintf(stderr, "Could not initialize context.\n");
diff --git a/examples/libsmbclient/testacl.c b/examples/libsmbclient/testacl.c
index 51cc90f..00e1c2c 100644
--- a/examples/libsmbclient/testacl.c
+++ b/examples/libsmbclient/testacl.c
@@ -143,7 +143,7 @@ int main(int argc, const char *argv[])
 
     if (full_time_names) {
         SMBCCTX *context = smbc_set_context(NULL);
-        smbc_option_set(context, "full_time_names", 1);
+        smbc_setOptionFullTimeNames(context, 1);
     }
     
     /* Perform requested action */
diff --git a/examples/libsmbclient/testacl2.c b/examples/libsmbclient/testacl2.c
index df38fe2..d2a97cf 100644
--- a/examples/libsmbclient/testacl2.c
+++ b/examples/libsmbclient/testacl2.c
@@ -39,7 +39,7 @@ int main(int argc, const char *argv[])
     }
 
     SMBCCTX *context = smbc_set_context(NULL);
-    smbc_option_set(context, "full_time_names", 1);
+    smbc_setOptionFullTimeNames(context, 1);
     
     the_acl = strdup("system.nt_sec_desc.*");
     ret = smbc_getxattr(argv[1], the_acl, value, sizeof(value));
diff --git a/examples/libsmbclient/testacl3.c b/examples/libsmbclient/testacl3.c
index 9102405..4ef6e80 100644
--- a/examples/libsmbclient/testacl3.c
+++ b/examples/libsmbclient/testacl3.c
@@ -28,7 +28,7 @@ int main(int argc, char * argv[])
     smbc_init(get_auth_data_fn, debug); 
     
     context = smbc_set_context(NULL);
-    smbc_option_set(context, "full_time_names", 1);
+    smbc_setOptionFullTimeNames(context, 1);
     
     for (;;)
     {
diff --git a/examples/libsmbclient/testbrowse.c b/examples/libsmbclient/testbrowse.c
index 562d2c2..a7eda36 100644
--- a/examples/libsmbclient/testbrowse.c
+++ b/examples/libsmbclient/testbrowse.c
@@ -108,24 +108,21 @@ main(int argc, char * argv[])
     }
 
     /* Set mandatory options (is that a contradiction in terms?) */
-    context->debug = debug;
+    smbc_setDebug(context, debug);
     if (context_auth) {
-        context->callbacks.auth_fn = NULL;
-        smbc_option_set(context,
-                        "auth_function",
-                        (void *) get_auth_data_with_context_fn);
-        smbc_option_set(context, "user_data", "hello world");
+        smbc_setFunctionAuthDataWithContext(context,
+                                            get_auth_data_with_context_fn);
+        smbc_setOptionUserData(context, "hello world");
     } else {
-        context->callbacks.auth_fn =
-            (no_auth ? no_auth_data_fn : get_auth_data_fn);
+        smbc_setFunctionAuthData(context, get_auth_data_fn);
     }
 
     /* If we've been asked to log to stderr instead of stdout, ... */
     if (debug_stderr) {
         /* ... then set the option to do so */
-        smbc_option_set(context, "debug_to_stderr", 1);
+        smbc_setOptionDebugToStderr(context, 1);
     }
-	
+
     /* Initialize the context using the previously specified options */
     if (!smbc_init_context(context)) {
         smbc_free_context(context, 0);
@@ -199,7 +196,7 @@ get_auth_data_with_context_fn(SMBCCTX * context,
 {
     printf("Authenticating with context 0x%lx", context);
     if (context != NULL) {
-        char *user_data = smbc_option_get(context, "user_data");
+        char *user_data = smbc_getOptionUserData(context);
         printf(" with user data %s", user_data);
     }
     printf("\n");
diff --git a/examples/libsmbclient/testbrowse2.c b/examples/libsmbclient/testbrowse2.c
index 76d98b9..0ac1d72 100644
--- a/examples/libsmbclient/testbrowse2.c
+++ b/examples/libsmbclient/testbrowse2.c
@@ -93,8 +93,8 @@ SMBCCTX* create_smbctx(){
 
     if ((ctx = smbc_new_context()) == NULL) return NULL;
 
-    ctx->debug = debuglevel;
-    ctx->callbacks.auth_fn = smbc_auth_fn;
+    smbc_setDebug(ctx, debuglevel);
+    smbc_setFunctionAuthData(ctx, smbc_auth_fn);
 
     if (smbc_init_context(ctx) == NULL){
 	smbc_free_context(ctx, 1);
@@ -105,7 +105,7 @@ SMBCCTX* create_smbctx(){
 }
 
 void delete_smbctx(SMBCCTX* ctx){
-    ctx->callbacks.purge_cached_fn(ctx);
+    smbc_getFunctionPurgeCachedServers(ctx)(ctx);
     smbc_free_context(ctx, 1);
 }
 
@@ -114,8 +114,9 @@ smbitem* get_smbitem_list(SMBCCTX *ctx, char *smb_path){
     struct smbc_dirent	*dirent;
     smbitem		*list = NULL, *item;
 
-    if ((fd = ctx->opendir(ctx, smb_path)) == NULL) return NULL;
-    while((dirent = ctx->readdir(ctx, fd)) != NULL){
+    if ((fd = smbc_getFunctionOpendir(ctx)(ctx, smb_path)) == NULL)
+        return NULL;
+    while((dirent = smbc_getFunctionReaddir(ctx)(ctx, fd)) != NULL){
 	if (strcmp(dirent->name, "") == 0) continue;
 	if (strcmp(dirent->name, ".") == 0) continue;
 	if (strcmp(dirent->name, "..") == 0) continue;
@@ -128,7 +129,7 @@ smbitem* get_smbitem_list(SMBCCTX *ctx, char *smb_path){
 	strcpy(item->name, dirent->name);
 	list = item;
     }
-    ctx->close_fn(ctx, fd);
+    smbc_getFunctionClose(ctx)(ctx, fd);
     return /* smbitem_list_sort */ (list);    
         
 }
@@ -167,7 +168,7 @@ void recurse(SMBCCTX *ctx, char *smb_group, char *smb_path, int maxlen){
 		    delete_smbctx(ctx1);
 		}else{
 		    recurse(ctx, smb_group, smb_path, maxlen);
-		    ctx->callbacks.purge_cached_fn(ctx);
+		    smbc_getFunctionPurgeCachedServers(ctx)(ctx);
 		}
 		break;
 	    case SMBC_FILE_SHARE:
@@ -181,7 +182,7 @@ void recurse(SMBCCTX *ctx, char *smb_group, char *smb_path, int maxlen){
 		if (list->type != SMBC_FILE){
 		    recurse(ctx, smb_group, smb_path, maxlen);
 		    if (list->type == SMBC_FILE_SHARE)
-			ctx->callbacks.purge_cached_fn(ctx);
+			smbc_getFunctionPurgeCachedServers(ctx)(ctx);
 		}
 		break;
 	}
diff --git a/examples/libsmbclient/testsmbc.c b/examples/libsmbclient/testsmbc.c
index c506f5f..1f06437 100644
--- a/examples/libsmbclient/testsmbc.c
+++ b/examples/libsmbclient/testsmbc.c
@@ -25,7 +25,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <stdlib.h>
-#include <libsmbclient.h>
+#include "libsmbclient.h"
 #include "get_auth_data_fn.h"
 
 int global_id = 0;
diff --git a/source/Makefile.in b/source/Makefile.in
index c91f544..44ac662 100644
--- a/source/Makefile.in
+++ b/source/Makefile.in
@@ -756,8 +756,19 @@ RPCCLIENT_OBJ = $(RPCCLIENT_OBJ1) \
 PAM_WINBIND_OBJ = nsswitch/pam_winbind.o $(WBCOMMON_OBJ) \
 		  $(LIBREPLACE_OBJ) @BUILD_INIPARSER@
 
-LIBSMBCLIENT_OBJ0 = libsmb/libsmbclient.o libsmb/libsmb_compat.o \
+LIBSMBCLIENT_OBJ0 = \
 		    libsmb/libsmb_cache.o \
+		    libsmb/libsmb_compat.o \
+		    libsmb/libsmb_context.o \
+		    libsmb/libsmb_dir.o \
+		    libsmb/libsmb_file.o \
+		    libsmb/libsmb_misc.o \
+		    libsmb/libsmb_path.o \
+		    libsmb/libsmb_printjob.o \
+		    libsmb/libsmb_server.o \
+		    libsmb/libsmb_stat.o \
+		    libsmb/libsmb_xattr.o \
+		    libsmb/libsmb_setget.o \
 		    $(PARAM_OBJ) $(LIB_NONSMBD_OBJ) \
 		    $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \
 		    $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) $(RPC_PARSE_OBJ) \
diff --git a/source/include/libsmb_internal.h b/source/include/libsmb_internal.h
index 6c7dc80..6930812 100644
--- a/source/include/libsmb_internal.h
+++ b/source/include/libsmb_internal.h
@@ -1,12 +1,71 @@
+/* 
+   Unix SMB/Netbios implementation.
+   SMB client library implementation
+   Copyright (C) Andrew Tridgell 1998
+   Copyright (C) Richard Sharpe 2000, 2002
+   Copyright (C) John Terpstra 2000
+   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/>.
+*/
+
+#include "includes.h"
+
+
 #ifndef _LIBSMB_INTERNAL_H_
 #define _LIBSMB_INTERNAL_H_
 
+#include "../include/libsmbclient.h"
+
 #define SMBC_MAX_NAME  1023
 #define SMBC_FILE_MODE (S_IFREG | 0444)
 #define SMBC_DIR_MODE  (S_IFDIR | 0555)
 
+/*
+ * DOS Attribute values (used internally)
+ */
+typedef struct DOS_ATTR_DESC {
+	int mode;
+	SMB_OFF_T size;
+	time_t create_time;
+	time_t access_time;
+	time_t write_time;
+	time_t change_time;
+	SMB_INO_T inode;
+} DOS_ATTR_DESC;
+
+
+/*
+ * Internal flags for extended attributes
+ */
 
-#include "include/libsmbclient.h"
+/* internal mode values */
+#define SMBC_XATTR_MODE_ADD          1
+#define SMBC_XATTR_MODE_REMOVE       2
+#define SMBC_XATTR_MODE_REMOVE_ALL   3
+#define SMBC_XATTR_MODE_SET          4
+#define SMBC_XATTR_MODE_CHOWN        5
+#define SMBC_XATTR_MODE_CHGRP        6
+
+#define CREATE_ACCESS_READ      READ_CONTROL_ACCESS
+
+/*We should test for this in configure ... */
+#ifndef ENOTSUP
+#define ENOTSUP EOPNOTSUPP
+#endif
 
 
 struct _SMBCSRV {
@@ -46,12 +105,13 @@ struct _SMBCFILE {
 };
 
 
-struct smbc_internal_data {
+/*
+ * Context structure
+ */
+struct SMBC_internal_data {
 
-	/*
-         * Is this handle initialized ? 
-	 */
-	bool    _initialized;
+	/* True when this handle is initialized */
+	bool                                    initialized;
 
         /* dirent pointer location
          *
@@ -64,22 +124,22 @@ struct smbc_internal_data {
          * According to <linux/limits.h>, NAME_MAX is 255.  Is it longer
          * anyplace else?
          */
-	char    _dirent[1024];
+	char                                    dirent[1024];
 
 	/*
          * server connection list
 	 */
-	SMBCSRV * _servers;
+	SMBCSRV *                               servers;
 	
 	/*
          * open file/dir list
 	 */
-	SMBCFILE * _files;
+	SMBCFILE *                              files;
 
         /*
          * Log to standard error instead of the more typical standard output
          */
-        bool _debug_stderr;
+        bool                                    debug_stderr;
 
         /*
          * Support "Create Time" in get/set with the *xattr() functions, if
@@ -88,33 +148,389 @@ struct smbc_internal_data {
          * CREATE_TIME.  Default is FALSE, i.e.  to use the old-style shorter
          * names and to not support CREATE time, for backward compatibility.
          */
-        bool _full_time_names;
+        bool                                    full_time_names;
 
         /*
          * The share mode of a file being opened.  To match POSIX semantics
          * (and maintain backward compatibility), DENY_NONE is the default.
          */
-         smbc_share_mode _share_mode;
+        smbc_share_mode                         share_mode;
 
         /*
          * Authentication function which includes the context.  This will be
          * used if set; otherwise context->callbacks.auth_fn() will be used.
          */
-        smbc_get_auth_data_with_context_fn _auth_fn_with_context;
+        smbc_get_auth_data_with_context_fn      auth_fn_with_context;
 
         /*
          * An opaque (to this library) user data handle which can be set
          * and retrieved with smbc_option_set() and smbc_option_get().
          */
-        void * _user_data;
+        void *                                  user_data;
 
         /*
          * Should we attempt UNIX smb encryption ? 
          * Set to 0 if we should never attempt, set to 1 if
          * encryption requested, set to 2 if encryption required.
          */
-        int _smb_encryption_level;
+        smbc_smb_encrypt_level                  smb_encryption_level;
+
+        struct smbc_server_cache * server_cache;
+
+        /* POSIX emulation functions */
+        struct
+        {
+#if 0 /* Left in libsmbclient.h for backward compatibility */
+                smbc_open_fn                    open_fn;
+                smbc_creat_fn                   creat_fn;
+                smbc_read_fn                    read_fn;
+                smbc_write_fn                   write_fn;
+                smbc_unlink_fn                  unlink_fn;
+                smbc_rename_fn                  rename_fn;
+                smbc_lseek_fn                   lseek_fn;
+                smbc_stat_fn                    stat_fn;
+                smbc_fstat_fn                   fstat_fn;
+#endif
+                smbc_ftruncate_fn               ftruncate_fn;
+#if 0 /* Left in libsmbclient.h for backward compatibility */
+                smbc_close_fn                   close_fn;
+                smbc_opendir_fn                 opendir_fn;
+                smbc_closedir_fn                closedir_fn;
+                smbc_readdir_fn                 readdir_fn;
+                smbc_getdents_fn                getdents_fn;
+                smbc_mkdir_fn                   mkdir_fn;
+                smbc_rmdir_fn                   rmdir_fn;
+                smbc_telldir_fn                 telldir_fn;
+                smbc_lseekdir_fn                lseekdir_fn;
+                smbc_fstatdir_fn                fstatdir_fn;
+                smbc_chmod_fn                   chmod_fn;
+                smbc_utimes_fn                  utimes_fn;
+                smbc_setxattr_fn                setxattr_fn;
+                smbc_getxattr_fn                getxattr_fn;
+                smbc_removexattr_fn             removexattr_fn;
+                smbc_listxattr_fn               listxattr_fn;
+#endif
+        }               posix_emu;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list