summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2007-08-13 15:41:29 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:29:37 -0500
commit20b3daec50f32a790e242337690572dd21ac51ca (patch)
tree28267078c4be6868af541a779962f393e47e2040
parent1b034a8f9e0668f7a2a40109989680c9eb2a5c12 (diff)
downloadsamba-20b3daec50f32a790e242337690572dd21ac51ca.tar.gz
samba-20b3daec50f32a790e242337690572dd21ac51ca.tar.bz2
samba-20b3daec50f32a790e242337690572dd21ac51ca.zip
r24368: Push down reply_prep_legacy one level
Not pretty, but necessary to convert the calls one by one (This used to be commit 523a463be427da0c3dbe01399e87b82b9f759512)
-rw-r--r--source3/smbd/nttrans.c222
1 files changed, 167 insertions, 55 deletions
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index 99391887d6..fd3d8b462b 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -3050,95 +3050,176 @@ static void handle_nttrans(connection_struct *conn,
struct trans_state *state,
struct smb_request *req)
{
- int outsize = -1;
-
- char *inbuf, *outbuf;
- int size, bufsize;
-
if (Protocol >= PROTOCOL_NT1) {
req->flags2 |= 0x40; /* IS_LONG_NAME */
SSVAL(req->inbuf,smb_flg2,req->flags2);
}
- if (!reply_prep_legacy(req, &inbuf, &outbuf, &size, &bufsize)) {
- reply_nterror(req, NT_STATUS_NO_MEMORY);
- END_PROFILE(SMBnttrans);
- return;
- }
-
/* Now we must call the relevant NT_TRANS function */
switch(state->call) {
case NT_TRANSACT_CREATE:
{
+ char *inbuf, *outbuf;
+ int size, bufsize;
+
START_PROFILE(NT_transact_create);
- outsize = call_nt_transact_create(conn, inbuf, outbuf,
- size, bufsize,
- &state->setup, state->setup_count,
- &state->param, state->total_param,
- &state->data, state->total_data,
- state->max_data_return);
+
+ if (!reply_prep_legacy(req, &inbuf, &outbuf, &size,
+ &bufsize)) {
+ reply_nterror(req, NT_STATUS_NO_MEMORY);
+ END_PROFILE(SMBnttrans);
+ return;
+ }
+
+ reply_post_legacy(
+ req,
+ call_nt_transact_create(
+ conn, inbuf, outbuf,
+ size, bufsize,
+ &state->setup, state->setup_count,
+ &state->param, state->total_param,
+ &state->data, state->total_data,
+ state->max_data_return));
+
END_PROFILE(NT_transact_create);
break;
}
case NT_TRANSACT_IOCTL:
{
+ char *inbuf, *outbuf;
+ int size, bufsize;
+
START_PROFILE(NT_transact_ioctl);
- outsize = call_nt_transact_ioctl(conn, inbuf, outbuf,
- size, bufsize,
- &state->setup, state->setup_count,
- &state->param, state->total_param,
- &state->data, state->total_data, state->max_data_return);
+
+ if (!reply_prep_legacy(req, &inbuf, &outbuf, &size,
+ &bufsize)) {
+ reply_nterror(req, NT_STATUS_NO_MEMORY);
+ END_PROFILE(SMBnttrans);
+ return;
+ }
+
+ reply_post_legacy(
+ req,
+ call_nt_transact_ioctl(
+ conn, inbuf, outbuf,
+ size, bufsize,
+ &state->setup, state->setup_count,
+ &state->param, state->total_param,
+ &state->data, state->total_data,
+ state->max_data_return));
+
END_PROFILE(NT_transact_ioctl);
break;
}
case NT_TRANSACT_SET_SECURITY_DESC:
{
+ char *inbuf, *outbuf;
+ int size, bufsize;
+
START_PROFILE(NT_transact_set_security_desc);
- outsize = call_nt_transact_set_security_desc(conn, inbuf, outbuf,
- size, bufsize,
- &state->setup, state->setup_count,
- &state->param, state->total_param,
- &state->data, state->total_data, state->max_data_return);
+
+ if (!reply_prep_legacy(req, &inbuf, &outbuf, &size,
+ &bufsize)) {
+ reply_nterror(req, NT_STATUS_NO_MEMORY);
+ END_PROFILE(SMBnttrans);
+ return;
+ }
+
+ reply_post_legacy(
+ req,
+ call_nt_transact_set_security_desc(
+ conn, inbuf, outbuf,
+ size, bufsize,
+ &state->setup, state->setup_count,
+ &state->param, state->total_param,
+ &state->data, state->total_data,
+ state->max_data_return));
END_PROFILE(NT_transact_set_security_desc);
break;
}
case NT_TRANSACT_NOTIFY_CHANGE:
{
+ char *inbuf, *outbuf;
+ int size, bufsize;
+
START_PROFILE(NT_transact_notify_change);
- outsize = call_nt_transact_notify_change(
- conn, inbuf, outbuf, size, bufsize,
- &state->setup, state->setup_count,
- &state->param, state->total_param,
- &state->data, state->total_data,
- state->max_data_return,
- state->max_param_return);
+
+ if (!reply_prep_legacy(req, &inbuf, &outbuf, &size,
+ &bufsize)) {
+ reply_nterror(req, NT_STATUS_NO_MEMORY);
+ END_PROFILE(SMBnttrans);
+ return;
+ }
+
+ reply_post_legacy(
+ req,
+ call_nt_transact_notify_change(
+ conn, inbuf, outbuf, size, bufsize,
+ &state->setup, state->setup_count,
+ &state->param, state->total_param,
+ &state->data, state->total_data,
+ state->max_data_return,
+ state->max_param_return));
+
END_PROFILE(NT_transact_notify_change);
break;
}
case NT_TRANSACT_RENAME:
{
+ char *inbuf, *outbuf;
+ int size, bufsize;
+
START_PROFILE(NT_transact_rename);
- outsize = call_nt_transact_rename(conn, inbuf, outbuf,
- size, bufsize,
- &state->setup, state->setup_count,
- &state->param, state->total_param,
- &state->data, state->total_data, state->max_data_return);
+
+ if (!reply_prep_legacy(req, &inbuf, &outbuf, &size,
+ &bufsize)) {
+ reply_nterror(req, NT_STATUS_NO_MEMORY);
+ END_PROFILE(SMBnttrans);
+ return;
+ }
+
+ reply_post_legacy(
+ req,
+ call_nt_transact_rename(
+ conn, inbuf, outbuf,
+ size, bufsize,
+ &state->setup, state->setup_count,
+ &state->param, state->total_param,
+ &state->data, state->total_data,
+ state->max_data_return));
+
END_PROFILE(NT_transact_rename);
break;
}
case NT_TRANSACT_QUERY_SECURITY_DESC:
{
+ char *inbuf, *outbuf;
+ int size, bufsize;
+
START_PROFILE(NT_transact_query_security_desc);
- outsize = call_nt_transact_query_security_desc(conn, inbuf, outbuf,
- size, bufsize,
- &state->setup, state->setup_count,
- &state->param, state->total_param,
- &state->data, state->total_data, state->max_data_return);
+
+ if (!reply_prep_legacy(req, &inbuf, &outbuf, &size,
+ &bufsize)) {
+ reply_nterror(req, NT_STATUS_NO_MEMORY);
+ END_PROFILE(SMBnttrans);
+ return;
+ }
+
+ reply_post_legacy(
+ req,
+ call_nt_transact_query_security_desc(
+ conn, inbuf, outbuf,
+ size, bufsize,
+ &state->setup, state->setup_count,
+ &state->param, state->total_param,
+ &state->data, state->total_data,
+ state->max_data_return));
+
END_PROFILE(NT_transact_query_security_desc);
break;
}
@@ -3146,24 +3227,56 @@ static void handle_nttrans(connection_struct *conn,
#ifdef HAVE_SYS_QUOTAS
case NT_TRANSACT_GET_USER_QUOTA:
{
+ char *inbuf, *outbuf;
+ int size, bufsize;
+
START_PROFILE(NT_transact_get_user_quota);
- outsize = call_nt_transact_get_user_quota(conn, inbuf, outbuf,
- size, bufsize,
- &state->setup, state->setup_count,
- &state->param, state->total_param,
- &state->data, state->total_data, state->max_data_return);
+
+ if (!reply_prep_legacy(req, &inbuf, &outbuf, &size,
+ &bufsize)) {
+ reply_nterror(req, NT_STATUS_NO_MEMORY);
+ END_PROFILE(SMBnttrans);
+ return;
+ }
+
+ reply_post_legacy(
+ req,
+ call_nt_transact_get_user_quota(
+ conn, inbuf, outbuf,
+ size, bufsize,
+ &state->setup, state->setup_count,
+ &state->param, state->total_param,
+ &state->data, state->total_data,
+ state->max_data_return));
+
END_PROFILE(NT_transact_get_user_quota);
break;
}
case NT_TRANSACT_SET_USER_QUOTA:
{
+ char *inbuf, *outbuf;
+ int size, bufsize;
+
START_PROFILE(NT_transact_set_user_quota);
- outsize = call_nt_transact_set_user_quota(conn, inbuf, outbuf,
- size, bufsize,
- &state->setup, state->setup_count,
- &state->param, state->total_param,
- &state->data, state->total_data, state->max_data_return);
+
+ if (!reply_prep_legacy(req, &inbuf, &outbuf, &size,
+ &bufsize)) {
+ reply_nterror(req, NT_STATUS_NO_MEMORY);
+ END_PROFILE(SMBnttrans);
+ return;
+ }
+
+ reply_post_legacy(
+ req,
+ call_nt_transact_set_user_quota(
+ conn, inbuf, outbuf,
+ size, bufsize,
+ &state->setup, state->setup_count,
+ &state->param, state->total_param,
+ &state->data, state->total_data,
+ state->max_data_return));
+
END_PROFILE(NT_transact_set_user_quota);
break;
}
@@ -3176,7 +3289,6 @@ static void handle_nttrans(connection_struct *conn,
reply_doserror(req, ERRSRV, ERRerror);
return;
}
- reply_post_legacy(req, outsize);
return;
}