--- samba-3.0.8pre1.orig/source/include/libsmbclient.h 2004-09-08 14:50:02.000000000 -0000 +++ samba-3.0.8pre1/source/include/libsmbclient.h 2004-11-26 17:49:09.492582270 -0000 @@ -447,26 +447,32 @@ } callbacks; /** Space to store private data of the server cache. */ struct smbc_server_cache * server_cache; /** INTERNAL DATA * do _NOT_ touch this from your program ! */ struct smbc_internal_data * internal; + /** See flags below + */ + int flags; }; +/* Flags for SMBCCTX->flags */ +#define SMBCCTX_FLAG_NO_AUTO_ANON 0x1 /* don't try to do automatic anon login */ + /**@ingroup misc * Create a new SBMCCTX (a context). * * Must be called before the context is passed to smbc_context_init() * * @return The given SMBCCTX pointer on success, NULL on error with errno set: * - ENOMEM Out of memory * * @see smbc_free_context(), smbc_init_context() * * @note Do not forget to smbc_init_context() the returned SMBCCTX pointer ! --- samba-3.0.8pre1.orig/source/libsmb/libsmbclient.c 2004-09-08 14:49:57.000000000 -0000 +++ samba-3.0.8pre1/source/libsmb/libsmbclient.c 2004-11-26 17:50:10.205662305 -0000 @@ -639,25 +639,27 @@ if (!cli_negprot(&c)) { cli_shutdown(&c); errno = ENOENT; return NULL; } if (!cli_session_setup(&c, username, password, strlen(password), password, strlen(password), workgroup) && /* try an anonymous login if it failed */ - !cli_session_setup(&c, "", "", 1,"", 0, workgroup)) { + ((context->flags & SMBCCTX_FLAG_NO_AUTO_ANON) || + !cli_session_setup(&c, "", "", 1,"", 0, workgroup))) { + cli_shutdown(&c); errno = EPERM; return NULL; } DEBUG(4,(" session setup ok\n")); if (!cli_send_tconX(&c, share, "?????", password, strlen(password)+1)) { errno = smbc_errno(context, &c); cli_shutdown(&c); return NULL;