[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-2953-gfa803ce

Derrell Lipman derrell at samba.org
Mon Jun 23 19:42:20 GMT 2008


The branch, v3-3-test has been updated
       via  fa803ce183376c938f92b0f31a7d89d522fd309f (commit)
       via  84b1ea39a4f27ebcf06a2bafed78396c7353df0e (commit)
      from  b20019ceaaf4a8964792f6ba37f50f91b6847e7f (commit)

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


- Log -----------------------------------------------------------------
commit fa803ce183376c938f92b0f31a7d89d522fd309f
Author: Andreas Schneider <anschneider at suse.de>
Date:   Mon Jun 23 16:29:40 2008 +0200

    Add documentation for kerberos support in libsmbclient.
    
    Signed-off-by: Andreas Schneider <anschneider at suse.de>
    Signed-off-by: Derrell Lipman <derrell.lipman at unwireduniverse.com>

commit 84b1ea39a4f27ebcf06a2bafed78396c7353df0e
Author: Andreas Schneider <anschneider at suse.de>
Date:   Mon Jun 23 11:00:20 2008 +0200

    Add krb5 support for the testbrowse example.
    
    Signed-off-by: Andreas Schneider <anschneider at suse.de>
    Signed-off-by: Derrell Lipman <derrell.lipman at unwireduniverse.com>

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

Summary of changes:
 examples/libsmbclient/get_auth_data_fn.h |   13 ++++++++++++-
 examples/libsmbclient/testbrowse.c       |    3 +++
 source/include/libsmbclient.h            |   10 ++++++++++
 3 files changed, 25 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/examples/libsmbclient/get_auth_data_fn.h b/examples/libsmbclient/get_auth_data_fn.h
index b1d36c8..6b91c97 100644
--- a/examples/libsmbclient/get_auth_data_fn.h
+++ b/examples/libsmbclient/get_auth_data_fn.h
@@ -1,3 +1,5 @@
+#include <stdlib.h>
+
 static void
 get_auth_data_fn(const char * pServer,
                  const char * pShare,
@@ -15,6 +17,8 @@ get_auth_data_fn(const char * pServer,
     char            username[256] = { '\0' };
     char            password[256] = { '\0' };
 
+    static int krb5_set = 1;
+
     if (strcmp(server, pServer) == 0 &&
         strcmp(share, pShare) == 0 &&
         *workgroup != '\0' &&
@@ -25,7 +29,12 @@ get_auth_data_fn(const char * pServer,
         strncpy(pPassword, password, maxLenPassword - 1);
         return;
     }
-    
+
+    if (krb5_set && getenv("KRB5CCNAME")) {
+      krb5_set = 0;
+      return;
+    }
+
     fprintf(stdout, "Workgroup: [%s] ", pWorkgroup);
     fgets(temp, sizeof(temp), stdin);
     
@@ -68,4 +77,6 @@ get_auth_data_fn(const char * pServer,
     strncpy(workgroup, pWorkgroup, sizeof(workgroup) - 1);
     strncpy(username, pUsername, sizeof(username) - 1);
     strncpy(password, pPassword, sizeof(password) - 1);
+
+    krb5_set = 1;
 }
diff --git a/examples/libsmbclient/testbrowse.c b/examples/libsmbclient/testbrowse.c
index a7eda36..a6e6395 100644
--- a/examples/libsmbclient/testbrowse.c
+++ b/examples/libsmbclient/testbrowse.c
@@ -117,6 +117,9 @@ main(int argc, char * argv[])
         smbc_setFunctionAuthData(context, get_auth_data_fn);
     }
 
+    smbc_setOptionUseKerberos(context, 1);
+    smbc_setOptionFallbackAfterKerberos(context, 1);
+
     /* If we've been asked to log to stderr instead of stdout, ... */
     if (debug_stderr) {
         /* ... then set the option to do so */
diff --git a/source/include/libsmbclient.h b/source/include/libsmbclient.h
index 9600264..74d0d5c 100644
--- a/source/include/libsmbclient.h
+++ b/source/include/libsmbclient.h
@@ -259,6 +259,11 @@ typedef struct _SMBCCTX SMBCCTX;
  * Type for the the authentication function called by the library to
  * obtain authentication credentals
  *
+ * For kerberos support the function should just be called without
+ * prompting the user for credentials. Which means a simple 'return'
+ * should work. Take a look at examples/libsmbclient/get_auth_data_fn.h
+ * and examples/libsmbclient/testbrowse.c.
+ *
  * @param srv       Server being authenticated to
  *
  * @param shr       Share being authenticated to
@@ -293,6 +298,11 @@ typedef void (*smbc_get_auth_data_fn)(const char *srv,
  * Type for the the authentication function called by the library to
  * obtain authentication credentals
  *
+ * For kerberos support the function should just be called without
+ * prompting the user for credentials. Which means a simple 'return'
+ * should work. Take a look at examples/libsmbclient/get_auth_data_fn.h
+ * and examples/libsmbclient/testbrowse.c.
+ *
  * @param c         Pointer to the smb context
  *
  * @param srv       Server being authenticated to


-- 
Samba Shared Repository


More information about the samba-cvs mailing list