[SCM] Samba Shared Repository - branch master updated
Stefan Metzmacher
metze at samba.org
Wed Jun 15 11:07:02 MDT 2011
The branch, master has been updated
via 9ba1087 auth/kerberos/gssapi_pac: fix compiler warnings
via 8d12649 s4:libcli/smb_composite: convert smb2_composite_setpathinfo_send/rev to tevent_req
from 1dbe970 librpc: fix buildwarning in NDR_WMI.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 9ba10877aa558c016e2a40f209d1eaf694e47965
Author: Stefan Metzmacher <metze at samba.org>
Date: Sat Apr 30 17:39:48 2011 +0200
auth/kerberos/gssapi_pac: fix compiler warnings
metze
Autobuild-User: Stefan Metzmacher <metze at samba.org>
Autobuild-Date: Wed Jun 15 19:06:24 CEST 2011 on sn-devel-104
commit 8d12649b3144daa5e8eb141967a753354abdd330
Author: Stefan Metzmacher <metze at samba.org>
Date: Sun May 1 18:10:20 2011 +0200
s4:libcli/smb_composite: convert smb2_composite_setpathinfo_send/rev to tevent_req
metze
-----------------------------------------------------------------------
Summary of changes:
auth/kerberos/gssapi_pac.c | 11 +-
source4/libcli/smb_composite/smb2.c | 184 ++++++++++++++++++++++++-----------
source4/libcli/wscript_build | 4 +-
3 files changed, 134 insertions(+), 65 deletions(-)
Changeset truncated at 500 lines:
diff --git a/auth/kerberos/gssapi_pac.c b/auth/kerberos/gssapi_pac.c
index e115cfe..70bc9e5 100644
--- a/auth/kerberos/gssapi_pac.c
+++ b/auth/kerberos/gssapi_pac.c
@@ -52,11 +52,6 @@ const gss_OID_desc * const gss_mech_krb5_wrong = krb5_gss_oid_array+2;
/* EXTRACTION OID AUTHZ ID */
#define EXTRACT_PAC_AUTHZ_DATA_FROM_SEC_CONTEXT_OID "\x2a\x85\x70\x2b\x0d\x03" "\x81\x00"
-static gss_OID_desc pac_data_oid = {
- EXTRACT_PAC_AUTHZ_DATA_FROM_SEC_CONTEXT_OID_LENGTH,
- (void *)EXTRACT_PAC_AUTHZ_DATA_FROM_SEC_CONTEXT_OID
-};
-
NTSTATUS gssapi_obtain_pac_blob(TALLOC_CTX *mem_ctx,
gss_ctx_id_t gssapi_context,
gss_name_t gss_client_name,
@@ -68,7 +63,7 @@ NTSTATUS gssapi_obtain_pac_blob(TALLOC_CTX *mem_ctx,
gss_buffer_desc pac_buffer;
gss_buffer_desc pac_display_buffer;
gss_buffer_desc pac_name = {
- .value = "urn:mspac:",
+ .value = discard_const("urn:mspac:"),
.length = sizeof("urn:mspac:")-1
};
int more = -1;
@@ -107,6 +102,10 @@ NTSTATUS gssapi_obtain_pac_blob(TALLOC_CTX *mem_ctx,
}
#elif defined(HAVE_GSS_INQUIRE_SEC_CONTEXT_BY_OID)
+ gss_OID_desc pac_data_oid = {
+ .elements = discard_const(EXTRACT_PAC_AUTHZ_DATA_FROM_SEC_CONTEXT_OID),
+ .length = EXTRACT_PAC_AUTHZ_DATA_FROM_SEC_CONTEXT_OID_LENGTH
+ };
gss_buffer_set_t set = GSS_C_NO_BUFFER_SET;
diff --git a/source4/libcli/smb_composite/smb2.c b/source4/libcli/smb_composite/smb2.c
index c2985f2..1f8ec83 100644
--- a/source4/libcli/smb_composite/smb2.c
+++ b/source4/libcli/smb_composite/smb2.c
@@ -25,6 +25,8 @@
#include "includes.h"
+#include <tevent.h>
+#include "lib/util/tevent_ntstatus.h"
#include "libcli/raw/libcliraw.h"
#include "libcli/raw/raw_proto.h"
#include "libcli/composite/composite.h"
@@ -264,107 +266,145 @@ NTSTATUS smb2_composite_rmdir(struct smb2_tree *tree, struct smb_rmdir *io)
return composite_wait_free(c);
}
+struct smb2_composite_setpathinfo_state {
+ struct smb2_tree *tree;
+ union smb_setfileinfo io;
+ NTSTATUS set_status;
+ struct smb2_create cr;
+ struct smb2_close cl;
+};
+
static void smb2_composite_setpathinfo_create_done(struct smb2_request *smb2req);
/*
composite SMB2 setpathinfo call
*/
-struct composite_context *smb2_composite_setpathinfo_send(struct smb2_tree *tree,
- union smb_setfileinfo *io)
+struct tevent_req *smb2_composite_setpathinfo_send(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct smb2_tree *tree,
+ const union smb_setfileinfo *io)
{
- struct composite_context *ctx;
- struct smb2_create create_parm;
+ struct tevent_req *req;
+ struct smb2_composite_setpathinfo_state *state;
struct smb2_request *smb2req;
- union smb_setfileinfo *io2;
- ctx = composite_create(tree, tree->session->transport->socket->event.ctx);
- if (ctx == NULL) return NULL;
+ req = tevent_req_create(mem_ctx, &state,
+ struct smb2_composite_setpathinfo_state);
+ if (req == NULL) {
+ return NULL;
+ }
- ZERO_STRUCT(create_parm);
- create_parm.in.desired_access = SEC_FLAG_MAXIMUM_ALLOWED;
- create_parm.in.create_disposition = NTCREATEX_DISP_OPEN;
- create_parm.in.share_access =
+ state->tree = tree;
+ state->io = *io;
+
+ state->cr.in.desired_access = SEC_FLAG_MAXIMUM_ALLOWED;
+ state->cr.in.create_disposition = NTCREATEX_DISP_OPEN;
+ state->cr.in.share_access =
NTCREATEX_SHARE_ACCESS_DELETE|
NTCREATEX_SHARE_ACCESS_READ|
NTCREATEX_SHARE_ACCESS_WRITE;
- create_parm.in.create_options = 0;
- create_parm.in.fname = io->generic.in.file.path;
- if (create_parm.in.fname[0] == '\\') {
- create_parm.in.fname++;
+ state->cr.in.create_options = 0;
+ state->cr.in.fname = state->io.generic.in.file.path;
+ if (state->cr.in.fname[0] == '\\') {
+ state->cr.in.fname++;
}
- smb2req = smb2_create_send(tree, &create_parm);
-
- io2 = talloc(ctx, union smb_setfileinfo);
- if (composite_nomem(io2, ctx)) {
- return ctx;
+ smb2req = smb2_create_send(tree, &state->cr);
+ if (tevent_req_nomem(smb2req, req)) {
+ return tevent_req_post(req, ev);
}
- *io2 = *io;
+ smb2req->async.fn = smb2_composite_setpathinfo_create_done;
+ smb2req->async.private_data = req;
- ctx->private_data = io2;
-
- composite_continue_smb2(ctx, smb2req, smb2_composite_setpathinfo_create_done, ctx);
- return ctx;
+ return req;
}
static void smb2_composite_setpathinfo_setinfo_done(struct smb2_request *smb2req);
static void smb2_composite_setpathinfo_create_done(struct smb2_request *smb2req)
{
- struct composite_context *ctx = talloc_get_type(smb2req->async.private_data,
- struct composite_context);
- struct smb2_tree *tree = smb2req->tree;
- struct smb2_create create_parm;
+ struct tevent_req *req =
+ talloc_get_type_abort(smb2req->async.private_data,
+ struct tevent_req);
+ struct smb2_composite_setpathinfo_state *state =
+ tevent_req_data(req,
+ struct smb2_composite_setpathinfo_state);
NTSTATUS status;
- union smb_setfileinfo *io2 = talloc_get_type(ctx->private_data,
- union smb_setfileinfo);
- status = smb2_create_recv(smb2req, ctx, &create_parm);
- if (!NT_STATUS_IS_OK(status)) {
- composite_error(ctx, status);
+ status = smb2_create_recv(smb2req, state, &state->cr);
+ if (tevent_req_nterror(req, status)) {
return;
}
- io2->generic.in.file.handle = create_parm.out.file.handle;
+ state->io.generic.in.file.handle = state->cr.out.file.handle;
- smb2req = smb2_setinfo_file_send(tree, io2);
- composite_continue_smb2(ctx, smb2req, smb2_composite_setpathinfo_setinfo_done, ctx);
+ smb2req = smb2_setinfo_file_send(state->tree, &state->io);
+ if (tevent_req_nomem(smb2req, req)) {
+ return;
+ }
+ smb2req->async.fn = smb2_composite_setpathinfo_setinfo_done;
+ smb2req->async.private_data = req;
}
static void smb2_composite_setpathinfo_close_done(struct smb2_request *smb2req);
static void smb2_composite_setpathinfo_setinfo_done(struct smb2_request *smb2req)
{
- struct composite_context *ctx = talloc_get_type(smb2req->async.private_data,
- struct composite_context);
- struct smb2_tree *tree = smb2req->tree;
- struct smb2_close close_parm;
+ struct tevent_req *req =
+ talloc_get_type_abort(smb2req->async.private_data,
+ struct tevent_req);
+ struct smb2_composite_setpathinfo_state *state =
+ tevent_req_data(req,
+ struct smb2_composite_setpathinfo_state);
NTSTATUS status;
- union smb_setfileinfo *io2 = talloc_get_type(ctx->private_data,
- union smb_setfileinfo);
status = smb2_setinfo_recv(smb2req);
- if (!NT_STATUS_IS_OK(status)) {
- composite_error(ctx, status);
+ state->set_status = status;
+
+ state->cl.in.file.handle = state->io.generic.in.file.handle;
+
+ smb2req = smb2_close_send(state->tree, &state->cl);
+ if (tevent_req_nomem(smb2req, req)) {
return;
}
+ smb2req->async.fn = smb2_composite_setpathinfo_close_done;
+ smb2req->async.private_data = req;
+}
- ZERO_STRUCT(close_parm);
- close_parm.in.file.handle = io2->generic.in.file.handle;
+static void smb2_composite_setpathinfo_close_done(struct smb2_request *smb2req)
+{
+ struct tevent_req *req =
+ talloc_get_type_abort(smb2req->async.private_data,
+ struct tevent_req);
+ struct smb2_composite_setpathinfo_state *state =
+ tevent_req_data(req,
+ struct smb2_composite_setpathinfo_state);
+ NTSTATUS status;
+
+ status = smb2_close_recv(smb2req, &state->cl);
+
+ if (tevent_req_nterror(req, state->set_status)) {
+ return;
+ }
- smb2req = smb2_close_send(tree, &close_parm);
- composite_continue_smb2(ctx, smb2req, smb2_composite_setpathinfo_close_done, ctx);
+ if (tevent_req_nterror(req, status)) {
+ return;
+ }
+
+ tevent_req_done(req);
}
-static void smb2_composite_setpathinfo_close_done(struct smb2_request *smb2req)
+NTSTATUS smb2_composite_setpathinfo_recv(struct tevent_req *req)
{
- struct composite_context *ctx = talloc_get_type(smb2req->async.private_data,
- struct composite_context);
NTSTATUS status;
- struct smb2_close close_parm;
- status = smb2_close_recv(smb2req, &close_parm);
- composite_error(ctx, status);
+ if (tevent_req_is_nterror(req, &status)) {
+ tevent_req_received(req);
+ return status;
+ }
+
+ tevent_req_received(req);
+ return NT_STATUS_OK;
}
/*
@@ -372,6 +412,36 @@ static void smb2_composite_setpathinfo_close_done(struct smb2_request *smb2req)
*/
NTSTATUS smb2_composite_setpathinfo(struct smb2_tree *tree, union smb_setfileinfo *io)
{
- struct composite_context *c = smb2_composite_setpathinfo_send(tree, io);
- return composite_wait_free(c);
+ struct tevent_req *subreq;
+ NTSTATUS status;
+ bool ok;
+ TALLOC_CTX *frame = talloc_stackframe();
+ struct tevent_context *ev = tree->session->transport->socket->event.ctx;
+
+ if (frame == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ subreq = smb2_composite_setpathinfo_send(frame, ev, tree, io);
+ if (subreq == NULL) {
+ TALLOC_FREE(frame);
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ ok = tevent_req_poll(subreq, ev);
+ if (!ok) {
+ status = map_nt_error_from_unix(errno);
+ TALLOC_FREE(frame);
+ return status;
+ }
+
+ status = smb2_composite_setpathinfo_recv(subreq);
+ TALLOC_FREE(subreq);
+ if (!NT_STATUS_IS_OK(status)) {
+ TALLOC_FREE(frame);
+ return status;
+ }
+
+ TALLOC_FREE(frame);
+ return NT_STATUS_OK;
}
diff --git a/source4/libcli/wscript_build b/source4/libcli/wscript_build
index 3d36925..d9e85d6 100644
--- a/source4/libcli/wscript_build
+++ b/source4/libcli/wscript_build
@@ -36,8 +36,8 @@ bld.SAMBA_SUBSYSTEM('LIBCLI_COMPOSITE',
bld.SAMBA_SUBSYSTEM('LIBCLI_SMB_COMPOSITE',
source='smb_composite/loadfile.c smb_composite/savefile.c smb_composite/connect.c smb_composite/sesssetup.c smb_composite/fetchfile.c smb_composite/appendacl.c smb_composite/fsinfo.c smb_composite/smb2.c',
autoproto='smb_composite/proto.h',
- deps='LIBCLI_SMB2',
- public_deps='LIBCLI_COMPOSITE credentials gensec LIBCLI_RESOLVE'
+ deps='LIBCLI_SMB2 UTIL_TEVENT',
+ public_deps='LIBCLI_COMPOSITE credentials gensec LIBCLI_RESOLVE tevent'
)
--
Samba Shared Repository
More information about the samba-cvs
mailing list