summaryrefslogtreecommitdiff
path: root/source4/smb_server
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-05-07 11:56:13 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:51:47 -0500
commit7e921fb96d9310e649a7d73972a0a87af8cb1233 (patch)
tree1895821c52a4938a714ec9a223b8e615269f98ee /source4/smb_server
parent998aab3d29611b712dcf4ee69b07b5ec683a2ebe (diff)
downloadsamba-7e921fb96d9310e649a7d73972a0a87af8cb1233.tar.gz
samba-7e921fb96d9310e649a7d73972a0a87af8cb1233.tar.bz2
samba-7e921fb96d9310e649a7d73972a0a87af8cb1233.zip
r549: added support for DOS error codes in NTSTATUS returns. This uses a
range of NTSTATUS codes that are normally invalid to prevent conflicts with real error codes. use the new DOS facility to fix the ERRbaduid return that volker found (This used to be commit 10fdfb52398857b604fff9684ee65a96d970bdaa)
Diffstat (limited to 'source4/smb_server')
-rw-r--r--source4/smb_server/request.c11
-rw-r--r--source4/smb_server/smb_server.c8
2 files changed, 17 insertions, 2 deletions
diff --git a/source4/smb_server/request.c b/source4/smb_server/request.c
index 065e63a8d2..964f4a2d70 100644
--- a/source4/smb_server/request.c
+++ b/source4/smb_server/request.c
@@ -310,8 +310,15 @@ void req_reply_error(struct request_context *req, NTSTATUS status)
return;
}
- SIVAL(req->out.hdr, HDR_RCLS, NT_STATUS_V(status));
- SSVAL(req->out.hdr, HDR_FLG2, SVAL(req->out.hdr, HDR_FLG2) | FLAGS2_32_BIT_ERROR_CODES);
+ if (NT_STATUS_IS_DOS(status)) {
+ /* its a encoded DOS error, using the reserved range */
+ SSVAL(req->out.hdr, HDR_RCLS, NT_STATUS_DOS_CLASS(status));
+ SSVAL(req->out.hdr, HDR_ERR, NT_STATUS_DOS_CODE(status));
+ SSVAL(req->out.hdr, HDR_FLG2, SVAL(req->out.hdr, HDR_FLG2) & ~FLAGS2_32_BIT_ERROR_CODES);
+ } else {
+ SIVAL(req->out.hdr, HDR_RCLS, NT_STATUS_V(status));
+ SSVAL(req->out.hdr, HDR_FLG2, SVAL(req->out.hdr, HDR_FLG2) | FLAGS2_32_BIT_ERROR_CODES);
+ }
req_send_reply(req);
}
diff --git a/source4/smb_server/smb_server.c b/source4/smb_server/smb_server.c
index 84209d8670..aceae08ad8 100644
--- a/source4/smb_server/smb_server.c
+++ b/source4/smb_server/smb_server.c
@@ -480,6 +480,14 @@ static void switch_message(int type, struct request_context *req)
return;
}
+ /* see if the vuid is valid */
+ if ((flags & AS_USER) && !req->user_ctx->vuser) {
+ if (!(flags & AS_GUEST)) {
+ req_reply_error(req, NT_STATUS_DOS(ERRSRV, ERRbaduid));
+ return;
+ }
+ }
+
/* does this protocol need to be run as the connected user? */
#if HACK_REWRITE
if ((flags & AS_USER) && !change_to_user(req->conn,session_tag)) {