#include <libsmbclient.h>
#include "get_auth_data_fn.h"
-static void
-no_auth_data_fn(const char * pServer,
- const char * pShare,
- char * pWorkgroup,
- int maxLenWorkgroup,
- char * pUsername,
- int maxLenUsername,
- char * pPassword,
- int maxLenPassword);
-
static void browse(char * path,
int scan,
int indent);
int context_auth = 0;
int scan = 0;
int iterations = -1;
- int again;
int opt;
char * p;
- char * q;
char buf[1024];
poptContext pc;
SMBCCTX * context;
if (context_auth) {
smbc_setFunctionAuthDataWithContext(context,
get_auth_data_with_context_fn);
- smbc_setOptionUserData(context, "hello world");
+ smbc_setOptionUserData(context, (void *)"hello world");
} else {
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 */
- 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);
exit(0);
}
-
-static void
-no_auth_data_fn(const char * pServer,
- const char * pShare,
- char * pWorkgroup,
- int maxLenWorkgroup,
- char * pUsername,
- int maxLenUsername,
- char * pPassword,
- int maxLenPassword)
-{
- return;
-}
-
-
static void
get_auth_data_with_context_fn(SMBCCTX * context,
const char * pServer,
char * pPassword,
int maxLenPassword)
{
- printf("Authenticating with context 0x%lx", context);
+ printf("Authenticating with context %p", 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");
char * p;
char buf[1024];
int dir;
- struct stat stat;
+ struct stat st;
struct smbc_dirent * dirent;
if (! scan)
p = path + strlen(path);
strcat(p, "/");
strcat(p+1, dirent->name);
- if (smbc_stat(path, &stat) < 0)
+ if (smbc_stat(path, &st) < 0)
{
printf(" unknown size (reason %d: %s)",
errno, strerror(errno));
}
else
{
- printf(" size %lu", (unsigned long) stat.st_size);
+ printf(" size %lu", (unsigned long) st.st_size);
}
*p = '\0';