summaryrefslogtreecommitdiff
path: root/source3/libsmb/libsmb_server.c
diff options
context:
space:
mode:
authorDerrell Lipman <derrell.lipman@unwireduniverse.com>2008-02-29 13:34:35 -0500
committerDerrell Lipman <derrell.lipman@unwireduniverse.com>2008-03-01 20:47:22 -0500
commit4ba42cbe0f6bbd25848786e1a87c06aca79b98ea (patch)
treefa2417599eca2565d0a3f8ace8ef005909fcd6ab /source3/libsmb/libsmb_server.c
parent257b7b09298f7cb983b2f31b87fc5e46e0f62f0c (diff)
downloadsamba-4ba42cbe0f6bbd25848786e1a87c06aca79b98ea.tar.gz
samba-4ba42cbe0f6bbd25848786e1a87c06aca79b98ea.tar.bz2
samba-4ba42cbe0f6bbd25848786e1a87c06aca79b98ea.zip
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 (This used to be commit 56429a3d60b2a48963342f6340b3c01469a892c6)
Diffstat (limited to 'source3/libsmb/libsmb_server.c')
-rw-r--r--source3/libsmb/libsmb_server.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/source3/libsmb/libsmb_server.c b/source3/libsmb/libsmb_server.c
index 978a843d30..70e0d57273 100644
--- a/source3/libsmb/libsmb_server.c
+++ b/source3/libsmb/libsmb_server.c
@@ -58,12 +58,12 @@ SMBC_remove_unused_server(SMBCCTX * context,
SMBCFILE * file;
/* are we being fooled ? */
- if (!context || !context->initialized || !srv) {
+ if (!context || !context->internal->initialized || !srv) {
return 1;
}
/* Check all open files/directories for a relation with this server */
- for (file = context->files; file; file = file->next) {
+ for (file = context->internal->files; file; file = file->next) {
if (file->srv == srv) {
/* Still used */
DEBUG(3, ("smbc_remove_usused_server: "
@@ -73,7 +73,7 @@ SMBC_remove_unused_server(SMBCCTX * context,
}
}
- DLIST_REMOVE(context->servers, srv);
+ DLIST_REMOVE(context->internal->servers, srv);
cli_shutdown(srv->cli);
srv->cli = NULL;
@@ -251,7 +251,7 @@ SMBC_server(TALLOC_CTX *ctx,
* If we found a connection and we're only allowed one share per
* server...
*/
- if (srv && *share != '\0' && context->one_share_per_server) {
+ if (srv && *share != '\0' && context->internal->one_share_per_server) {
/*
* ... then if there's no current connection to the share,
@@ -322,7 +322,7 @@ SMBC_server(TALLOC_CTX *ctx,
return NULL;
}
- make_nmb_name(&calling, context->netbios_name, 0x0);
+ make_nmb_name(&calling, context->config.netbios_name, 0x0);
make_nmb_name(&called , server, 0x20);
DEBUG(4,("SMBC_server: server_n=[%s] server=[%s]\n", server_n, server));
@@ -339,14 +339,14 @@ SMBC_server(TALLOC_CTX *ctx,
return NULL;
}
- if (context->use_kerberos) {
+ if (context->flags.bits & SMB_CTX_FLAG_USE_KERBEROS) {
c->use_kerberos = True;
}
- if (context->fallback_after_kerberos) {
+ if (context->flags.bits & SMB_CTX_FLAG_FALLBACK_AFTER_KERBEROS) {
c->fallback_after_kerberos = True;
}
- c->timeout = context->timeout;
+ c->timeout = context->config.timeout;
/*
* Force use of port 139 for first try if share is $IPC, empty, or
@@ -428,7 +428,8 @@ SMBC_server(TALLOC_CTX *ctx,
/* Failed. Try an anonymous login, if allowed by flags. */
username_used = "";
- if (context->no_auto_anonymous_login ||
+ if ((context->flags.bits &
+ SMBCCTX_FLAG_NO_AUTO_ANONYMOUS_LOGON) ||
!NT_STATUS_IS_OK(cli_session_setup(c, username_used,
*pp_password, 1,
*pp_password, 0,
@@ -451,7 +452,7 @@ SMBC_server(TALLOC_CTX *ctx,
DEBUG(4,(" tconx ok\n"));
- if (context->smb_encryption_level) {
+ if (context->internal->smb_encryption_level) {
/* Attempt UNIX smb encryption. */
if (!NT_STATUS_IS_OK(cli_force_encryption(c,
username_used,
@@ -466,7 +467,7 @@ SMBC_server(TALLOC_CTX *ctx,
DEBUG(4,(" SMB encrypt failed\n"));
- if (context->smb_encryption_level == 2) {
+ if (context->internal->smb_encryption_level == 2) {
cli_shutdown(c);
errno = EPERM;
return NULL;
@@ -512,7 +513,7 @@ SMBC_server(TALLOC_CTX *ctx,
DEBUG(2, ("Server connect ok: //%s/%s: %p\n",
server, share, srv));
- DLIST_ADD(context->servers, srv);
+ DLIST_ADD(context->internal->servers, srv);
return srv;
failed:
@@ -566,7 +567,7 @@ SMBC_attr_server(TALLOC_CTX *ctx,
}
flags = 0;
- if (context->use_kerberos) {
+ if (context->flags.bits & SMB_CTX_FLAG_USE_KERBEROS) {
flags |= CLI_FULL_CONNECTION_USE_KERBEROS;
}
@@ -586,7 +587,7 @@ SMBC_attr_server(TALLOC_CTX *ctx,
return NULL;
}
- if (context->smb_encryption_level) {
+ if (context->internal->smb_encryption_level) {
/* Attempt UNIX smb encryption. */
if (!NT_STATUS_IS_OK(cli_force_encryption(ipc_cli,
*pp_username,
@@ -602,7 +603,7 @@ SMBC_attr_server(TALLOC_CTX *ctx,
DEBUG(4,(" SMB encrypt failed on IPC$\n"));
- if (context->smb_encryption_level == 2) {
+ if (context->internal->smb_encryption_level == 2) {
cli_shutdown(ipc_cli);
errno = EPERM;
return NULL;
@@ -668,7 +669,7 @@ SMBC_attr_server(TALLOC_CTX *ctx,
return NULL;
}
- DLIST_ADD(context->servers, ipc_srv);
+ DLIST_ADD(context->internal->servers, ipc_srv);
}
return ipc_srv;